public abstract class AbstractTypeServerPluginContainer extends Object
plugin types.| Constructor and Description |
|---|
AbstractTypeServerPluginContainer(MasterServerPluginContainer master)
Instantiates the plugin container.
|
| Modifier and Type | Method and Description |
|---|---|
protected ServerPluginManager |
createPluginManager()
This will be called when its time for this plugin container to create its plugin manager.
|
protected org.apache.commons.logging.Log |
getLog()
Returns the logger that can be used to log messages.
|
MasterServerPluginContainer |
getMasterServerPluginContainer()
Returns the master plugin container that is responsible for managing this instance.
|
Long |
getPluginLoadTime(org.rhq.core.domain.plugin.PluginKey pluginKey)
Given a plugin key, this returns the time (in epoch milliseconds) when that plugin was loaded into
this plugin container.
|
ServerPluginManager |
getPluginManager()
Returns the object that manages the plugins.
|
abstract ServerPluginType |
getSupportedServerPluginType()
Each plugin container will tell the master which plugins it can support via this method; this
method returns the type of plugin that the plugin container can process.
|
void |
initialize()
The initialize method that prepares the plugin container.
|
ControlResults |
invokePluginControl(org.rhq.core.domain.plugin.PluginKey pluginKey,
String controlName,
org.rhq.core.domain.configuration.Configuration params)
Invokes a control operation on a given plugin and returns the results.
|
boolean |
isPluginEnabled(org.rhq.core.domain.plugin.PluginKey pluginKey)
Determines if the given plugin is enabled in the plugin container.
|
boolean |
isPluginLoaded(org.rhq.core.domain.plugin.PluginKey pluginKey)
Determines if the given plugin is loaded in the plugin container.
|
void |
loadPlugin(ServerPluginEnvironment env,
boolean enabled)
Informs the plugin container that it has a plugin that it must begin to start managing.
|
void |
reloadPlugin(org.rhq.core.domain.plugin.PluginKey pluginKey,
boolean enabled)
Informs the plugin container that a plugin should be reloaded and any of its resources
should be started if being enabled.
|
void |
scheduleAllPluginJobs()
If a plugin has scheduled jobs, this method will schedule them now.
|
protected void |
scheduleJob(ScheduledJobDefinition schedule,
org.rhq.core.domain.plugin.PluginKey pluginKey)
Schedules a job for periodic execution.
|
void |
schedulePluginJobs(org.rhq.core.domain.plugin.PluginKey pluginKey) |
void |
shutdown()
The shutdown method that will stop and unload all plugins.
|
void |
start()
This method informs the plugin container that all of its plugins have been loaded.
|
void |
stop()
This will inform the plugin container that it must stop doing its work.
|
void |
unloadPlugin(org.rhq.core.domain.plugin.PluginKey pluginKey)
Informs the plugin container that a plugin should be unloaded and any of its resources
should be released.
|
void |
unschedulePluginJobs(org.rhq.core.domain.plugin.PluginKey pluginKey)
Unschedules any plugin jobs that are currently scheduled for the named plugin.
|
public AbstractTypeServerPluginContainer(MasterServerPluginContainer master)
master - the master plugin container that is creating this instance.public abstract ServerPluginType getSupportedServerPluginType()
public MasterServerPluginContainer getMasterServerPluginContainer()
public ServerPluginManager getPluginManager()
public boolean isPluginLoaded(org.rhq.core.domain.plugin.PluginKey pluginKey)
pluginKey - true if the plugin is loaded in this plugin container; false otherwisepublic boolean isPluginEnabled(org.rhq.core.domain.plugin.PluginKey pluginKey)
true implies the plugin is also loaded. If false is returned,
it is either because the plugin is loaded but disabled, or the plugin is just
not loaded. Use isPluginLoaded(PluginKey) to know if the plugin is loaded or not.pluginKey - true if the plugin is enabled in this plugin container; false otherwisepublic Long getPluginLoadTime(org.rhq.core.domain.plugin.PluginKey pluginKey)
pluginKey - identifies the plugin whose load time is to be returnednull if the plugin is not loadedpublic void initialize()
throws Exception
Exception - if the plugin container failed to initialize for some reasonpublic void start()
loadPlugin(ServerPluginEnvironment, boolean) loaded}.public void stop()
shutdown().public void shutdown()
public void loadPlugin(ServerPluginEnvironment env, boolean enabled) throws Exception
env - the plugin environment, including the plugin jar and its descriptorenabled - true if the plugin should be initialized; false if
the plugin's existence should be noted but it should not be initialized or startedException - if failed to load the pluginpublic void unloadPlugin(org.rhq.core.domain.plugin.PluginKey pluginKey)
throws Exception
pluginKey - identifies the plugin that should be shutdownException - if failed to unload the pluginpublic void reloadPlugin(org.rhq.core.domain.plugin.PluginKey pluginKey,
boolean enabled)
throws Exception
pluginKey - identifies the plugin that should be reloadedenabled - indicates if the plugin should be enabled or disabled after being loadedException - if failed to unload the pluginpublic void scheduleAllPluginJobs()
throws Exception
start() method because it is possible that
the plugin container has been started before the scheduler has. In this case, the caller
must wait for the scheduler to be started before this method is called to schedule jobs.Exception - if failed to schedule jobspublic void schedulePluginJobs(org.rhq.core.domain.plugin.PluginKey pluginKey)
throws Exception
Exceptionpublic void unschedulePluginJobs(org.rhq.core.domain.plugin.PluginKey pluginKey)
throws Exception
stop() method because we never want
to unschedule jobs since other plugin containers on other servers may be running
and able to process the jobs. This method should only be called when a plugin
is being disabled or removed.pluginKey - Exception - if failed to unschedule jobspublic ControlResults invokePluginControl(org.rhq.core.domain.plugin.PluginKey pluginKey, String controlName, org.rhq.core.domain.configuration.Configuration params) throws Exception
pluginKey - identifies the plugin whose control operation is to be invokedcontrolName - identifies the name of the control operation to invokeparams - parameters to pass to the control operation; may be nullException - if failed to obtain the plugin component and invoke the control. This usually means an
abnormal error occurred - if the control operation merely failed to do what it needed to do,
the error will be reported in the returned results, not as a thrown exception.protected ServerPluginManager createPluginManager()
protected org.apache.commons.logging.Log getLog()
protected void scheduleJob(ScheduledJobDefinition schedule, org.rhq.core.domain.plugin.PluginKey pluginKey) throws Exception
schedule indicates the
job is not enabled, this method returns immediately as a no-op.schedule - instructs how the job should be scheduledpluginKey - the key of the plugin scheduling the jobException - if failed to schedule the jobCopyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.