Class PluginConfig

  • All Implemented Interfaces:
    java.io.Serializable

    public class PluginConfig
    extends java.lang.Object
    implements java.io.Serializable
    Configuration of a plug-in that will be stored in the repository.
    See Also:
    Serialized Form
    • Field Detail

      • name

        protected java.lang.String name
      • type

        protected java.lang.String type
      • description

        protected java.lang.String description
      • 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 Detail

      • PluginConfig

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

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

      • 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 java.lang.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 java.lang.String getName()
        Gets the value of the name attribute.
        Returns:
        possible object is String
      • setName

        public void setName​(java.lang.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 java.lang.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​(java.lang.String value)
        Sets the value of the type property.

        There is no fixed list of types.

        Parameters:
        value - allowed object is String
      • getDescription

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

        Description can be NULL.

        Returns:
        possible object is String
      • setDescription

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

        public static PluginConfig fromXML​(java.io.Reader reader,
                                           java.lang.Class<?>... customClazz)
                                    throws javax.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:
        javax.xml.bind.JAXBException
        Since:
        4.0.0
      • fromXML

        public static PluginConfig fromXML​(java.lang.String xmlString,
                                           java.lang.Class<?>... customClazz)
                                    throws javax.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:
        javax.xml.bind.JAXBException
        Since:
        4.0.0
      • fromXML

        public static PluginConfig fromXML​(byte[] xmlData,
                                           java.lang.Class<?>... customClazz)
                                    throws javax.xml.bind.JAXBException,
                                           java.io.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:
        javax.xml.bind.JAXBException
        java.io.UnsupportedEncodingException
        Since:
        4.0.0
      • toXML

        public java.lang.String toXML​(java.lang.Class<?>... customClazz)
                               throws javax.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:
        javax.xml.bind.JAXBException
        Since:
        4.0.0
      • getCustomConfig

        public final java.lang.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​(java.lang.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​(java.io.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​(java.io.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​(java.lang.String xmlString,
                                                      java.lang.Class<T> T)
                                               throws javax.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:
        javax.xml.bind.JAXBException
        Since:
        4.0.0
      • configsToEntityModel

        public EntityModel configsToEntityModel​(java.util.HashMap<java.lang.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
      • getInstanceList

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

        public PluginConfig.Dependencies.PluginDependency getDependency​(java.lang.String path)
        Get first plugin dependency with this path or null, if none found
        Parameters:
        path -
        Returns:
        PluginDependency or null
        Since:
        4.0.0
      • getInstance

        public PluginConfig getInstance​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String path)
        Removes all dependencies for this path from this config.
        Parameters:
        path -
        Since:
        4.0.0
      • removeInstance

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object