Class PluginLibraryControl
- Direct Known Subclasses:
AbstractConnector.Library
This class has to be sub-classed in plug-ins. The subclass has to be annotated as @Startup @Singleton. It contains the life-cycle methods and variables of the plug-in library.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumList of plug-in library or plug-in types. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringName of the application in the JavaEE container.protected PluginLibraryControl.PluginTypeType of the plugin library. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeVersionChange(String oldVersion) Method triggered when during startup of a plugin library a change in version is detected.getConfigForPlugin(String mappedName) Get the current list of loaded default configuration documents for a plug-in.getConfigsForPlugin(String mappedName) Get the current map of loaded default configuration documents for a plug-in.static StringgetJNDINameForPlugin(String mappedName) Retrieves a Java global name for a plug-in with mappedName from cache.getPluginConfigsFromFolder(String folder, Class<?>... customClazz) Get plugin configs from default section of plug-in folder.getPluginConfigsFromFolder(String mappedName, String folder, boolean recursively, Class<?>... customClazz) Get plugin configs from folder in the repository.static StringgetPluginTags(Class<?> c) static booleanisPluginLibraryStarted(String appName) voidRead all configs for all plug-in classes into internal object.voidshutdown()Called by the @preDestroy method of the plug-in library startup singleton bean Scans all classes in the library for @PubServerPlugin annotation unregister the plug-in library
unregister all classes with the @PubServerPlugin annotation as plug-insvoidstartup()Called by the @PostConstruct method of the plug-in library startup singleton beanvoidstartupFailed(String message) voidvoidValidates all configurations currently loaded for the plug-in.voidvalidateConfigurations(Collection<PluginConfig> pluginConfigs) Validates all configurations from list given as argument.
-
Field Details
-
appName
Name of the application in the JavaEE container. Is read by injection. -
pluginType
Type of the plugin library. Defaults to "Unknown".
-
-
Constructor Details
-
PluginLibraryControl
public PluginLibraryControl()
-
-
Method Details
-
startupSuccess
public void startupSuccess() -
startupFailed
-
isPluginLibraryStarted
-
getPluginLibraryInfo
- Returns:
- the pluginInfo
-
startup
public void startup()Called by the @PostConstruct method of the plug-in library startup singleton bean- Reads the plug-in library configuration from the @PubServerPluginLibrary annotation
- Scans all classes in the library for @PubServerPlugin annotation.
- Registers the plug-in library.
- Registers all classes with the @PubServerPlugin annotation as plug-ins.
- Checks for @PubServerRole and @PubServerPermission annotations and creates entries if necessary.
Throws LifeCycleException if something fails. This will also cause a failure of the application deployment in the JavaEE container.
- Reads the plug-in library configuration from the @PubServerPluginLibrary annotation
-
getPluginTags
-
shutdown
public void shutdown()Called by the @preDestroy method of the plug-in library startup singleton bean- Scans all classes in the library for @PubServerPlugin annotation
- unregister the plug-in library
- unregister all classes with the @PubServerPlugin annotation as plug-ins
-
getPluginConfigsFromFolder
Get plugin configs from default section of plug-in folder.- Parameters:
folder- base folder for a plug-incustomClazz- list of config classes- Returns:
- list of plugin configs for a repository folder
-
getPluginConfigsFromFolder
public Map<String,PluginConfig> getPluginConfigsFromFolder(String mappedName, String folder, boolean recursively, Class<?>... customClazz) Get plugin configs from folder in the repository.This will not read from cache but from the data source.
- Parameters:
mappedName- plugin namerecursively- if true read from nested folders toocustomClazz- list of JAXB config classes- Returns:
- map of parsed plugin configs for a mappedName
-
getConfigForPlugin
Get the current list of loaded default configuration documents for a plug-in.Please note that the list only contains documents from the "default" folder in the repository, e.g. from "com.werk-ii.pluginLib.MyPlugin/WerkII/default", and not from other folders.
Please note that the list only contains documents in the cache. Changes done in the repository - check-in via ison - are not immediately reflected in the cache. You have to call
readConfigsForPluginLib()to refresh the cache before you callgetConfigForPlugin(String).- Parameters:
mappedName- of plug-in- Returns:
- List of PluginConfigs
-
getConfigsForPlugin
Get the current map of loaded default configuration documents for a plug-in.Please note that the map only contains documents from the "default" folder in the repository, e.g. from "com.werk-ii.pluginLib.MyPlugin/WerkII/default", and not from other folders.
Please note that the map only contains documents in the cache. Changes done in the repository - check-in via ison - are not immediately reflected in the cache. You have to call
readConfigsForPluginLib()to refresh the cache before you callgetConfigForPlugin(String).- Parameters:
mappedName- of plug-in- Returns:
- List of PluginConfigs
-
readConfigsForPluginLib
public void readConfigsForPluginLib()Read all configs for all plug-in classes into internal object. -
getPluginManager
- Returns:
- plugin manager - if it cannot retrieved an LifeCycleException will be thrown
-
getConfigManager
- Returns:
- config manager - if it cannot retrieved an LifeCycleException will be thrown
-
getAuthManager
- Returns:
- auth manager - if it cannot retrieved an LifeCycleException will be thrown
-
getSessionManager
- Returns:
- session manager - if it cannot retrieved an LifeCycleException will be thrown
-
getTraceManager
- Returns:
- trace manager - if it cannot retrieved an LifeCycleException will be thrown
-
getDocumentManager
- Returns:
- document manager - if it cannot retrieved an LifeCycleException will be thrown
-
getDocumentLockManager
- Returns:
- document lock manager - if it cannot retrieved an LifeCycleException will be thrown
-
getClientManager
- Returns:
- client manager - if it cannot retrieved an LifeCycleException will be thrown
-
getMediaAssetManager
- Returns:
- media asset manager - if it cannot retrieved an LifeCycleException will be thrown
-
getJNDINameForPlugin
Retrieves a Java global name for a plug-in with mappedName from cache.If not found in cache it will query the pluginManager.
- Parameters:
mappedName- container specific name for the plugin- Returns:
- global jndi name or null
-
beforeVersionChange
Method triggered when during startup of a plugin library a change in version is detected.Version is set via annotation in
#PubServerPluginLibrary. It can be read viagetPluginLibraryInfo()object.You may implement this method if you need to migrate existing repository data to new version.
The default implementation is empty.
The method is required to throw in exception if the migration fails. This will lead to a deployment failure in application server. The oldVersion (stored in database) will not be modified in case of failure.
- Parameters:
oldVersion- Version string from the previous deployment - otherwise empty string- Throws:
PluginException- in case of failed migration from old to new version
-
getAppName
-
validateConfigurations
Validates all configurations from list given as argument.- Parameters:
pluginConfigs-- Throws:
PluginException- if any configuration is null or invalid.
-
validateConfigurations
Validates all configurations currently loaded for the plug-in. I.e. all configurations from the /default folder.- Throws:
PluginException- if any configuration is null or invalid.
-