org.rhq.enterprise.communications.command.server
Class CommandMBean

java.lang.Object
  extended by org.rhq.enterprise.communications.command.server.CommandMBean
All Implemented Interfaces:
MBeanRegistration
Direct Known Subclasses:
AutoDiscovery, CommandService, CommandServiceDirectory

public abstract class CommandMBean
extends Object
implements MBeanRegistration

The superclass for all services that are to be deployed as MBeans. This class itself is not a valid MBean - there is no MBean interface. Subclasses need to provide their own MBean interface. This class simply provides some convienent lifecycle methods.

Author:
John Mazzitelli

Constructor Summary
CommandMBean()
          Creates a new CommandMBean object.
 
Method Summary
 mazz.i18n.Logger getLog()
          Returns a logger that can be used to log messages under the instance's own category.
 MBeanServer getMBeanServer()
          Returns the MBeanServer where this service is registered; will be null if not registered anywhere.
 ObjectName getObjectName()
          Returns the name of this MBean service as it is registered under; will be null if not registered in an MBeanServer.
 void postDeregister()
           
 void postRegister(Boolean arg0)
           
 void preDeregister()
           
 ObjectName preRegister(MBeanServer mbs, ObjectName name)
           
 void startService()
          This is called after the MBean is fully registered with the MBeanServer.
 void stopService()
          This is called when the MBean is being deregistered from the MBeanServer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandMBean

public CommandMBean()
Creates a new CommandMBean object.

Method Detail

preRegister

public ObjectName preRegister(MBeanServer mbs,
                              ObjectName name)
                       throws Exception
Specified by:
preRegister in interface MBeanRegistration
Throws:
Exception
See Also:
MBeanRegistration.preRegister(MBeanServer, ObjectName)

postRegister

public void postRegister(Boolean arg0)
Specified by:
postRegister in interface MBeanRegistration
See Also:
MBeanRegistration.postRegister(java.lang.Boolean)

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface MBeanRegistration
Throws:
Exception
See Also:
MBeanRegistration.preDeregister()

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface MBeanRegistration
See Also:
MBeanRegistration.postDeregister()

getMBeanServer

public MBeanServer getMBeanServer()
Returns the MBeanServer where this service is registered; will be null if not registered anywhere.

Returns:
the MBeanServer where this MBean is registered

getObjectName

public ObjectName getObjectName()
Returns the name of this MBean service as it is registered under; will be null if not registered in an MBeanServer.

Returns:
the object name that this MBean is registered under

getLog

public mazz.i18n.Logger getLog()
Returns a logger that can be used to log messages under the instance's own category.

Returns:
a logger whose category is the name of this object's implementation class

startService

public void startService()
This is called after the MBean is fully registered with the MBeanServer. This implementation is a no-op that subclasses are free to override.


stopService

public void stopService()
This is called when the MBean is being deregistered from the MBeanServer. This implementation is a no-op that subclasses are free to override.



Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.