mx4j.tools.remote
Class AbstractConnectionManager
java.lang.Object
mx4j.tools.remote.AbstractConnectionManager
- ConnectionManager
public abstract class AbstractConnectionManager
extends java.lang.Object
Implementation of the ConnectionManager interface that implements emission of connection notifications,
authentication, and proper closing of connections.
protected Subject | authenticate(Object credentials) - Authenticates a Subject with the given credentials, by looking up a JMXAuthenticator
in the environment returned by
getEnvironment() .
|
void | close() - Implemented using the template method pattern
|
void | closeConnection(Connection connection) - Implemented using the template method pattern, handles the emission of the connection notification
of type "closed".
|
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".
|
protected String | createConnectionID(Subject subject) - Returns a connection ID as specified by JSR 160.
|
protected abstract void | doClose() - Closes this ConnectionManager but not the connections it manages
|
protected abstract void | doCloseConnection(Connection connection) - Closes the given Connection.
|
protected abstract Connection | doConnect(String connectionId, Subject subject) - Template method to be implemented by subclasses; must return the server-side part of
a connection.
|
protected Map | getEnvironment() - Returns the environment passed when creating the JMXConnectorServer
|
protected AccessControlContext | getSecurityContext() - Returns a security context at the moment of creation of this ConnectionManager.
|
protected boolean | isClosed() - Returns whether the
close() method has been called.
|
AbstractConnectionManager
protected AbstractConnectionManager(AbstractJMXConnectorServer server,
Map environment)
Called by subclasses.
server
- The JMXConnectorServer that will emit connection notificationsenvironment
- The environment passed when the JMXConnectorServer is created.
authenticate
protected Subject authenticate(Object credentials)
throws IOException,
SecurityException
Authenticates a Subject with the given credentials, by looking up a JMXAuthenticator
in the environment returned by
getEnvironment()
.
close
public void close()
throws IOException
Implemented using the template method pattern
- close in interface ConnectionManager
closeConnection
public void closeConnection(Connection connection)
throws IOException
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.
- closeConnection in interface ConnectionManager
connect
public Connection connect(Object credentials)
throws IOException,
SecurityException
Implemented using the template method pattern, it handles authentication, creation of the connection ID,
emission of connection notification of type "opened".
- connect in interface ConnectionManager
createConnectionID
protected String createConnectionID(Subject subject)
Returns a connection ID as specified by JSR 160.
subject
- The authenticated Subject
doClose
protected abstract void doClose()
throws IOException
Closes this ConnectionManager but not the connections it manages
doCloseConnection
protected abstract void doCloseConnection(Connection connection)
throws IOException
Closes the given Connection.
doConnect
protected abstract Connection doConnect(String connectionId,
Subject subject)
throws IOException
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.
connectionId
- The connection ID for connection that is returnedsubject
- The authenticated Subject
- The server-side part of a connection (with the given connection ID)
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
close()
method has been called.
Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.