org.rhq.enterprise.server.plugin.pc
Class ServerPluginService

java.lang.Object
  extended by org.rhq.enterprise.server.plugin.pc.ServerPluginService
All Implemented Interfaces:
ServerPluginServiceManagement

public class ServerPluginService
extends Object
implements ServerPluginServiceManagement

This is the singleton management service responsible for managing the lifecycle of the MasterServerPluginContainer. It will be started when the entire server starts and shutdown when the entire server shuts down. It has a management interface to allow it to be recycled on demand when desired.

Author:
John Mazzitelli

Field Summary
 
Fields inherited from interface org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement
OBJECT_NAME, OBJECT_NAME_STR
 
Constructor Summary
ServerPluginService()
           
 
Method Summary
protected  MasterServerPluginContainer createMasterPluginContainer()
          This will create, configure and initialize the plugin container and return it.
 MasterServerPluginContainer getMasterPluginContainer()
          Returns the master server plugin container that will be responsible for managing all plugins of all types and their classloaders.
 File getServerPluginsDirectory()
          Returns the directory where the server plugins are found.
 boolean isMasterPluginContainerStarted()
          Returns true if the master plugin container has be started.
 boolean isStarted()
          Returns true if this service has been started.
 void restartMasterPluginContainer()
          Convienence method that first does a ServerPluginServiceManagement.stopMasterPluginContainer() and then a ServerPluginServiceManagement.startMasterPluginContainer().
 void start()
          Starts the service but will not start the master plugin container.
 void startMasterPluginContainer()
          Starts the master plugin container which will load in all plugins, start them and then schedule all jobs for all plugins.
 void startMasterPluginContainerWithoutSchedulingJobs()
          Similar to ServerPluginServiceManagement.startMasterPluginContainer(), but this will not tell the master plugin container to schedule any jobs yet.
 void stop()
          Shuts down this service along with the master plugin container.
 void stopMasterPluginContainer()
          Stops the master plugin container which will shuts down all plugins.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerPluginService

public ServerPluginService()
Method Detail

start

public void start()
Description copied from interface: ServerPluginServiceManagement
Starts the service but will not start the master plugin container. After the server fully initializes, it should only then start the master server-side plugin container.

Specified by:
start in interface ServerPluginServiceManagement

startMasterPluginContainer

public void startMasterPluginContainer()
Description copied from interface: ServerPluginServiceManagement
Starts the master plugin container which will load in all plugins, start them and then schedule all jobs for all plugins. You cannot start the plugin container unless this service has been started. If the master plugin container is already started, this does nothing and returns. You must ensure the job scheduler is started prior to calling this method.

Specified by:
startMasterPluginContainer in interface ServerPluginServiceManagement
See Also:
ServerPluginServiceManagement.startMasterPluginContainerWithoutSchedulingJobs()

stopMasterPluginContainer

public void stopMasterPluginContainer()
Description copied from interface: ServerPluginServiceManagement
Stops the master plugin container which will shuts down all plugins. If the master plugin container is already shutdown, this does nothing and returns.

Specified by:
stopMasterPluginContainer in interface ServerPluginServiceManagement

stop

public void stop()
Description copied from interface: ServerPluginServiceManagement
Shuts down this service along with the master plugin container.

Specified by:
stop in interface ServerPluginServiceManagement

restartMasterPluginContainer

public void restartMasterPluginContainer()
Description copied from interface: ServerPluginServiceManagement
Convienence method that first does a ServerPluginServiceManagement.stopMasterPluginContainer() and then a ServerPluginServiceManagement.startMasterPluginContainer().

Specified by:
restartMasterPluginContainer in interface ServerPluginServiceManagement

startMasterPluginContainerWithoutSchedulingJobs

public void startMasterPluginContainerWithoutSchedulingJobs()
Description copied from interface: ServerPluginServiceManagement
Similar to ServerPluginServiceManagement.startMasterPluginContainer(), but this will not tell the master plugin container to schedule any jobs yet. Usually this is only called when the server itself is starting up and it wants to start the master PC but it has not yet started the scheduler. In this case, after this method is called, the caller must ensure the scheduler is started and then tell the master PC to schedule all its plugin jobs.

Specified by:
startMasterPluginContainerWithoutSchedulingJobs in interface ServerPluginServiceManagement
See Also:
ServerPluginServiceManagement.startMasterPluginContainer()

getMasterPluginContainer

public MasterServerPluginContainer getMasterPluginContainer()
Description copied from interface: ServerPluginServiceManagement
Returns the master server plugin container that will be responsible for managing all plugins of all types and their classloaders.

Specified by:
getMasterPluginContainer in interface ServerPluginServiceManagement
Returns:
the master plugin container, if started. Will be null if not started

isStarted

public boolean isStarted()
Description copied from interface: ServerPluginServiceManagement
Returns true if this service has been started. This does not necessarily mean the master plugin container has be started - see ServerPluginServiceManagement.isMasterPluginContainerStarted() for that.

Specified by:
isStarted in interface ServerPluginServiceManagement
Returns:
true if this service has been started

isMasterPluginContainerStarted

public boolean isMasterPluginContainerStarted()
Description copied from interface: ServerPluginServiceManagement
Returns true if the master plugin container has be started. Note that this is not an indication if this service has started - see ServerPluginServiceManagement.isStarted() for that. But, if the master plugin container has been started, then by definition this service has also been started.

Specified by:
isMasterPluginContainerStarted in interface ServerPluginServiceManagement
Returns:
true if the master plugin container has been started

getServerPluginsDirectory

public File getServerPluginsDirectory()
Description copied from interface: ServerPluginServiceManagement
Returns the directory where the server plugins are found.

Specified by:
getServerPluginsDirectory in interface ServerPluginServiceManagement
Returns:
server plugins directory

createMasterPluginContainer

protected MasterServerPluginContainer createMasterPluginContainer()
This will create, configure and initialize the plugin container and return it.

This is protected to allow subclasses to override the PC that is created by this service (mainly to support tests).

Returns:
the PC that this service will use


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.