org.jboss.soa.esb.listeners.lifecycle
Class LifecycleController

java.lang.Object
  extended by org.jboss.soa.esb.listeners.lifecycle.LifecycleController
All Implemented Interfaces:
javax.management.DynamicMBean
Direct Known Subclasses:
ThreadedLifecycleController

public class LifecycleController
extends java.lang.Object
implements javax.management.DynamicMBean

LifecycleController is an MBean implementation that

Author:
tcunning@redhat.com

Field Summary
static java.lang.String LIFECYCLESTATE_ATTRIB
           
static java.lang.String START_ACTION
           
static java.lang.String STARTTIME_ATTRIB
           
static java.lang.String STOP_ACTION
           
static java.lang.String XML_ATTRIB
           
 
Constructor Summary
LifecycleController(ManagedLifecycleAdapter f_lifecycle)
          Constructor using lifecycle and config tree.
 
Method Summary
 java.lang.String getAttribute(java.lang.String name)
          Gets the attribute value.
protected  java.util.SortedSet<java.lang.String> getAttributeNames()
          Get the list of attribute names
 javax.management.AttributeList getAttributes(java.lang.String[] arg0)
          Gets the list of attributes.
 java.lang.String getListenerXMLAsHtml()
          Gets the configtree XML as escaped HTML.
 javax.management.MBeanInfo getMBeanInfo()
          This creates the MBeanInfo object provided.
protected  javax.management.ObjectName getObjectName()
           
protected  java.util.List<javax.management.MBeanOperationInfo> getOperations()
          Get the list of operations
 java.lang.Object invoke(java.lang.String method, java.lang.Object[] arg1, java.lang.String[] arg2)
          Invoke calls the operations provided by the LifecycleController If one of the operation methods fails, we throw the exception, and if an unknown operation is called, we throw an exception.
protected  java.lang.Object invokeOperation(java.lang.String method, java.lang.Object[] arg1, java.lang.Object[] arg2)
          Invoke the operations on the controller
protected  void registerMBean()
          Register this MBean with JBoss.
 void setAttribute(javax.management.Attribute arg0)
          This method is here to implement the DynamicMBean interface in full, but it is not used because all of the attributes provided are read-only.
 javax.management.AttributeList setAttributes(javax.management.AttributeList arg0)
          This method is here to implement the DynamicMBean interface in full, but it is not used because all of the attributes provided are read-only.
 void setLifecycle(ManagedLifecycleAdapter f_aml)
          Lifecycle mutator.
protected  void setStartTime(long f_startTime)
          StartTime mutator.
 void start()
          Calls start on the lifecycle.
 void stop()
          Calls stop on the lifecycle.
protected  void unregisterMBean()
          Unregister this MBean with JBoss.
protected  void unsetStartTime()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIFECYCLESTATE_ATTRIB

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

STARTTIME_ATTRIB

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

XML_ATTRIB

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

START_ACTION

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

STOP_ACTION

public static final java.lang.String STOP_ACTION
See Also:
Constant Field Values
Constructor Detail

LifecycleController

public LifecycleController(ManagedLifecycleAdapter f_lifecycle)
Constructor using lifecycle and config tree.

Parameters:
f_lifecycle - lifecycle
f_configtree - config tree
Method Detail

setStartTime

protected void setStartTime(long f_startTime)
StartTime mutator.

Parameters:
f_startTime - start time

unsetStartTime

protected void unsetStartTime()

setLifecycle

public void setLifecycle(ManagedLifecycleAdapter f_aml)
Lifecycle mutator.

Parameters:
f_aml - lifecycle

getListenerXMLAsHtml

public java.lang.String getListenerXMLAsHtml()
Gets the configtree XML as escaped HTML.

Returns:
configtree XML

start

public void start()
           throws ManagedLifecycleException
Calls start on the lifecycle.

Throws:
ManagedLifecycleException

stop

public void stop()
          throws ManagedLifecycleException
Calls stop on the lifecycle.

Throws:
ManagedLifecycleException

registerMBean

protected void registerMBean()
Register this MBean with JBoss.


unregisterMBean

protected void unregisterMBean()
Unregister this MBean with JBoss.


getAttributes

public javax.management.AttributeList getAttributes(java.lang.String[] arg0)
Gets the list of attributes. We return all Lifecycle attributes from the ConfigTree, and the start time, configtree XML, and the lifecycle state.

Specified by:
getAttributes in interface javax.management.DynamicMBean

getAttribute

public java.lang.String getAttribute(java.lang.String name)
                              throws javax.management.AttributeNotFoundException
Gets the attribute value.

Specified by:
getAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException

getMBeanInfo

public javax.management.MBeanInfo getMBeanInfo()
This creates the MBeanInfo object provided. We are returning generic text for the attribute descriptions (the word Property and the name of the attribute), all of the attributes are read-only, and we provide four invocation methods - start/stop/initialise/destroy on the Lifecycle.

Specified by:
getMBeanInfo in interface javax.management.DynamicMBean

getAttributeNames

protected java.util.SortedSet<java.lang.String> getAttributeNames()
Get the list of attribute names

Returns:
The list of attribute names

getOperations

protected java.util.List<javax.management.MBeanOperationInfo> getOperations()
Get the list of operations

Returns:
The list of operations

invoke

public java.lang.Object invoke(java.lang.String method,
                               java.lang.Object[] arg1,
                               java.lang.String[] arg2)
                        throws javax.management.ReflectionException
Invoke calls the operations provided by the LifecycleController If one of the operation methods fails, we throw the exception, and if an unknown operation is called, we throw an exception.

Specified by:
invoke in interface javax.management.DynamicMBean
Throws:
javax.management.ReflectionException

invokeOperation

protected java.lang.Object invokeOperation(java.lang.String method,
                                           java.lang.Object[] arg1,
                                           java.lang.Object[] arg2)
                                    throws javax.management.ReflectionException
Invoke the operations on the controller

Throws:
javax.management.ReflectionException

setAttribute

public void setAttribute(javax.management.Attribute arg0)
                  throws javax.management.AttributeNotFoundException,
                         javax.management.InvalidAttributeValueException,
                         javax.management.MBeanException,
                         javax.management.ReflectionException
This method is here to implement the DynamicMBean interface in full, but it is not used because all of the attributes provided are read-only.

Specified by:
setAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.InvalidAttributeValueException
javax.management.MBeanException
javax.management.ReflectionException

setAttributes

public javax.management.AttributeList setAttributes(javax.management.AttributeList arg0)
This method is here to implement the DynamicMBean interface in full, but it is not used because all of the attributes provided are read-only.

Specified by:
setAttributes in interface javax.management.DynamicMBean

getObjectName

protected javax.management.ObjectName getObjectName()