com.adventnet.services.cascading
Class RemoteModelProxy

java.lang.Object
  |
  +--com.adventnet.services.cascading.RemoteModelProxy

class RemoteModelProxy
extends java.lang.Object
implements DynamicMBean, ModelMBean, MBeanRegistration


Constructor Summary
RemoteModelProxy(Cascader casc, ObjectName name)
           
 
Method Summary
 void addAttributeChangeNotificationListener(NotificationListener inlistener, java.lang.String inAttributeName, java.lang.Object inhandback)
          Registers an object which implements the NotificationListener interface as a listener for AttributeChangeNotifications.
 void addNotificationListener(NotificationListener listener, NotificationFilter filter, java.lang.Object handback)
          Enables a couple (listener,handback) for a registered MBean to be added.
 java.lang.String findPersistent(java.lang.String MBeanName)
          Looks in the persistent store for this MBean to see if there is a persistent version of it.
 java.lang.Object getAttribute(java.lang.String attribute)
          Gets the value of a specific attribute of this MBean.
 AttributeList getAttributes(java.lang.String[] attributes)
          Enables the values of several attributes of this MBean.
 MBeanInfo getMBeanInfo()
          This method discovers the attributes and operations this MBean exposes for management.
 MBeanNotificationInfo[] getNotificationInfo()
          Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent.
 java.lang.String getObjectName()
          Returns the ObjectName of this RemoteProxy with which it has been registered with the MBeanServer.
 java.lang.Object invoke(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature)
          Invokes an action on the original MBean associated with this MBean.
 void load()
          Locates the MBean in a persistent store and primes this instance of the MBean with the stored values.Any currently set values are overwritten.
 void postDeregister()
          Allows this MBean to perform any operations needed after having been de-registered in the MBeanServer.
 void postRegister(java.lang.Boolean registrationDone)
          Allows this MBean to perform any operations needed after having been registered in the MBeanServer or after the registration has failed.
 void preDeregister()
          Allows this MBean to perform any operations it needs before being de-registered by the MBeanServer.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          Allows the MBean to perform any operations it needs before being registered in the MBeanServer.
 void removeAttributeChangeNotificationListener(NotificationListener inlistener, java.lang.String inAttributeName)
          Removes a listener for attributeChangeNotifications from the MBean.
 void removeNotificationListener(NotificationListener listener)
          Enables a listener for an MBean to be removed.
 void sendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal)
          Sends an attributeChangeNotification which contains the old value and new value for the attribute to the registered AttributeChangeNotification listeners on the ModelMBean.
 void sendAttributeChangeNotification(AttributeChangeNotification ntfyObj)
          Sends an attributeChangeNotification which is passed in to the registered attributeChangeNotification listeners on the ModelMBean.
 void sendNotification(Notification ntfyObj)
          Sends a Notification which is passed in to the registered Notification listeners on the ModelMBean as a jmx.modelmbean.general notification.
 void sendNotification(java.lang.String ntfyText)
          Sends a Notification which contains the text string that is passed in to the registered Notification listeners on the ModelMBean.
 void setAttribute(Attribute attribute)
          Sets the value of a specific attribute of this MBean.
 AttributeList setAttributes(AttributeList attributes)
          Sets the values of several attributes of this MBean.
 void setManagedResource(java.lang.Object mr, java.lang.String mr_type)
          Sets the instance handle of the object against which to execute all methods in this ModelMBean management interface (MBeanInfo and Descriptors)
 void setModelMBeanInfo(ModelMBeanInfo mbi)
          Initializes a ModelMBean object using ModelMBeanInfo passed in.
 void store()
          Writes the MBean in a persistent store.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteModelProxy

public RemoteModelProxy(Cascader casc,
                        ObjectName name)
Method Detail

getMBeanInfo

public MBeanInfo getMBeanInfo()
This method discovers the attributes and operations this MBean exposes for management.
Specified by:
getMBeanInfo in interface DynamicMBean
Returns:
An instance of MBeanInfo allowing to retrieve all attributes and operations of this MBean.

getAttribute

public java.lang.Object getAttribute(java.lang.String attribute)
                              throws AttributeNotFoundException,
                                     MBeanException,
                                     ReflectionException
Gets the value of a specific attribute of this MBean.
Specified by:
getAttribute in interface DynamicMBean
Parameters:
attribute - A String specifying the name of the attribute to be retrieved.
Returns:
The value of the retrieved attribute.
Throws:
AttributeNotFoundException - The specified attribute is not accessible in the MBean.
MBeanException - The constructor of the MBean has thrown an exception
ReflectionException - Wraps a ClassNotFoundException or a java.lang.Exception that occured trying to invoke the MBean's constructor.

getAttributes

public AttributeList getAttributes(java.lang.String[] attributes)
Enables the values of several attributes of this MBean.
Specified by:
getAttributes in interface DynamicMBean
Parameters:
attributes - A list of attributes to be retrieved.
Returns:
The value of the retrieved attributes as attributeList.

invoke

public java.lang.Object invoke(java.lang.String actionName,
                               java.lang.Object[] params,
                               java.lang.String[] signature)
                        throws MBeanException,
                               ReflectionException
Invokes an action on the original MBean associated with this MBean.
Specified by:
invoke in interface DynamicMBean
Parameters:
actionName - The name of the action to be invoked.
params - An array containing the parameters to be set when the action is invoked
signature - An array containing the signature of the action. The class objects will be loaded using the same class loader as the one used for loading the MBean on which the action was invoked.
Returns:
The object returned by the action, which represents the result ofinvoking the action on the specified MBean.
Throws:
MBeanException - The constructor of the MBean has thrown an exception
ReflectionException - Wraps a ClassNotFoundException or a java.lang.Exception that occured trying to invoke the MBean's constructor.

setAttribute

public void setAttribute(Attribute attribute)
                  throws AttributeNotFoundException,
                         InvalidAttributeValueException,
                         MBeanException,
                         ReflectionException
Sets the value of a specific attribute of this MBean.
Specified by:
setAttribute in interface DynamicMBean
Parameters:
attribute - The identification of the attribute to be set and the value it is to be set to.
Throws:
AttributeNotFoundException - The specified attribute is not accessible in the MBean.
InvalidAttributeValueException - The specified value for the attribute is not valid.
MBeanException - The constructor of the MBean has thrown an exception
ReflectionException - Wraps a ClassNotFoundException or a java.lang.Exception that occured trying to invoke the MBean's constructor.

setAttributes

public AttributeList setAttributes(AttributeList attributes)
Sets the values of several attributes of this MBean.
Specified by:
setAttributes in interface DynamicMBean
Parameters:
attributes - A list of attributes: The identification of the attributes to be set and the values they are to be set to.
Returns:
The list of attributes that were set, with their new values.

getObjectName

public java.lang.String getObjectName()
Returns the ObjectName of this RemoteProxy with which it has been registered with the MBeanServer.
Returns:
the ObjectName

load

public void load()
          throws MBeanException,
                 RuntimeOperationsException,
                 InstanceNotFoundException
Locates the MBean in a persistent store and primes this instance of the MBean with the stored values.Any currently set values are overwritten.
Throws:
MBeanException - The constructor of the MBean has thrown an exception
RuntimeOperationsException - Wraps a java.lang.IllegalArgumentException: The object name in parameter is null or the attribute in parameter is null.
InstanceNotFoundException - The specified MBean is not registered in the MBeanServer.

store

public void store()
           throws MBeanException,
                  RuntimeOperationsException,
                  InstanceNotFoundException
Writes the MBean in a persistent store.
Throws:
MBeanException - The constructor of the MBean has thrown an exception
RuntimeOperationsException - Wraps a java.lang.IllegalArgumentException: The object name in parameter is null or the attribute in parameter is null.
InstanceNotFoundException - The specified MBean is not registered in the MBeanServer.

findPersistent

public java.lang.String findPersistent(java.lang.String MBeanName)
                                throws java.lang.Exception
Looks in the persistent store for this MBean to see if there is a persistent version of it.
Parameters:
MBeanName - The name of the MBean.
Returns:
String the specific MBeanName found.
Throws:
java.langException - - This exception should be caught by the MBeanServer and re-thrown as an MBeanRegistrationException

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws java.lang.Exception
Allows the MBean to perform any operations it needs before being registered in the MBeanServer. If the name of the MBean is not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered in the MBeanServer.
Specified by:
preRegister in interface MBeanRegistration
Parameters:
server - The MBeanServer in which the MBean will be registered.
name - The object name of the MBean.
Returns:
The name of the MBean registered.
Throws:
java.lang.Exception - - This exception should be caught by the MBeanServer and re-thrown as an MBeanRegistrationException.

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Allows this MBean to perform any operations needed after having been registered in the MBeanServer or after the registration has failed.
Specified by:
postRegister in interface MBeanRegistration
Parameters:
registrationDone - Indicates whether or not the MBean has been successfully registered in the MBeanServer. The value false means that either the registration phase has failed.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Allows this MBean to perform any operations it needs before being de-registered by the MBeanServer.
Specified by:
preDeregister in interface MBeanRegistration
Throws:
java.langException - This exception should be caught by the MBeanServer and re-thrown as an MBeanRegistrationException.

postDeregister

public void postDeregister()
Allows this MBean to perform any operations needed after having been de-registered in the MBeanServer.
Specified by:
postDeregister in interface MBeanRegistration

setManagedResource

public void setManagedResource(java.lang.Object mr,
                               java.lang.String mr_type)
                        throws MBeanException,
                               RuntimeOperationsException,
                               InstanceNotFoundException,
                               InvalidTargetObjectTypeException
Sets the instance handle of the object against which to execute all methods in this ModelMBean management interface (MBeanInfo and Descriptors)
Specified by:
setManagedResource in interface ModelMBean
Parameters:
mr - Object that is the managed resource
mr_type - The type of reference for the managed resource. Can be: ObjectReference, Handle, IOR, EJBHandle, RMIReference. If the MBeanServer cannot process the mr_type passed in, an InvalidTargetTypeException will be thrown.
Throws:
MBeanException - The initializer of the object has thrown an exception.
RuntimeOperationsException - Wraps an IllegalArgumentException: The managed resource or managed resoure type passed in parameter is null or invalid.
InstanceNotFoundException - The managed resource object could not be found.
javax.management.InvalidTargetObjectTypeException - The managed resource type cannot be processed by the ModelMBean or JMX Agent.

setModelMBeanInfo

public void setModelMBeanInfo(ModelMBeanInfo mbi)
                       throws MBeanException,
                              RuntimeOperationsException
Initializes a ModelMBean object using ModelMBeanInfo passed in. The ModelMBean must be instantiated, but not registered with the MBeanServer. After the ModelMBean's ModelMBeanInfo (with Descriptors) are customized, the ModelMBean should be registered with the MBeanServer.
Specified by:
setModelMBeanInfo in interface ModelMBean
Parameters:
inModelMBeanInfo - - The ModelMBeanInfo object to be used by the ModelMBean.
Throws:
MBeanException - The constructor of the MBeanInfo has return null or thrown an exception.
RuntimeOperationsException - Wraps an IllegalArgumentException: The MBeanInfo passed in parameter is null or invalid.

addNotificationListener

public void addNotificationListener(NotificationListener listener,
                                    NotificationFilter filter,
                                    java.lang.Object handback)
                             throws java.lang.IllegalArgumentException
Enables a couple (listener,handback) for a registered MBean to be added.
Parameters:
listener - The listener object which will handles notifications emitted by the registered MBean.
filter - The filter object. If not specified, no filtering will be performed before handling notifications.
handback - The context to be sent to the listener when a notification is emitted.
Throws:
java.lang.IllegalArgumentException -  

removeNotificationListener

public void removeNotificationListener(NotificationListener listener)
                                throws ListenerNotFoundException
Enables a listener for an MBean to be removed. All couple (listener, handback) are removed.
Parameters:
listener - - The listener object which will handles notifications emitted by the registered MBean.
Throws:
ListenerNotFoundException - The couple (listener,handback) is not registered in the MBean. The exception message contains either "listener", "handback" or the object name depending on which object cannot be found.

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent.
Returns:
A NotificationInfo object

addAttributeChangeNotificationListener

public void addAttributeChangeNotificationListener(NotificationListener inlistener,
                                                   java.lang.String inAttributeName,
                                                   java.lang.Object inhandback)
                                            throws MBeanException,
                                                   RuntimeOperationsException,
                                                   java.lang.IllegalArgumentException
Description copied from interface: ModelMBeanNotificationBroadcaster
Registers an object which implements the NotificationListener interface as a listener for AttributeChangeNotifications. This object's 'handleNotification()' method will be invoked when any attributeChangeNotification is issued through or by the MBean. This does not include other Notifications. They must be registered for independently. An AttributeChangeNotification will be generated for this attributeName.
Tags copied from interface: ModelMBeanNotificationBroadcaster
Parameters:
inlistener - The listener object which will handles notifications emitted by the registered MBean.
inAttributeName - The name of the MBean attribute for which to receive change notifications. If null, then all attribute changes will cause an attributeChangeNotification to be issued.
inhandback - The context to be sent to the listener with the notification when a notification is emitted.
Throws:
MBeanException - Wrappering exceptions from distributed communications.
RuntimeOPerationsException - RuntimeOperationsException to wrapper IllegalArgumentExceptions.
java.lang.IllegalArgumentException - Listener is null or attributeName is null.

removeAttributeChangeNotificationListener

public void removeAttributeChangeNotificationListener(NotificationListener inlistener,
                                                      java.lang.String inAttributeName)
                                               throws MBeanException,
                                                      RuntimeOperationsException,
                                                      ListenerNotFoundException
Description copied from interface: ModelMBeanNotificationBroadcaster
Removes a listener for attributeChangeNotifications from the MBean.
Tags copied from interface: ModelMBeanNotificationBroadcaster
Parameters:
inlistener - The listener name which was handling notifications emitted by the registered MBean. This method will remove all information related to this listener.
inAttributeName - The attribute for which the listener no longer wants to receive attributeChangeNotifications.
Throws:
MBeanException - Wrappering exceptions from distributed communications.
RuntimeOperationsException - Wrappering exceptions from distributed communications.
ListenerNotFoundException - The couple (listener,handback) is not registered in the MBean. The exception message contains either "listener", "handback" or the object name depending on which object cannot be found.

sendNotification

public void sendNotification(Notification ntfyObj)
                      throws MBeanException,
                             RuntimeOperationsException
Description copied from interface: ModelMBeanNotificationBroadcaster
Sends a Notification which is passed in to the registered Notification listeners on the ModelMBean as a jmx.modelmbean.general notification.
Tags copied from interface: ModelMBeanNotificationBroadcaster
Parameters:
ntfyObj - The notification which is to be passed to the 'handleNotification' method of the listener object.
Throws:
MBeanException - The initializer of the object has thrown an exception.
RuntimeOperationsException - Wraps an IllegalArgumentException: The Notification object passed in parameter is null or invalid.

sendNotification

public void sendNotification(java.lang.String ntfyText)
                      throws MBeanException,
                             RuntimeOperationsException
Description copied from interface: ModelMBeanNotificationBroadcaster
Sends a Notification which contains the text string that is passed in to the registered Notification listeners on the ModelMBean.
Tags copied from interface: ModelMBeanNotificationBroadcaster
Parameters:
ntfyText - The text which is to be passed in the Notification to the 'handleNotification' method of the listener object. the constructed Notification will be: type "jmx.modelmbean.general" source this ModelMBean instance sequence 1
Throws:
MBeanException - The initializer of the object has thrown an exception.
RuntimeOperationsException - Wraps an IllegalArgumentException: The Notification text string passed in parameter is null or invalid.

sendAttributeChangeNotification

public void sendAttributeChangeNotification(AttributeChangeNotification ntfyObj)
                                     throws MBeanException,
                                            RuntimeOperationsException
Description copied from interface: ModelMBeanNotificationBroadcaster
Sends an attributeChangeNotification which is passed in to the registered attributeChangeNotification listeners on the ModelMBean.
Tags copied from interface: ModelMBeanNotificationBroadcaster
Parameters:
ntfyObj - The notification which is to be passed to the 'handleNotification' method of the listener object.
Throws:
MBeanException - The initializer of the object has thrown an exception.
RuntimeOperationsException - Wraps an IllegalArgumentException: The Notification object passed in parameter is null or invalid.

sendAttributeChangeNotification

public void sendAttributeChangeNotification(Attribute inOldVal,
                                            Attribute inNewVal)
                                     throws MBeanException,
                                            RuntimeOperationsException
Description copied from interface: ModelMBeanNotificationBroadcaster
Sends an attributeChangeNotification which contains the old value and new value for the attribute to the registered AttributeChangeNotification listeners on the ModelMBean.
Tags copied from interface: ModelMBeanNotificationBroadcaster
Parameters:
inOldVal - The origional value for the Attribute
inNewVal - The current value for the Attribute

 				The constructed attributeChangeNotification will be:
 				type        "jmx.attribute.change"
 				source      this ModelMBean instance
 				sequence    1
 				attributeName oldValue.getName()
 				attributeType oldValue's class
 				attributeOldValue oldValue.getValue()
 				attributeNewValue newValue.getValue()
 				

Throws:
MBeanException - to wrapper implementation exceptions
RuntimeOperationsException - to wrapper IllegalArgumentExceptions.