com.philemonworks.selfdiagnose.check
Class CheckMBeanProperty

java.lang.Object
  extended by com.philemonworks.selfdiagnose.DiagnosticTask
      extended by com.philemonworks.selfdiagnose.PatternMatchingTask
          extended by com.philemonworks.selfdiagnose.check.CheckProperty
              extended by com.philemonworks.selfdiagnose.check.CheckMBeanProperty
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CheckWebsphereJMSListenerPort

public class CheckMBeanProperty
extends CheckProperty

CheckMBeanProperty is a DiagnosticTask that checks a property and matches its (String) value to a regular expression pattern.

<checkmbeanproperty query="MyApp:name=myBean" operation="getVersion" />
<checkmbeanproperty mbeanfactory="com.ibm.websphere.management.AdminServiceFactory" query="WebSphere:type=ListenerPort,name=sli_caseStatusService-ontvangenBLIBerichtLp,*" operation="isStarted" pattern="true" />
 
Stores the property value into the (optional) specified variable.

Author:
Ernest Micklei
See Also:
Serialized Form

Field Summary
protected  String mbeanServerFactoryClassName
           
protected  String operation
           
protected static String PARAMETER_FACTORY
           
protected static String PARAMETER_OPERATION
           
protected  String query
           
 
Fields inherited from class com.philemonworks.selfdiagnose.check.CheckProperty
PARAMETER_PROPERTY, property
 
Fields inherited from class com.philemonworks.selfdiagnose.PatternMatchingTask
PARAMETER_PATTERN, pattern
 
Fields inherited from class com.philemonworks.selfdiagnose.DiagnosticTask
comment, PARAMETER_COMMENT, PARAMETER_REPORT, PARAMETER_VARIABLE, reportResults, requestor, variableName
 
Constructor Summary
CheckMBeanProperty()
           
 
Method Summary
protected  Object accessAttributeFromMBean(ObjectName nodeAgent, MBeanServer server)
          Access the attribute of the MBean using the MBeanServer
 String getAttribute()
           
 String getDescription()
           
protected  MBeanServer getMBeanServer()
          Create a new MBeanServer.
 String getMbeanServerFactoryClassName()
           
 String getOperation()
           
 String getQuery()
           
 void initializeFromAttributes(Attributes attributes)
          This method is sent from the SelfDiagnoseHandler when a configuration is being processed.
protected  Object invokeOperationOnMBean(ObjectName nodeAgent, MBeanServer server)
          Invoke the method on the MBean using the MBeanServer
protected  Object invokePropertyOnMBean(DiagnosticTaskResult result)
          Find the MBean and invoke the property as a method
 void run(ExecutionContext ctx, DiagnosticTaskResult result)
          Run the task.
 void setMbeanServerFactoryClassName(String mbeanFactoryClassName)
           
 void setOperation(String operation)
           
 void setQuery(String query)
           
 void setUp(ExecutionContext ctx)
          Override this method to verify that task parameters are initialized/set correctly.
 
Methods inherited from class com.philemonworks.selfdiagnose.check.CheckProperty
checkPropertyAccess, getProperty, isThisRequested, setProperty
 
Methods inherited from class com.philemonworks.selfdiagnose.PatternMatchingTask
checkValueAgainstPattern, getPattern, setPattern
 
Methods inherited from class com.philemonworks.selfdiagnose.DiagnosticTask
createResult, getComment, getDefaultReportTemplate, getRequestor, getTaskName, getVariableName, hasComment, isReportResults, run, run, setComment, setReportResults, setRequestor, setVariableName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_OPERATION

protected static final String PARAMETER_OPERATION
See Also:
Constant Field Values

PARAMETER_FACTORY

protected static final String PARAMETER_FACTORY
See Also:
Constant Field Values

operation

protected String operation

query

protected String query

mbeanServerFactoryClassName

protected String mbeanServerFactoryClassName
Constructor Detail

CheckMBeanProperty

public CheckMBeanProperty()
Method Detail

getDescription

public String getDescription()
Specified by:
getDescription in class DiagnosticTask
Returns:
String the description

run

public void run(ExecutionContext ctx,
                DiagnosticTaskResult result)
         throws DiagnoseException
Description copied from class: DiagnosticTask
Run the task. If an error is detected then raise a DiagnoseException. Otherwise use the result object to the report any messages when a run is completed.

Specified by:
run in class DiagnosticTask
Parameters:
ctx - ExecutionContext
result - DiagnosticTaskResult
Throws:
DiagnoseException

getMBeanServer

protected MBeanServer getMBeanServer()
                              throws DiagnoseException
Create a new MBeanServer.

Returns:
MBeanServer
Throws:
DiagnoseException

setUp

public void setUp(ExecutionContext ctx)
           throws DiagnoseException
Override this method to verify that task parameters are initialized/set correctly.

Overrides:
setUp in class CheckProperty
Parameters:
ctx - : ExecutionContext
Throws:
DiagnoseException

initializeFromAttributes

public void initializeFromAttributes(Attributes attributes)
This method is sent from the SelfDiagnoseHandler when a configuration is being processed. Use the passed attributes to initialize the receiver.

Overrides:
initializeFromAttributes in class CheckProperty
Parameters:
attributes - : org.xml.sax.Attributes

invokePropertyOnMBean

protected Object invokePropertyOnMBean(DiagnosticTaskResult result)
                                throws DiagnoseException
Find the MBean and invoke the property as a method

Parameters:
result - : DiagnosticTaskResult
Returns:
Object
Throws:
DiagnoseException

invokeOperationOnMBean

protected Object invokeOperationOnMBean(ObjectName nodeAgent,
                                        MBeanServer server)
                                 throws DiagnoseException
Invoke the method on the MBean using the MBeanServer

Parameters:
ObjectName - nodeAgent
MBeanServer - server
Returns:
Object
Throws:
DiagnoseException

accessAttributeFromMBean

protected Object accessAttributeFromMBean(ObjectName nodeAgent,
                                          MBeanServer server)
                                   throws DiagnoseException
Access the attribute of the MBean using the MBeanServer

Parameters:
ObjectName - nodeAgent
MBeanServer - server
Returns:
Object
Throws:
DiagnoseException

getAttribute

public String getAttribute()

getMbeanServerFactoryClassName

public String getMbeanServerFactoryClassName()

setMbeanServerFactoryClassName

public void setMbeanServerFactoryClassName(String mbeanFactoryClassName)

getQuery

public String getQuery()

setQuery

public void setQuery(String query)

getOperation

public String getOperation()

setOperation

public void setOperation(String operation)


Copyright © 2012. All Rights Reserved.