org.norther.tammi.core.base
Class MBeanInstance<R>

java.lang.Object
  extended by javax.management.ObjectInstance
      extended by org.norther.tammi.core.base.MBeanInstance<R>
Type Parameters:
R - the adapter type.
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, MBeanReference<R>

public class MBeanInstance<R>
extends ObjectInstance
implements MBeanReference<R>, NotificationEmitter

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

Version:
$Id: MBeanInstance.java,v 1.21 2009/09/28 15:08:42 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
MBeanInstance(ReferableMBean<R> 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<R> instance)
          Marks as deserialized.
 boolean equals(Object object)
           
 R 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 javax.management.ObjectInstance
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MBeanInstance

public MBeanInstance(ReferableMBean<R> 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 R get()
Description copied from interface: MBeanReference
Gets the referent.

Specified by:
get in interface MBeanReference<R>
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<R>
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<R>
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<R>
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<R>
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<R> 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.