org.rhq.core.pc.plugin
Class PluginComponentFactory

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

public class PluginComponentFactory
extends Object
implements ContainerService

This class builds and lifecycles the various plugin components for use by the other services.

Author:
Greg Hinkle, John Mazzitelli

Constructor Summary
PluginComponentFactory()
           
 
Method Summary
 ResourceComponent buildResourceComponent(org.rhq.core.domain.resource.Resource resource)
          This will create a new ResourceComponent instance that will represent the given Resource.
 ResourceDiscoveryComponent getDiscoveryComponent(org.rhq.core.domain.resource.ResourceType resourceType, ResourceContainer parentResourceContainer)
          This will create a new ResourceDiscoveryComponent instance that can be used to discover and create Resources of the given resourceType.
 ClassLoader getDiscoveryComponentClassLoader(ResourceContainer parentResourceContainer, String pluginName)
           
 ClassLoader getResourceClassloader(org.rhq.core.domain.resource.Resource resource)
          Given a resource, this will return the appropriate classloader for that resource.
 void initialize()
          Creates our (initially empty) cache of discovery components.
 void setConfiguration(PluginContainerConfiguration configuration)
          Informs the container service how it should be configured by providing the full plugin container configuration.
 void shutdown()
          Clears our cache of discovery components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginComponentFactory

public PluginComponentFactory()
Method Detail

getDiscoveryComponent

public ResourceDiscoveryComponent getDiscoveryComponent(org.rhq.core.domain.resource.ResourceType resourceType,
                                                        ResourceContainer parentResourceContainer)
                                                 throws PluginContainerException
This will create a new ResourceDiscoveryComponent instance that can be used to discover and create Resources of the given resourceType. The new discovery component will be loaded in the plugin classloader that belongs to the plugin responsible for handling that specific resource type.

Parameters:
resourceType - the type of resource that is to be discovered
parentResourceContainer - represents the parent resource for any newly discovered resources that may be found by the discovery component that is created by this method. This can be null, but ONLY in the case when the resourceType is that of a root platform type.
Returns:
a new discover component loaded in the proper plugin classloader that can discover resources of the given type
Throws:
PluginContainerException - if failed to create the discovery component instance

getDiscoveryComponentClassLoader

public ClassLoader getDiscoveryComponentClassLoader(ResourceContainer parentResourceContainer,
                                                    String pluginName)
                                             throws PluginContainerException
Throws:
PluginContainerException

buildResourceComponent

public ResourceComponent buildResourceComponent(org.rhq.core.domain.resource.Resource resource)
                                         throws PluginContainerException
This will create a new ResourceComponent instance that will represent the given Resource. The new component will be loaded in the proper plugin classloader based on its specific resource type.

Parameters:
resource - the resource that the component will wrap
Returns:
a new resource component loaded in the proper plugin classloader
Throws:
PluginContainerException - if failed to create the component instance

getResourceClassloader

public ClassLoader getResourceClassloader(org.rhq.core.domain.resource.Resource resource)
                                   throws PluginContainerException
Given a resource, this will return the appropriate classloader for that resource. If no classloader has been created for it yet, one will be created by this method.

Parameters:
resource - the resource whose classloader is to be returned (and possibly created if needed)
Returns:
the resource's classloader
Throws:
PluginContainerException - if the resource's classloader could not be created

initialize

public void initialize()
Creates our (initially empty) cache of discovery components.

Specified by:
initialize in interface ContainerService
See Also:
ContainerService.initialize()

shutdown

public void shutdown()
Clears our cache of discovery components.

Specified by:
shutdown in interface ContainerService
See Also:
ContainerService.shutdown()

setConfiguration

public void setConfiguration(PluginContainerConfiguration configuration)
Description copied from interface: ContainerService
Informs the container service how it should be configured by providing the full plugin container configuration. The plugin container will ensure it passes in a non-null configuration object so implementations of this interface should never have to worry about a null configuration parameter value.

Specified by:
setConfiguration in interface ContainerService


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