org.apache.camel.management
Class DefaultInstrumentationAgent

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.management.DefaultInstrumentationAgent
All Implemented Interfaces:
CamelContextAware, Service, InstrumentationAgent

public class DefaultInstrumentationAgent
extends ServiceSupport
implements InstrumentationAgent, CamelContextAware

Default implementation of the Camel JMX service agent


Field Summary
static String DEFAULT_CONNECTOR_PATH
           
static String DEFAULT_DOMAIN
           
static String DEFAULT_HOST
           
static int DEFAULT_PORT
           
static String SYSTEM_PROPERTY_JMX
           
static String SYSTEM_PROPERTY_JMX_USE_PLATFORM_MBS
           
 
Constructor Summary
DefaultInstrumentationAgent()
           
 
Method Summary
protected  void createJmxConnector(String host)
           
protected  void createMBeanServer()
           
protected  void doStart()
           
protected  void doStop()
           
 void enableJmx()
           
 void enableJmx(String domainName, String connectorPath, int port)
           
 CamelContext getCamelContext()
           
 MBeanServer getMBeanServer()
          Get the MBeanServer which hosts managed objects.
 void register(Object obj, ObjectName name)
          Registers object with management infrastructure with a specific name.
 void register(Object obj, ObjectName name, boolean forceRegistration)
          Registers object with management infrastructure with a specific name.
 void setCamelContext(CamelContext camelContext)
          Injects the CamelContext
 void setCreateConnector(boolean flag)
           
 void setMBeanServer(MBeanServer server)
           
 void setUsePlatformMBeanServer(boolean flag)
           
 void unregister(ObjectName name)
          Unregisters object based upon registered name
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getThreadName, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Field Detail

SYSTEM_PROPERTY_JMX

public static final String SYSTEM_PROPERTY_JMX
See Also:
Constant Field Values

SYSTEM_PROPERTY_JMX_USE_PLATFORM_MBS

public static final String SYSTEM_PROPERTY_JMX_USE_PLATFORM_MBS
See Also:
Constant Field Values

DEFAULT_DOMAIN

public static final String DEFAULT_DOMAIN
See Also:
Constant Field Values

DEFAULT_HOST

public static final String DEFAULT_HOST
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAULT_CONNECTOR_PATH

public static final String DEFAULT_CONNECTOR_PATH
See Also:
Constant Field Values
Constructor Detail

DefaultInstrumentationAgent

public DefaultInstrumentationAgent()
Method Detail

getCamelContext

public CamelContext getCamelContext()

setCamelContext

public void setCamelContext(CamelContext camelContext)
Description copied from interface: CamelContextAware
Injects the CamelContext

Specified by:
setCamelContext in interface CamelContextAware

setCreateConnector

public void setCreateConnector(boolean flag)

setUsePlatformMBeanServer

public void setUsePlatformMBeanServer(boolean flag)

setMBeanServer

public void setMBeanServer(MBeanServer server)

getMBeanServer

public MBeanServer getMBeanServer()
Description copied from interface: InstrumentationAgent
Get the MBeanServer which hosts managed objects.

NOTE: if the JMXEnabled configuration is not set to true, this method will return null.

Specified by:
getMBeanServer in interface InstrumentationAgent
Returns:
the MBeanServer

register

public void register(Object obj,
                     ObjectName name)
              throws JMException
Description copied from interface: InstrumentationAgent
Registers object with management infrastructure with a specific name. Object must be annotated or implement standard MBean interface.

Specified by:
register in interface InstrumentationAgent
Parameters:
obj - the object to register
name - the name
Throws:
JMException - is thrown if the registration failed

register

public void register(Object obj,
                     ObjectName name,
                     boolean forceRegistration)
              throws JMException
Description copied from interface: InstrumentationAgent
Registers object with management infrastructure with a specific name. Object must be annotated or implement standard MBean interface.

Specified by:
register in interface InstrumentationAgent
Parameters:
obj - the object to register
name - the name
forceRegistration - if set to true, then object will be registered despite existing object is already registered with the name.
Throws:
JMException - is thrown if the registration failed

unregister

public void unregister(ObjectName name)
                throws JMException
Description copied from interface: InstrumentationAgent
Unregisters object based upon registered name

Specified by:
unregister in interface InstrumentationAgent
Parameters:
name - the name
Throws:
JMException - is thrown if the unregistration failed

doStart

protected void doStart()
                throws Exception
Specified by:
doStart in class ServiceSupport
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Specified by:
doStop in class ServiceSupport
Throws:
Exception

enableJmx

public void enableJmx()

enableJmx

public void enableJmx(String domainName,
                      String connectorPath,
                      int port)

createMBeanServer

protected void createMBeanServer()

createJmxConnector

protected void createJmxConnector(String host)
                           throws IOException
Throws:
IOException


Copyright © 2008 IONA Open Source Community. All Rights Reserved.