mx4j.tools.remote

Class AbstractConnectionManager

public abstract class AbstractConnectionManager extends Object implements ConnectionManager

Implementation of the ConnectionManager interface that implements emission of connection notifications, authentication, and proper closing of connections.

Version: $Revision: 1.7 $

Constructor Summary
protected AbstractConnectionManager(AbstractJMXConnectorServer server, Map environment)
Called by subclasses.
Method Summary
protected Subjectauthenticate(Object credentials)
Authenticates a Subject with the given credentials, by looking up a JMXAuthenticator in the environment returned by AbstractConnectionManager.
voidclose()
Implemented using the template method pattern
voidcloseConnection(Connection connection)
Implemented using the template method pattern, handles the emission of the connection notification of type "closed".
Connectionconnect(Object credentials)
Implemented using the template method pattern, it handles authentication, creation of the connection ID, emission of connection notification of type "opened".
protected StringcreateConnectionID(Subject subject)
Returns a connection ID as specified by JSR 160.
protected abstract voiddoClose()
Closes this ConnectionManager but not the connections it manages
protected abstract voiddoCloseConnection(Connection connection)
Closes the given Connection.
protected abstract ConnectiondoConnect(String connectionId, Subject subject)
Template method to be implemented by subclasses; must return the server-side part of a connection.
protected MapgetEnvironment()
Returns the environment passed when creating the JMXConnectorServer
protected AccessControlContextgetSecurityContext()
Returns a security context at the moment of creation of this ConnectionManager.
protected booleanisClosed()
Returns whether the AbstractConnectionManager method has been called.

Constructor Detail

AbstractConnectionManager

protected AbstractConnectionManager(AbstractJMXConnectorServer server, Map environment)
Called by subclasses.

Parameters: server The JMXConnectorServer that will emit connection notifications environment The environment passed when the JMXConnectorServer is created.

Method Detail

authenticate

protected Subject authenticate(Object credentials)
Authenticates a Subject with the given credentials, by looking up a JMXAuthenticator in the environment returned by AbstractConnectionManager.

close

public void close()
Implemented using the template method pattern

See Also: AbstractConnectionManager AbstractConnectionManager

closeConnection

public void closeConnection(Connection connection)
Implemented using the template method pattern, handles the emission of the connection notification of type "closed". This method is called both when closing the connector server and when closing a connector.

See Also: AbstractConnectionManager

connect

public Connection connect(Object credentials)
Implemented using the template method pattern, it handles authentication, creation of the connection ID, emission of connection notification of type "opened".

See Also: AbstractConnectionManager AbstractConnectionManager AbstractConnectionManager

createConnectionID

protected String createConnectionID(Subject subject)
Returns a connection ID as specified by JSR 160.

Parameters: subject The authenticated Subject

doClose

protected abstract void doClose()
Closes this ConnectionManager but not the connections it manages

Throws: IOException If this ConnectionManager cannot be closed

doCloseConnection

protected abstract void doCloseConnection(Connection connection)
Closes the given Connection.

doConnect

protected abstract Connection doConnect(String connectionId, Subject subject)
Template method to be implemented by subclasses; must return the server-side part of a connection. When an remote invocation arrives, it will lookup the corrispondent server-side part of the connection and delegate the call to it. The server-side part of the connection must then (eventually) call the MBeanServer to satisfy the request.

Parameters: connectionId The connection ID for connection that is returned subject The authenticated Subject

Returns: The server-side part of a connection (with the given connection ID)

Throws: IOException If the connection cannot be created

getEnvironment

protected Map getEnvironment()
Returns the environment passed when creating the JMXConnectorServer

getSecurityContext

protected AccessControlContext getSecurityContext()
Returns a security context at the moment of creation of this ConnectionManager. This security context is the restricting context that should be used when a call from a remote client is invoked in a doPrivileged() block.

isClosed

protected boolean isClosed()
Returns whether the AbstractConnectionManager method has been called.
Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.