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 ConfigChangeResultapplyConfigurationChange(JmxConnectionHandlerCfg config)Applies the configuration changes to this change listener.voidbind()Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.voiddoClose()Closes this connection handler so that it will no longer accept new client connections.voiddoInitializeConnectionHandler(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.DngetComponentEntryDN()Retrieves the DN of the configuration entry with which this alert generator is associated.StringgetConnectionHandlerName()Retrieves a name that may be used to refer to this connection handler.StringgetConnectionHandlerType()Returns the type of this connection handler.DngetKeyManagerProviderDN()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.HostgetListenAddress()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.intgetListenPort()Get the JMX connection handler's listen port.StringgetProtocol()Retrieves the name of the protocol used to communicate with clients.RmiConnectorgetRMIConnector()Get the JMX connection handler's RMI connector.intgetRmiPort()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.booleanisConfigurationAcceptable(ServerContext serverContext, JmxConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons)Indicates whether the provided configuration is acceptable for this connection handler.booleanisConfigurationChangeAcceptable(JmxConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.booleanisUseSSL()Determines whether clients are allowed to connect over JMX using SSL.voidprocessServerShutdown(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.voidregisterClientConnection(ClientConnection connection)Registers a client connection with this JMX connection handler.voidrun()voidtoString(StringBuilder buffer)Appends a string representation of this connection handler to the provided buffer.voidunregisterClientConnection(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, toString
-
-
-
-
Method Detail
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(JmxConnectionHandlerCfg config)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein 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 IOExceptionDescription copied from class:ConnectionHandlerOperates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.- Specified by:
bindin classConnectionHandler<JmxConnectionHandlerCfg>- Throws:
IOException- If theConnectionHandlercannot be bound.
-
doClose
public void doClose()
Description copied from class:ConnectionHandlerCloses 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:
doClosein classConnectionHandler<JmxConnectionHandlerCfg>
-
getClientConnections
public Collection<ClientConnection> getClientConnections()
Retrieves the set of active client connections that have been established through this connection handler.- Specified by:
getClientConnectionsin 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:
getComponentEntryDNin classConnectionHandler<JmxConnectionHandlerCfg>- Returns:
- The DN of the configuration entry with which this alert generator is associated.
-
getConnectionHandlerName
public String getConnectionHandlerName()
Description copied from class:ConnectionHandlerRetrieves 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:
getConnectionHandlerNamein classConnectionHandler<JmxConnectionHandlerCfg>- Returns:
- A unique name that may be used to refer to this connection handler.
-
getConnectionHandlerType
public String getConnectionHandlerType()
Description copied from class:ConnectionHandlerReturns the type of this connection handler. By default this returnsConnectionHandler.getProtocol(). It should be returning the insecure protocol version.- Overrides:
getConnectionHandlerTypein 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
nullif 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:ConnectionHandlerInitializes this connection handler provider based on the information in the provided connection handler configuration.- Specified by:
doInitializeConnectionHandlerin 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:ConnectionHandlerRetrieves 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:
getProtocolin 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:ConnectionHandlerRetrieves information about the listener(s) that will be used to accept client connections.- Specified by:
getListenersin 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:ConnectionHandlerIndicates 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:
isConfigurationAcceptablein 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:
trueif the provided configuration is acceptable for this connection handler, orfalseif not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(JmxConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein 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
trueif the proposed change is acceptable, orfalseif it is not.
-
isUseSSL
public boolean isUseSSL()
Determines whether clients are allowed to connect over JMX using SSL.- Returns:
- Returns
trueif clients are allowed to connect over JMX using SSL.
-
processServerShutdown
public void processServerShutdown(LocalizableMessage reason)
Description copied from interface:ServerShutdownListenerIndicates 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:
processServerShutdownin 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:ConnectionHandlerAppends a string representation of this connection handler to the provided buffer.- Specified by:
toStringin classConnectionHandler<JmxConnectionHandlerCfg>- Parameters:
buffer- The buffer to which the information should be appended.
-
-