com.jrockit.mc.rjmx
Class ConnectionManager

java.lang.Object
  extended by com.jrockit.mc.rjmx.ConnectionManager
All Implemented Interfaces:
IConnectionManager

public final class ConnectionManager
extends java.lang.Object
implements IConnectionManager

This is the default implementation of the IConnectionManager. This class is used to control the life cycle of the default implementation of IConnectionHandles. It is used to connect IConnectionDescriptors to an end point of communication. The corresponding IConnectionHandle can then be used to access various services.

Author:
Marcus Hirt

Constructor Summary
ConnectionManager()
           
 
Method Summary
 void addConnectionHandleStateListener(IConnectionHandleStateListener listener, IConnectionHandleFilter filter)
          Registers a listener for changes to IConnectionHandles.
 IConnectionHandle connect(IConnectionDescriptor descriptor)
          Connect using the IConnectionDescriptor
 IConnectionHandle disconnect(IConnectionHandle handle)
          Disconnects a IConnectionHandle
 IConnectionHandle[] getConnections()
          Returns all available IConnectionHandle
 IConnectionHandle[] getConnections(IConnectionDescriptor descriptor)
          Returns all connection for a given IConnectionDescriptor
 IPasswordProvider getPasswordProvider()
          The password provider.
 IConnectionHandle innerConnect(IConnectionDescriptor descriptor)
           
 void removeConnectionHandleStateListener(IConnectionHandleStateListener listener)
          Removes the specified listener.
 void setPasswordProvider(IPasswordProvider provider)
          Sets the password provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionManager

public ConnectionManager()
Method Detail

connect

public IConnectionHandle connect(IConnectionDescriptor descriptor)
                          throws ConnectionException
Description copied from interface: IConnectionManager
Connect using the IConnectionDescriptor

Specified by:
connect in interface IConnectionManager
Parameters:
descriptor - the descriptor
Returns:
a connection handle
Throws:
ConnectionException - if a connection could not be established

innerConnect

public IConnectionHandle innerConnect(IConnectionDescriptor descriptor)
                               throws java.lang.Exception
Throws:
java.lang.Exception

disconnect

public IConnectionHandle disconnect(IConnectionHandle handle)
                             throws ConnectionException
Description copied from interface: IConnectionManager
Disconnects a IConnectionHandle

Specified by:
disconnect in interface IConnectionManager
Parameters:
handle - the connection to disconnect
Returns:
a connection handle
Throws:
ConnectionException - if the connection could not be disconnected

getConnections

public IConnectionHandle[] getConnections()
Description copied from interface: IConnectionManager
Returns all available IConnectionHandle

Specified by:
getConnections in interface IConnectionManager
Returns:
an array IConnectionHandles

addConnectionHandleStateListener

public void addConnectionHandleStateListener(IConnectionHandleStateListener listener,
                                             IConnectionHandleFilter filter)
Description copied from interface: IConnectionManager
Registers a listener for changes to IConnectionHandles.

Specified by:
addConnectionHandleStateListener in interface IConnectionManager
Parameters:
listener - the listener to register.
filter - the filter to decide for which IConnectionHandles to to notify the listener. May be null, which means notifications will be triggered by all IConnectionHandles.

removeConnectionHandleStateListener

public void removeConnectionHandleStateListener(IConnectionHandleStateListener listener)
Description copied from interface: IConnectionManager
Removes the specified listener.

Specified by:
removeConnectionHandleStateListener in interface IConnectionManager
Parameters:
listener - the listener to remove.

getConnections

public IConnectionHandle[] getConnections(IConnectionDescriptor descriptor)
Description copied from interface: IConnectionManager
Returns all connection for a given IConnectionDescriptor

Specified by:
getConnections in interface IConnectionManager
Returns:
all connections for the given IConnectionDescriptor

setPasswordProvider

public void setPasswordProvider(IPasswordProvider provider)
Sets the password provider. Used to provide lazy resolution of passwords. The way this is currently done will probably change in the future, but it currently works by having the meta data required in the ConnectionDescriptor. The interface allows for other implementations in the future, for instance a fully separated password repository. Also, this way headless mode can configure its own password provider that gets the master password from another source, for instance system properties.

Parameters:
provider - the password provider to use.

getPasswordProvider

public IPasswordProvider getPasswordProvider()
The password provider.

Returns:
the password provider, or null if there is none.


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.