org.rhq.plugins.apache
Class ApacheServerComponent

java.lang.Object
  extended by org.rhq.plugins.apache.ApacheServerComponent
All Implemented Interfaces:
AvailabilityFacet, ResourceComponent, MeasurementFacet, OperationFacet

public class ApacheServerComponent
extends java.lang.Object
implements ResourceComponent, MeasurementFacet, OperationFacet

The resource component for Apache 1.3/2.x servers.

Author:
Ian Springer

Field Summary
static java.lang.String DEFAULT_ERROR_LOG_PATH
           
static java.lang.String DEFAULT_EXECUTABLE_PATH
           
static java.lang.String PLUGIN_CONFIG_PROP_CONTROL_SCRIPT_PATH
           
static java.lang.String PLUGIN_CONFIG_PROP_ERROR_LOG_EVENTS_ENABLED
           
static java.lang.String PLUGIN_CONFIG_PROP_ERROR_LOG_FILE_PATH
           
static java.lang.String PLUGIN_CONFIG_PROP_ERROR_LOG_INCLUDES_PATTERN
           
static java.lang.String PLUGIN_CONFIG_PROP_ERROR_LOG_MINIMUM_SEVERITY
           
static java.lang.String PLUGIN_CONFIG_PROP_EXECUTABLE_PATH
           
static java.lang.String PLUGIN_CONFIG_PROP_HTTPD_CONF
           
static java.lang.String PLUGIN_CONFIG_PROP_SERVER_ROOT
           
static java.lang.String PLUGIN_CONFIG_PROP_SNMP_AGENT_COMMUNITY
           
static java.lang.String PLUGIN_CONFIG_PROP_SNMP_AGENT_HOST
           
static java.lang.String PLUGIN_CONFIG_PROP_SNMP_AGENT_PORT
           
static java.lang.String PLUGIN_CONFIG_PROP_URL
           
static java.lang.String SERVER_BUILT_TRAIT
           
 
Constructor Summary
ApacheServerComponent()
           
 
Method Summary
 AvailabilityType getAvailability()
           
 java.io.File getControlScriptPath()
          Return the absolute path of this Apache server's control script (e.g.
 java.io.File getExecutablePath()
          Return the absolute path of this Apache server's executable (e.g.
 java.io.File getHttpdConfFile()
          Returns the httpd.conf file
 java.io.File getServerRoot()
          Return the absolute path of this Apache server's server root (e.g.
 SNMPSession getSNMPSession()
          Returns an SNMP session that can be used to communicate with this server's SNMP agent.
static SNMPSession getSNMPSession(SNMPClient snmpClient, Configuration pluginConfig)
           
 void getValues(MeasurementReport report, java.util.Set<MeasurementScheduleRequest> schedules)
           
 OperationResult invokeOperation(java.lang.String name, Configuration params)
           
 void start(ResourceContext resourceContext)
           
 void startOperationFacet(OperationContext context)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGIN_CONFIG_PROP_SERVER_ROOT

public static final java.lang.String PLUGIN_CONFIG_PROP_SERVER_ROOT
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_EXECUTABLE_PATH

public static final java.lang.String PLUGIN_CONFIG_PROP_EXECUTABLE_PATH
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_CONTROL_SCRIPT_PATH

public static final java.lang.String PLUGIN_CONFIG_PROP_CONTROL_SCRIPT_PATH
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_URL

public static final java.lang.String PLUGIN_CONFIG_PROP_URL
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_HTTPD_CONF

public static final java.lang.String PLUGIN_CONFIG_PROP_HTTPD_CONF
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_SNMP_AGENT_HOST

public static final java.lang.String PLUGIN_CONFIG_PROP_SNMP_AGENT_HOST
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_SNMP_AGENT_PORT

public static final java.lang.String PLUGIN_CONFIG_PROP_SNMP_AGENT_PORT
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_SNMP_AGENT_COMMUNITY

public static final java.lang.String PLUGIN_CONFIG_PROP_SNMP_AGENT_COMMUNITY
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_ERROR_LOG_FILE_PATH

public static final java.lang.String PLUGIN_CONFIG_PROP_ERROR_LOG_FILE_PATH
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_ERROR_LOG_EVENTS_ENABLED

public static final java.lang.String PLUGIN_CONFIG_PROP_ERROR_LOG_EVENTS_ENABLED
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_ERROR_LOG_MINIMUM_SEVERITY

public static final java.lang.String PLUGIN_CONFIG_PROP_ERROR_LOG_MINIMUM_SEVERITY
See Also:
Constant Field Values

PLUGIN_CONFIG_PROP_ERROR_LOG_INCLUDES_PATTERN

public static final java.lang.String PLUGIN_CONFIG_PROP_ERROR_LOG_INCLUDES_PATTERN
See Also:
Constant Field Values

SERVER_BUILT_TRAIT

public static final java.lang.String SERVER_BUILT_TRAIT
See Also:
Constant Field Values

DEFAULT_EXECUTABLE_PATH

public static final java.lang.String DEFAULT_EXECUTABLE_PATH

DEFAULT_ERROR_LOG_PATH

public static final java.lang.String DEFAULT_ERROR_LOG_PATH
Constructor Detail

ApacheServerComponent

public ApacheServerComponent()
Method Detail

start

public void start(ResourceContext resourceContext)
           throws java.lang.Exception
Specified by:
start in interface ResourceComponent
Throws:
java.lang.Exception

stop

public void stop()
Specified by:
stop in interface ResourceComponent

getAvailability

public AvailabilityType getAvailability()
Specified by:
getAvailability in interface AvailabilityFacet

getValues

public void getValues(MeasurementReport report,
                      java.util.Set<MeasurementScheduleRequest> schedules)
               throws java.lang.Exception
Specified by:
getValues in interface MeasurementFacet
Throws:
java.lang.Exception

startOperationFacet

public void startOperationFacet(OperationContext context)

invokeOperation

@Nullable
public OperationResult invokeOperation(@NotNull
                                                java.lang.String name,
                                                @NotNull
                                                Configuration params)
                                throws java.lang.Exception
Specified by:
invokeOperation in interface OperationFacet
Throws:
java.lang.Exception

getSNMPSession

@NotNull
public SNMPSession getSNMPSession()
                           throws java.lang.Exception
Returns an SNMP session that can be used to communicate with this server's SNMP agent.

Returns:
an SNMP session that can be used to communicate with this server's SNMP agent
Throws:
java.lang.Exception - on failure to initialize the SNMP session

getSNMPSession

@NotNull
public static SNMPSession getSNMPSession(SNMPClient snmpClient,
                                                 Configuration pluginConfig)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getServerRoot

@NotNull
public java.io.File getServerRoot()
Return the absolute path of this Apache server's server root (e.g. "C:\Program Files\Apache Group\Apache2").

Returns:
the absolute path of this Apache server's server root (e.g. "C:\Program Files\Apache Group\Apache2")

getExecutablePath

@NotNull
public java.io.File getExecutablePath()
Return the absolute path of this Apache server's executable (e.g. "C:\Program Files\Apache Group\Apache2\bin\Apache.exe").

Returns:
the absolute path of this Apache server's executable (e.g. "C:\Program Files\Apache Group\Apache2\bin\Apache.exe")

getHttpdConfFile

public java.io.File getHttpdConfFile()
Returns the httpd.conf file

Returns:
A File object that represents the httpd.conf file or null in case of error

getControlScriptPath

@NotNull
public java.io.File getControlScriptPath()
Return the absolute path of this Apache server's control script (e.g. "C:\Program Files\Apache Group\Apache2\bin\Apache.exe"). On Unix we need to try various locations, as some unixes have bin/ conf/ .. all within one root and on others those are separated.

Returns:
the absolute path of this Apache server's control script (e.g. "C:\Program Files\Apache Group\Apache2\bin\Apache.exe")


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