public final class PluginsManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PluginsManager.InactivityCause
Cause of the deactivation of a feature
|
static class |
PluginsManager.PluginsInformation
Helper class containing all relevant informations after features list computation.
|
static class |
PluginsManager.Status
PluginsManager status after initialization.
|
Modifier and Type | Field and Description |
---|---|
private static PluginsManager |
__instance |
private Map<String,Plugin> |
_allPlugins |
private Map<String,ComponentDefinition> |
_components |
private Collection<PluginIssue> |
_errors |
private Map<String,ExtensionPointDefinition> |
_extensionPoints |
private Map<String,Map<String,ExtensionDefinition>> |
_extensions |
private Map<String,Feature> |
_features |
private Map<String,PluginsManager.InactivityCause> |
_inactiveFeatures |
private Map<String,File> |
_locations |
private Logger |
_logger |
private Map<String,Plugin> |
_plugins |
private Map<String,String> |
_resourceURIs |
private boolean |
_safeMode |
private PluginsManager.Status |
_status |
static String |
FEATURE_ID_SEPARATOR
Separator between pluginName and featureName
|
static String |
PLUGIN_FILENAME
Plugin filename
|
static String |
PLUGIN_NAME_REGEXP
The regexp to determine if a plugin name is correct (add ^ and $ as delimiters if this is your only test)
|
static String |
PLUGIN_NAMES_IGNORED
The regexp to determine if a plugin name is ignored (CVS or .* or *.bak or *.old)
|
Modifier | Constructor and Description |
---|---|
private |
PluginsManager() |
Modifier and Type | Method and Description |
---|---|
private void |
_addPlugin(Map<String,Plugin> plugins,
String pluginName,
File pluginDir,
Collection<String> excludedPlugins) |
private Map<String,Plugin> |
_computeActivePlugins(Collection<String> excludedPlugins,
Map<String,Feature> initialFeatures,
Map<String,PluginsManager.InactivityCause> inactiveFeatures,
Map<String,ExtensionPointDefinition> extensionPoints,
Collection<PluginIssue> errors) |
private Map<String,ComponentDefinition> |
_computeComponents(Map<String,Feature> features,
Map<String,String> componentsConfig,
Collection<PluginIssue> errors) |
private Map<String,Map<String,ExtensionDefinition>> |
_computeExtensions(Map<String,Feature> features,
Collection<PluginIssue> errors) |
private void |
_computeFeaturesDependencies(String featureId,
Map<String,Feature> features,
Map<String,Feature> result,
String initialFeatureId,
Collection<PluginIssue> errors) |
private Map<String,Collection<String>> |
_computeIncomingDeactivations(Map<String,Feature> features) |
private Map<String,Collection<String>> |
_computeIncompingDependencies(Map<String,Feature> features) |
private String |
_dumpFeature(Feature feature,
Map<String,PluginsManager.InactivityCause> inactiveFeatures) |
private String |
_dumpPlugin(Plugin plugin,
Collection<String> excludedPlugins,
Map<String,PluginsManager.InactivityCause> inactiveFeatures) |
private PluginsComponentManager |
_enterSafeMode(ComponentManager parentCM,
Context context,
String contextPath) |
private Configuration |
_getComponentConfiguration(Configuration initialConfiguration,
String contextPath,
String pluginName,
Collection<PluginIssue> errors) |
private Configuration |
_getConfigurationFromStream(String pluginName,
InputStream is,
String path,
Collection<String> excludedPlugins) |
private void |
_initResourceURIs() |
private void |
_loadComponents(PluginsComponentManager manager,
Map<String,ComponentDefinition> components,
String contextPath,
Collection<PluginIssue> errors) |
private void |
_loadExtensionsPoints(PluginsComponentManager manager,
Map<String,ExtensionPointDefinition> extensionPoints,
Map<String,Map<String,ExtensionDefinition>> extensionsDefinitions,
String contextPath,
Collection<PluginIssue> errors) |
private void |
_loadRuntimeInit(PluginsComponentManager manager,
Collection<PluginIssue> errors) |
private Map<String,Plugin> |
_parsePlugins(String contextPath,
Collection<String> locations,
Map<String,File> externalPlugins,
Collection<String> excludedPlugins) |
private void |
_pluginError(String pluginName,
String message,
PluginIssue.PluginIssueCode code,
Collection<String> excludedPlugins,
Exception e) |
private Map<String,Feature> |
_processOutgoingDependencies(Map<String,Feature> initialFeatures,
Map<String,PluginsManager.InactivityCause> inactiveFeatures,
Collection<PluginIssue> errors) |
private void |
_removeInactiveFeatures(Map<String,Feature> initialFeatures,
Map<String,PluginsManager.InactivityCause> inactiveFeatures,
Map<String,Collection<String>> incomingDeactivations,
Map<String,String> componentsConfig) |
private PluginsManager.PluginsInformation |
computeActiveFeatures(String contextPath,
Collection<String> excludedPlugins,
Collection<String> excludedFeatures,
Map<String,String> componentsConfig)
Computes the actual plugins and features to load, based on values selected by the administrator.
This method don't actually load nor execute any Java code. |
String |
dump(Map<String,PluginsManager.InactivityCause> inactiveFeatures)
Outputs the structure of the plugins.
|
Map<String,Plugin> |
getAllPlugins()
Returns all existing plugins definitions.
|
Set<String> |
getBundledPluginsNames()
Returns a String array containing the names of the plugins bundled in jars
|
Collection<String> |
getComponents()
Returns the components roles.
|
Collection<PluginIssue> |
getErrors()
Returns errors gathered during plugins loading.
|
Map<String,Collection<String>> |
getExtensionPoints()
Returns the extensions points and their extensions
|
Map<String,Feature> |
getFeatures()
Returns loaded features declarations.
|
Map<String,PluginsManager.InactivityCause> |
getInactiveFeatures()
Returns inactive features id and cause of deactivation.
|
static PluginsManager |
getInstance()
Returns the shared instance of the
PluginManager |
File |
getPluginLocation(String pluginName)
Returns the plugin filesystem location for the given plugin or null if the plugin is loaded from the classpath.
|
Set<String> |
getPluginNames()
Returns the names of the plugins
|
Map<String,Plugin> |
getPlugins()
Returns active plugins declarations.
|
String |
getResourceURI(String pluginName)
Returns the base URI for the given plugin resources, or null if the plugin does not exist or is located in the file system.
|
PluginsManager.Status |
getStatus()
Returns the status after initialization.
|
PluginsComponentManager |
init(ComponentManager parentCM,
Context context,
String contextPath,
boolean forceSafeMode)
Initialization of the plugin manager
|
boolean |
isSafeMode()
Returns true if the safe mode is activated.
|
public static final String PLUGIN_NAMES_IGNORED
public static final String PLUGIN_NAME_REGEXP
public static final String FEATURE_ID_SEPARATOR
public static final String PLUGIN_FILENAME
private static PluginsManager __instance
private boolean _safeMode
private Map<String,String> _resourceURIs
private Map<String,File> _locations
private Map<String,Plugin> _allPlugins
private Map<String,PluginsManager.InactivityCause> _inactiveFeatures
private Map<String,ExtensionPointDefinition> _extensionPoints
private Map<String,ComponentDefinition> _components
private Map<String,Map<String,ExtensionDefinition>> _extensions
private PluginsManager.Status _status
private Collection<PluginIssue> _errors
private PluginsManager()
public static PluginsManager getInstance()
PluginManager
public boolean isSafeMode()
public Collection<PluginIssue> getErrors()
public Set<String> getPluginNames()
public Set<String> getBundledPluginsNames()
public Map<String,Plugin> getPlugins()
public Map<String,Plugin> getAllPlugins()
public Map<String,Feature> getFeatures()
public Map<String,PluginsManager.InactivityCause> getInactiveFeatures()
public Map<String,Collection<String>> getExtensionPoints()
public Collection<String> getComponents()
public String getResourceURI(String pluginName)
pluginName
- the name of the pluginpublic File getPluginLocation(String pluginName)
pluginName
- the plugin namepublic PluginsManager.Status getStatus()
public PluginsComponentManager init(ComponentManager parentCM, Context context, String contextPath, boolean forceSafeMode) throws Exception
parentCM
- the parent ComponentManager
.context
- the Avalon contextcontextPath
- the Web context path on the server filesystemforceSafeMode
- true to force the application to enter the safe modePluginsComponentManager
containing loaded components.Exception
- if something wrong occurs during plugins loadingpublic String dump(Map<String,PluginsManager.InactivityCause> inactiveFeatures)
inactiveFeatures
- id and cause of inactive featuresprivate String _dumpPlugin(Plugin plugin, Collection<String> excludedPlugins, Map<String,PluginsManager.InactivityCause> inactiveFeatures)
private String _dumpFeature(Feature feature, Map<String,PluginsManager.InactivityCause> inactiveFeatures)
private void _initResourceURIs() throws IOException
IOException
private Map<String,Plugin> _parsePlugins(String contextPath, Collection<String> locations, Map<String,File> externalPlugins, Collection<String> excludedPlugins) throws IOException
IOException
private void _addPlugin(Map<String,Plugin> plugins, String pluginName, File pluginDir, Collection<String> excludedPlugins) throws IOException
IOException
private Configuration _getConfigurationFromStream(String pluginName, InputStream is, String path, Collection<String> excludedPlugins)
private void _pluginError(String pluginName, String message, PluginIssue.PluginIssueCode code, Collection<String> excludedPlugins, Exception e)
private PluginsManager.PluginsInformation computeActiveFeatures(String contextPath, Collection<String> excludedPlugins, Collection<String> excludedFeatures, Map<String,String> componentsConfig)
contextPath
- the application context path.excludedPlugins
- manually excluded plugins.excludedFeatures
- manually excluded features.componentsConfig
- chosen components, among those with the same role.private Map<String,Plugin> _computeActivePlugins(Collection<String> excludedPlugins, Map<String,Feature> initialFeatures, Map<String,PluginsManager.InactivityCause> inactiveFeatures, Map<String,ExtensionPointDefinition> extensionPoints, Collection<PluginIssue> errors)
private void _removeInactiveFeatures(Map<String,Feature> initialFeatures, Map<String,PluginsManager.InactivityCause> inactiveFeatures, Map<String,Collection<String>> incomingDeactivations, Map<String,String> componentsConfig)
private Map<String,Collection<String>> _computeIncomingDeactivations(Map<String,Feature> features)
private Map<String,Feature> _processOutgoingDependencies(Map<String,Feature> initialFeatures, Map<String,PluginsManager.InactivityCause> inactiveFeatures, Collection<PluginIssue> errors)
private Map<String,Collection<String>> _computeIncompingDependencies(Map<String,Feature> features)
private void _computeFeaturesDependencies(String featureId, Map<String,Feature> features, Map<String,Feature> result, String initialFeatureId, Collection<PluginIssue> errors)
private Map<String,Map<String,ExtensionDefinition>> _computeExtensions(Map<String,Feature> features, Collection<PluginIssue> errors)
private Map<String,ComponentDefinition> _computeComponents(Map<String,Feature> features, Map<String,String> componentsConfig, Collection<PluginIssue> errors)
private void _loadExtensionsPoints(PluginsComponentManager manager, Map<String,ExtensionPointDefinition> extensionPoints, Map<String,Map<String,ExtensionDefinition>> extensionsDefinitions, String contextPath, Collection<PluginIssue> errors)
private void _loadComponents(PluginsComponentManager manager, Map<String,ComponentDefinition> components, String contextPath, Collection<PluginIssue> errors)
private Configuration _getComponentConfiguration(Configuration initialConfiguration, String contextPath, String pluginName, Collection<PluginIssue> errors)
private void _loadRuntimeInit(PluginsComponentManager manager, Collection<PluginIssue> errors)
private PluginsComponentManager _enterSafeMode(ComponentManager parentCM, Context context, String contextPath)