Package com.jalios.jcms.plugin
Class PluginManager
java.lang.Object
com.jalios.jcms.plugin.PluginManager
- All Implemented Interfaces:
PluginComponent,ReplicaMessageListener
Singleton used to manage plugin's life cycle.
It also contains utility methods and constants for plugins.
It also contains utility methods and constants for plugins.
- Initialization of PluginManager
- Loading Plugins
- Initialize dependencies
- Initializing deployed Plugins
- Setup deployed plugins
- Since:
- jcms-5.7.0
- Author:
- Jean-Philippe Encausse
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringDefault folder path in which to look for I18N plugin properties overrides.static final StringProperty use to specified a folder path in which to look for I18N plugin properties overrides.static final Stringstatic final Stringprotected static final Stringstatic final Stringprotected static final String -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckResourceAccess(String resource) Returns true if the given plugin's resource (JSP) is provided by an active plugin.voidbooleandeletePluginFiles(Plugin plugin) Delete all deployed files of the given plugin.booleandeployPlugin(Plugin plugin, String archiveName) Deploy all files from a given archive to the current JCMS directory tree.booleandisablePlugin(Plugin plugin) Disable the given plugin.booleandisablePlugin(String pluginName) Disable the given plugin.booleanenablePlugin(Plugin plugin) Enable the given plugin.booleanenablePlugin(String pluginName) Enable the given plugin.findPluginProvidingType(String className) Return the plugin providing the given type.Returns the plugin providing the given workflow.getAllPathSet(boolean sources) Returns a Set of relative path to all plugins declared filesgetAllPathSet(boolean sources, boolean generated, boolean signature, boolean pkg, boolean jar, String prefix, boolean directory) Returns a Set of relative path to all plugins declared filesvoidgetCssFiles(Collection<File> cssPaths, FileFilter filter) Fill given cssPaths collection with plugins css path used for portalsvoidgetCssFiles(Collection<File> cssPaths, Collection<Plugin> collection, FileFilter filter) Fill given cssPaths collection with plugins css path used for portalsstatic PluginManagerReturns a PluginManager.Returns a Set of relative Path to all webapp's jarReturns the main plugin (or null if there is no main plugin)Returns the core properties the main plugin override.Returns the name of the main plugin (or null if there is no main plugin)Returns the plugin for the given name or null if it does not exists.static PluginManagergetPluginPath(boolean priv, String pluginName, Set<String> pluginSet) Returns a Set of relative Path to plugin public/private folder with all files stored on disk even if they are not declared in xmlReturns a Collection of plugins.org.jdom.input.SAXBuilderReturns a Set of relative Path to all webapp's workflowvoidInits the PluginManager.voidInitialize main plugin (reserved for JCMS internals).voidInits all plugins that have been correctly loaded.voidinitPlugins(Collection<Plugin> collection) Inits all plugins that have been correctly loaded.voidvoidInvalidate cache of plugin's JSP to include for given tags.booleanReturns true if the main plugin has been defined.booleanisPluginActive(String pluginName) Returns true if this plugin is active.booleanisPluginEnabled(String pluginName) Returns true if this plugin is enabled.booleanloadArchive(File file) Load a given Plugin Archive if it has not been already loaddedvoidloadLanguageProperties(LangProperties properties, List<String> jcmsLangList) Iterates on plugin's collection and load only languages properties for initialized plugins.voidloadMainPluginProperties(LangProperties properties, List<String> jcmsLangList) Loads all the properties of the main plugin.loadPluginXML(File file) Load a given Plugin Archive if it has not been already loaddedvoidloadProperties(LangProperties properties, List<String> jcmsLangList) Iterates on plugin's collection and load properties, including language properties for initialized plugins.voidloadProperties(LangProperties properties, List<String> jcmsLangList, Collection<Plugin> collection, boolean onlyLangProp) Iterates on plugin's collection and load properties for initialized pluginsstatic Collection<Plugin> orderPlugins(Collection<Plugin> plugins, boolean useDefaultOnFailure) Computes a topological sort of all the plugins and inter-dependencies.booleanperformDeletePackage(String packageName) Delete the given plugin packagevoidperformInclude(String tag, javax.servlet.jsp.PageContext pageContext) Iterates on plugin's collection and retrieve Plugins' JSP to include for the given anchor.voidProcess the given ReplicaMessage.voidRegister a loaded plugin in PluginManagervoidIterates on plugin's collection and register AlarmListener for initialized plugins.voidregisterAlarmListener(Collection<Plugin> collection) Iterates on plugin's collection and register AlarmListener for initialized pluginsvoidIterates on plugin's collection and register AlertChannel for initialized plugins.voidregisterAlertChannel(Collection<Plugin> collection) Iterates on plugin's collection and register AlertChannel for initialized pluginsvoidIterates on plugin's collection and register AuthenticationHandlers for initialized plugins.voidregisterAuthenticationHandler(Collection<Plugin> collection) Iterates on plugin's collection and register AuthenticationHandlers for initialized pluginsvoidIterates on plugin's collection and register ChannelListener for initialized plugins.voidregisterChannelListener(Collection<Plugin> collection) Iterates on plugin's collection and register ChannelListener for initialized pluginsvoidIterates on plugin's collection and register CleanFilter for initialized plugins.voidregisterCleanFilter(Collection<Plugin> collection) Iterates on plugin's collection and register CleanFilter for initialized pluginsvoidIterates on plugin's collection and register DataController for initialized plugins.voidregisterDataController(Collection<Plugin> collection) Iterates on plugin's collection and register DataController for initialized pluginsvoidIterates on plugin's collection and register DBlistener for initialized plugins.voidregisterDBListener(Collection<Plugin> collection) Iterates on plugin's collection and register DBlistener for initialized pluginsvoidIterates on plugin's collection and register Hibernate mappings for initialized plugins.voidregisterHibernateMapping(Collection<Plugin> collection) Iterates on plugin's collection and register Hibernate mappings for initialized pluginsvoidIterates on plugin's collection and register JSyncListener for initialized plugins.voidregisterJSyncListener(Collection<Plugin> collection) Iterates on plugin's collection and register JSyncListener for initialized pluginsvoidregisterOpenApiResources(Collection<Plugin> collection) Iterates on plugin's collection and register RestResource for initialized pluginsvoidIterates on plugin's collection and register PolicyFilter for initialized plugins.voidregisterPolicyFilter(Collection<Plugin> collection) Iterates on plugin's collection and register PolicyFilter for initialized pluginsvoidIterates on plugin's collection and register QueryFilter for initialized plugins.voidregisterQueryFilter(Collection<Plugin> collection) Iterates on plugin's collection and register QueryFilter for initialized pluginsvoidIterates on plugin's collection and register RestResource for initialized plugins.voidregisterStoreListener(boolean beforeStoreLoad) Iterates on plugin's collection and register StoreListener for initialized plugins.voidregisterStoreListener(Collection<Plugin> collection, boolean beforeStoreLoad) Iterates on plugin's collection and register StoreListener for initialized pluginsvoidIterates on plugin's collection and register types' template for initialized plugins.voidregisterTemplates(Collection<Plugin> collection) Iterates on plugin's collection and register types' template for initialized pluginsvoidSetup all plugins that have been correctly initialized.voidsetupPlugins(Collection<Plugin> collection) Setup all plugins that have been correctly initialized.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jalios.jcms.plugin.PluginComponent
init
-
Field Details
-
PLUGIN_PRIVATE_PATH
- See Also:
-
PLUGIN_PUBLIC_PATH
- See Also:
-
PLUGIN_XML
- See Also:
-
PLUGIN_BUILD
- See Also:
-
PLUGIN_EXTENSION
- See Also:
-
PLUGIN_BACKUP
- See Also:
-
MAIN_PLUGIN_PROP
- See Also:
-
MAIN_PLUGIN_CHECK_PROP
- See Also:
-
PLUGIN_SYNC_PROP
- See Also:
-
REPLICA_MESSAGE_PLUGIN
- See Also:
-
PAYLOAD_ENABLE
- See Also:
-
PAYLOAD_DISABLE
- See Also:
-
PAYLOAD_REQUEST_FOR_ACTIVATION
- See Also:
-
PAYLOAD_REQUEST_FOR_DEACTIVATION
- See Also:
-
PLUGIN_I18N_OVERRIDE_PATH_PROP
Property use to specified a folder path in which to look for I18N plugin properties overrides. The value of the property must contain pattern${pluginName}which is replaced by each plugin name. Default value is "WEB-INF/plugins/LangPatchPlugin/properties/languages/${pluginName}/"- Since:
- 10.0.6 / JCMS-8916
- See Also:
-
PLUGIN_I18N_OVERRIDE_PATH_DEFAULT
Default folder path in which to look for I18N plugin properties overrides.- Since:
- 10.0.6 / JCMS-8916
- See Also:
-
-
Method Details
-
getInstance
Returns a PluginManager. Singleton method initalized by Channel (not synchronized)- Returns:
- PluginManager the Pluginmanager
-
getPluginManager
-
init
Inits the PluginManager.- Parameters:
channel- the Channel singleton instance
-
initPlugins
public void initPlugins()Inits all plugins that have been correctly loaded. Called after Channelinitialized most important stuff. -
initPlugins
Inits all plugins that have been correctly loaded. Called juste after PluginManager Initialisation, Channel not completly initialised. Properties not loaded.- Parameters:
collection- a collection of Plugin
-
setupPlugins
public void setupPlugins()Setup all plugins that have been correctly initialized. Channel properties have been loaded. -
setupPlugins
Setup all plugins that have been correctly initialized. Channel properties have been loaded.- Parameters:
collection- a collection of Plugin
-
getMainPluginName
Returns the name of the main plugin (or null if there is no main plugin)- Returns:
- the name of the main plugin (or null if there is no main plugin)
- Since:
- jcms-8.0.1
-
getMainPlugin
Returns the main plugin (or null if there is no main plugin)- Returns:
- the main plugin (or null if there is no main plugin)
- Since:
- jcms-8.0.1
-
isMainPluginDefined
public boolean isMainPluginDefined()Returns true if the main plugin has been defined.- Returns:
- true if the main plugin has been defined.
- Since:
- jcms-8.0.1
-
initMainPlugin
Initialize main plugin (reserved for JCMS internals).- Throws:
IllegalStateException- if the main plugin is not correctly started- Since:
- jcms-8.0.1
-
loadMainPluginProperties
Loads all the properties of the main plugin.- Parameters:
properties- the properties where to load the main plugin propertiesjcmsLangList- the JCMS language list- Since:
- jcms-8.0.1
-
getMainPluginCoreProperties
Returns the core properties the main plugin override.- Returns:
- the core properties the main plugin override.
- Since:
- jcms-8.0.1
-
getAllPathSet
Returns a Set of relative path to all plugins declared files- Parameters:
sources- also include .java sources- Returns:
- Set of relative path
-
getAllPathSet
public Set<String> getAllPathSet(boolean sources, boolean generated, boolean signature, boolean pkg, boolean jar, String prefix, boolean directory) Returns a Set of relative path to all plugins declared files- Parameters:
sources- also include .java sourcesgenerated- include generated contentsignature- add signature filepkg- add package filejar- add jar fileprefix- add prefix to pathdirectory- should resolve directory path- Returns:
- Set of relative path
-
getPluginEntityResolver
-
getSAXBuilder
public org.jdom.input.SAXBuilder getSAXBuilder() -
register
Register a loaded plugin in PluginManager- Parameters:
plugin- the loaded plugin
-
loadPluginXML
Load a given Plugin Archive if it has not been already loadded- Parameters:
file- the folder that contains PLUGIN_XML- Returns:
- Plugin or null if there is an error
-
loadArchive
Load a given Plugin Archive if it has not been already loadded- Parameters:
file- the archive that ends with PLUGIN_EXTENSION- Returns:
- Plugin or null if there is an error
-
orderPlugins
public static Collection<Plugin> orderPlugins(Collection<Plugin> plugins, boolean useDefaultOnFailure) Computes a topological sort of all the plugins and inter-dependencies.- Plugin must be Comparable
- Any cycle in the plugin dependencies will result in a naive sorting implementation being used
- Parameters:
plugins- a collection of plugin, must not be nulluseDefaultOnFailure- true to use a naive sorting implementation if a cycle is detected, false to return null- Returns:
- a sorted collection of plugins according to their dependencies, names and order
- Since:
- jcms-10.0.2 / JCMS-6901
-
deployPlugin
Deploy all files from a given archive to the current JCMS directory tree. If file already exists backup it to plugin backup directory.- Parameters:
plugin- the loaded PluginarchiveName- the archive to deploy- Returns:
- boolean true if deployement has been correctly done
-
deletePluginFiles
Delete all deployed files of the given plugin.- Parameters:
plugin- the loaded Plugin- Returns:
- boolean true if delete has been correctly done
-
performDeletePackage
Delete the given plugin package- Parameters:
packageName- the name of the package to delete- Returns:
- boolean
- Since:
- jcms-5.7.1
-
registerTemplates
public void registerTemplates()Iterates on plugin's collection and register types' template for initialized plugins. -
registerTemplates
Iterates on plugin's collection and register types' template for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerStoreListener
public void registerStoreListener(boolean beforeStoreLoad) Iterates on plugin's collection and register StoreListener for initialized plugins.- Parameters:
beforeStoreLoad- boolean true before loading store
-
registerStoreListener
Iterates on plugin's collection and register StoreListener for initialized plugins- Parameters:
collection- a collection of PluginbeforeStoreLoad- boolean true before loading store
-
registerDBListener
public void registerDBListener()Iterates on plugin's collection and register DBlistener for initialized plugins. -
registerDBListener
Iterates on plugin's collection and register DBlistener for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerJSyncListener
public void registerJSyncListener()Iterates on plugin's collection and register JSyncListener for initialized plugins. -
registerJSyncListener
Iterates on plugin's collection and register JSyncListener for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerDataController
public void registerDataController()Iterates on plugin's collection and register DataController for initialized plugins. -
registerDataController
Iterates on plugin's collection and register DataController for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerAlarmListener
public void registerAlarmListener()Iterates on plugin's collection and register AlarmListener for initialized plugins. -
registerAlarmListener
Iterates on plugin's collection and register AlarmListener for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerAlertChannel
public void registerAlertChannel()Iterates on plugin's collection and register AlertChannel for initialized plugins. -
registerAlertChannel
Iterates on plugin's collection and register AlertChannel for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerRestResource
public void registerRestResource()Iterates on plugin's collection and register RestResource for initialized plugins. -
registerOpenApiResources
Iterates on plugin's collection and register RestResource for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerChannelListener
public void registerChannelListener()Iterates on plugin's collection and register ChannelListener for initialized plugins. -
registerChannelListener
Iterates on plugin's collection and register ChannelListener for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerQueryFilter
public void registerQueryFilter()Iterates on plugin's collection and register QueryFilter for initialized plugins. -
registerQueryFilter
Iterates on plugin's collection and register QueryFilter for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerCleanFilter
public void registerCleanFilter()Iterates on plugin's collection and register CleanFilter for initialized plugins. -
registerCleanFilter
Iterates on plugin's collection and register CleanFilter for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerPolicyFilter
public void registerPolicyFilter()Iterates on plugin's collection and register PolicyFilter for initialized plugins. -
registerPolicyFilter
Iterates on plugin's collection and register PolicyFilter for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerAuthenticationHandler
public void registerAuthenticationHandler()Iterates on plugin's collection and register AuthenticationHandlers for initialized plugins. -
registerAuthenticationHandler
Iterates on plugin's collection and register AuthenticationHandlers for initialized plugins- Parameters:
collection- a collection of Plugin
-
registerHibernateMapping
public void registerHibernateMapping()Iterates on plugin's collection and register Hibernate mappings for initialized plugins. -
registerHibernateMapping
Iterates on plugin's collection and register Hibernate mappings for initialized plugins- Parameters:
collection- a collection of Plugin
-
getCssFiles
Fill given cssPaths collection with plugins css path used for portals- Parameters:
cssPaths- Collection of css pathfilter- FileFilter for css
-
getCssFiles
public void getCssFiles(Collection<File> cssPaths, Collection<Plugin> collection, FileFilter filter) Fill given cssPaths collection with plugins css path used for portals- Parameters:
cssPaths- Collection of css pathcollection- Collection of pluginsfilter- FileFilter for css
-
invalidateIncludeCache
public void invalidateIncludeCache()Invalidate cache of plugin's JSP to include for given tags. -
performInclude
Iterates on plugin's collection and retrieve Plugins' JSP to include for the given anchor. WARNING ! This method must be called from a jsp taglib- Parameters:
tag- the scope of includepageContext- the current Jsp's pageContext, required !
-
clearCachedInclude
public void clearCachedInclude() -
loadProperties
Iterates on plugin's collection and load properties, including language properties for initialized plugins.- Parameters:
properties- the channel propertiesjcmsLangList- the lang list of JCMS
-
loadLanguageProperties
Iterates on plugin's collection and load only languages properties for initialized plugins.- Parameters:
properties- the channel propertiesjcmsLangList- the lang list of JCMS- Since:
- jcms-6.1.0
-
loadProperties
public void loadProperties(LangProperties properties, List<String> jcmsLangList, Collection<Plugin> collection, boolean onlyLangProp) Iterates on plugin's collection and load properties for initialized plugins- Parameters:
properties- the channel propertiesjcmsLangList- the lang list of JCMScollection- a collection of PluginonlyLangProp- only the language properties
-
getWorkflowsPath
Returns a Set of relative Path to all webapp's workflow- Returns:
- Set of relative path
-
getJarsPath
Returns a Set of relative Path to all webapp's jar- Returns:
- Set of relative path
-
getPluginPath
Returns a Set of relative Path to plugin public/private folder with all files stored on disk even if they are not declared in xml- Parameters:
priv- boolean true if private or false if publicpluginName- the name og the pluginpluginSet- the set of known path to add- Returns:
- Set of relative path
-
getPlugins
Returns a Collection of plugins.- Returns:
- Collenction the plugin's collection
-
getPlugin
Returns the plugin for the given name or null if it does not exists.- Parameters:
pluginName- the name of the plugin- Returns:
- Plugin the plugin
-
isPluginEnabled
Returns true if this plugin is enabled.- Parameters:
pluginName- the name of the plugin- Returns:
- true if this plugin is enabled.
- Since:
- jcms-10.0.2
-
isPluginActive
Returns true if this plugin is active.- Parameters:
pluginName- the name of the plugin- Returns:
- true if this plugin is active.
- Since:
- jcms-10.0.2
-
enablePlugin
Enable the given plugin.- Parameters:
pluginName- the name of the plugin.- Returns:
- true if the plugin has been successfully enabled.
- Since:
- jcms-10.0.0
-
enablePlugin
Enable the given plugin.- Parameters:
plugin- the plugin.- Returns:
- true if the plugin has been successfully enabled.
- Since:
- jcms-10.0.0
-
disablePlugin
Disable the given plugin.- Parameters:
pluginName- the name of the plugin.- Returns:
- true if the plugin has been successfully disabled.
- Since:
- jcms-10.0.0
-
disablePlugin
Disable the given plugin.- Parameters:
plugin- the plugin.- Returns:
- true if the plugin has been successfully disabled.
- Since:
- jcms-10.0.0
-
findPluginProvidingType
Return the plugin providing the given type.- Parameters:
className- the class name of the type- Returns:
- the plugin providing the given type.
- Since:
- jcms-10.0.0
-
findPluginProvidingWorkflow
Returns the plugin providing the given workflow.- Parameters:
wfId- the workflow ID- Returns:
- the plugin providing the given workflow.
- Since:
- jcms-10.0.0
-
checkResourceAccess
Returns true if the given plugin's resource (JSP) is provided by an active plugin.- Parameters:
resource- the resource.- Returns:
- true if the given plugin's resource (JSP) is provided by an active plugin.
- Since:
- jcms-10.0.0
-
isPluginSyncEnabled
public boolean isPluginSyncEnabled() -
initReplicaMessageListener
public void initReplicaMessageListener() -
processMessage
Description copied from interface:ReplicaMessageListenerProcess the given ReplicaMessage.- Specified by:
processMessagein interfaceReplicaMessageListener- Parameters:
msg- the ReplicaMessage to process
-