|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.jdmk.remote.cascading.proxy.CascadingProxy
public class CascadingProxy
This class is used to proxy an MBean residing in a source
MBeanServer. Connections to that source MBeanServer
are obtained through an MBeanServerConnectionFactory
.
The CascadingProxy is a DynamicMBean
that forwards all
the calls it receive to a source MBean, residing in a source
MBeanServer. The CascadingProxy also makes it possible
for Notification Listeners
to register
for notifications emitted by the source MBeans.
Constructor Summary | |
---|---|
CascadingProxy(ObjectName sourceMBeanName,
MBeanServerConnectionFactory mbscf)
Creates a new CascadingProxy. |
Method Summary | |
---|---|
void |
addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
Adds a listener to the source MBean. |
Object |
getAttribute(String attribute)
Obtain the value of a specific attribute from the source MBean. |
AttributeList |
getAttributes(String[] attributes)
Get the values of several attributes from the source MBean. |
MBeanServerConnectionFactory |
getConnectionFactory()
Returns the MBeanServerConnectionFactory, as passed to this object's constructor. |
MBeanInfo |
getMBeanInfo()
Returns the MBeanInfo of the source MBean. |
MBeanNotificationInfo[] |
getNotificationInfo()
Returns an array indicating, for each notification this MBean may send, the name of the Java class of the notification and the notification type. |
ObjectName |
getSourceMBeanName()
The ObjectName of the source MBean, as passed to this Object's constructor. |
ObjectName |
getTargetName()
The ObjectName of this cascading proxy. |
Object |
invoke(String actionName,
Object[] params,
String[] signature)
Allows an action to be invoked on the source MBean. |
void |
postDeregister()
Allows the MBean to perform any operations needed after having been unregistered in the MBean server. |
void |
postRegister(Boolean registrationDone)
Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed. |
void |
preDeregister()
Allows the MBean to perform any operations it needs before being unregistered by the MBean server. |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Allows the MBean to perform any operations it needs before being registered in the MBean server. |
void |
removeNotificationListener(NotificationListener listener)
Removes a listener from the source MBean. |
void |
removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
Removes a listener from the source MBean. |
void |
setAttribute(Attribute attribute)
Set the value of a specific attribute on the source MBean. |
AttributeList |
setAttributes(AttributeList attributes)
Sets the values of several attributes in the source MBean. |
protected Notification |
translate(Notification notif)
Translate the source ObjectName into this CascadingProxy's ObjectName. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CascadingProxy(ObjectName sourceMBeanName, MBeanServerConnectionFactory mbscf)
sourceMBeanName
- The ObjectName of the source MBean.mbscf
- An MBeanServerConnectionFactory from which
connections with the MBeanServer containing the
source MBean can be obtained.
The CascadingProxy will call mbscf.getMBeanServerConnection()
every time it needs to access
the subagent.Method Detail |
---|
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
getAttribute
in interface DynamicMBean
attribute
- The name of the attribute to be retrieved
AttributeNotFoundException
MBeanException
- Wraps a java.lang.Exception thrown by the MBean's getter.
ReflectionException
- Wraps a java.lang.Exception
thrown while trying to invoke the getter.
UndeclaredThrowableException
- if an
InstanceNotFoundException or an IOException
is raised while trying to forward the request to the source
MBean.setAttribute(javax.management.Attribute)
,
DynamicMBean.getAttribute(java.lang.String)
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
setAttribute
in interface DynamicMBean
attribute
- The identification of the attribute to
be set and the value it is to be set to.
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
- Wraps a java.lang.Exception thrown
by the MBean's setter.
ReflectionException
- Wraps a java.lang.Exception
thrown while trying to invoke the MBean's setter.
UndeclaredThrowableException
- if an
InstanceNotFoundException or an IOException
is raised while trying to forward the request to the source
MBean.getAttribute(java.lang.String)
,
DynamicMBean.setAttribute(javax.management.Attribute)
public AttributeList getAttributes(String[] attributes)
getAttributes
in interface DynamicMBean
attributes
- A list of the attributes to be retrieved.
UndeclaredThrowableException
- if an
InstanceNotFoundException, an IOException,
or a ReflectionException
is raised while trying to forward the request to the source
MBean.setAttributes(javax.management.AttributeList)
,
DynamicMBean.getAttributes(java.lang.String[])
public AttributeList setAttributes(AttributeList attributes)
setAttributes
in interface DynamicMBean
attributes
- A list of attributes: The identification of the
attributes to be set and the values they are to be set to.
UndeclaredThrowableException
- if an
InstanceNotFoundException, an IOException,
or a ReflectionException
is raised while trying to forward the request to the source
MBean.getAttributes(java.lang.String[])
,
DynamicMBean.setAttributes(javax.management.AttributeList)
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException
invoke
in interface DynamicMBean
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.
MBeanException
- Wraps a java.lang.Exception
thrown by the MBean's invoked method.
ReflectionException
- Wraps a java.lang.Exception
thrown while trying to invoke the method
UndeclaredThrowableException
- if an
InstanceNotFoundException or an IOException
is raised while trying to forward the request to the source
MBean.DynamicMBean.invoke(java.lang.String, java.lang.Object[], java.lang.String[])
public MBeanInfo getMBeanInfo()
Subclasses may therefore wish to redefine this method in order to cache the returned MBeanInfo.
getMBeanInfo
in interface DynamicMBean
UndeclaredThrowableException
- if an
InstanceNotFoundException, an IOException,
a ReflectionException, or an
IntrospectionException
is raised while trying to forward the request to the source
MBean.public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
getTargetName()
.
preRegister
in interface MBeanRegistration
server
- The MBean server in which the MBean will be registered.name
- The object name of the MBean. If name
this method throws an IllegalArgumentException.
IllegalArgumentException
- if the parameter name
is null
Exception
MBeanRegistration.preRegister(javax.management.MBeanServer, javax.management.ObjectName)
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
registrationDone
- Indicates whether or not the MBean has
been successfully registered in the MBean server. The value
false means that the registration phase has failed.MBeanRegistration.postRegister(java.lang.Boolean)
public void preDeregister() throws Exception
preDeregister
in interface MBeanRegistration
Exception
- This exception will be caught by
the MBean server and re-thrown as an MBeanRegistrationException
or a RuntimeMBeanException
.MBeanRegistration.preDeregister()
public void postDeregister()
postDeregister
in interface MBeanRegistration
public final ObjectName getSourceMBeanName()
public ObjectName getTargetName()
preRegister(javax.management.MBeanServer, javax.management.ObjectName)
method.
public MBeanNotificationInfo[] getNotificationInfo()
Returns an array indicating, for each notification this MBean may send, the name of the Java class of the notification and the notification type.
This method returns the notification information present in the source MBean's MBeanInfo - if any. Otherwise, it returns an empty array.
It is not illegal for the MBean to send notifications not described in this array. However, some clients of the MBean server may depend on the array being complete for their correct functioning.
getNotificationInfo
in interface NotificationBroadcaster
NotificationBroadcaster.getNotificationInfo()
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
addNotificationListener
in interface NotificationBroadcaster
listener
- The listener object which will handle the
notifications emitted by the broadcaster.filter
- The filter object. If filter is null, no
filtering will be performed before handling notifications.handback
- An opaque object to be sent back to the
listener when a notification is emitted. This object cannot be
used by the Notification broadcaster object. It should be
resent unchanged with the notification to the listener.
IllegalArgumentException
- Listener parameter is null.
UndeclaredThrowableException
- if an
InstanceNotFoundException or an IOException
is raised while trying to forward the request to the source
MBean.removeNotificationListener(javax.management.NotificationListener)
,
NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
removeNotificationListener
in interface NotificationBroadcaster
listener
- A listener that was previously added to this
MBean.
ListenerNotFoundException
- The listener is not
registered with the MBean.
UndeclaredThrowableException
- if an
InstanceNotFoundException or an IOException
is raised while trying to forward the request to the source
MBean.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
,
NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException
Removes a listener from the source MBean. The MBean must have a
listener that exactly matches the given listener
,
filter
, and handback
parameters. If
there is more than one such listener, only one is removed.
The filter
and handback
parameters
may be null if and only if they are null in a listener to be
removed.
removeNotificationListener
in interface NotificationEmitter
listener
- A listener that was previously added to this
MBean.filter
- The filter that was specified when the listener
was added.handback
- The handback that was specified when the listener was
added.
ListenerNotFoundException
- The listener is not
registered with the MBean, or it is not registered with the
given filter and handback.
UndeclaredThrowableException
- if an
InstanceNotFoundException or an IOException
is raised while trying to forward the request to the source
MBean.NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public final MBeanServerConnectionFactory getConnectionFactory()
protected Notification translate(Notification notif)
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |