Package org.opends.server.protocols.net
Class NetConnectionHandler
java.lang.Object
org.opends.server.api.ConnectionHandler<NetConnectionHandlerCfg>
org.opends.server.protocols.net.NetConnectionHandler
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConfigurationChangeListener<NetConnectionHandlerCfg>
,ServerShutdownListener
public final class NetConnectionHandler
extends ConnectionHandler<NetConnectionHandlerCfg>
implements ConfigurationChangeListener<NetConnectionHandlerCfg>, ServerShutdownListener
Network protocol (LDAP/HTTP) connection handler.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor called by config framework for non-administrative connection handlers. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAdditionalMeters
(MeterRegistryHolder registry) Computes additional meters that is specific to the connection handler implementation.protected void
Adds the object class names that should be included in the monitor entry related to this connection handler to the provided attribute.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.protected void
doClose()
Closes this connection handler so that it will no longer accept new client connections.protected void
doInitializeConnectionHandler
(ServerContext serverContext, NetConnectionHandlerCfg config) Initializes this connection handler provider based on the information in the provided connection handler configuration.Returns the set of active client connections that have been established through this connection handler.Returns the DN of the configuration entry with which this alert generator is associated.Retrieves a name that may be used to refer to this connection handler.Returns the type of this connection handler.Indicates the connection security used by this connection handler.Retrieves an unmodifiable set of enabled SSL cipher suites configured for this connection handler, if applicable.Retrieves the set of enabled SSL protocols configured for this connection handler.Returns the set of statistics maintained by this connection handler.Collection
<com.forgerock.opendj.util.HostPort> Retrieves information about the listener(s) that will be used to accept client connections.Retrieves the name of the protocol used to communicate with clients.boolean
Indicates if the connection is on the Administration Connector which may mean it is excluded from certain checks.boolean
isConfigurationAcceptable
(ServerContext serverContext, NetConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons) Indicates whether the provided configuration is acceptable for this connection handler.boolean
isConfigurationChangeAcceptable
(NetConnectionHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons) Indicates whether the proposed change to the configuration is acceptable to this change listener.static NetConnectionHandler
Returns a new administrative connection handler.void
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.Methods inherited from class org.opends.server.api.ConnectionHandler
close, getServerContext, initializeConnectionHandler
-
Constructor Details
-
NetConnectionHandler
public NetConnectionHandler()Default constructor called by config framework for non-administrative connection handlers.
-
-
Method Details
-
newAdministrativeConnectionHandler
Returns a new administrative connection handler.- Returns:
- a new administrative connection handler
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(ServerContext serverContext, NetConnectionHandlerCfg 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<NetConnectionHandlerCfg>
- 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.
-
getConnectionSecurity
Indicates the connection security used by this connection handler.- Returns:
- the connection security.
-
doInitializeConnectionHandler
protected void doInitializeConnectionHandler(ServerContext serverContext, NetConnectionHandlerCfg config) throws InitializationException 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<NetConnectionHandlerCfg>
- Parameters:
serverContext
- The server context.config
- The connection handler configuration that contains the information to use to initialize this connection handler.- Throws:
InitializationException
- If a problem occurs during initialization that is not related to the server configuration.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(NetConnectionHandlerCfg configuration, 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<NetConnectionHandlerCfg>
- Parameters:
configuration
- 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.
-
applyConfigurationChange
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<NetConnectionHandlerCfg>
- Parameters:
config
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
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<NetConnectionHandlerCfg>
- Returns:
- A unique name that may be used to refer to this connection handler.
-
getConnectionHandlerType
Description copied from class:ConnectionHandler
Returns the type of this connection handler. It should be returning the insecure protocol version.- Specified by:
getConnectionHandlerType
in classConnectionHandler<NetConnectionHandlerCfg>
- Returns:
- the type of this connection handler
-
isAdministrative
public boolean isAdministrative()Description copied from class:ConnectionHandler
Indicates if the connection is on the Administration Connector which may mean it is excluded from certain checks.- Overrides:
isAdministrative
in classConnectionHandler<NetConnectionHandlerCfg>
- Returns:
true
if the connection is on the Administration Connector.
-
getEnabledSslCipherSuites
Description copied from class:ConnectionHandler
Retrieves an unmodifiable set of enabled SSL cipher suites configured for this connection handler, if applicable. Implementations must return an empty set if use of SSL/TLS is not possible.- Overrides:
getEnabledSslCipherSuites
in classConnectionHandler<NetConnectionHandlerCfg>
- Returns:
- The set of enabled SSL cipher suites configured for this connection handler.
-
getEnabledSslProtocols
Description copied from class:ConnectionHandler
Retrieves the set of enabled SSL protocols configured for this connection handler. Implementations must return an empty set if use of SSL/TLS is not possible.- Overrides:
getEnabledSslProtocols
in classConnectionHandler<NetConnectionHandlerCfg>
- Returns:
- The set of enabled SSL protocols configured for this connection handler.
-
getComponentEntryDn
Description copied from class:ConnectionHandler
Returns the DN of the configuration entry with which this alert generator is associated.- Specified by:
getComponentEntryDn
in classConnectionHandler<NetConnectionHandlerCfg>
- Returns:
- the DN of the configuration entry with which this alert generator is associated
-
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<NetConnectionHandlerCfg>
- Returns:
- The name of the protocol used to communicate with clients.
-
addAdditionalMeters
Description copied from class:ConnectionHandler
Computes additional meters that is specific to the connection handler implementation. The default implementation is to do nothing.- Overrides:
addAdditionalMeters
in classConnectionHandler<NetConnectionHandlerCfg>
- Parameters:
registry
- where additional meters should be added.
-
addAdditionalMonitorObjectClassNames
Description copied from class:ConnectionHandler
Adds the object class names that should be included in the monitor entry related to this connection handler to the provided attribute.- Overrides:
addAdditionalMonitorObjectClassNames
in classConnectionHandler<NetConnectionHandlerCfg>
- Parameters:
ocAttr
- The object class attribute on which the object class names are added.
-
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<NetConnectionHandlerCfg>
- 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.
-
getClientConnections
Description copied from class:ConnectionHandler
Returns the set of active client connections that have been established through this connection handler.- Specified by:
getClientConnections
in classConnectionHandler<NetConnectionHandlerCfg>
- Returns:
- the set of active client connections that have been established through this connection handler
-
bind
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<NetConnectionHandlerCfg>
- Throws:
IOException
- If theConnectionHandler
cannot be bound.
-
doClose
protected 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<NetConnectionHandlerCfg>
-
processServerShutdown
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.
-
getLdapStatistics
Returns the set of statistics maintained by this connection handler.- Returns:
- the set of statistics maintained by this connection handler
-