org.modeshape.rhq.plugin
Class Facet

java.lang.Object
  extended by org.modeshape.rhq.plugin.Facet
All Implemented Interfaces:
org.rhq.core.pluginapi.availability.AvailabilityFacet, org.rhq.core.pluginapi.configuration.ConfigurationFacet, org.rhq.core.pluginapi.content.ContentFacet, org.rhq.core.pluginapi.inventory.CreateChildResourceFacet, org.rhq.core.pluginapi.inventory.DeleteResourceFacet, org.rhq.core.pluginapi.inventory.ResourceComponent<org.rhq.core.pluginapi.inventory.ResourceComponent>, org.rhq.core.pluginapi.measurement.MeasurementFacet, org.rhq.core.pluginapi.operation.OperationFacet, org.rhq.plugins.jbossas5.ProfileServiceComponent<org.rhq.core.pluginapi.inventory.ResourceComponent>, org.rhq.plugins.jmx.JMXComponent<org.rhq.core.pluginapi.inventory.ResourceComponent>
Direct Known Subclasses:
ConnectorComponent, EngineComponent, RepositoryComponent, SequencerComponent, SequencingServiceComponent

public abstract class Facet
extends Object
implements org.rhq.plugins.jbossas5.ProfileServiceComponent<org.rhq.core.pluginapi.inventory.ResourceComponent>, org.rhq.core.pluginapi.measurement.MeasurementFacet, org.rhq.core.pluginapi.operation.OperationFacet, org.rhq.core.pluginapi.configuration.ConfigurationFacet, org.rhq.core.pluginapi.content.ContentFacet, org.rhq.core.pluginapi.inventory.DeleteResourceFacet, org.rhq.core.pluginapi.inventory.CreateChildResourceFacet

This class implements required RHQ interfaces and provides common logic used by all MetaMatrix components.


Field Summary
protected  String componentType
           
protected  String deploymentName
          The name of the ManagedDeployment (e.g.: C:/opt/jboss-5.0.0.GA/server/default/deploy/foo.vdb).
protected  boolean isAvailable
           
protected  Log LOG
           
protected  String name
           
protected  org.rhq.core.domain.configuration.Configuration resourceConfiguration
          Represents the resource configuration of the custom product being managed.
protected  org.rhq.core.pluginapi.inventory.ResourceContext<?> resourceContext
          All AMPS plugins are stateful - this context contains information that your resource component can use when performing its processing.
 
Fields inherited from interface org.rhq.plugins.jmx.JMXComponent
CREDENTIALS_CONFIG_PROP, PRINCIPAL_CONFIG_PROP
 
Constructor Summary
Facet()
           
 
Method Summary
 String componentType()
           
 void deleteResource()
           
 org.rhq.core.domain.content.transfer.DeployPackagesResponse deployPackages(Set<org.rhq.core.domain.content.transfer.ResourcePackageDetails> packages, org.rhq.core.pluginapi.content.ContentServices contentServices)
           
 Set<org.rhq.core.domain.content.transfer.ResourcePackageDetails> discoverDeployedPackages(org.rhq.core.domain.content.PackageType arg0)
           
protected  void execute(ExecutedResult result, Map valueMap)
           
 List<org.rhq.core.domain.content.transfer.DeployPackageStep> generateInstallationSteps(org.rhq.core.domain.content.transfer.ResourcePackageDetails arg0)
           
 org.rhq.core.domain.measurement.AvailabilityType getAvailability()
           
 String getComponentIdentifier()
           
protected static org.rhq.core.domain.configuration.Configuration getDefaultPluginConfiguration(org.rhq.core.domain.resource.ResourceType resourceType)
           
protected  Map<String,org.jboss.managed.api.ManagedProperty> getManagedProperties()
           
 org.rhq.core.domain.configuration.Configuration getResourceConfiguration()
           
abstract  void getValues(org.rhq.core.domain.measurement.MeasurementReport arg0, Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> arg1)
          The plugin container will call this method when your resource component has been scheduled to collect some measurements now.
 org.rhq.core.pluginapi.operation.OperationResult invokeOperation(String name, org.rhq.core.domain.configuration.Configuration configuration)
          The plugin container will call this method when it wants to invoke an operation on your managed resource.
protected  boolean isAvailable()
          Helper method that indicates the latest status based on the last getAvailabilit() call.
 org.rhq.core.domain.configuration.Configuration loadResourceConfiguration()
          The plugin container will call this method and it needs to obtain the current configuration of the managed resource.
 org.rhq.core.domain.content.transfer.RemovePackagesResponse removePackages(Set<org.rhq.core.domain.content.transfer.ResourcePackageDetails> arg0)
           
 InputStream retrievePackageBits(org.rhq.core.domain.content.transfer.ResourcePackageDetails packageDetails)
           
protected  void setComponentIdentifier(String identifier)
           
protected  void setComponentName(String componentName)
           
protected  void setMetricArguments(String name, org.rhq.core.domain.configuration.Configuration configuration, Map<String,Object> argumentMap)
           
protected  void setOperationArguments(String name, org.rhq.core.domain.configuration.Configuration configuration, Map<String,Object> argumentMap)
           
 void setResourceConfiguration(org.rhq.core.domain.configuration.Configuration resourceConfiguration)
           
 void start(org.rhq.core.pluginapi.inventory.ResourceContext context)
          This is called when your component has been started with the given context.
 void stop()
          This is called when the component is being stopped, usually due to the plugin container shutting down.
protected  void updateComponent(org.jboss.managed.api.ManagedComponent managedComponent)
           
 void updateResourceConfiguration(org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport report)
          The plugin container will call this method when it has a new configuration for your managed resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.rhq.plugins.jbossas5.ProfileServiceComponent
getConnection
 
Methods inherited from interface org.rhq.plugins.jmx.JMXComponent
getEmsConnection
 
Methods inherited from interface org.rhq.core.pluginapi.inventory.CreateChildResourceFacet
createResource
 

Field Detail

LOG

protected final Log LOG

resourceConfiguration

protected org.rhq.core.domain.configuration.Configuration resourceConfiguration
Represents the resource configuration of the custom product being managed.


resourceContext

protected org.rhq.core.pluginapi.inventory.ResourceContext<?> resourceContext
All AMPS plugins are stateful - this context contains information that your resource component can use when performing its processing.


name

protected String name

componentType

protected String componentType

isAvailable

protected boolean isAvailable

deploymentName

protected String deploymentName
The name of the ManagedDeployment (e.g.: C:/opt/jboss-5.0.0.GA/server/default/deploy/foo.vdb).

Constructor Detail

Facet

public Facet()
Method Detail

start

public void start(org.rhq.core.pluginapi.inventory.ResourceContext context)
This is called when your component has been started with the given context. You normally initialize some internal state of your component as well as attempt to make a stateful connection to your managed resource.

Specified by:
start in interface org.rhq.core.pluginapi.inventory.ResourceComponent<org.rhq.core.pluginapi.inventory.ResourceComponent>
Parameters:
context -
See Also:
ResourceComponent.start(ResourceContext)

stop

public void stop()
This is called when the component is being stopped, usually due to the plugin container shutting down. You can perform some cleanup here; though normally not much needs to be done here.

Specified by:
stop in interface org.rhq.core.pluginapi.inventory.ResourceComponent<org.rhq.core.pluginapi.inventory.ResourceComponent>
See Also:
ResourceComponent.stop()

getResourceConfiguration

public org.rhq.core.domain.configuration.Configuration getResourceConfiguration()
Returns:
the resourceConfiguration

setResourceConfiguration

public void setResourceConfiguration(org.rhq.core.domain.configuration.Configuration resourceConfiguration)
Parameters:
resourceConfiguration - the resourceConfiguration to set

componentType

public String componentType()

setComponentName

protected void setComponentName(String componentName)

getComponentIdentifier

public String getComponentIdentifier()

setComponentIdentifier

protected void setComponentIdentifier(String identifier)

setOperationArguments

protected void setOperationArguments(String name,
                                     org.rhq.core.domain.configuration.Configuration configuration,
                                     Map<String,Object> argumentMap)

setMetricArguments

protected void setMetricArguments(String name,
                                  org.rhq.core.domain.configuration.Configuration configuration,
                                  Map<String,Object> argumentMap)

execute

protected void execute(ExecutedResult result,
                       Map valueMap)

getAvailability

public org.rhq.core.domain.measurement.AvailabilityType getAvailability()
Specified by:
getAvailability in interface org.rhq.core.pluginapi.availability.AvailabilityFacet

isAvailable

protected boolean isAvailable()
Helper method that indicates the latest status based on the last getAvailabilit() call.

Returns:
true if the resource is available

getValues

public abstract void getValues(org.rhq.core.domain.measurement.MeasurementReport arg0,
                               Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> arg1)
                        throws Exception
The plugin container will call this method when your resource component has been scheduled to collect some measurements now. It is within this method that you actually talk to the managed resource and collect the measurement data that is has emitted.

Specified by:
getValues in interface org.rhq.core.pluginapi.measurement.MeasurementFacet
Throws:
Exception
See Also:
MeasurementFacet.getValues(MeasurementReport, Set)

invokeOperation

public org.rhq.core.pluginapi.operation.OperationResult invokeOperation(String name,
                                                                        org.rhq.core.domain.configuration.Configuration configuration)
The plugin container will call this method when it wants to invoke an operation on your managed resource. Your plugin will connect to the managed resource and invoke the analogous operation in your own custom way.

Specified by:
invokeOperation in interface org.rhq.core.pluginapi.operation.OperationFacet
See Also:
OperationFacet.invokeOperation(String, Configuration)

loadResourceConfiguration

public org.rhq.core.domain.configuration.Configuration loadResourceConfiguration()
The plugin container will call this method and it needs to obtain the current configuration of the managed resource. Your plugin will obtain the managed resource's configuration in your own custom way and populate the returned Configuration object with the managed resource's configuration property values.

Specified by:
loadResourceConfiguration in interface org.rhq.core.pluginapi.configuration.ConfigurationFacet
See Also:
ConfigurationFacet.loadResourceConfiguration()

updateResourceConfiguration

public void updateResourceConfiguration(org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport report)
The plugin container will call this method when it has a new configuration for your managed resource. Your plugin will re-configure the managed resource in your own custom way, setting its configuration based on the new values of the given configuration.

Specified by:
updateResourceConfiguration in interface org.rhq.core.pluginapi.configuration.ConfigurationFacet
See Also:
ConfigurationFacet.updateResourceConfiguration(ConfigurationUpdateReport)

getManagedProperties

protected Map<String,org.jboss.managed.api.ManagedProperty> getManagedProperties()
                                                                          throws Exception
Returns:
Map
Throws:
Exception

updateComponent

protected void updateComponent(org.jboss.managed.api.ManagedComponent managedComponent)
                        throws Exception
Parameters:
managedComponent -
Throws:
Exception

deleteResource

public void deleteResource()
                    throws Exception
Specified by:
deleteResource in interface org.rhq.core.pluginapi.inventory.DeleteResourceFacet
Throws:
Exception

deployPackages

public org.rhq.core.domain.content.transfer.DeployPackagesResponse deployPackages(Set<org.rhq.core.domain.content.transfer.ResourcePackageDetails> packages,
                                                                                  org.rhq.core.pluginapi.content.ContentServices contentServices)
Specified by:
deployPackages in interface org.rhq.core.pluginapi.content.ContentFacet

discoverDeployedPackages

public Set<org.rhq.core.domain.content.transfer.ResourcePackageDetails> discoverDeployedPackages(org.rhq.core.domain.content.PackageType arg0)
Specified by:
discoverDeployedPackages in interface org.rhq.core.pluginapi.content.ContentFacet

generateInstallationSteps

public List<org.rhq.core.domain.content.transfer.DeployPackageStep> generateInstallationSteps(org.rhq.core.domain.content.transfer.ResourcePackageDetails arg0)
Specified by:
generateInstallationSteps in interface org.rhq.core.pluginapi.content.ContentFacet

removePackages

public org.rhq.core.domain.content.transfer.RemovePackagesResponse removePackages(Set<org.rhq.core.domain.content.transfer.ResourcePackageDetails> arg0)
Specified by:
removePackages in interface org.rhq.core.pluginapi.content.ContentFacet

retrievePackageBits

public InputStream retrievePackageBits(org.rhq.core.domain.content.transfer.ResourcePackageDetails packageDetails)
Specified by:
retrievePackageBits in interface org.rhq.core.pluginapi.content.ContentFacet

getDefaultPluginConfiguration

protected static org.rhq.core.domain.configuration.Configuration getDefaultPluginConfiguration(org.rhq.core.domain.resource.ResourceType resourceType)


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.