Class DefaultPluginManager<App extends PluggableApplication, Plug extends Plugin>
java.lang.Object
net.thevpc.common.prs.plugin.DefaultPluginManager<App,Plug>
- All Implemented Interfaces:
PluginManager<App,Plug>
public abstract class DefaultPluginManager<App extends PluggableApplication, Plug extends Plugin>
extends Object
implements PluginManager<App,Plug>
- Author:
- Taha BEN SALAH (taha.bensalah@gmail.com) %creationtime 15 nov. 2006 23:39:30
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbuild(ProgressMonitor monitor) voidbuildCreatePlugins(ProgressMonitor monitor) protected voidbuildEnd(ProgressMonitor monitor) protected voidbuildLookupExtensions(ProgressMonitor monitor) protected voidbuildLookupPlugins(ProgressMonitor monitor) protected Map<String, ClassLoader> protected Map<String, SoftClassLoader> protected voidbuildPostCreatePlugins(ProgressMonitor monitor) protected voidbuildPostLookupExtensions(ProgressMonitor monitor) protected voidbuildPostLookupPlugins(ProgressMonitor monitor) protected voidbuildPostPrepare(ProgressMonitor monitor) protected voidbuildPrepare(ProgressMonitor monitor) protected voidbuildStart(ProgressMonitor monitor) voidcheckValidPlugin(String plugin) voidclose()protected Stringprotected PlugcreatePlugin(PluginDescriptor descriptor) protected abstract PlugcreatePluginImpl(PluginDescriptor descriptor) String[]getAllDependencies(String pluginId) Plug[]returns the SystemPlugin similar to getSystemPlugins()[0].protected PluginManagerCachegetCache()protected StringPlug[]only valid pluginsPlug[]getPlugins(PluginFilter<Plug> filter) getPluginStatus(String pluginId) getPluginVarFolder(String pluginId) Plug[]All System/Core PluginsgetValidPlugin(String pluginId) voidvoidinitializeInstance(Object instance, FieldValueProviderManager fieldValueProviderManager, String pluginId) voidinstallPlugin(String plugin, VersionInterval ve, boolean installDependencies) voidinstallPlugin(URL newPluginUrl, boolean installDependencies) booleanisPluginEnabled(String pluginId) booleanloadPluginDescriptor(URL url) final PluginDescriptorloadPluginDescriptor(URL url, ClassLoader parent) voidbooleanregisterPlugins(PluginDescriptor... descriptors) voidprotected voidsetCoreClassLoader(ClassLoader coreClassLoader) protected voidsetCoreURLs(List<URL> coreURLs) protected voidsetDescriptorsCRC(String CRC) voidsetLocalRepository(LocalRepository localRepository) voidsetSafeMode(boolean safeMode) when safe mode new plugins will not be installed and all loaded plugions will be disabledvoiduninstallPlugin(String pluginId) voidvoidunregisterPlugin(String pluginId) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PluginManager
getPluginsFolder, getPluginsVarFolder
-
Constructor Details
-
DefaultPluginManager
public DefaultPluginManager()
-
-
Method Details
-
addPluginRepository
- Specified by:
addPluginRepositoryin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
removePluginRepository
- Specified by:
removePluginRepositoryin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getPluginRepositories
- Specified by:
getPluginRepositoriesin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getAvailablePluginDescriptors
- Specified by:
getAvailablePluginDescriptorsin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getSystemPlugins
Description copied from interface:PluginManagerAll System/Core Plugins- Specified by:
getSystemPluginsin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Returns:
- Array of all registred System Plugins
-
init
- Specified by:
initin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Throws:
PluginException
-
buildStart
- Throws:
PluginException
-
buildEnd
- Throws:
PluginException
-
buildPostPrepare
- Throws:
PluginException
-
buildPostLookupPlugins
- Throws:
PluginException
-
buildPostLookupExtensions
- Throws:
PluginException
-
buildPostCreatePlugins
- Throws:
PluginException
-
buildPrepare
- Throws:
PluginException
-
close
- Specified by:
closein interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Throws:
PluginException
-
registerPlugins
- Throws:
PluginException
-
installPlugin
- Specified by:
installPluginin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Throws:
PluginException
-
installPlugin
public void installPlugin(String plugin, VersionInterval ve, boolean installDependencies) throws PluginException - Specified by:
installPluginin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Parameters:
plugin- pluginId to look for in plugin repositoriesinstallDependencies- if true, all dependent plugins will be installed too- Throws:
PluginException- if problem
-
uninstallPlugin
- Specified by:
uninstallPluginin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Throws:
PluginException
-
loadPluginDescriptor
- Throws:
PluginException
-
getPluginVarFolder
- Specified by:
getPluginVarFolderin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Throws:
PluginException
-
loadPluginDescriptor
public final PluginDescriptor loadPluginDescriptor(URL url, ClassLoader parent) throws PluginException - Throws:
PluginException
-
getPluginLoader
-
unregisterAvailablePlugins
- Specified by:
unregisterAvailablePluginsin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Throws:
PluginException
-
registerPlugins
- Specified by:
registerPluginsin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Parameters:
descriptors-- Returns:
- false if plugin is not yet registred but registration failes (class not found, etc) throws InvalidPluginException when desc is null throws PluginAlreadyRegistredException if already registred
- Throws:
InvalidPluginException- when plugin is invalid
-
unregisterPlugin
- Specified by:
unregisterPluginin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Throws:
PluginException
-
getEnabledPlugins
Description copied from interface:PluginManageronly valid plugins- Specified by:
getEnabledPluginsin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Returns:
- all plugins
-
buildCreatePlugins
-
getPluginClass
-
getPluginsList
-
getAllPlugins
- Specified by:
getAllPluginsin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getPlugins
- Specified by:
getPluginsin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getPlugin
- Specified by:
getPluginin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getValidPlugin
- Specified by:
getValidPluginin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getPluginStatus
- Specified by:
getPluginStatusin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
isPluginEnabled
- Specified by:
isPluginEnabledin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
createPlugin
-
createPluginImpl
-
getApplication
- Specified by:
getApplicationin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getApplicationVersion
Description copied from interface:PluginManagerreturns the SystemPlugin similar to getSystemPlugins()[0]. should return null il no plugin specified. TODO? should add Specific Exception?- Specified by:
getApplicationVersionin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>- Returns:
- the SystemPlugin
-
isSafeMode
public boolean isSafeMode() -
setSafeMode
public void setSafeMode(boolean safeMode) when safe mode new plugins will not be installed and all loaded plugions will be disabled- Parameters:
safeMode- true if no plugins hve to be loaded
-
checkValidPlugin
-
getPluginDescriptors
-
getPluginDescriptor
- Specified by:
getPluginDescriptorin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
computeDescriptorsCRC
- Throws:
IOException
-
getDescriptorsCRC
-
setDescriptorsCRC
-
buildLookupPlugins
-
getSoftCoreClassLoader
- Specified by:
getSoftCoreClassLoaderin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
buildPluginSoftClassLoaders
-
buildPluginsHardClassLoaders
-
getCache
-
build
-
buildLookupExtensions
-
initializeInstance
public void initializeInstance(Object instance, FieldValueProviderManager fieldValueProviderManager, String pluginId) - Specified by:
initializeInstancein interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getCoreURLs
-
setCoreURLs
-
getCoreClassLoader
- Specified by:
getCoreClassLoaderin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
setCoreClassLoader
-
getExtensions
- Specified by:
getExtensionsin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
setLocalRepository
-
getLocalRepository
- Specified by:
getLocalRepositoryin interfacePluginManager<App extends PluggableApplication, Plug extends Plugin>
-
getAllDependencies
-