Package com.priint.pubserver.config
Class PluginConfig
- java.lang.Object
-
- com.priint.pubserver.config.PluginConfig
-
- All Implemented Interfaces:
java.io.Serializable
public class PluginConfig extends java.lang.Object implements java.io.SerializableConfiguration of a plug-in that will be stored in the repository.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPluginConfig.CustomJava-class for anonymous complex type.static classPluginConfig.DependenciesJava class for anonymous complex type.static classPluginConfig.InstancesJava class for anonymous complex type.
-
Field Summary
Fields Modifier and Type Field Description protected static longcountMarshallingprotected static longcountUnmarshallingprotected PluginConfig.Customcustomprotected PluginConfig.Dependenciesdependenciesprotected java.lang.Stringdescriptionprotected PluginConfig.Instancesinstancesprotected java.lang.Stringnameprotected static longtimeMarshallingprotected static longtimeUnmarshallingprotected static longtotalCountMarshallingprotected static longtotalCountUnmarshallingprotected static longtotalTimeMarshallingprotected static longtotalTimeUnmarshallingprotected java.lang.Stringtype
-
Constructor Summary
Constructors Constructor Description PluginConfig()Create a configuration object as container for custom configurations.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EntityModelconfigsToEntityModel(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 EntityModelstatic <T> TcustomConfigFromXML(java.lang.String xmlString, java.lang.Class<T> T)Get a custom config value of type T from an xml representing a PluginConfig.static PluginConfigfromXML(byte[] xmlData, java.lang.Class<?>... customClazz)Import a configuration file (i.e.static PluginConfigfromXML(java.io.Reader reader, java.lang.Class<?>... customClazz)Import a configuration file (i.e.static PluginConfigfromXML(java.lang.String xmlString, java.lang.Class<?>... customClazz)Import a configuration file (i.e.PluginConfig.CustomgetCustom()Gets the value of the custom property.java.lang.ObjectgetCustomConfig()Get (first) custom configuration of any type into an object.<T> TgetCustomConfig(java.lang.Class<T> T)Get (first) custom configuration of any type into an object.PluginConfig.DependenciesgetDependencies()Gets the value of the dependencies property.PluginConfig.Dependencies.PluginDependencygetDependency(java.lang.String path)Get first plugin dependency with this path or null, if none foundPluginConfig.Dependencies.PluginDependencygetDependency(java.lang.String path, PluginConfigDependencyRestriction restriction)Get plugin dependency with this path and restriction or null, if not foundjava.util.List<PluginConfig.Dependencies.PluginDependency>getDependencyList()java.lang.StringgetDescription()Gets the value of the description property.PluginConfiggetInstance(java.lang.String key)Scans the list of instances of this PluginConfig for an instance with the given key and returns it.java.util.List<PluginConfig.Instances.Entry>getInstanceList()PluginConfig.InstancesgetInstances()get current instances object - if not found initializes a new onejava.lang.StringgetName()Gets the value of the name attribute.java.lang.StringgetType()Gets the value of the type property.voidputDependency(java.lang.String dependencyName, PluginConfigDependencyRestriction restriction)Adds a dependency to this config.voidputInstance(java.lang.String key, PluginConfig pluginConfig)Adds a plugin config instance to this config.voidremoveDependency(java.lang.String path)Removes all dependencies for this path from this config.PluginConfig.Dependencies.PluginDependencyremoveDependency(java.lang.String path, PluginConfigDependencyRestriction restriction)Removes a dependency from this config.voidremoveInstance(java.lang.String key)Removes an instance from this config.voidreplaceCustomConfig(java.io.Serializable object)Remove all custom objects from this configuration and replace by the object provided as parameter.static voidresetCounters()Internal management methods.voidsetCustom(PluginConfig.Custom value)Set the value of the custom property.voidsetCustomConfig(java.io.Serializable object)Set (first) custom configuration of any type into an object.voidsetDependencies(PluginConfig.Dependencies value)Set the value of the dependencies property.voidsetDescription(java.lang.String value)Sets the value of the description property.voidsetInstances(PluginConfig.Instances value)Set the value of the instances property.voidsetName(java.lang.String value)Set the value of the name attribute.voidsetType(java.lang.String value)Sets the value of the type property.protected static longstartMarshalling()Internal management methods.protected static longstartUnmarshalling()Internal management methods.protected static voidstopMarshalling(long startTime)Internal management methods.protected static voidstopUnmarshalling(long startTime)Internal management methods.static java.lang.Stringsummary()Internal management methods.java.lang.StringtoString()java.lang.StringtoXML(java.lang.Class<?>... customClazz)Convert this configuration into an XML string.
-
-
-
Field Detail
-
name
protected java.lang.String name
-
type
protected java.lang.String type
-
description
protected java.lang.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 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 isString
-
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 isString
-
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 isString
-
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 isPluginConfig.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 isPluginConfig.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 isPluginConfig.Instances
-
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.JAXBExceptionjava.io.UnsupportedEncodingException- Since:
- 4.0.0
-
toXML
public java.lang.String toXML(java.lang.Class<?>... customClazz) throws javax.xml.bind.JAXBExceptionConvert 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.JAXBExceptionGet 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
-
getDependencyList
public java.util.List<PluginConfig.Dependencies.PluginDependency> getDependencyList()
- Returns:
- list of plugin dependencies in the configuration
- 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
-
getDependency
public PluginConfig.Dependencies.PluginDependency getDependency(java.lang.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
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
-
removeDependency
public PluginConfig.Dependencies.PluginDependency removeDependency(java.lang.String path, PluginConfigDependencyRestriction restriction)
Removes a dependency from this config.- Parameters:
path-restriction-- Returns:
- removed dependency or null
- Since:
- 4.1.5
-
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:
toStringin classjava.lang.Object
-
-