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

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 DESTROY_ACTION
           
static java.lang.String INIT_ACTION
           
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(ManagedLifecycle f_lifecycle, ConfigTree f_configtree)
          Constructor using lifecycle and config tree.
 
Method Summary
 void destroy()
          Calls destroy on the lifecycle.
 java.lang.String getAttribute(java.lang.String name)
          Gets the attribute value.
 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.
 void initialise()
          Calls initialise on the lifecycle.
 java.lang.Object invoke(java.lang.String method, java.lang.Object[] arg1, java.lang.String[] arg2)
          Invoke calls the four operations provided by the LifecycleController - initialise, start, stop, destroy.
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 setConfigTree(ConfigTree f_ct)
          ConfigTree mutator.
 void setLifecycle(ManagedLifecycle 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 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

INIT_ACTION

public static final java.lang.String INIT_ACTION
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

DESTROY_ACTION

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

LifecycleController

public LifecycleController(ManagedLifecycle f_lifecycle,
                           ConfigTree f_configtree)
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(ManagedLifecycle f_aml)
Lifecycle mutator.

Parameters:
f_aml - lifecycle

getListenerXMLAsHtml

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

Returns:
configtree XML

setConfigTree

public void setConfigTree(ConfigTree f_ct)
ConfigTree mutator.

Parameters:
f_ct - config tree

destroy

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

Throws:
ManagedLifecycleException

initialise

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

Throws:
ManagedLifecycleException

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.


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

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 four operations provided by the LifecycleController - initialise, start, stop, destroy. 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

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