public class MasterServerPluginContainer extends Object
| Constructor and Description |
|---|
MasterServerPluginContainer() |
| Modifier and Type | Method and Description |
|---|---|
protected ClassLoaderManager |
createClassLoaderManager(Map<URL,? extends ServerPluginDescriptorType> plugins,
ClassLoader rootClassLoader,
File tmpDir)
Creates the manager that will be responsible for instantiating plugin classloaders.
|
protected List<AbstractTypeServerPluginContainer> |
createPluginContainers()
Creates the individual plugin containers that can be used to deploy different plugin types.
|
protected ClassLoader |
createRootServerPluginClassLoader()
Create the root classloader that will be the ancester to all plugin classloaders.
|
ClassLoaderManager |
getClassLoaderManager()
Returns the manager that is responsible for created classloaders for plugins.
|
protected EnhancedScheduler |
getClusteredScheduler()
Most jobs need to be scheduled using the clustered scheduler so they can be run on different
machines in the RHQ cluster in order to balance the load across the cluster.
|
MasterServerPluginContainerConfiguration |
getConfiguration()
Returns the configuration that this object was initialized with.
|
protected List<org.rhq.core.domain.plugin.PluginKey> |
getDisabledPluginKeys()
This will return a list of plugin keys that represent all the plugins that are to be
disabled.
|
protected EnhancedScheduler |
getNonClusteredScheduler()
Some schedule jobs may want to run on all machines in the RHQ cluster.
|
<T extends AbstractTypeServerPluginContainer> |
getPluginContainerByClass(Class<T> clazz)
Get the plugin container of the given class.
|
protected AbstractTypeServerPluginContainer |
getPluginContainerByDescriptor(ServerPluginDescriptorType descriptor)
Given a plugin's descriptor, this will return the plugin container that can manage the plugin.
|
<T extends AbstractTypeServerPluginContainer> |
getPluginContainerByPlugin(org.rhq.core.domain.plugin.PluginKey pluginKey)
Given the key of a deployed plugin, this returns the plugin container that is hosting
that plugin.
|
AbstractTypeServerPluginContainer |
getPluginContainerByPluginType(ServerPluginType pluginType)
Given a server plugin type, this will return the plugin container that can manage that type of plugin.
|
List<ServerPluginType> |
getServerPluginTypes()
This will return all known server plugins types.
|
void |
initialize(MasterServerPluginContainerConfiguration config)
Starts the master plugin container, which will load all plugins and begin managing them.
|
protected void |
initializeNonClusteredScheduler()
Some schedule jobs may want to run on all machines in the RHQ cluster.
|
void |
loadPlugin(URL pluginUrl,
boolean enabled)
Loads a plugin into the appropriate plugin container.
|
protected Map<URL,? extends ServerPluginDescriptorType> |
preloadAllPlugins()
Finds all plugins and parses their descriptors.
|
void |
scheduleAllPluginJobs()
Asks that all plugin containers schedule jobs now, if needed.
|
void |
shutdown()
Stops all plugins and cleans up after them.
|
protected void |
shutdownNonClusteredScheduler()
This will stop the internal, non-clustered scheduler running in the master plugin container.
|
public void initialize(MasterServerPluginContainerConfiguration config)
config - the master configurationpublic void shutdown()
public void loadPlugin(URL pluginUrl, boolean enabled) throws Exception
pluginUrl - the location where the new plugin is foundenabled - indicates if the plugin should be enabled as soon as its loadedException - if the plugin's descriptor could not be parsed or could not be loaded into the plugin containerpublic void scheduleAllPluginJobs()
initialize(MasterServerPluginContainerConfiguration)
method because it is possible that the master plugin container has been
initialized before the scheduler is started. In this case, the caller must wait for the scheduler to
be started before this method is called to schedule jobs.public MasterServerPluginContainerConfiguration getConfiguration()
initialized or has been shutdown,
this will return null.public ClassLoaderManager getClassLoaderManager()
public List<ServerPluginType> getServerPluginTypes()
getPluginContainerByPluginType(ServerPluginType).public <T extends AbstractTypeServerPluginContainer> T getPluginContainerByClass(Class<T> clazz)
clazz - the class name of the plugin container that the caller wantsnull if none found)public <T extends AbstractTypeServerPluginContainer> T getPluginContainerByPlugin(org.rhq.core.domain.plugin.PluginKey pluginKey)
null is returned.pluginKey - nullpublic AbstractTypeServerPluginContainer getPluginContainerByPluginType(ServerPluginType pluginType)
null.pluginType - the type of server plugin whose PC is to be returnedprotected AbstractTypeServerPluginContainer getPluginContainerByDescriptor(ServerPluginDescriptorType descriptor)
descriptor - descriptor to identify a plugin whose container is to be returnedprotected Map<URL,? extends ServerPluginDescriptorType> preloadAllPlugins() throws Exception
initialization.
If a plugin fails to preload, it will be ignored - other plugins will still preload.Exception - on catastrophic failure. Note that if a plugin failed to load,
that plugin will simply be ignored and no exception will be thrownprotected List<org.rhq.core.domain.plugin.PluginKey> getDisabledPluginKeys()
protected List<AbstractTypeServerPluginContainer> createPluginContainers()
This is protected to allow subclasses to override the PCs that are created by this service (mainly to support tests).
protected ClassLoader createRootServerPluginClassLoader()
protected ClassLoaderManager createClassLoaderManager(Map<URL,? extends ServerPluginDescriptorType> plugins, ClassLoader rootClassLoader, File tmpDir)
plugins - maps plugin URLs with their parsed descriptorsrootClassLoader - the classloader at the top of the classloader hierarchytmpDir - where the classloaders can write out the jars that are embedded in the plugin jarsprotected void initializeNonClusteredScheduler()
throws Exception
Exception - if failed to initialize the internal schedulerprotected void shutdownNonClusteredScheduler()
protected EnhancedScheduler getNonClusteredScheduler() throws Exception
Exception - if failed to obtain the internal schedulergetClusteredScheduler()protected EnhancedScheduler getClusteredScheduler()
getNonClusteredScheduler()Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.