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

java.lang.Object
  extended by org.rhq.modules.plugins.jbossas7.BaseComponent<T>
      extended by org.rhq.modules.plugins.jbossas7.BaseServerComponent<T>
All Implemented Interfaces:
AvailabilityFacet, ConfigurationFacet, CreateChildResourceFacet, DeleteResourceFacet, ResourceComponent<T>, MeasurementFacet, OperationFacet, AS7Component<T>
Direct Known Subclasses:
HostControllerComponent, StandaloneASComponent

public abstract class BaseServerComponent<T extends ResourceComponent<?>>
extends BaseComponent<T>
implements MeasurementFacet

Base component for functionality that is common to Standalone Servers and Host Controllers.

Author:
Heiko W. Rupp

Field Summary
 
Fields inherited from class org.rhq.modules.plugins.jbossas7.BaseComponent
MANAGED_SERVER, testConnection
 
Constructor Summary
BaseServerComponent()
           
 
Method Summary
protected  void collectConfigTrait(org.rhq.core.domain.measurement.MeasurementReport report, org.rhq.core.domain.measurement.MeasurementScheduleRequest request)
           
 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
protected abstract  Address getEnvironmentAddress()
           
protected abstract  Address getHostAddress()
           
protected abstract  AS7Mode getMode()
           
 ServerPluginConfiguration getServerPluginConfiguration()
           
 void getValues(org.rhq.core.domain.measurement.MeasurementReport report, Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> requests)
          Gather measurement data
protected  OperationResult installManagementUser(org.rhq.core.domain.configuration.Configuration parameters, org.rhq.core.domain.configuration.Configuration pluginConfig)
           
protected  OperationResult postProcessResult(String name, Result res)
          Do some post processing of the Result - especially the 'shutdown' operation needs a special treatment.
protected  OperationResult restartServer(org.rhq.core.domain.configuration.Configuration parameters)
          Restart the server by first executing a 'shutdown' operation via the management API and then calling the startServer() method to start it again.
 void setConnection(ASConnection connection)
           
 void start(ResourceContext<T> resourceContext)
          Start the resource connection
protected  OperationResult startServer()
          Start the server by calling the start script defined in the plugin configuration.
 void stop()
           
protected  boolean waitUntilDown(OperationResult tmp)
           
 
Methods inherited from class org.rhq.modules.plugins.jbossas7.BaseComponent
createResource, deleteResource, deployContent, getAddress, getPath, getServerComponent, getStringValue, invokeOperation, loadResourceConfiguration, readAttribute, readAttribute, readAttribute, runDeploymentMagicOnServer, setPath, updateResourceConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseServerComponent

public BaseServerComponent()
Method Detail

start

public void start(ResourceContext<T> resourceContext)
           throws InvalidPluginConfigurationException,
                  Exception
Description copied from class: BaseComponent
Start the resource connection

Specified by:
start in interface ResourceComponent<T extends ResourceComponent<?>>
Overrides:
start in class BaseComponent<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<?>>
Overrides:
stop in class BaseComponent<T extends ResourceComponent<?>>

getAvailability

public org.rhq.core.domain.measurement.AvailabilityType getAvailability()
Description copied from class: BaseComponent
Return availability of this resource

Specified by:
getAvailability in interface AvailabilityFacet
Overrides:
getAvailability in class BaseComponent<T extends ResourceComponent<?>>
See Also:
AvailabilityFacet.getAvailability()

getServerPluginConfiguration

public ServerPluginConfiguration getServerPluginConfiguration()

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<?>>
Overrides:
getASConnection in class BaseComponent<T extends ResourceComponent<?>>
Returns:
the connection that can be used to send management requests to the managed AS& instance

setConnection

public void setConnection(ASConnection connection)
Overrides:
setConnection in class BaseComponent<T extends ResourceComponent<?>>

getMode

@NotNull
protected abstract AS7Mode getMode()

restartServer

protected OperationResult restartServer(org.rhq.core.domain.configuration.Configuration parameters)
                                 throws Exception
Restart the server by first executing a 'shutdown' operation via the management API and then calling the startServer() method to start it again.

Parameters:
parameters - Parameters to pass to the (recursive) invocation of #invokeOperation
Returns:
State of execution
Throws:
Exception - If anything goes wrong

waitUntilDown

protected boolean waitUntilDown(OperationResult tmp)
                         throws InterruptedException
Throws:
InterruptedException

startServer

protected OperationResult startServer()
Start the server by calling the start script defined in the plugin configuration.

Returns:
the result of the operation

postProcessResult

protected OperationResult postProcessResult(String name,
                                            Result res)
Do some post processing of the Result - especially the 'shutdown' operation needs a special treatment.

Parameters:
name - Name of the operation
res - Result of the operation vs. AS7
Returns:
OperationResult filled in from values of res

installManagementUser

protected OperationResult installManagementUser(org.rhq.core.domain.configuration.Configuration parameters,
                                                org.rhq.core.domain.configuration.Configuration pluginConfig)

getValues

public void getValues(org.rhq.core.domain.measurement.MeasurementReport report,
                      Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> requests)
               throws Exception
Description copied from class: BaseComponent
Gather measurement data

Specified by:
getValues in interface MeasurementFacet
Overrides:
getValues in class BaseComponent<T extends ResourceComponent<?>>
Throws:
Exception
See Also:
MeasurementFacet.getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)

getEnvironmentAddress

@NotNull
protected abstract Address getEnvironmentAddress()

getHostAddress

@NotNull
protected abstract Address getHostAddress()

collectConfigTrait

protected void collectConfigTrait(org.rhq.core.domain.measurement.MeasurementReport report,
                                  org.rhq.core.domain.measurement.MeasurementScheduleRequest request)


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