Class Plugin

java.lang.Object
ru.bgcrm.plugin.Plugin
Direct Known Subclasses:
Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin, Plugin

public abstract class Plugin extends Object
Parent class for all the plugins
  • Field Details

  • Constructor Details

    • Plugin

      protected Plugin(String id)
  • Method Details

    • getId

      public String getId()
      Plugin's ID
      Returns:
      the plugin ID
    • getTitle

      public String getTitle()
      Human readable plugin title
      Returns:
      the title
    • getTitleWithPrefix

      public final String getTitleWithPrefix()
      Prefix 'Plugin ' plus getTitle()
      Returns:
      the title with prefix
    • isSystem

      public boolean isSystem()
      System plugins are always loaded, enabled and not show in the list
      Returns:
      true if system
    • getXml

      public Document getXml(String name, Document defaultValue)
      XML document from the plugin's package
      Parameters:
      name - the file name
      defaultValue - the default value
      Returns:
      the parsed document, or defaultValue
    • endpoints

      protected Map<String, List<String>> endpoints()
      Plugin endpoints
      Returns:
      the endpoints map
    • loadEndpoints

      @Deprecated protected Map<String, List<String>> loadEndpoints()
      Deprecated.
      Outdated version of endpoints() method, should no more be inherited in plugins
    • getResourcePath

      public String getResourcePath(String name)
      Gets path of a file, placed in the plugin's package
      Parameters:
      name - name of the file
      Returns:
      the resource path, or null
    • getActionPackages

      public Set<String> getActionPackages()
      Packages for searching annotated actions
      Returns:
      the packages
    • getDependencies

      public Set<String> getDependencies()
      Dependencies plugin IDs
      Returns:
      the dependency plugin IDs
    • getEndpoints

      public final List<String> getEndpoints(String key)
      Endpoints for connecting the plugin in JSP templates
      Returns:
      the endpoints
    • getMessageTypeClass

      public Class<? extends MessageTypeEmail> getMessageTypeClass(String name)
      Message type class, supported by the plugin
      Parameters:
      name - name of the type, must start from the plugin ID
      Returns:
      the message type class, or null
    • init

      public void init(Connection con) throws Exception
      Initialization during server's start
      Parameters:
      con - the DB connection
      Throws:
      Exception
    • isEnabled

      public boolean isEnabled(ConfigMap config, String defaultValue)
      If the plugin enabled
      Parameters:
      config - configuration, where the plugin can be explicitly enabled
      defaultValue - default value if not explicitly enabled: '1' - enabled, 'lic' - if presented in license
      Returns:
      true or false
    • getLocalization

      public Localization getLocalization()
      Returns:
      the plugin's localization from l10n.xml if exists, or null
    • getLocalizer

      public Localizer getLocalizer()
      Returns:
      the plugin's only localization for Localization.getLang() language
    • getTables

      public Set<Table> getTables()
      Used DB tables
      Returns:
      the tables
    • getObjectTypes

      public Set<String> getObjectTypes()
      Plugin's entities
      Returns:
      the object types
    • getObjectTypeTitle

      public String getObjectTypeTitle(String objectType)
      Human readable title of an entity, used where entities of all the plugins are listed together, e.g. in the parameters directory selector. Has to be localized by the plugin itself with getLocalizer(): the localization of the kernel screen showing the title doesn't include the one of the plugin.
      Parameters:
      objectType - one of getObjectTypes()
      Returns:
      the title, the object type itself by default
    • getCleaner

      public Cleaner getCleaner()
      DB cleaner
      Returns:
      the cleaner, or null