org.rhq.modules.plugins.jbossas7
Class BaseComponent<T extends ResourceComponent<?>>

java.lang.Object
  extended by org.rhq.modules.plugins.jbossas7.BaseComponent<T>
Type Parameters:
T - the type of the component's parent resource component
All Implemented Interfaces:
AvailabilityFacet, ConfigurationFacet, CreateChildResourceFacet, DeleteResourceFacet, ResourceComponent<T>, MeasurementFacet, OperationFacet, AS7Component<T>
Direct Known Subclasses:
BaseServerComponent, DatasourceComponent, DeploymentComponent, HornetQComponent, HostComponent, IspnCacheComponent, IspnCContainerComponent, IspnComponent, JDRComponent, JmsComponent, JVMDefinitionComponent, LoggerComponent, ManagedASComponent, ModClusterComponent, NamingComponent, ServerGroupComponent, SocketBindingGroupComponent, ThreadPoolComponent, ThreadsComponent, VHostComponent, WebConnectorComponent, WebRuntimeComponent, WebservicesComponent

public class BaseComponent<T extends ResourceComponent<?>>
extends Object
implements AS7Component<T>, MeasurementFacet, ConfigurationFacet, DeleteResourceFacet, CreateChildResourceFacet, OperationFacet

The base class for all AS7 resource components.


Field Summary
static String MANAGED_SERVER
           
protected  ASConnection testConnection
           
 
Constructor Summary
BaseComponent()
           
 
Method Summary
 CreateResourceReport createResource(CreateResourceReport report)
           
 void deleteResource()
           
protected  CreateResourceReport deployContent(CreateResourceReport report)
          Deploy content to the remote server - this is one half of #createResource
 Address getAddress()
           
 ASConnection getASConnection()
          Returns the connection that can be used to send management requests to the managed AS& instance.
 org.rhq.core.domain.measurement.AvailabilityType getAvailability()
          Return availability of this resource
 String getPath()
          Returns a path in the form (key=value)?(,key=value)* that can be used to construct an address to this component's underlying managed service.
 BaseServerComponent getServerComponent()
           
protected  String getStringValue(Object val)
           
 void getValues(org.rhq.core.domain.measurement.MeasurementReport report, Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> metrics)
          Gather measurement data
 OperationResult invokeOperation(String name, org.rhq.core.domain.configuration.Configuration parameters)
           
 org.rhq.core.domain.configuration.Configuration loadResourceConfiguration()
           
protected  String readAttribute(Address address, String name)
           
protected
<T> T
readAttribute(Address address, String name, Class<T> resultType)
           
protected  String readAttribute(String name)
           
 CreateResourceReport runDeploymentMagicOnServer(CreateResourceReport report, String runtimeName, String deploymentName, String hash)
          Do the actual fumbling with the domain api to deploy the uploaded content
 void setConnection(ASConnection connection)
           
 void setPath(String path)
           
 void start(ResourceContext<T> context)
          Start the resource connection
 void stop()
           
 void updateResourceConfiguration(ConfigurationUpdateReport report)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANAGED_SERVER

public static final String MANAGED_SERVER
See Also:
Constant Field Values

testConnection

protected ASConnection testConnection
Constructor Detail

BaseComponent

public BaseComponent()
Method Detail

start

public void start(ResourceContext<T> context)
           throws InvalidPluginConfigurationException,
                  Exception
Start the resource connection

Specified by:
start in interface ResourceComponent<T extends ResourceComponent<?>>
Throws:
InvalidPluginConfigurationException
Exception
See Also:
ResourceComponent.start(org.rhq.core.pluginapi.inventory.ResourceContext)

stop

public void stop()
Specified by:
stop in interface ResourceComponent<T extends ResourceComponent<?>>

getAvailability

public org.rhq.core.domain.measurement.AvailabilityType getAvailability()
Return availability of this resource

Specified by:
getAvailability in interface AvailabilityFacet
See Also:
AvailabilityFacet.getAvailability()

getServerComponent

public BaseServerComponent getServerComponent()

getValues

public void getValues(org.rhq.core.domain.measurement.MeasurementReport report,
                      Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> metrics)
               throws Exception
Gather measurement data

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

getStringValue

protected String getStringValue(Object val)

getASConnection

public ASConnection getASConnection()
Description copied from interface: AS7Component
Returns the connection that can be used to send management requests to the managed AS& instance.

Specified by:
getASConnection in interface AS7Component<T extends ResourceComponent<?>>
Returns:
the connection that can be used to send management requests to the managed AS& instance

getPath

public String getPath()
Description copied from interface: AS7Component
Returns a path in the form (key=value)?(,key=value)* that can be used to construct an address to this component's underlying managed service.

Specified by:
getPath in interface AS7Component<T extends ResourceComponent<?>>
Returns:
a path in the form (key=value)?(,key=value)* that can be used to construct an address to this component's underlying managed service

loadResourceConfiguration

public org.rhq.core.domain.configuration.Configuration loadResourceConfiguration()
                                                                          throws Exception
Specified by:
loadResourceConfiguration in interface ConfigurationFacet
Throws:
Exception

updateResourceConfiguration

public void updateResourceConfiguration(ConfigurationUpdateReport report)
Specified by:
updateResourceConfiguration in interface ConfigurationFacet

deleteResource

public void deleteResource()
                    throws Exception
Specified by:
deleteResource in interface DeleteResourceFacet
Throws:
Exception

createResource

public CreateResourceReport createResource(CreateResourceReport report)
Specified by:
createResource in interface CreateChildResourceFacet

deployContent

protected CreateResourceReport deployContent(CreateResourceReport report)
Deploy content to the remote server - this is one half of #createResource

Parameters:
report - Create resource report that tells us what to do
Returns:
report that tells us what has been done.

runDeploymentMagicOnServer

public CreateResourceReport runDeploymentMagicOnServer(CreateResourceReport report,
                                                       String runtimeName,
                                                       String deploymentName,
                                                       String hash)
Do the actual fumbling with the domain api to deploy the uploaded content

Parameters:
report - CreateResourceReport to report the result
runtimeName - File name to use as runtime name
deploymentName - Name of the deployment
hash - Hash of the content bytes
Returns:
the passed report with success or failure settings

invokeOperation

public OperationResult invokeOperation(String name,
                                       org.rhq.core.domain.configuration.Configuration parameters)
                                throws InterruptedException,
                                       Exception
Specified by:
invokeOperation in interface OperationFacet
Throws:
InterruptedException
Exception

setConnection

public void setConnection(ASConnection connection)

setPath

public void setPath(String path)

getAddress

public Address getAddress()

readAttribute

protected String readAttribute(String name)
                        throws Exception
Throws:
Exception

readAttribute

protected String readAttribute(Address address,
                               String name)
                        throws Exception
Throws:
Exception

readAttribute

protected <T> T readAttribute(Address address,
                              String name,
                              Class<T> resultType)
                   throws Exception
Throws:
Exception


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