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, ArooaSession session)
          Constructor.
 
Method Summary
 ObjectName createMBeanFor(Object object, ServerContext context)
          Create an MBean and register with the server using the generated name.
 void destroy(ObjectName objName)
          Remove a bean from the server.
 ArooaSession getArooaSession()
          Get the session used by the server.
 ObjectName nameFor(Object object)
          Get the object name for the give component object.
 Object objectFor(ObjectName objectName)
          Get the client side component for the given object name.
static ObjectName objectName(int sequence)
          Helper function to build the object name from the sequence number.
 
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,
                          ArooaSession session)
Constructor.

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

createMBeanFor

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

Specified by:
createMBeanFor in interface ServerSession
Parameters:
object - The object the MBean is wrapping.
context - The context.
Returns:
context The server context for the object.
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)
Helper function to build the object name from the sequence number.

Parameters:
sequence - The object sequence number.
Returns:
A JMX object name.

nameFor

public ObjectName nameFor(Object object)
Description copied from interface: ObjectNames
Get the object name for the give component object.

Specified by:
nameFor in interface ObjectNames
Parameters:
object - The proxy.
Returns:
The name.

objectFor

public Object objectFor(ObjectName objectName)
Description copied from interface: ObjectNames
Get the client side component for the given object name.

Specified by:
objectFor in interface ObjectNames
Parameters:
objectName - The object name.
Returns:
The proxy. Null if none exsists for the given name.

getArooaSession

public ArooaSession getArooaSession()
Description copied from interface: ServerSession
Get the session used by the server.

Specified by:
getArooaSession in interface ServerSession
Returns:
The session.