com.jalios.jcms.plugin
Class PluginManager

java.lang.Object
  extended by com.jalios.jcms.plugin.PluginManager

public final class PluginManager
extends Object

Singleton used to manage plugin's life cycle. It also contains utility methods and constants for plugins. 1. Initialization of PluginManager 2. Loading Plugins 3. Initialize dependencies 4. Initializing deployed Plugins 5. Setup deployed plugins

Since:
jcms-5.7.0
Version:
$Revision: 29813 $
Author:
Jean-Philippe Encausse

Field Summary
static String PLUGIN_BACKUP
           
static String PLUGIN_BUILD
           
static String PLUGIN_EXTENSION
           
static String PLUGIN_PRIVATE_PATH
           
static String PLUGIN_PUBLIC_PATH
           
static String PLUGIN_XML
           
protected  Collection<Plugin> pluginCollection
           
protected  Map<String,Plugin> pluginMap
           
protected  File pluginPrivateFolder
           
static String REVISION
           
 
Method Summary
 boolean deletePluginFiles(Plugin plugin)
          Delete all deployed files of the given plugin.
 boolean deployPlugin(Plugin plugin, String archiveName)
          Deploy all files from a given archive to the current JCMS directory tree.
 Set<String> getAllPathSet(boolean sources)
          Returns a Set of relative path to all plugins declared files
 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
 void getCssFiles(Collection<File> cssPaths, Collection<Plugin> collection, FileFilter filter)
          Fill given cssPaths collection with plugins css path used for portals
 void getCssFiles(Collection<File> cssPaths, FileFilter filter)
          Fill given cssPaths collection with plugins css path used for portals
 Set<String> getJarsPath()
          Returns a Set of relative Path to all webapp's jar
 Plugin getPlugin(String pluginName)
          Returns the plugin for the given name or null if it does not exists.
 EntityResolver getPluginEntityResolver()
           
static PluginManager getPluginManager()
          Returns a PluginManager.
 Set<String> getPluginPath(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 xml
 Collection<Plugin> getPlugins()
          Returns a Collection of plugins.
 org.jdom.input.SAXBuilder getSAXBuilder()
           
 Set<String> getWorkflowsPath()
          Returns a Set of relative Path to all webapp's workflow
 void init(Channel channel)
          Inits the PluginManager.
 void initPlugins()
          Inits all plugins that have been correctly loaded.
 void initPlugins(Collection<Plugin> collection)
          Inits all plugins that have been correctly loaded.
 void invalidateIncludeCache()
          Invalidate cache of plugin's JSP to include for given tags.
 Plugin loadArchive(File file)
          Load a given Plugin Archive if it has not been already loadded
 void loadLanguageProperties(LangProperties properties, List<String> jcmsLangList)
          Iterates on plugin's collection and load only languages properties for initialized plugins.
 Plugin loadPluginXML(File file)
          Load a given Plugin Archive if it has not been already loadded
 void loadProperties(LangProperties properties, List<String> jcmsLangList)
          Iterates on plugin's collection and load properties, including language properties for initialized plugins.
 void loadProperties(LangProperties properties, List<String> jcmsLangList, Collection<Plugin> collection, boolean onlyLangProp)
          Iterates on plugin's collection and load properties for initialized plugins
 boolean performDeletePackage(String packageName)
          Delete the given plugin package
 Map<Plugin,Set<SignatureDiffEntry>> performDiffPlugins()
          Perform a Diff on each loaded plugins and store results in a Map
 void performInclude(String tag, javax.servlet.jsp.PageContext pageContext)
          Iterates on plugin's collection and retrieve Plugins' JSP to include for the given anchor.
 void register(Plugin plugin)
          Register a loaded plugin in PluginManager
 void registerAlarmListener()
          Iterates on plugin's collection and register AlarmListener for initialized plugins.
 void registerAlarmListener(Collection<Plugin> collection)
          Iterates on plugin's collection and register AlarmListener for initialized plugins
 void registerAuthenticationHandler()
          Iterates on plugin's collection and register AuthenticationHandlers for initialized plugins.
 void registerAuthenticationHandler(Collection<Plugin> collection)
          Iterates on plugin's collection and register AuthenticationHandlers for initialized plugins
 void registerChannelListener()
          Iterates on plugin's collection and register ChannelListener for initialized plugins.
 void registerChannelListener(Collection<Plugin> collection)
          Iterates on plugin's collection and register ChannelListener for initialized plugins
 void registerCleanFilter()
          Iterates on plugin's collection and register CleanFilter for initialized plugins.
 void registerCleanFilter(Collection<Plugin> collection)
          Iterates on plugin's collection and register CleanFilter for initialized plugins
 void registerDataController()
          Iterates on plugin's collection and register DataController for initialized plugins.
 void registerDataController(Collection<Plugin> collection)
          Iterates on plugin's collection and register DataController for initialized plugins
 void registerDBListener()
          Iterates on plugin's collection and register DBlistener for initialized plugins.
 void registerDBListener(Collection<Plugin> collection)
          Iterates on plugin's collection and register DBlistener for initialized plugins
 void registerHibernateMapping()
          Iterates on plugin's collection and register Hibernate mappings for initialized plugins.
 void registerHibernateMapping(Collection<Plugin> collection)
          Iterates on plugin's collection and register Hibernate mappings for initialized plugins
 void registerOpenApiResources(Collection<Plugin> collection)
          Iterates on plugin's collection and register RestResource for initialized plugins
 void registerPolicyFilter()
          Iterates on plugin's collection and register PolicyFilter for initialized plugins.
 void registerPolicyFilter(Collection<Plugin> collection)
          Iterates on plugin's collection and register PolicyFilter for initialized plugins
 void registerQueryFilter()
          Iterates on plugin's collection and register QueryFilter for initialized plugins.
 void registerQueryFilter(Collection<Plugin> collection)
          Iterates on plugin's collection and register QueryFilter for initialized plugins
 void registerRestResource()
          Iterates on plugin's collection and register RestResource for initialized plugins.
 void registerStoreListener(boolean beforeStoreLoad)
          Iterates on plugin's collection and register StoreListener for initialized plugins.
 void registerStoreListener(Collection<Plugin> collection, boolean beforeStoreLoad)
          Iterates on plugin's collection and register StoreListener for initialized plugins
 void registerTemplates()
          Iterates on plugin's collection and register types' template for initialized plugins.
 void registerTemplates(Collection<Plugin> collection)
          Iterates on plugin's collection and register types' template for initialized plugins
 void setupPlugins()
          Setup all plugins that have been correctly initialized.
 void setupPlugins(Collection<Plugin> collection)
          Setup all plugins that have been correctly initialized.
 void signPlugins()
          Sign all plugins that have been correctly initialized.
 void signPlugins(Collection<Plugin> collection)
          Sign all plugins that have been correctly initialized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

PLUGIN_PRIVATE_PATH

public static final String PLUGIN_PRIVATE_PATH
See Also:
Constant Field Values

PLUGIN_PUBLIC_PATH

public static final String PLUGIN_PUBLIC_PATH
See Also:
Constant Field Values

PLUGIN_XML

public static final String PLUGIN_XML
See Also:
Constant Field Values

PLUGIN_BUILD

public static final String PLUGIN_BUILD
See Also:
Constant Field Values

PLUGIN_EXTENSION

public static final String PLUGIN_EXTENSION
See Also:
Constant Field Values

PLUGIN_BACKUP

public static final String PLUGIN_BACKUP
See Also:
Constant Field Values

pluginCollection

protected Collection<Plugin> pluginCollection

pluginMap

protected Map<String,Plugin> pluginMap

pluginPrivateFolder

protected File pluginPrivateFolder
Method Detail

getPluginManager

public static PluginManager getPluginManager()
Returns a PluginManager. Singleton method initalized by Channel (not synchronized)

Returns:
PluginManager the Pluginmanager

init

public void init(Channel channel)
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

public void initPlugins(Collection<Plugin> collection)
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

public void setupPlugins(Collection<Plugin> collection)
Setup all plugins that have been correctly initialized. Channel properties have been loaded.

Parameters:
collection - a collection of Plugin

signPlugins

public void signPlugins()
Sign all plugins that have been correctly initialized. Channel properties have been loaded.


signPlugins

public void signPlugins(Collection<Plugin> collection)
Sign all plugins that have been correctly initialized. Channel properties have been loaded.

Parameters:
collection - a collection of Plugin

performDiffPlugins

public Map<Plugin,Set<SignatureDiffEntry>> performDiffPlugins()
Perform a Diff on each loaded plugins and store results in a Map

Returns:
Return a Map of Plugin/Set of DiffEntry.

getAllPathSet

public Set<String> getAllPathSet(boolean sources)
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 sources
generated - include generated content
signature - add signature file
pkg - add package file
jar - add jar file
prefix - add prefix to path
directory - should resolve directory path
Returns:
Set of relative path

getPluginEntityResolver

public EntityResolver getPluginEntityResolver()

getSAXBuilder

public org.jdom.input.SAXBuilder getSAXBuilder()

register

public void register(Plugin plugin)
Register a loaded plugin in PluginManager

Parameters:
plugin - the loaded plugin

loadPluginXML

public Plugin loadPluginXML(File file)
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

public Plugin loadArchive(File file)
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

deployPlugin

public boolean deployPlugin(Plugin plugin,
                            String archiveName)
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 Plugin
archiveName - the archive to deploy
Returns:
boolean true if deployement has been correctly done

deletePluginFiles

public boolean deletePluginFiles(Plugin plugin)
Delete all deployed files of the given plugin.

Parameters:
plugin - the loaded Plugin
Returns:
boolean true if delete has been correctly done

performDeletePackage

public boolean performDeletePackage(String packageName)
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

public void registerTemplates(Collection<Plugin> collection)
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

public void registerStoreListener(Collection<Plugin> collection,
                                  boolean beforeStoreLoad)
Iterates on plugin's collection and register StoreListener for initialized plugins

Parameters:
collection - a collection of Plugin
beforeStoreLoad - boolean true before loading store

registerDBListener

public void registerDBListener()
Iterates on plugin's collection and register DBlistener for initialized plugins.


registerDBListener

public void registerDBListener(Collection<Plugin> collection)
Iterates on plugin's collection and register DBlistener 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

public void registerDataController(Collection<Plugin> collection)
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

public void registerAlarmListener(Collection<Plugin> collection)
Iterates on plugin's collection and register AlarmListener 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

public void registerOpenApiResources(Collection<Plugin> collection)
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

public void registerChannelListener(Collection<Plugin> collection)
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

public void registerQueryFilter(Collection<Plugin> collection)
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

public void registerCleanFilter(Collection<Plugin> collection)
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

public void registerPolicyFilter(Collection<Plugin> collection)
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

public void registerAuthenticationHandler(Collection<Plugin> collection)
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

public void registerHibernateMapping(Collection<Plugin> collection)
Iterates on plugin's collection and register Hibernate mappings for initialized plugins

Parameters:
collection - a collection of Plugin

getCssFiles

public void getCssFiles(Collection<File> cssPaths,
                        FileFilter filter)
Fill given cssPaths collection with plugins css path used for portals

Parameters:
cssPaths - Collection of css path
filter - 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 path
collection - Collection of plugins
filter - FileFilter for css

invalidateIncludeCache

public void invalidateIncludeCache()
Invalidate cache of plugin's JSP to include for given tags.


performInclude

public void performInclude(String tag,
                           javax.servlet.jsp.PageContext pageContext)
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 include
pageContext - the current Jsp's pageContext, required !

loadProperties

public void loadProperties(LangProperties properties,
                           List<String> jcmsLangList)
Iterates on plugin's collection and load properties, including language properties for initialized plugins.

Parameters:
properties - the channel properties
jcmsLangList - the lang list of JCMS

loadLanguageProperties

public void loadLanguageProperties(LangProperties properties,
                                   List<String> jcmsLangList)
Iterates on plugin's collection and load only languages properties for initialized plugins.

Parameters:
properties - the channel properties
jcmsLangList - 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 properties
jcmsLangList - the lang list of JCMS
collection - a collection of Plugin

getWorkflowsPath

public Set<String> getWorkflowsPath()
Returns a Set of relative Path to all webapp's workflow

Returns:
Set of relative path

getJarsPath

public Set<String> getJarsPath()
Returns a Set of relative Path to all webapp's jar

Returns:
Set of relative path

getPluginPath

public Set<String> getPluginPath(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 xml

Parameters:
priv - boolean true if private or false if public
pluginName - the name og the plugin
pluginSet - the set of known path to add
Returns:
Set of relative path

getPlugins

public Collection<Plugin> getPlugins()
Returns a Collection of plugins.

Returns:
Collenction the plugin's collection

getPlugin

public Plugin getPlugin(String pluginName)
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


Copyright © 2001-2010 Jalios SA. All Rights Reserved.