org.objectweb.fractal.jmx.agent
Class Agent

java.lang.Object
  extended byorg.objectweb.fractal.jmx.agent.Agent
All Implemented Interfaces:
Admin, AdminAttributes, AttributeController, BindingController, LifeCycleController

public class Agent
extends Object
implements BindingController, LifeCycleController, AdminAttributes, Admin

A component representing the JMX agent level. This component encapsulates a JMX MBeanServer and allows MBean manipulation by implementing the Admin interface for registering MBeans, and the AdminAttributes interface for filtering MBeans. Where the MBeans represent component server interfaces or JMX monitors for observing component attributes.

The binding controller part of this component sets the [required] listener component that handles JMX notifications sent out by the monitors. The life-cycle controller part bootstraps this component by registering two MBeans representing its Admin and AdminAttributes interfaces. These two interfaces are identified respectively in the agent by the ObjectName:

    Agent:itf=admin
    Agent:itf=attribute-controller
 

The naming convention used for the MBeans representing component server interfaces is defined in Admin. The monitors are identified by the ObjectName:

    AgentService:type=monitorType,monitor=index[,attributeType=attType]
 
where:

Version:
0.1

Field Summary
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
Agent()
           
 
Method Summary
 void bindFc(String itfName, Object itfValue)
           
 void expose()
          Registers MBeans in the agent.
 String getFcState()
           
 String getItfPatterns()
          Returns the patterns for filtering components interface MBeans.
 String getMonitorCounterPatterns()
          Returns the patterns for filtering counter monitor MBeans.
 String getMonitorGaugePatterns()
          Returns the patterns for filtering gauge monitor MBeans.
 String getMonitorPeriodicPatterns()
          Returns the patterns for filtering periodic monitor MBeans.
 String getMonitorStringPatterns()
          Returns the patterns for filtering string monitor MBeans.
 MBeanServer getRawMBeanServer()
          Returns the underlying MBeanServer used by the agent.
 String[] listFc()
           
 Object lookupFc(String itfName)
           
 void setItfPatterns(String str)
          Sets the patterns for filtering components interface MBeans.
 void setMonitorCounterPatterns(String counters)
          Sets the patterns for filtering counter monitor MBeans.
 void setMonitorGaugePatterns(String gauges)
          Sets the patterns for filtering gauge monitor MBeans.
 void setMonitorPeriodicPatterns(String periodic)
          Sets the patterns for filtering periodic monitor MBeans.
 void setMonitorStringPatterns(String str)
          Sets the patterns for filtering string monitor MBeans.
 void setRawMBeanServer(MBeanServer srv)
          Sets the underlying MBeanServer used by the agent.
 void startFc()
           
 void stopFc()
           
 void unbindFc(String itfName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Agent

public Agent()
Method Detail

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController

lookupFc

public Object lookupFc(String itfName)
Specified by:
lookupFc in interface BindingController

bindFc

public void bindFc(String itfName,
                   Object itfValue)
Specified by:
bindFc in interface BindingController

unbindFc

public void unbindFc(String itfName)
Specified by:
unbindFc in interface BindingController

getFcState

public String getFcState()
Specified by:
getFcState in interface LifeCycleController

startFc

public void startFc()
Specified by:
startFc in interface LifeCycleController

stopFc

public void stopFc()
Specified by:
stopFc in interface LifeCycleController

getItfPatterns

public String getItfPatterns()
Description copied from interface: AdminAttributes
Returns the patterns for filtering components interface MBeans.

Specified by:
getItfPatterns in interface AdminAttributes
Returns:
the patterns for filtering components interface MBeans.
See Also:
AdminAttributes.setItfPatterns(java.lang.String)

setItfPatterns

public void setItfPatterns(String str)
Description copied from interface: AdminAttributes
Sets the patterns for filtering components interface MBeans. Any component interface, whose ObjectName matches one of these patterns, can be registered in the agent.

The syntax of this filter is defined to equal a sequence of (";" separated) string representations of ObjectName patterns. For example:

    *:itf=attribute-controller,*;*/Foo/*:*
 
represents two patterns that can match respectively:

Specified by:
setItfPatterns in interface AdminAttributes
Parameters:
str - the patterns for filtering components interface MBeans.

getMonitorStringPatterns

public String getMonitorStringPatterns()
Description copied from interface: AdminAttributes
Returns the patterns for filtering string monitor MBeans.

Specified by:
getMonitorStringPatterns in interface AdminAttributes
Returns:
the patterns for filtering string monitor MBeans.
See Also:
AdminAttributes.setMonitorStringPatterns(java.lang.String)

setMonitorStringPatterns

public void setMonitorStringPatterns(String str)
Description copied from interface: AdminAttributes
Sets the patterns for filtering string monitor MBeans. Any getter of type string, specified in a component interface whose ObjectName matches one of these patterns, can be observed by a string monitor.

The syntax of this filter is defined to equal a sequence of (";" separated) string representations of ObjectName patterns. Where the following properties are reserved for the configuration of a string monitor (as defined in the JMX specification):

For example:

    *:itf=attribute-controller,observedAttribute=Foo,granularityPeriod=5000,
      stringToCompare=fooval,notifyDiffer=true,notifyMatch=true,*
 
represents a pattern that can match the attribute controller interface of any component, if this interface specifies a string attribute "Foo". This attribute will be monitored every 5000 ms and compared with the value "fooval". As defined in the JMX specification:

Specified by:
setMonitorStringPatterns in interface AdminAttributes
Parameters:
str - the patterns for filtering string monitor MBeans.

getMonitorCounterPatterns

public String getMonitorCounterPatterns()
Description copied from interface: AdminAttributes
Returns the patterns for filtering counter monitor MBeans.

Specified by:
getMonitorCounterPatterns in interface AdminAttributes
Returns:
the patterns for filtering counter monitor MBeans.
See Also:
AdminAttributes.setMonitorCounterPatterns(java.lang.String)

setMonitorCounterPatterns

public void setMonitorCounterPatterns(String counters)
Description copied from interface: AdminAttributes
Sets the patterns for filtering counter monitor MBeans. Any getter of type integer (Byte, Integer, Short, Long), specified in a component interface whose ObjectName matches one of these patterns, can be observed by a counter monitor.

The syntax of this filter is defined to equal a sequence of (";" separated) string representations of ObjectName patterns. Where the following properties are reserved for the configuration of a counter monitor (as defined in the JMX specification):

For example:

    *:itf=stat-controller,observedAttribute=NumberOfMethodCall,granularityPeriod=5000,
      initThreshold=2,modulus=0,offset=10,differenceMode=false,*
 
represents a pattern that can match the interface "stat-controller" of any component, if this interface specifies an integer attribute named "NumberOfMethodCall". This attribute will be monitored every 5000 ms. Threshold notifications are sent, as defined in the JMX specification for a counter monitor configured with: InitThreshold=2, Modulus=0, Offset=10 and DifferenceMode=false (by default Notify=true).

Specified by:
setMonitorCounterPatterns in interface AdminAttributes
Parameters:
counters - the patterns for filtering counter monitor MBeans.

getMonitorGaugePatterns

public String getMonitorGaugePatterns()
Description copied from interface: AdminAttributes
Returns the patterns for filtering gauge monitor MBeans.

Specified by:
getMonitorGaugePatterns in interface AdminAttributes
Returns:
the patterns for filtering gauge monitor MBeans.
See Also:
AdminAttributes.setMonitorGaugePatterns(java.lang.String)

setMonitorGaugePatterns

public void setMonitorGaugePatterns(String gauges)
Description copied from interface: AdminAttributes
Sets the patterns for filtering gauge monitor MBeans. Any getter of type integer or floating-point (Byte, Integer, Short, Long, Float, Double), specified in a component interface whose ObjectName matches one of these patterns, can be observed by a gauge monitor.

The syntax of this filter is defined to equal a sequence of (";" separated) string representations of ObjectName patterns. Where the following properties are reserved for the configuration of a gauge monitor (as defined in the JMX specification):

For example:

    *:itf=stat-controller,observedAttribute=RateOfMethodCall,granularityPeriod=5000,
      lowThreshold=0.05,highThreshold=0.15,differenceMode=false,*
 
represents a pattern that can match the interface "stat-controller" of any component, if this interface specifies an integer or floating-point attribute named "RateOfMethodCall". This attribute will be monitored every 5000 ms. Threshold high notifications and Threshold low notifications are sent, as defined in the JMX specification for a gauge monitor configured with: LowThreshold=0.05, HighThreshold=0.15 and DifferenceMode=false (by default NotifyHigh=true and NotifyLow=true).

Specified by:
setMonitorGaugePatterns in interface AdminAttributes
Parameters:
gauges - the patterns for filtering gauge monitor MBeans.

getMonitorPeriodicPatterns

public String getMonitorPeriodicPatterns()
Description copied from interface: AdminAttributes
Returns the patterns for filtering periodic monitor MBeans.

Specified by:
getMonitorPeriodicPatterns in interface AdminAttributes
Returns:
the patterns for filtering periodic monitor MBeans.
See Also:
AdminAttributes.setMonitorPeriodicPatterns(java.lang.String)

setMonitorPeriodicPatterns

public void setMonitorPeriodicPatterns(String periodic)
Description copied from interface: AdminAttributes
Sets the patterns for filtering periodic monitor MBeans. Any getter, specified in a component interface whose ObjectName matches one of these patterns, can be observed by a periodic monitor.

The syntax of this filter is defined to equal a sequence of (";" separated) string representations of ObjectName patterns. Where the following properties are reserved for the configuration of a periodic monitor:

For example:

    *:itf=attribute-controller,observedAttribute=Foo,granularityPeriod=5000
 
represents a pattern that can match the attribute controller interface of any component, if this interface specifies a string attribute "Foo". Every 5000 ms, this attribute will be monitored and a notification will be sent.

Specified by:
setMonitorPeriodicPatterns in interface AdminAttributes
Parameters:
periodic - the patterns for filtering periodic monitor MBeans.

getRawMBeanServer

public MBeanServer getRawMBeanServer()
Description copied from interface: AdminAttributes
Returns the underlying MBeanServer used by the agent. This method allows raw MBean manipulation on the Fractal JMX agent side.

Specified by:
getRawMBeanServer in interface AdminAttributes
Returns:
the underlying MBeanServer used by the agent.

setRawMBeanServer

public void setRawMBeanServer(MBeanServer srv)
Description copied from interface: AdminAttributes
Sets the underlying MBeanServer used by the agent.

This method is unsupported, but specified since the Fractal attribute controller API requires getter and setter methods for each attribute.

Specified by:
setRawMBeanServer in interface AdminAttributes
Parameters:
srv - the underlying MBeanServer used by the agent.

expose

public void expose()
            throws JMException
Description copied from interface: Admin
Registers MBeans in the agent. This method allows the agent component (implementing this interface) to register MBeans in its scope, where:

This method:

Specified by:
expose in interface Admin
Throws:
JMException - if a problem occurs during the MBean registration.