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.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 FeatureActivator |
_featureActivator |
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 |
INCLUDED_FEATURES_CONTEXT_ATTRIBUTE
Context attribute containing the features to include.
|
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 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 |
_initializeConfigurationComponentManager(String contextPath,
FeatureActivator.PluginsInformation pluginsInfo,
PluginsComponentManager configCM) |
private void |
_initResourceURIs() |
private void |
_loadComponents(PluginsComponentManager manager,
Map<String,ComponentDefinition> components,
String contextPath,
Collection<PluginIssue> errors) |
private void |
_loadExtensionsPoint(PluginsComponentManager manager,
String point,
Map<String,ExtensionPointDefinition> extensionPoints,
Map<String,Map<String,ExtensionDefinition>> extensionsDefinitions,
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 void |
_parseConfiguration(ConfigManager configManager,
Map<String,Plugin> plugins,
Map<String,Feature> features) |
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 void |
_setActivator(Context context) |
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
public static final String INCLUDED_FEATURES_CONTEXT_ATTRIBUTE
PluginsManager
will init with IncludePolicyFeatureActivator
and the provided collection of features (as strings).
PluginsManager
will init with ExcludePolicyFeatureActivator
which is the default one.
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 FeatureActivator _featureActivator
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()
private void _setActivator(Context context)
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 loadingprivate void _initializeConfigurationComponentManager(String contextPath, FeatureActivator.PluginsInformation pluginsInfo, PluginsComponentManager configCM)
private void _parseConfiguration(ConfigManager configManager, Map<String,Plugin> plugins, Map<String,Feature> features)
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 void _loadExtensionsPoint(PluginsComponentManager manager, String point, Map<String,ExtensionPointDefinition> extensionPoints, Map<String,Map<String,ExtensionDefinition>> extensionsDefinitions, 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 _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) throws Exception
Exception