org.jboss.soa.esb.actions.converters
Class SmooksMessageCounter

java.lang.Object
  extended by org.jboss.soa.esb.actions.converters.SmooksMessageCounter
All Implemented Interfaces:
javax.management.DynamicMBean

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

Smooks message counter is a MBean that displays shows how many failed and successful messages have been processed and shows the processing time of each.

Since:
Version 4.2
Author:
tcunning@redhat.com

Field Summary
static java.lang.String RESET_COUNTER
           
static java.lang.String TRANSFORM_FAILED
           
static java.lang.String TRANSFORM_SUCCEED
           
 
Constructor Summary
SmooksMessageCounter(ConfigTree f_config)
          Constructor
 
Method Summary
 java.lang.Object getAttribute(java.lang.String key)
           
 javax.management.AttributeList getAttributes(java.lang.String[] arg0)
           
 javax.management.MBeanInfo getMBeanInfo()
          This creates the MBeanInfo object provided.
protected  javax.management.ObjectName getObjectName()
          Return the object name, which for a SmooksMessageCounter is the deployment name (x.esb) and the category (SmooksMessageCounter).
 void incrementTotalCount()
          Increment the total message count of this service.
 void initHashes()
          Initialize the hashes by setting the counts and the processing time to an initial value of 0.
 void initMessageProfile(java.lang.String messageProfile)
          Initialize the message profile with a count of 0 for the time hash, the processed hash, and the failed hash.
 java.lang.Object invoke(java.lang.String method, java.lang.Object[] arg1, java.lang.String[] arg2)
           
protected  void registerMBean()
          Register this MBean with JBoss.
 void resetCounter()
          Reset the counters - set all the entries in the action counter hash and in the action process time hash to zero.
 void setAttribute(javax.management.Attribute arg0)
           
 javax.management.AttributeList setAttributes(javax.management.AttributeList arg0)
           
 void update(long procTime, java.lang.String messageProfile, java.lang.String status)
          Update the counts of the SmooksMessageCounter for a particular message profile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSFORM_SUCCEED

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

TRANSFORM_FAILED

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

RESET_COUNTER

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

SmooksMessageCounter

public SmooksMessageCounter(ConfigTree f_config)
Constructor

Parameters:
f_config - config tree
Method Detail

incrementTotalCount

public void incrementTotalCount()
Increment the total message count of this service.


initHashes

public void initHashes()
Initialize the hashes by setting the counts and the processing time to an initial value of 0.


resetCounter

public void resetCounter()
Reset the counters - set all the entries in the action counter hash and in the action process time hash to zero.


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

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
                              throws javax.management.AttributeNotFoundException,
                                     javax.management.MBeanException,
                                     javax.management.ReflectionException
Specified by:
getAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.MBeanException
javax.management.ReflectionException

getAttributes

public javax.management.AttributeList getAttributes(java.lang.String[] arg0)
Specified by:
getAttributes 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.MBeanException,
                               javax.management.ReflectionException
Specified by:
invoke in interface javax.management.DynamicMBean
Throws:
javax.management.MBeanException
javax.management.ReflectionException

setAttribute

public void setAttribute(javax.management.Attribute arg0)
                  throws javax.management.AttributeNotFoundException,
                         javax.management.InvalidAttributeValueException,
                         javax.management.MBeanException,
                         javax.management.ReflectionException
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)
Specified by:
setAttributes in interface javax.management.DynamicMBean

registerMBean

protected void registerMBean()
Register this MBean with JBoss.


initMessageProfile

public void initMessageProfile(java.lang.String messageProfile)
Initialize the message profile with a count of 0 for the time hash, the processed hash, and the failed hash.

Parameters:
messageProfile - message profile

update

public void update(long procTime,
                   java.lang.String messageProfile,
                   java.lang.String status)
Update the counts of the SmooksMessageCounter for a particular message profile.

Parameters:
procTime - time
messageProfile - profile
status - status

getObjectName

protected javax.management.ObjectName getObjectName()
Return the object name, which for a SmooksMessageCounter is the deployment name (x.esb) and the category (SmooksMessageCounter).

Returns:
object name