Class PluginConfig

java.lang.Object
com.priint.pubserver.config.PluginConfig
All Implemented Interfaces:
Serializable

public class PluginConfig extends Object implements Serializable
Configuration of a plug-in that will be stored in the repository.
See Also:
  • Field Details

    • name

      protected String name
    • type

      protected String type
    • description

      protected String description
    • custom

      protected PluginConfig.Custom custom
    • dependencies

      protected PluginConfig.Dependencies dependencies
    • instances

      protected PluginConfig.Instances instances
    • countMarshalling

      protected static long countMarshalling
    • countUnmarshalling

      protected static long countUnmarshalling
    • timeMarshalling

      protected static long timeMarshalling
    • timeUnmarshalling

      protected static long timeUnmarshalling
    • totalCountMarshalling

      protected static long totalCountMarshalling
    • totalCountUnmarshalling

      protected static long totalCountUnmarshalling
    • totalTimeMarshalling

      protected static long totalTimeMarshalling
    • totalTimeUnmarshalling

      protected static long totalTimeUnmarshalling
  • Constructor Details

    • PluginConfig

      public PluginConfig()
      Create a configuration object as container for custom configurations.
    • PluginConfig

      public PluginConfig(String name, String type, String description, Serializable customConfig)
      Create a configuration object as container for custom configurations.
      Parameters:
      name -
      type -
      description -
      customConfig -
  • Method Details

    • startMarshalling

      protected static long startMarshalling()
      Internal management methods. Do no use in plug-ins.
    • stopMarshalling

      protected static void stopMarshalling(long startTime)
      Internal management methods. Do no use in plug-ins.
    • startUnmarshalling

      protected static long startUnmarshalling()
      Internal management methods. Do no use in plug-ins.
    • stopUnmarshalling

      protected static void stopUnmarshalling(long startTime)
      Internal management methods. Do no use in plug-ins.
    • summary

      public static String summary()
      Internal management methods. Do no use in plug-ins.
    • resetCounters

      public static void resetCounters()
      Internal management methods. Do no use in plug-ins.
    • getName

      public String getName()
      Gets the value of the name attribute.
      Returns:
      possible object is String
    • setName

      public void setName(String value)
      Set the value of the name attribute. We recommend that names follow the rules for a valid file name (i.e. no "/" no "\"). But this is not enforced by the system.
      Parameters:
      value - allowed object is String
    • getType

      public String getType()
      Gets the value of the type property.

      There is no fixed list of types.

      Type can be NULL.

      Returns:
      possible object is String
    • setType

      public void setType(String value)
      Sets the value of the type property.

      There is no fixed list of types.

      Parameters:
      value - allowed object is String
    • getDescription

      public String getDescription()
      Gets the value of the description property.

      Description can be NULL.

      Returns:
      possible object is String
    • setDescription

      public void setDescription(String value)
      Sets the value of the description property.
      Parameters:
      value - allowed object is String
    • getCustom

      public PluginConfig.Custom getCustom()
      Gets the value of the custom property.
      Returns:
      possible object is PluginConfig.Custom
    • setCustom

      public void setCustom(PluginConfig.Custom value)
      Set the value of the custom property.
      Parameters:
      value - allowed object is PluginConfig.Custom
    • getDependencies

      public PluginConfig.Dependencies getDependencies()
      Gets the value of the dependencies property.
      Returns:
      possible object is PluginConfig.Dependencies
    • setDependencies

      public void setDependencies(PluginConfig.Dependencies value)
      Set the value of the dependencies property.
      Parameters:
      value - allowed object is PluginConfig.Dependencies
    • getInstances

      public PluginConfig.Instances getInstances()
      get current instances object - if not found initializes a new one
      Returns:
      possible object is PluginConfig.Instances
    • setInstances

      public void setInstances(PluginConfig.Instances value)
      Set the value of the instances property.
      Parameters:
      value - allowed object is PluginConfig.Instances
    • fromXML

      public static PluginConfig fromXML(Reader reader, Class<?>... customClazz) throws jakarta.xml.bind.JAXBException
      Import a configuration file (i.e. as a character reader) into PluginConfig, thereby casting the custom content to an object of either type ElementNSImpl or a type identified by namespace.
      Parameters:
      reader -
      customClazz - (if null you will get an ElementNSImpl for custom)
      Returns:
      new PluginConfig
      Throws:
      jakarta.xml.bind.JAXBException
      Since:
      4.0.0
    • fromXML

      public static PluginConfig fromXML(String xmlString, Class<?>... customClazz) throws jakarta.xml.bind.JAXBException
      Import a configuration file (i.e. its XML string) into PluginConfig, thereby casting the custom content to an object of either type ElementNSImpl or a type identified by namespace.
      Parameters:
      xmlString -
      customClazz - (if null you will get an ElementNSImpl for custom)
      Returns:
      new PluginConfig
      Throws:
      jakarta.xml.bind.JAXBException
      Since:
      4.0.0
    • fromXML

      public static PluginConfig fromXML(byte[] xmlData, Class<?>... customClazz) throws jakarta.xml.bind.JAXBException, UnsupportedEncodingException
      Import a configuration file (i.e. its byte data) into PluginConfig, thereby casting the custom content to an object of either type ElementNSImpl or a type identified by namespace.
      Parameters:
      xmlData -
      customClazz - (if null you will get an ElementNSImpl for custom)
      Returns:
      new PluginConfig
      Throws:
      jakarta.xml.bind.JAXBException
      UnsupportedEncodingException
      Since:
      4.0.0
    • toXML

      public String toXML(Class<?>... customClazz) throws jakarta.xml.bind.JAXBException
      Convert this configuration into an XML string.
      If no customClazz given, it will be inferred from the custom element (if existing).
      Parameters:
      customClazz - of embedded configuration
      Returns:
      XML string representation of PluginConfig
      Throws:
      jakarta.xml.bind.JAXBException
      Since:
      4.0.0
    • getCustomConfig

      public final Object getCustomConfig()
      Get (first) custom configuration of any type into an object.
      Returns:
      content of custom element or null if nothing found
      Since:
      4.0.0
    • getCustomConfig

      public final <T> T getCustomConfig(Class<T> T)
      Get (first) custom configuration of any type into an object.
      Type Parameters:
      T -
      Parameters:
      T - type class of custom data in the configuration
      Returns:
      content of custom element or null if nothing found
      Since:
      4.0.0
    • setCustomConfig

      public final void setCustomConfig(Serializable object)
      Set (first) custom configuration of any type into an object.
      Parameters:
      object - any serializable object
      Since:
      4.0.0
    • replaceCustomConfig

      public final void replaceCustomConfig(Serializable object)
      Remove all custom objects from this configuration and replace by the object provided as parameter.
      Parameters:
      object - any serializable object
      Since:
      4.0.0
    • customConfigFromXML

      public static final <T> T customConfigFromXML(String xmlString, Class<T> T) throws jakarta.xml.bind.JAXBException
      Get a custom config value of type T from an xml representing a PluginConfig.
      Parameters:
      xmlString -
      T - type class of custom configuration
      Returns:
      Object of type T or null.
      Throws:
      jakarta.xml.bind.JAXBException
      Since:
      4.0.0
    • configsToEntityModel

      public EntityModel configsToEntityModel(HashMap<String,PluginConfig> entitiesConfig)
      Get the entity model from this config Gets a list of plug-in configuration XML for a PluginConfig of an EntityModel
      Parameters:
      entitiesConfig - HashMap of PluginConfig for Entities. This Map can also include Entities that are not related to the Entity Model.
      Returns:
      An Entity Model.
      Since:
      4.0.0
    • getDependencyList

      public List<PluginConfig.Dependencies.PluginDependency> getDependencyList()
      Returns:
      list of plugin dependencies in the configuration
      Since:
      4.0.0
    • getInstanceList

      public List<PluginConfig.Instances.Entry> getInstanceList()
      Returns:
      list of instances in the configuration
      Since:
      4.0.0
    • getDependency

      Get first plugin dependency with this path or null, if none found
      Parameters:
      path -
      Returns:
      PluginDependency or null
      Since:
      4.0.0
    • getDependency

      Get plugin dependency with this path and restriction or null, if not found
      Parameters:
      path -
      restriction -
      Returns:
      PluginDependency or null
      Since:
      4.1.5
    • getInstance

      public PluginConfig getInstance(String key)
      Scans the list of instances of this PluginConfig for an instance with the given key and returns it. Only direct instances are scanned. No recursion.
      Parameters:
      key -
      Returns:
      the PluginConfig with the given key or null, if not found
      Since:
      4.0.0
    • putDependency

      public void putDependency(String dependencyName, PluginConfigDependencyRestriction restriction)
      Adds a dependency to this config. If the dependency with the given name already exists, it will be updated.
      Parameters:
      dependencyName -
      restriction -
      Since:
      4.0.0
    • putInstance

      public void putInstance(String key, PluginConfig pluginConfig)
      Adds a plugin config instance to this config. If the instance with the given key already exists, it will be updated.
      Parameters:
      key -
      pluginConfig -
      Since:
      4.0.0
    • removeDependency

      public void removeDependency(String path)
      Removes all dependencies for this path from this config.
      Parameters:
      path -
      Since:
      4.0.0
    • removeDependency

      Removes a dependency from this config.
      Parameters:
      path -
      restriction -
      Returns:
      removed dependency or null
      Since:
      4.1.5
    • removeInstance

      public void removeInstance(String key)
      Removes an instance from this config.
      Parameters:
      key -
      Since:
      4.0.0
    • toString

      public String toString()
      Overrides:
      toString in class Object