org.oddjob.jmx.server
Class OddjobMBeanFactory

java.lang.Object
  extended by org.oddjob.jmx.server.OddjobMBeanFactory
All Implemented Interfaces:
ObjectNames, ServerSession

public class OddjobMBeanFactory
extends Object
implements ServerSession

A factory for producing OddjobMBeans. The MBean names are just sequential formatted numbers. The root name is created with the 0 number.


Constructor Summary
OddjobMBeanFactory(MBeanServer server)
          Constructor.
 
Method Summary
 ObjectName createMBeanFor(Object obj, ServerContext context)
          Create an MBean and register with the server using the generated name.
 void destroy(ObjectName objName)
          Remove a bean from the server.
 ObjectName nameFor(Object object)
           
 Object objectFor(ObjectName objectName)
           
static ObjectName objectName(int sequence)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OddjobMBeanFactory

public OddjobMBeanFactory(MBeanServer server)
Constructor.

Parameters:
server - The server to register newly created beans with.
Method Detail

createMBeanFor

public ObjectName createMBeanFor(Object obj,
                                 ServerContext context)
                          throws JMException
Create an MBean and register with the server using the generated name.

Specified by:
createMBeanFor in interface ServerSession
Parameters:
obj - The object the MBean is wrapping.
Returns:
The object name registered.
Throws:
JMException - If the MBean fails to register.

destroy

public void destroy(ObjectName objName)
             throws JMException
Remove a bean from the server.

Specified by:
destroy in interface ServerSession
Parameters:
objName - The bean.
Throws:
JMException

objectName

public static ObjectName objectName(int sequence)

nameFor

public ObjectName nameFor(Object object)
Specified by:
nameFor in interface ObjectNames

objectFor

public Object objectFor(ObjectName objectName)
Specified by:
objectFor in interface ObjectNames