org.norther.tammi.core.base
Class MBeanInstance

java.lang.Object
  extended by javax.management.ObjectInstance
      extended by org.norther.tammi.core.base.MBeanInstance
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, MBeanReference

public class MBeanInstance
extends ObjectInstance
implements MBeanReference, NotificationEmitter

An extension to javax.management.ObjectInstance containing an optional reference to the corresponding registered MBean instance.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
MBeanInstance(ReferableMBean instance)
          Constructs a new empty instance.
 
Method Summary
 void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           
protected  void deregistered()
          Marks as deregistered.
protected  void deserialized(ReferableMBean instance)
          Marks as deserialized.
 boolean equals(Object object)
           
 Object get()
          Gets the referent.
 String getClassName()
          Gets the class name.
 MBeanServer getMBeanServer()
          Gets the MBean server.
 MBeanNotificationInfo[] getNotificationInfo()
           
 ObjectName getObjectName()
          Gets the object name.
 int hashCode()
           
 boolean isRegistered()
          Checks whether registered, already unregistered or unregistration is just going on.
protected  void registered(ObjectName name, MBeanServer server)
          Marks as registered.
 void removeNotificationListener(NotificationListener listener)
           
 void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           
protected  void setMBeanServer(MBeanServer server)
          Sets the MBean server.
protected  void setObjectName(ObjectName name)
          Sets the object name.
protected  void unregistered()
          Marks as unregistered.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanInstance

public MBeanInstance(ReferableMBean instance)
Constructs a new empty instance.

Parameters:
instance - the MBean instance.
Method Detail

equals

public boolean equals(Object object)
Overrides:
equals in class ObjectInstance

hashCode

public int hashCode()
Overrides:
hashCode in class ObjectInstance

get

public Object get()
Description copied from interface: MBeanReference
Gets the referent.

Specified by:
get in interface MBeanReference
Returns:
the referent or null if not available.

getObjectName

public ObjectName getObjectName()
Description copied from interface: MBeanReference
Gets the object name.

Specified by:
getObjectName in interface MBeanReference
Overrides:
getObjectName in class ObjectInstance
Returns:
the object name or null if not available.

getClassName

public String getClassName()
Description copied from interface: MBeanReference
Gets the class name.

Specified by:
getClassName in interface MBeanReference
Overrides:
getClassName in class ObjectInstance
Returns:
the class name or null if not available.

isRegistered

public boolean isRegistered()
Description copied from interface: MBeanReference
Checks whether registered, already unregistered or unregistration is just going on.

Specified by:
isRegistered in interface MBeanReference
Returns:
true if still registered, otherwise false.

getMBeanServer

public MBeanServer getMBeanServer()
Description copied from interface: MBeanReference
Gets the MBean server.

Specified by:
getMBeanServer in interface MBeanReference
Returns:
the MBean server or null if never registered.

addNotificationListener

public void addNotificationListener(NotificationListener listener,
                                    NotificationFilter filter,
                                    Object handback)
Specified by:
addNotificationListener in interface NotificationBroadcaster

removeNotificationListener

public void removeNotificationListener(NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
                                throws ListenerNotFoundException
Specified by:
removeNotificationListener in interface NotificationEmitter
Throws:
ListenerNotFoundException

removeNotificationListener

public void removeNotificationListener(NotificationListener listener)
                                throws ListenerNotFoundException
Specified by:
removeNotificationListener in interface NotificationBroadcaster
Throws:
ListenerNotFoundException

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Specified by:
getNotificationInfo in interface NotificationBroadcaster

registered

protected void registered(ObjectName name,
                          MBeanServer server)
Marks as registered.

Note that notifications are not sent by MBeanInstance as the proper timing for notifications is decided by MBeans themselves.

Parameters:
name - the object name.
server - the MBean server.
Throws:
IllegalStateException - if already registered.
IllegalArgumentException - for a name pattern.

deregistered

protected void deregistered()
Marks as deregistered.


unregistered

protected void unregistered()
Marks as unregistered.

Note that notifications are not sent by MBeanInstance as the proper timing for notifications is decided by MBeans themselves.


deserialized

protected void deserialized(ReferableMBean instance)
Marks as deserialized.

Parameters:
instance - the MBean instance.

setObjectName

protected void setObjectName(ObjectName name)
Sets the object name.

Parameters:
name - the object name.
Throws:
IllegalStateException - if already registered.
IllegalArgumentException - for a name pattern.

setMBeanServer

protected void setMBeanServer(MBeanServer server)
Sets the MBean server.

Parameters:
server - the MBean server.
Throws:
IllegalStateException - if already registered.


Copyright © 2004 The Norther Organization. All rights reserved.