org.objectweb.cjdbc.controller.jmx
Class JmxAgent

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.jmx.JmxAgent
Direct Known Subclasses:
CjdbcJmxAgent

public class JmxAgent
extends java.lang.Object

Generic JMX Server with loading of different adaptors and enalbing of security options.

Version:
1.0
Author:
Emmanuel Cecchet, Nicolas Modrzyk, Duncan Smith

Field Summary
protected static java.util.ArrayList adaptors
           
protected static java.lang.String domainName
           
private static boolean enableSSL
           
private  java.lang.String hostname
           
(package private) static Trace logger
          Logger instance
protected static javax.management.MBeanServer server
           
private static javax.management.ObjectName ssl
           
 
Constructor Summary
protected JmxAgent()
          Creates a new JMX agent bound to the localhost
protected JmxAgent(java.lang.String hostname)
          Creates a new JMX agent
 
Method Summary
private static void addAdaptor(JmxAdaptor adaptor)
          Add an adaptor to this agent
 void addInterceptor(mx4j.server.interceptor.DefaultMBeanServerInterceptor custom)
          Add an interceptor to the server
 void enableAdaptor(java.lang.String type, int port)
          Enable an adaptor for this JmxAgent add it to the internal store of adaptors.
private static void enableSSL()
          This is to enable SSL over RMI
protected static void register(java.lang.Object mbean, java.lang.String name, java.lang.String type)
          Register a mean in the JmxAgent
 void registerMBean(java.lang.Object mbean)
          Generically Register a mean in the JmxAgent
 void setDomainName(java.lang.String domain)
          Set domain name fot this jmx agent
 void setSsl(boolean ssl)
          Possibly enable SSL support
 void start()
          This method start the JMX server, the http adaptor and register the MBeans.
 void stop()
          Stop all the adaptor for this jmx agent, and stop the agent;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ssl

private static javax.management.ObjectName ssl

domainName

protected static java.lang.String domainName

hostname

private java.lang.String hostname

enableSSL

private static boolean enableSSL

server

protected static javax.management.MBeanServer server

adaptors

protected static java.util.ArrayList adaptors

logger

static Trace logger
Logger instance

Constructor Detail

JmxAgent

protected JmxAgent()
            throws java.lang.Exception
Creates a new JMX agent bound to the localhost

Throws:
java.lang.Exception - If host name cannot be resolved

JmxAgent

protected JmxAgent(java.lang.String hostname)
            throws java.lang.Exception
Creates a new JMX agent

Throws:
java.lang.Exception - If host name cannot be resolved
Method Detail

setSsl

public void setSsl(boolean ssl)
            throws JmxException
Possibly enable SSL support

Parameters:
ssl - if true, tries to enable rmi on ssl
Throws:
JmxException - if ssl=true and enableSSL fails

addInterceptor

public void addInterceptor(mx4j.server.interceptor.DefaultMBeanServerInterceptor custom)
                    throws JmxException
Add an interceptor to the server

Parameters:
custom - an object that can be identified as an MBeanServerInterceptor
Throws:
JmxException - if fails

setDomainName

public void setDomainName(java.lang.String domain)
Set domain name fot this jmx agent

Parameters:
domain - the name of the domain

addAdaptor

private static final void addAdaptor(JmxAdaptor adaptor)
Add an adaptor to this agent

Parameters:
adaptor - a jmxadaptor

enableAdaptor

public void enableAdaptor(java.lang.String type,
                          int port)
                   throws JmxException
Enable an adaptor for this JmxAgent add it to the internal store of adaptors.

Parameters:
type - the type of the adaptor
port - the port to use for this adaptor
Throws:
JmxException - if fails

start

public void start()
           throws JmxException
This method start the JMX server, the http adaptor and register the MBeans.

Throws:
JmxException - if service fails to start

stop

public void stop()
          throws JmxException
Stop all the adaptor for this jmx agent, and stop the agent;

Throws:
JmxException - if fails

enableSSL

private static final void enableSSL()
                             throws JmxException
This is to enable SSL over RMI

Throws:
java.lang.Exception - if creation fails
JmxException

registerMBean

public void registerMBean(java.lang.Object mbean)
                   throws JmxException
Generically Register a mean in the JmxAgent

Parameters:
mbean - the mbean
Throws:
JmxException - if fails

register

protected static void register(java.lang.Object mbean,
                               java.lang.String name,
                               java.lang.String type)
                        throws JmxException
Register a mean in the JmxAgent

Parameters:
mbean - the mbean
name - the name of the mbean
type - the type of the mean
Throws:
java.lang.Exception - if fails
JmxException


Copyright © 2002, 2003 - ObjectWeb Consortium - All Rights Reserved.