public abstract class AbstractConnectionManager extends java.lang.Object implements ConnectionManager
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConnectionManager(AbstractJMXConnectorServer server,
java.util.Map environment)
Called by subclasses.
|
| Modifier and Type | Method and Description |
|---|---|
protected javax.security.auth.Subject |
authenticate(java.lang.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(java.lang.Object credentials)
Implemented using the template method pattern, it handles authentication, creation of the connection ID,
emission of connection notification of type "opened".
|
protected java.lang.String |
createConnectionID(javax.security.auth.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(java.lang.String connectionId,
javax.security.auth.Subject subject)
Template method to be implemented by subclasses; must return the server-side part of
a connection.
|
protected java.util.Map |
getEnvironment()
Returns the environment passed when creating the JMXConnectorServer
|
protected java.security.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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetProtocolprotected AbstractConnectionManager(AbstractJMXConnectorServer server, java.util.Map environment)
server - The JMXConnectorServer that will emit connection notificationsenvironment - The environment passed when the JMXConnectorServer is created.public Connection connect(java.lang.Object credentials) throws java.io.IOException, java.lang.SecurityException
connect in interface ConnectionManagercredentials - The credentials sent by the client to authenticate a subject.java.io.IOException - If the connection cannot be created.java.lang.SecurityException - If the authentication fails.doConnect(java.lang.String, javax.security.auth.Subject),
authenticate(java.lang.Object),
createConnectionID(javax.security.auth.Subject)protected java.lang.String createConnectionID(javax.security.auth.Subject subject)
subject - The authenticated Subjectprotected abstract Connection doConnect(java.lang.String connectionId, javax.security.auth.Subject subject) throws java.io.IOException
connectionId - The connection ID for connection that is returnedsubject - The authenticated Subjectjava.io.IOException - If the connection cannot be createdpublic void close()
throws java.io.IOException
close in interface ConnectionManagerjava.io.IOExceptiondoClose(),
closeConnection(mx4j.tools.remote.Connection)protected abstract void doClose()
throws java.io.IOException
java.io.IOException - If this ConnectionManager cannot be closedpublic void closeConnection(Connection connection) throws java.io.IOException
closeConnection in interface ConnectionManagerjava.io.IOExceptiondoCloseConnection(mx4j.tools.remote.Connection)protected abstract void doCloseConnection(Connection connection) throws java.io.IOException
java.io.IOExceptionprotected boolean isClosed()
close() method has been called.protected java.util.Map getEnvironment()
protected java.security.AccessControlContext getSecurityContext()
protected javax.security.auth.Subject authenticate(java.lang.Object credentials)
throws java.io.IOException,
java.lang.SecurityException
getEnvironment().java.io.IOExceptionjava.lang.SecurityException