org.norther.tammi.core.model
Class ReferableModelMBean<R>

java.lang.Object
  extended by javax.management.modelmbean.RequiredModelMBean
      extended by org.norther.tammi.core.model.ReferableModelMBean<R>
Type Parameters:
R - the adaptee type.
All Implemented Interfaces:
Serializable, DynamicMBean, MBeanRegistration, ModelMBean, ModelMBeanNotificationBroadcaster, NotificationBroadcaster, NotificationEmitter, PersistentMBean, AdaptableMBean<R>, Identifiable, NamePattern, ReferableMBean<R>
Direct Known Subclasses:
VariableZ.ReferenceModelMBean, WidgetModelMBean

public class ReferableModelMBean<R>
extends RequiredModelMBean
implements AdaptableMBean<R>, NamePattern, Identifiable, Serializable

Extends javax.management.RequiredModelMBean to support referable adaptees as managed resources.

Version:
$Id: ReferableModelMBean.java,v 1.16 2009/09/28 15:08:44 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
static String ADAPTER_NOTIF_DESCRIPTION
          The notification description.
static ModelMBeanNotificationInfo[] ADAPTER_NOTIFICATIONS
          Adapter notifications.
 
Fields inherited from interface org.norther.tammi.core.base.ReferableMBean
ID, MBEAN, NS, TYPE
 
Constructor Summary
ReferableModelMBean()
          Creates an empty adapter.
ReferableModelMBean(ModelMBeanInfo info)
          Creates a new adapter with a specified model.
 
Method Summary
 void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           
 Object getAttribute(String name)
           
 String getCanonicalName()
          Gets the canonical object name of the MBean as a string.
 R getManagedResource()
          Gets the managed resource.
 MBeanReference<R> getMBean()
          Gets a reference to the MBean.
 String getNamePattern()
          Gets the name pattern as a string.
 MBeanNotificationInfo[] getNotificationInfo()
           
 ObjectName getQueryPattern()
          Gets the name pattern as an object name query.
 void postDeregister()
           
 void postRegister(Boolean done)
           
 void preDeregister()
           
 ObjectName preRegister(MBeanServer server, ObjectName name)
           
 void removeNotificationListener(NotificationListener listener)
           
 void sendNotification(Notification notification)
           
 void setAttribute(Attribute attr)
           
 void setCanonicalName(String name)
          Sets the canonical object name of the MBean as a string.
 void setManagedResource(Object adaptee, String type)
           
 void setNamePattern(String pattern)
          Sets the name pattern as a string.
 void setQueryPattern(ObjectName pattern)
          Sets the name pattern as an object name query.
 
Methods inherited from class javax.management.modelmbean.RequiredModelMBean
addAttributeChangeNotificationListener, getAttributes, getClassLoaderRepository, getMBeanInfo, invoke, load, removeAttributeChangeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, setAttributes, setModelMBeanInfo, store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.management.modelmbean.ModelMBean
setModelMBeanInfo
 
Methods inherited from interface javax.management.DynamicMBean
getAttributes, getMBeanInfo, invoke, setAttributes
 
Methods inherited from interface javax.management.PersistentMBean
load, store
 
Methods inherited from interface javax.management.modelmbean.ModelMBeanNotificationBroadcaster
addAttributeChangeNotificationListener, removeAttributeChangeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification
 

Field Detail

ADAPTER_NOTIF_DESCRIPTION

public static final String ADAPTER_NOTIF_DESCRIPTION
The notification description.

See Also:
Constant Field Values

ADAPTER_NOTIFICATIONS

public static final ModelMBeanNotificationInfo[] ADAPTER_NOTIFICATIONS
Adapter notifications.

Constructor Detail

ReferableModelMBean

public ReferableModelMBean()
                    throws MBeanException
Creates an empty adapter.

Throws:
MBeanException - if initialization of the adaptee fails.

ReferableModelMBean

public ReferableModelMBean(ModelMBeanInfo info)
                    throws MBeanException,
                           RuntimeOperationsException
Creates a new adapter with a specified model.

Parameters:
info - the managed model.
Throws:
MBeanException - if initialization of the adaptee fails.
RuntimeOperationsException - for exceptions during construction.
Method Detail

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
Specified by:
preRegister in interface MBeanRegistration
Overrides:
preRegister in class RequiredModelMBean
Throws:
Exception

postRegister

public void postRegister(Boolean done)
Specified by:
postRegister in interface MBeanRegistration
Overrides:
postRegister in class RequiredModelMBean

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface MBeanRegistration
Overrides:
preDeregister in class RequiredModelMBean
Throws:
Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface MBeanRegistration
Overrides:
postDeregister in class RequiredModelMBean

getMBean

public MBeanReference<R> getMBean()
Description copied from interface: ReferableMBean
Gets a reference to the MBean.

Specified by:
getMBean in interface ReferableMBean<R>
Returns:
a reference to the MBean.

getCanonicalName

public String getCanonicalName()
Description copied from interface: Identifiable
Gets the canonical object name of the MBean as a string.

Specified by:
getCanonicalName in interface Identifiable
Returns:
the canonical object name as a string or null.

setCanonicalName

public void setCanonicalName(String name)
                      throws MalformedObjectNameException
Description copied from interface: Identifiable
Sets the canonical object name of the MBean as a string. The canonical object name can be used by persistence mechanisms to store the identity of the MBean.

Specified by:
setCanonicalName in interface Identifiable
Parameters:
name - the canonical object name as a string.
Throws:
MalformedObjectNameException - for an invalid name.

getNamePattern

public String getNamePattern()
Description copied from interface: NamePattern
Gets the name pattern as a string.

Specified by:
getNamePattern in interface NamePattern
Returns:
the name pattern or null.

setNamePattern

public void setNamePattern(String pattern)
                    throws MalformedObjectNameException
Description copied from interface: NamePattern
Sets the name pattern as a string.

Specified by:
setNamePattern in interface NamePattern
Parameters:
pattern - the name pattern.
Throws:
MalformedObjectNameException - for an invalid name.

getQueryPattern

public ObjectName getQueryPattern()
Description copied from interface: NamePattern
Gets the name pattern as an object name query.

Specified by:
getQueryPattern in interface NamePattern
Returns:
the query pattern or null.

setQueryPattern

public void setQueryPattern(ObjectName pattern)
Description copied from interface: NamePattern
Sets the name pattern as an object name query. The name pattern is applied when generating a unique name during registration of an unnamed MBean.

Specified by:
setQueryPattern in interface NamePattern
Parameters:
pattern - the query pattern.

addNotificationListener

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

getNotificationInfo

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

removeNotificationListener

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

sendNotification

public void sendNotification(Notification notification)
Specified by:
sendNotification in interface ModelMBeanNotificationBroadcaster
Overrides:
sendNotification in class RequiredModelMBean

getManagedResource

public R getManagedResource()
Description copied from interface: AdaptableMBean
Gets the managed resource.

Specified by:
getManagedResource in interface AdaptableMBean<R>
Returns:
the managed resource.

setManagedResource

public void setManagedResource(Object adaptee,
                               String type)
                        throws MBeanException,
                               RuntimeOperationsException,
                               InstanceNotFoundException,
                               InvalidTargetObjectTypeException
Specified by:
setManagedResource in interface ModelMBean
Overrides:
setManagedResource in class RequiredModelMBean
Throws:
MBeanException
RuntimeOperationsException
InstanceNotFoundException
InvalidTargetObjectTypeException

getAttribute

public Object getAttribute(String name)
                    throws AttributeNotFoundException,
                           ReflectionException,
                           MBeanException
Specified by:
getAttribute in interface DynamicMBean
Overrides:
getAttribute in class RequiredModelMBean
Throws:
AttributeNotFoundException
ReflectionException
MBeanException

setAttribute

public void setAttribute(Attribute attr)
                  throws AttributeNotFoundException,
                         InvalidAttributeValueException,
                         ReflectionException,
                         MBeanException
Specified by:
setAttribute in interface DynamicMBean
Overrides:
setAttribute in class RequiredModelMBean
Throws:
AttributeNotFoundException
InvalidAttributeValueException
ReflectionException
MBeanException


Copyright © 2004 The Norther Organization. All rights reserved.