com.sun.jdmk.remote.cascading
Class LocalMBeanServerConnectionFactory

java.lang.Object
  extended by com.sun.jdmk.remote.cascading.LocalMBeanServerConnectionFactory
All Implemented Interfaces:
MBeanServerConnectionFactory

public class LocalMBeanServerConnectionFactory
extends Object
implements MBeanServerConnectionFactory

An MBeanServerConnectionFactory that wraps a local MBeanServerConnection, e.g, an MBeanServer. The default implementation of this class is to always return the MBeanServerConnection passed to its constructor. The add/remove connection listener methods are not implemented - they simply do nothing, because the underlying MBeanServerConnection is expected to be a local MBeanServer, or an object that wraps a local MBeanServer.

Since:
Java DMK 5.1

Constructor Summary
LocalMBeanServerConnectionFactory(MBeanServerConnection local, String localID)
          Creates a LocalMBeanServerConnectionFactory from a local MBeanServerConnection.
 
Method Summary
 void addConnectionNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
          This implementation does nothing.
 String getConnectionId()
          Returns the connection ID identifying this local connection, as passed to this object's constructor.
 MBeanServerConnection getMBeanServerConnection()
          Return the local MBeanServerConnection as passed to the constructor of this object.
static MBeanServerConnectionFactory newInstance(MBeanServer s)
          Creates a new instance of a LocalMBeanServerConnectionFactory.
 void removeConnectionNotificationListener(NotificationListener listener)
          This implementation does nothing.
 void removeConnectionNotificationListener(NotificationListener l, NotificationFilter f, Object handback)
          This implementation does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalMBeanServerConnectionFactory

public LocalMBeanServerConnectionFactory(MBeanServerConnection local,
                                         String localID)
Creates a LocalMBeanServerConnectionFactory from a local MBeanServerConnection.

Parameters:
local - A local MBeanServerConnection. This MBeanServerConnection is expected to be an an MBeanServer, or an object that wraps an MBeanServer. The wrapped object should not be a remote MBeanServerConnection returned by a JMXConnector. If you wish to create a MBeanServerConnectionFactory for a remote agent, use the BasicMBeanServerConnectionFactory instead.
localID - An ID identifying this local connection. This is the string that will be returned by {link #getConnectionId()}.
Method Detail

getMBeanServerConnection

public final MBeanServerConnection getMBeanServerConnection()
                                                     throws IOException
Return the local MBeanServerConnection as passed to the constructor of this object. Usually this MBeanServerConnection is an MBeanServer, or an object that wraps an MBeanServer.

Specified by:
getMBeanServerConnection in interface MBeanServerConnectionFactory
Returns:
the local MBeanServerConnection.
Throws:
IOException - if a valid MBeanServerConnection cannot be created.
See Also:
JMXConnector.getMBeanServerConnection()

addConnectionNotificationListener

public void addConnectionNotificationListener(NotificationListener listener,
                                              NotificationFilter filter,
                                              Object handback)

This implementation does nothing. Since local connections never change, they never emit notifications.

Specified by:
addConnectionNotificationListener in interface MBeanServerConnectionFactory
Parameters:
listener - a listener to receive connection status notifications.
filter - a filter to select which notifications are to be delivered to the listener, or null if all notifications are to be delivered.
handback - an object to be given to the listener along with each notification. Can be null.
See Also:
MBeanServerConnectionFactory.removeConnectionNotificationListener(javax.management.NotificationListener), NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)

removeConnectionNotificationListener

public void removeConnectionNotificationListener(NotificationListener listener)
                                          throws ListenerNotFoundException

This implementation does nothing. Since local connections never change, they never emit notifications.

Specified by:
removeConnectionNotificationListener in interface MBeanServerConnectionFactory
Parameters:
listener - a listener to receive connection status notifications.
Throws:
ListenerNotFoundException - if the listener is not registered with this JMXConnector.
See Also:
MBeanServerConnectionFactory.removeConnectionNotificationListener(NotificationListener, NotificationFilter, Object), MBeanServerConnectionFactory.addConnectionNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object), NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)

removeConnectionNotificationListener

public void removeConnectionNotificationListener(NotificationListener l,
                                                 NotificationFilter f,
                                                 Object handback)
                                          throws ListenerNotFoundException

This implementation does nothing. Since local connections never change, they never emit notifications.

Specified by:
removeConnectionNotificationListener in interface MBeanServerConnectionFactory
Parameters:
l - a listener to receive connection status notifications.
f - a filter to select which notifications are to be delivered to the listener. Can be null.
handback - an object to be given to the listener along with each notification. Can be null.
Throws:
ListenerNotFoundException - if the listener is not registered with this JMXConnector, or is not registered with the given filter and handback.
See Also:
MBeanServerConnectionFactory.removeConnectionNotificationListener(NotificationListener), MBeanServerConnectionFactory.addConnectionNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object), NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)

getConnectionId

public final String getConnectionId()
                             throws IOException

Returns the connection ID identifying this local connection, as passed to this object's constructor.

Specified by:
getConnectionId in interface MBeanServerConnectionFactory
Returns:
the unique ID of this local connection.
Throws:
IOException - if the connection ID cannot be obtained, for instance because the connection is closed or broken.

newInstance

public static MBeanServerConnectionFactory newInstance(MBeanServer s)
Creates a new instance of a LocalMBeanServerConnectionFactory. This is equivalent to new LocalMBeanServerConnectionFactory(s,cid).

Parameters:
s - A local MBeanServer for which to obtain a MBeanServerConnectionFactory.
See Also:
getConnectionId()

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.