org.rhq.core.pc
Class PluginContainer

java.lang.Object
  extended by org.rhq.core.pc.PluginContainer
All Implemented Interfaces:
ContainerService

public class PluginContainer
extends Object
implements ContainerService

This is the embeddable container that houses all plugins and the infrastructure that binds them together. It contains all the managers such as PluginManager and InventoryManager.

This container is controlled by its lifecycle methods (initialize() and shutdown(). Prior to initialization, this container's configuration should be set via setConfiguration(PluginContainerConfiguration). If this is not done, a default configuration will be created.

Author:
Greg Hinkle, John Mazzitelli

Nested Class Summary
static interface PluginContainer.InitializationListener
          Invoked by the plugin container immediately after it is initialized
 
Method Summary
 void addAgentServiceLifecycleListener(AgentServiceLifecycleListener listener)
          Adds a listener that will be notified whenever an AgentService hosted within this plugin container is started or stopped.
 void addInitializationListener(PluginContainer.InitializationListener listener)
          Add the callback listener to notify when the plugin container is initialized.
 AgentRegistrar getAgentRegistrar()
          Sets the given registrar as the object responsible for registering the plugin container with a remote server.
 AgentServiceStreamRemoter getAgentServiceStreamRemoter()
          Returns a remoter object that can be used to remote streams.
 BundleAgentService getBundleAgentService()
           
 BundleManager getBundleManager()
           
 ConfigurationAgentService getConfigurationAgentService()
           
 ConfigurationManager getConfigurationManager()
           
 ContentAgentService getContentAgentService()
           
 ContentManager getContentManager()
           
 DiscoveryAgentService getDiscoveryAgentService()
           
 DriftManager getDriftManager()
           
 EventManager getEventManager()
           
static PluginContainer getInstance()
          Returns the singleton instance.
 InventoryManager getInventoryManager()
           
 MeasurementAgentService getMeasurementAgentService()
           
 MeasurementManager getMeasurementManager()
           
 OperationAgentService getOperationAgentService()
           
 OperationManager getOperationManager()
           
 PluginComponentFactory getPluginComponentFactory()
           
 PluginManager getPluginManager()
           
 ResourceFactoryAgentService getResourceFactoryAgentService()
           
 ResourceFactoryManager getResourceFactoryManager()
           
 SupportAgentService getSupportAgentService()
           
 SupportManager getSupportManager()
           
 void initialize()
          Initializes the plugin container which initializes all internal managers.
 boolean isInsideAgent()
           
 boolean isStarted()
          If the plugin container has been initialized and plugins have started work, this returns true.
 void notifyRebootRequestListener()
           
 void removeAgentServiceLifecycleListener(AgentServiceLifecycleListener listener)
          Removes the given listener such that it will no longer receive AgentService notifications.
 void setAgentRegistrar(AgentRegistrar registrar)
          Sets the given registrar as the object responsible for registering the plugin container with a remote server.
 void setAgentServiceStreamRemoter(AgentServiceStreamRemoter streamRemoter)
          Adds a remoter object that is responsible for remoting streams.
 void setConfiguration(PluginContainerConfiguration configuration)
          Sets this plugin container's configuration which also provides configuration settings for all the internal services.
 void setRebootRequestListener(RebootRequestListener listener)
           
 void shutdown()
          Shuts down the plugin container and all its internal services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static PluginContainer getInstance()
Returns the singleton instance.

Returns:
the plugin container

setConfiguration

public void setConfiguration(PluginContainerConfiguration configuration)
Sets this plugin container's configuration which also provides configuration settings for all the internal services.

Specified by:
setConfiguration in interface ContainerService
Parameters:
configuration -

addAgentServiceLifecycleListener

public void addAgentServiceLifecycleListener(AgentServiceLifecycleListener listener)
Adds a listener that will be notified whenever an AgentService hosted within this plugin container is started or stopped.

Parameters:
listener -

removeAgentServiceLifecycleListener

public void removeAgentServiceLifecycleListener(AgentServiceLifecycleListener listener)
Removes the given listener such that it will no longer receive AgentService notifications.

Parameters:
listener -

getAgentServiceStreamRemoter

public AgentServiceStreamRemoter getAgentServiceStreamRemoter()
Returns a remoter object that can be used to remote streams. If null, the plugin container will not be able to remote streams to external clients, as in the case when the plugin container is not running inside an agent (i.e. embedded mode).

Returns:
remoter the object that will prepare a stream to be accessed by remote clients (may be null)

setAgentServiceStreamRemoter

public void setAgentServiceStreamRemoter(AgentServiceStreamRemoter streamRemoter)
Adds a remoter object that is responsible for remoting streams. If null, the plugin container will not be able to remote streams to external clients, as in the case when the plugin container is not running inside an agent (i.e. embedded mode).

Parameters:
streamRemoter -

getAgentRegistrar

public AgentRegistrar getAgentRegistrar()
Sets the given registrar as the object responsible for registering the plugin container with a remote server. If null, the plugin container will not be considered running in an agent containing needing to be registered with a remote server.

Returns:
the object that can be used to register this plugin container (may be null)

setAgentRegistrar

public void setAgentRegistrar(AgentRegistrar registrar)
Sets the given registrar as the object responsible for registering the plugin container with a remote server. If null, the plugin container will not be considered running in an agent containing needing to be registered with a remote server.

Parameters:
registrar -

isStarted

public boolean isStarted()
If the plugin container has been initialized and plugins have started work, this returns true.

Returns:
true if the plugin container was initialized and started; false otherwise

initialize

public void initialize()
Initializes the plugin container which initializes all internal managers. Once initialized, all plugins will be activated, metrics will begin getting collected and automatic discovery will start.

Note that if no configuration was set prior to this method being called, a default configuration will be created and used.

If the plugin container has already been initialized, this method does nothing and returns.

Specified by:
initialize in interface ContainerService

shutdown

public void shutdown()
Shuts down the plugin container and all its internal services. If the plugin container has already been shutdown, this method does nothing and returns.

Specified by:
shutdown in interface ContainerService

getPluginManager

public PluginManager getPluginManager()

getPluginComponentFactory

public PluginComponentFactory getPluginComponentFactory()

getInventoryManager

public InventoryManager getInventoryManager()

getConfigurationManager

public ConfigurationManager getConfigurationManager()

getMeasurementManager

public MeasurementManager getMeasurementManager()

getOperationManager

public OperationManager getOperationManager()

getResourceFactoryManager

public ResourceFactoryManager getResourceFactoryManager()

getContentManager

public ContentManager getContentManager()

getEventManager

public EventManager getEventManager()

getSupportManager

public SupportManager getSupportManager()

getBundleManager

public BundleManager getBundleManager()

getDriftManager

public DriftManager getDriftManager()

getDiscoveryAgentService

public DiscoveryAgentService getDiscoveryAgentService()

getConfigurationAgentService

public ConfigurationAgentService getConfigurationAgentService()

getMeasurementAgentService

public MeasurementAgentService getMeasurementAgentService()

getOperationAgentService

public OperationAgentService getOperationAgentService()

getResourceFactoryAgentService

public ResourceFactoryAgentService getResourceFactoryAgentService()

getContentAgentService

public ContentAgentService getContentAgentService()

getSupportAgentService

public SupportAgentService getSupportAgentService()

getBundleAgentService

public BundleAgentService getBundleAgentService()

isInsideAgent

public boolean isInsideAgent()

setRebootRequestListener

public void setRebootRequestListener(RebootRequestListener listener)

notifyRebootRequestListener

public void notifyRebootRequestListener()

addInitializationListener

public void addInitializationListener(PluginContainer.InitializationListener listener)
Add the callback listener to notify when the plugin container is initialized. If this method is invoked and the PC is already initialized, then listener will be invoked immediately.

Parameters:
listener - The callback object to notify


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