|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.jdmk.remote.cascading.CascadingService
public class CascadingService
The CascadingServiceMBean is a high level service MBean that makes it possible to remotely configure CascadingAgents. This MBean makes it possible to mount a partial view of a source MBeanServer known by its JMXServiceURL into the target MBeanServer of this CascadingServiceMBean.
The target MBeanServer of a CascadingServiceMBean is
usually the MBeanServer in which that
CascadingServiceMBean is registered.
It is recommended to instantiate at most one
CascadingServiceMBean per target MBeanServer. If no
ObjectName is specified when registering the
CascadingServiceMBean, then
the CascadingServiceMBean will supply its own default name:
CASCADING_SERVICE_DEFAULT_NAME
=new
ObjectName("com.sun.jdmk:type=CascadingService").
If the JMX Connection with a source MBeanServer fails or is permanently
closed, the CascadingServiceMBean will emit a
JMXConnectionNotification
with the following parameters:
"com.sun.jdmk.remote.cascading.failed"
mount
method
If the cascading is unmounted (unmount
was called) then
the CascadingServiceMBean will emit a
JMXConnectionNotification
with the following parameters:
"com.sun.jdmk.remote.cascading.stopped"
mount
methodunmount
Note: In this implementation, the mount
operation does not perform any checks with regards to the coherency
of the supplied targetPath. It is under the responsibility of
the application to conform to the rules documented in The File System Analogy
ProxyCascadingAgent
.
Field Summary |
---|
Fields inherited from interface com.sun.jdmk.remote.cascading.CascadingServiceMBean |
---|
CASCADING_FAILED_NOTIFICATION, CASCADING_SERVICE_DEFAULT_NAME, CASCADING_STOPPED_NOTIFICATION |
Constructor Summary | |
---|---|
CascadingService()
Instantiate a new CascadingService. |
|
CascadingService(MBeanServer targetMBS)
Instantiate a new CascadingService for the specified target MBeanServer. |
Method Summary | |
---|---|
void |
addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
|
String[] |
getMountPointIDs()
Returns an array of current mountPointIDs. |
MBeanNotificationInfo[] |
getNotificationInfo()
|
MBeanServer |
getTargetMBeanServer()
The target MBeanServer in which the source MBeans will be mounted under the target path. |
boolean |
isMounted(String mountPointID)
Tell whether the given ID identifies a currently mounted mountPoint. |
String |
mount(JMXServiceURL sourceURL,
Map sourceMap,
ObjectName sourcePattern,
String targetPath)
Mounts a partial view of the source MBeanServer identified by its JMXServiceURL. |
void |
postDeregister()
|
void |
postRegister(Boolean registrationDone)
|
void |
preDeregister()
|
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)
|
void |
removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
|
boolean |
unmount(String mountPointID)
Undo the mount operation identified by mountPointID. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CascadingService()
public CascadingService(MBeanServer targetMBS)
targetMBS
- The target MBeanServer for this cascading
service.Method Detail |
---|
public final String mount(JMXServiceURL sourceURL, Map sourceMap, ObjectName sourcePattern, String targetPath) throws IOException, InstanceAlreadyExistsException
CascadingServiceMBean
JMXConnector
by calling
JMXConnectorFactory.connect(sourceURL,sourceMap).
Then it mounts the source MBeanServer thus connected under the
provided targetPath into the target MBeanServer
of this CascadingServiceMBean.
Note that only the source MBeans whose source ObjectName
satisfy the provided sourcePattern will be mounted.
Finally, it returns a mountPointID string identifying
this mount operation. The calling application is expected to later
call unmount
with this mountPointID
as parameter.
mount
in interface CascadingServiceMBean
sourceURL
- A JMXServiceURL from which a
JMXConnector to the source MBeanServer can
be obtained.
sourceMap
- A Map object that will be passed to the
JMXConnectorFactory.connect(JMXServiceURL,Map)
method, in order to connect to the source MBeanServer.
This parameter can be null.
sourcePattern
- An ObjectName pattern that must be
satisfied by the ObjectNames of the source MBeans.
The sourcePattern is evaluated in the context of the source MBeanServer. The source pattern is used to perform a partial mount of the source MBeanServer in the target MBeanServer. Only those MBeans that satisfy the pattern will be mounted. The source pattern is thus a filter element. A null sourcePattern is equivalent to the wildcard "*:*".
targetPath
- The domain path under which the source
MBeans will be mounted in the target MBeanServer.
If this parameter is not null, all source MBean names will be transformed in the target MBeanServer by prefixing their domain name with the string targetPath+"/". An MBean whose name is "D:k1=v1,k2=v2" will thus be mounted as "targetPath/D:k1=v1,k2=v2".
A null targetPath means that MBeans are mounted directly at the root of the hierarchy, that is, as if they were local MBeans. Using a null targetPath is thus highly discouraged, as it could cause name conflicts in the target MBeanServer.
Similarly, MBeans from different sources should not be mounted under the same targetPath. Moreover, an application should not attempt to mount source MBeans under a targetPath that already contain MBeans in the target MBeanServer.
However, this implementation does not enforce these rules:
It is the responsibility of the application that uses the
CascadingService to ensure the consistency of
the mounting strategy - see The File System Analogy
.
Note: A zero-length targetPath is treated as a null targetPath.
CascadingServiceMBean.unmount(java.lang.String)
.
IOException
- if the connector client or the connection to
the source MBeanServer cannot be made, or if the underlying
CascadingAgent cannot be started because of a
communication problem. See JMXConnectorFactory.connect
and CascadingAgentMBean.start
.
InstanceAlreadyExistsException
- if a name conflict is
detected while performing the mount operation.
See CascadingAgentMBean.start
.public final boolean unmount(String mountPointID) throws IOException
CascadingServiceMBean
mount
.
unmount
in interface CascadingServiceMBean
mountPointID
- A mount point ID previously obtained from
mount
.
IOException
- if the connection with the source
MBeanServer cannot be closed cleanly, or if
the underlying CascadingAgent fails to stop.
See JMXConnector.close
and CascadingAgentMBean.stop
.public boolean isMounted(String mountPointID)
CascadingServiceMBean
isMounted
in interface CascadingServiceMBean
public String[] getMountPointIDs()
CascadingServiceMBean
getMountPointIDs
in interface CascadingServiceMBean
public final void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException
addNotificationListener
in interface NotificationBroadcaster
IllegalArgumentException
public final void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
removeNotificationListener
in interface NotificationBroadcaster
ListenerNotFoundException
public final void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException
removeNotificationListener
in interface NotificationEmitter
ListenerNotFoundException
public MBeanNotificationInfo[] getNotificationInfo()
getNotificationInfo
in interface NotificationBroadcaster
public final MBeanServer getTargetMBeanServer()
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
preRegister
in interface MBeanRegistration
server
- The MBean server in which the MBean will be registered.name
- The object name of the MBean. If name
is null then CascadingServiceMBean.CASCADING_SERVICE_DEFAULT_NAME
is returned.
IllegalArgumentException
- if no target MBeanServer
was specified in the constructor and this object is already
registered in an MBeanServer.
Exception
MBeanRegistration.preRegister(javax.management.MBeanServer, javax.management.ObjectName)
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
public void preDeregister() throws Exception
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
postDeregister
in interface MBeanRegistration
|
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 |