Package org.opends.server.protocols.jmx
Class JmxConnectionHandler
- java.lang.Object
-
- org.opends.server.api.ConnectionHandler<JmxConnectionHandlerCfg>
-
- org.opends.server.protocols.jmx.JmxConnectionHandler
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Runnable
,ConfigurationChangeListener<JmxConnectionHandlerCfg>
,ServerShutdownListener
public final class JmxConnectionHandler extends ConnectionHandler<JmxConnectionHandlerCfg> implements Runnable, ServerShutdownListener, ConfigurationChangeListener<JmxConnectionHandlerCfg>
This class defines a connection handler that will be used for communicating with administrative clients over JMX. The connection handler is responsible for accepting new connections, reading requests from the clients and parsing them as operations. A single request handler should be used.
-
-
Constructor Summary
Constructors Constructor Description JmxConnectionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResult
applyConfigurationChange(JmxConnectionHandlerCfg config)
Applies the configuration changes to this change listener.void
bind()
Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.void
doClose()
Closes this connection handler so that it will no longer accept new client connections.void
doInitializeConnectionHandler(ServerContext serverContext, JmxConnectionHandlerCfg config)
Initializes this connection handler provider based on the information in the provided connection handler configuration.Collection<ClientConnection>
getClientConnections()
Retrieves the set of active client connections that have been established through this connection handler.Dn
getComponentEntryDN()
Retrieves the DN of the configuration entry with which this alert generator is associated.String
getConnectionHandlerName()
Retrieves a name that may be used to refer to this connection handler.String
getConnectionHandlerType()
Returns the type of this connection handler.Dn
getKeyManagerProviderDN()
Retrieves the DN of the key manager provider that should be used for operations associated with this connection handler which need access to a key manager.com.forgerock.opendj.util.Host
getListenAddress()
Get the JMX connection handler's listen address.Collection<com.forgerock.opendj.util.HostPort>
getListeners()
Retrieves information about the listener(s) that will be used to accept client connections.int
getListenPort()
Get the JMX connection handler's listen port.String
getProtocol()
Retrieves the name of the protocol used to communicate with clients.RmiConnector
getRMIConnector()
Get the JMX connection handler's RMI connector.int
getRmiPort()
Get the JMX connection handler's rmi port.SortedSet<String>
getSSLServerCertNicknames()
Retrieves the nicknames of the server certificates that should be used in conjunction with this JMX connection handler.boolean
isConfigurationAcceptable(ServerContext serverContext, JmxConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this connection handler.boolean
isConfigurationChangeAcceptable(JmxConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.boolean
isUseSSL()
Determines whether clients are allowed to connect over JMX using SSL.void
processServerShutdown(LocalizableMessage reason)
Indicates that the Directory Server has received a request to stop running and that this shutdown listener should take any action necessary to prepare for it.void
registerClientConnection(ClientConnection connection)
Registers a client connection with this JMX connection handler.void
run()
void
toString(StringBuilder buffer)
Appends a string representation of this connection handler to the provided buffer.void
unregisterClientConnection(ClientConnection connection)
Unregisters a client connection from this JMX connection handler.-
Methods inherited from class org.opends.server.api.ConnectionHandler
addAdditionalMeters, addAdditionalMonitorObjectClassNames, close, getEnabledSSLCipherSuites, getEnabledSSLProtocols, getNumRequestHandlers, getServerContext, initializeConnectionHandler, isAdministrative, toString
-
-
-
-
Method Detail
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(JmxConnectionHandlerCfg config)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<JmxConnectionHandlerCfg>
- Parameters:
config
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
bind
public void bind() throws IOException
Description copied from class:ConnectionHandler
Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.- Specified by:
bind
in classConnectionHandler<JmxConnectionHandlerCfg>
- Throws:
IOException
- If theConnectionHandler
cannot be bound.
-
doClose
public void doClose()
Description copied from class:ConnectionHandler
Closes this connection handler so that it will no longer accept new client connections. Implementations should disconnect any existing connections and release any other resources associated with the connection handler.- Overrides:
doClose
in classConnectionHandler<JmxConnectionHandlerCfg>
-
getClientConnections
public Collection<ClientConnection> getClientConnections()
Retrieves the set of active client connections that have been established through this connection handler.- Specified by:
getClientConnections
in classConnectionHandler<JmxConnectionHandlerCfg>
- Returns:
- The set of active client connections that have been established through this connection handler.
-
getComponentEntryDN
public Dn getComponentEntryDN()
Retrieves the DN of the configuration entry with which this alert generator is associated.- Specified by:
getComponentEntryDN
in classConnectionHandler<JmxConnectionHandlerCfg>
- Returns:
- The DN of the configuration entry with which this alert generator is associated.
-
getConnectionHandlerName
public String getConnectionHandlerName()
Description copied from class:ConnectionHandler
Retrieves a name that may be used to refer to this connection handler. Every connection handler instance (even handlers of the same type) must have a unique name.- Specified by:
getConnectionHandlerName
in classConnectionHandler<JmxConnectionHandlerCfg>
- Returns:
- A unique name that may be used to refer to this connection handler.
-
getConnectionHandlerType
public String getConnectionHandlerType()
Description copied from class:ConnectionHandler
Returns the type of this connection handler. By default this returnsConnectionHandler.getProtocol()
. It should be returning the insecure protocol version.- Overrides:
getConnectionHandlerType
in classConnectionHandler<JmxConnectionHandlerCfg>
- Returns:
- The type of this connection handler.
-
getKeyManagerProviderDN
public Dn getKeyManagerProviderDN()
Retrieves the DN of the key manager provider that should be used for operations associated with this connection handler which need access to a key manager.- Returns:
- The DN of the key manager provider that should be used for operations associated with this connection
handler which need access to a key manager, or
null
if no key manager provider has been configured for this connection handler.
-
getListenAddress
public com.forgerock.opendj.util.Host getListenAddress()
Get the JMX connection handler's listen address.- Returns:
- Returns the JMX connection handler's listen address.
-
getListenPort
public int getListenPort()
Get the JMX connection handler's listen port.- Returns:
- Returns the JMX connection handler's listen port.
-
getRmiPort
public int getRmiPort()
Get the JMX connection handler's rmi port.- Returns:
- Returns the JMX connection handler's rmi port.
-
getRMIConnector
public RmiConnector getRMIConnector()
Get the JMX connection handler's RMI connector.- Returns:
- Returns the JMX connection handler's RMI connector.
-
getSSLServerCertNicknames
public SortedSet<String> getSSLServerCertNicknames()
Retrieves the nicknames of the server certificates that should be used in conjunction with this JMX connection handler.- Returns:
- The nicknames of the server certificates that should be used in conjunction with this JMX connection handler.
-
doInitializeConnectionHandler
public void doInitializeConnectionHandler(ServerContext serverContext, JmxConnectionHandlerCfg config)
Description copied from class:ConnectionHandler
Initializes this connection handler provider based on the information in the provided connection handler configuration.- Specified by:
doInitializeConnectionHandler
in classConnectionHandler<JmxConnectionHandlerCfg>
- Parameters:
serverContext
- The server context.config
- The connection handler configuration that contains the information to use to initialize this connection handler.
-
getProtocol
public String getProtocol()
Description copied from class:ConnectionHandler
Retrieves the name of the protocol used to communicate with clients. It should take into account any special naming that may be needed to express any security mechanisms or other constraints in place (e.g., "LDAPS" for LDAP over SSL).- Specified by:
getProtocol
in classConnectionHandler<JmxConnectionHandlerCfg>
- Returns:
- The name of the protocol used to communicate with clients.
-
getListeners
public Collection<com.forgerock.opendj.util.HostPort> getListeners()
Description copied from class:ConnectionHandler
Retrieves information about the listener(s) that will be used to accept client connections.- Specified by:
getListeners
in classConnectionHandler<JmxConnectionHandlerCfg>
- Returns:
- Information about the listener(s) that will be used to accept client connections, or an empty list if this connection handler does not accept connections from network clients.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(ServerContext serverContext, JmxConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons)
Description copied from class:ConnectionHandler
Indicates whether the provided configuration is acceptable for this connection handler. It should be possible to call this method on an uninitialized connection handler instance in order to determine whether the connection handler would be able to use the provided configuration.- Overrides:
isConfigurationAcceptable
in classConnectionHandler<JmxConnectionHandlerCfg>
- Parameters:
serverContext
- The server contextconfig
- The connection handler configuration for which to make the determination.unacceptableReasons
- A list that may be used to hold the reasons that the provided configuration is not acceptable.- Returns:
true
if the provided configuration is acceptable for this connection handler, orfalse
if not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(JmxConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in interfaceConfigurationChangeListener<JmxConnectionHandlerCfg>
- Parameters:
config
- The new configuration containing the changes.unacceptableReasons
- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
true
if the proposed change is acceptable, orfalse
if it is not.
-
isUseSSL
public boolean isUseSSL()
Determines whether clients are allowed to connect over JMX using SSL.- Returns:
- Returns
true
if clients are allowed to connect over JMX using SSL.
-
processServerShutdown
public void processServerShutdown(LocalizableMessage reason)
Description copied from interface:ServerShutdownListener
Indicates that the Directory Server has received a request to stop running and that this shutdown listener should take any action necessary to prepare for it.- Specified by:
processServerShutdown
in interfaceServerShutdownListener
- Parameters:
reason
- The human-readable reason for the shutdown.
-
registerClientConnection
public void registerClientConnection(ClientConnection connection)
Registers a client connection with this JMX connection handler.- Parameters:
connection
- The client connection.
-
unregisterClientConnection
public void unregisterClientConnection(ClientConnection connection)
Unregisters a client connection from this JMX connection handler.- Parameters:
connection
- The client connection.
-
toString
public void toString(StringBuilder buffer)
Description copied from class:ConnectionHandler
Appends a string representation of this connection handler to the provided buffer.- Specified by:
toString
in classConnectionHandler<JmxConnectionHandlerCfg>
- Parameters:
buffer
- The buffer to which the information should be appended.
-
-