Package com.priint.pubserver.config
Class PluginConfig
java.lang.Object
com.priint.pubserver.config.PluginConfig
- All Implemented Interfaces:
Serializable
Configuration of a plug-in that will be stored in the repository.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classJava-class for anonymous complex type.static classJava class for anonymous complex type.static classJava class for anonymous complex type. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static longprotected static longprotected PluginConfig.Customprotected PluginConfig.Dependenciesprotected Stringprotected PluginConfig.Instancesprotected Stringprotected static longprotected static longprotected static longprotected static longprotected static longprotected static longprotected String -
Constructor Summary
ConstructorsConstructorDescriptionCreate a configuration object as container for custom configurations.PluginConfig(String name, String type, String description, Serializable customConfig) Create a configuration object as container for custom configurations. -
Method Summary
Modifier and TypeMethodDescriptionconfigsToEntityModel(HashMap<String, PluginConfig> entitiesConfig) Get the entity model from this config Gets a list of plug-in configuration XML for a PluginConfig of an EntityModelstatic final <T> TcustomConfigFromXML(String xmlString, Class<T> T) Get a custom config value of type T from an xml representing a PluginConfig.static PluginConfigImport a configuration file (i.e.static PluginConfigImport a configuration file (i.e.static PluginConfigImport a configuration file (i.e.Gets the value of the custom property.final ObjectGet (first) custom configuration of any type into an object.final <T> TgetCustomConfig(Class<T> T) Get (first) custom configuration of any type into an object.Gets the value of the dependencies property.getDependency(String path) Get first plugin dependency with this path or null, if none foundgetDependency(String path, PluginConfigDependencyRestriction restriction) Get plugin dependency with this path and restriction or null, if not foundGets the value of the description property.getInstance(String key) Scans the list of instances of this PluginConfig for an instance with the given key and returns it.get current instances object - if not found initializes a new onegetName()Gets the value of the name attribute.getType()Gets the value of the type property.voidputDependency(String dependencyName, PluginConfigDependencyRestriction restriction) Adds a dependency to this config.voidputInstance(String key, PluginConfig pluginConfig) Adds a plugin config instance to this config.voidremoveDependency(String path) Removes all dependencies for this path from this config.removeDependency(String path, PluginConfigDependencyRestriction restriction) Removes a dependency from this config.voidremoveInstance(String key) Removes an instance from this config.final voidreplaceCustomConfig(Serializable object) Remove all custom objects from this configuration and replace by the object provided as parameter.static voidInternal management methods.voidsetCustom(PluginConfig.Custom value) Set the value of the custom property.final voidsetCustomConfig(Serializable object) Set (first) custom configuration of any type into an object.voidSet the value of the dependencies property.voidsetDescription(String value) Sets the value of the description property.voidSet the value of the instances property.voidSet the value of the name attribute.voidSets the value of the type property.protected static longInternal management methods.protected static longInternal management methods.protected static voidstopMarshalling(long startTime) Internal management methods.protected static voidstopUnmarshalling(long startTime) Internal management methods.static Stringsummary()Internal management methods.toString()Convert this configuration into an XML string.
-
Field Details
-
name
-
type
-
description
-
custom
-
dependencies
-
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
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
Internal management methods. Do no use in plug-ins. -
resetCounters
public static void resetCounters()Internal management methods. Do no use in plug-ins. -
getName
Gets the value of the name attribute.- Returns:
- possible object is
String
-
setName
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 isString
-
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
Sets the value of the type property.There is no fixed list of types.
- Parameters:
value- allowed object isString
-
getDescription
Gets the value of the description property.Description can be NULL.
- Returns:
- possible object is
String
-
setDescription
Sets the value of the description property.- Parameters:
value- allowed object isString
-
getCustom
Gets the value of the custom property.- Returns:
- possible object is
PluginConfig.Custom
-
setCustom
Set the value of the custom property.- Parameters:
value- allowed object isPluginConfig.Custom
-
getDependencies
Gets the value of the dependencies property.- Returns:
- possible object is
PluginConfig.Dependencies
-
setDependencies
Set the value of the dependencies property.- Parameters:
value- allowed object isPluginConfig.Dependencies
-
getInstances
get current instances object - if not found initializes a new one- Returns:
- possible object is
PluginConfig.Instances
-
setInstances
Set the value of the instances property.- Parameters:
value- allowed object isPluginConfig.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.JAXBExceptionUnsupportedEncodingException- Since:
- 4.0.0
-
toXML
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
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
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
Set (first) custom configuration of any type into an object.- Parameters:
object- any serializable object- Since:
- 4.0.0
-
replaceCustomConfig
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
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
- Returns:
- list of plugin dependencies in the configuration
- Since:
- 4.0.0
-
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
public PluginConfig.Dependencies.PluginDependency getDependency(String path, PluginConfigDependencyRestriction restriction) 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
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
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
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
Removes all dependencies for this path from this config.- Parameters:
path-- Since:
- 4.0.0
-
removeDependency
public PluginConfig.Dependencies.PluginDependency removeDependency(String path, PluginConfigDependencyRestriction restriction) Removes a dependency from this config.- Parameters:
path-restriction-- Returns:
- removed dependency or null
- Since:
- 4.1.5
-
removeInstance
Removes an instance from this config.- Parameters:
key-- Since:
- 4.0.0
-
toString
-