Package org.opends.server.protocols.jmx
Class JmxConnectionHandler
- java.lang.Object
-
- java.lang.Thread
-
- org.opends.server.api.DirectoryThread
-
- org.opends.server.api.ConnectionHandler<JMXConnectionHandlerCfg>
-
- org.opends.server.protocols.jmx.JmxConnectionHandler
-
- All Implemented Interfaces:
Runnable,ConfigurationChangeListener<JMXConnectionHandlerCfg>,ServerShutdownListener
public final class JmxConnectionHandler extends ConnectionHandler<JMXConnectionHandlerCfg> implements 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opends.server.api.DirectoryThread
DirectoryThread.Factory
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description static StringTRUST_MANAGER_ARRAY_KEYKey that may be placed into a JMX connection environment map to provide a customjavax.net.ssl.TrustManagerarray for a connection.-
Fields inherited from class org.opends.server.api.ConnectionHandler
LISTEN_TIMEOUT_MS
-
Fields inherited from class org.opends.server.api.DirectoryThread
DIRECTORY_THREAD_GROUP
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description JmxConnectionHandler()Creates a new instance of this JMX connection handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResultapplyConfigurationChange(JMXConnectionHandlerCfg config)Applies the configuration changes to this change listener.voidfinalizeConnectionHandler(org.forgerock.i18n.LocalizableMessage finalizeReason)Closes this connection handler so that it will no longer accept new client connections.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.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.InetAddressgetListenAddress()Get the JMX connection handler's listen address: the one it was initialized with, until it restarts.Collection<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.StringgetShutdownListenerName()Retrieves the human-readable name for this shutdown listener.SortedSet<String>getSSLServerCertNicknames()Retrieves the nicknames of the server certificates that should be used in conjunction with this JMX connection handler.voidinitializeConnectionHandler(ServerContext serverContext, JMXConnectionHandlerCfg config)Initializes this connection handler provider based on the information in the provided connection handler configuration.booleanisConfigurationAcceptable(ConnectionHandlerCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the provided configuration is acceptable for this connection handler.booleanisConfigurationChangeAcceptable(JMXConnectionHandlerCfg config, List<org.forgerock.i18n.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(org.forgerock.i18n.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()Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.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
getConnectionHandlerMonitor, getEnabledSSLCipherSuites, getEnabledSSLProtocols, getNumRequestHandlers, isAdminConnectionHandler, setAdminConnectionHandler, setConnectionHandlerMonitor, toString
-
Methods inherited from class org.opends.server.api.DirectoryThread
getAssociatedTask, getCreationStackTrace, getDebugProperties, getParentThread, initiateShutdown, isShutdownInitiated, setAssociatedTask, startWork, stopWork
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
-
-
-
Field Detail
-
TRUST_MANAGER_ARRAY_KEY
public static final String TRUST_MANAGER_ARRAY_KEY
Key that may be placed into a JMX connection environment map to provide a customjavax.net.ssl.TrustManagerarray for a connection.- See Also:
- Constant Field Values
-
-
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.
-
finalizeConnectionHandler
public void finalizeConnectionHandler(org.forgerock.i18n.LocalizableMessage finalizeReason)
Description copied from class:ConnectionHandlerCloses this connection handler so that it will no longer accept new client connections. Implementations should disconnect any existing connections.- Specified by:
finalizeConnectionHandlerin classConnectionHandler<JMXConnectionHandlerCfg>- Parameters:
finalizeReason- The reason that this connection handler should be finalized.
-
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.
-
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 InetAddress getListenAddress()
Get the JMX connection handler's listen address: the one it was initialized with, until it restarts.- 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.
-
getShutdownListenerName
public String getShutdownListenerName()
Description copied from interface:ServerShutdownListenerRetrieves the human-readable name for this shutdown listener.- Specified by:
getShutdownListenerNamein interfaceServerShutdownListener- Returns:
- The human-readable name for this shutdown listener.
-
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.
-
initializeConnectionHandler
public void initializeConnectionHandler(ServerContext serverContext, JMXConnectionHandlerCfg config) throws ConfigException, InitializationException
Description copied from class:ConnectionHandlerInitializes this connection handler provider based on the information in the provided connection handler configuration.- Specified by:
initializeConnectionHandlerin classConnectionHandler<JMXConnectionHandlerCfg>- Parameters:
serverContext- The server context.config- The connection handler configuration that contains the information to use to initialize this connection handler.- Throws:
ConfigException- If an unrecoverable problem arises in the process of performing the initialization as a result of the server configuration.InitializationException- If a problem occurs during initialization that is not related to the server configuration.
-
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.
-
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<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(ConnectionHandlerCfg configuration, List<org.forgerock.i18n.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.
Note that implementations which use a subclass of the provided configuration class will likely need to cast the configuration to the appropriate subclass type.- Overrides:
isConfigurationAcceptablein classConnectionHandler<JMXConnectionHandlerCfg>- Parameters:
configuration- 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<org.forgerock.i18n.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(org.forgerock.i18n.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.
-
run
public void run()
Description copied from class:ConnectionHandlerOperates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.- Specified by:
runin interfaceRunnable- Specified by:
runin classConnectionHandler<JMXConnectionHandlerCfg>
-
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.
-
-