Class ConnectionHandler<T extends ConnectionHandlerCfg>
java.lang.Object
org.opends.server.api.ConnectionHandler<T>
- Type Parameters:
T- The type of connection handler configuration handled by this connection handler implementation.
- All Implemented Interfaces:
Closeable, AutoCloseable
- Direct Known Subclasses:
HttpConnectionHandler, LdapConnectionHandler, LdifConnectionHandler, NetConnectionHandler
public abstract class ConnectionHandler<T extends ConnectionHandlerCfg>
extends Object
implements Closeable
This class defines the set of methods and structures that must be implemented by a Directory Server connection
handler.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAdditionalMeters(MeterRegistryHolder registry) Computes additional meters that is specific to the connection handler implementation.protected voidAdds the object class names that should be included in the monitor entry related to this connection handler to the provided attribute.abstract voidbind()Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.final voidclose()Closes this connection handler so that it will no longer accept new client connections, disconnecting any existing connections, and releasing any other resources associated with the connection handler.protected voiddoClose()Closes this connection handler so that it will no longer accept new client connections.protected abstract voiddoInitializeConnectionHandler(ServerContext serverContext, T configuration) Initializes this connection handler provider based on the information in the provided connection handler configuration.abstract Collection<ClientConnection> Returns the set of active client connections that have been established through this connection handler.abstract DnReturns the DN of the configuration entry with which this alert generator is associated.abstract StringRetrieves a name that may be used to refer to this connection handler.abstract StringReturns the type of 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.abstract Collection<com.forgerock.opendj.util.HostPort> Retrieves information about the listener(s) that will be used to accept client connections.abstract StringRetrieves the name of the protocol used to communicate with clients.protected ServerContextReturns the server context.final voidinitializeConnectionHandler(ServerContext serverContext, T configuration) Initializes this connection handler provider based on the information in the provided connection handler configuration.booleanIndicates if the connection is on the Administration Connector which may mean it is excluded from certain checks.booleanisConfigurationAcceptable(ServerContext serverContext, T configuration, List<LocalizableMessage> unacceptableReasons) Indicates whether the provided configuration is acceptable for this connection handler.
-
Constructor Details
-
ConnectionHandler
public ConnectionHandler()
-
-
Method Details
-
getConnectionHandlerName
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.- Returns:
- A unique name that may be used to refer to this connection handler.
-
getConnectionHandlerType
Returns the type of this connection handler. It should be returning the insecure protocol version.- Returns:
- the type of this connection handler
-
getEnabledSslCipherSuites
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.- Returns:
- The set of enabled SSL cipher suites configured for this connection handler.
-
getEnabledSslProtocols
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.- Returns:
- The set of enabled SSL protocols configured for this connection handler.
-
getComponentEntryDn
Returns the DN of the configuration entry with which this alert generator is associated.- Returns:
- the DN of the configuration entry with which this alert generator is associated
-
getProtocol
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).- Returns:
- The name of the protocol used to communicate with clients.
-
getListeners
Retrieves information about the listener(s) that will be used to accept client connections.- 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
Returns the set of active client connections that have been established through this connection handler.- Returns:
- the set of active client connections that have been established through this connection handler
-
getServerContext
-
initializeConnectionHandler
public final void initializeConnectionHandler(ServerContext serverContext, T configuration) throws InitializationException Initializes this connection handler provider based on the information in the provided connection handler configuration.- Parameters:
serverContext- The server context.configuration- 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.
-
doInitializeConnectionHandler
protected abstract void doInitializeConnectionHandler(ServerContext serverContext, T configuration) throws InitializationException Initializes this connection handler provider based on the information in the provided connection handler configuration.- Parameters:
serverContext- The server context.configuration- 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.
-
isAdministrative
public boolean isAdministrative()Indicates if the connection is on the Administration Connector which may mean it is excluded from certain checks.- Returns:
trueif the connection is on the Administration Connector.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(ServerContext serverContext, T configuration, List<LocalizableMessage> unacceptableReasons) 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.- Parameters:
serverContext- The server contextconfiguration- 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.
-
bind
Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.- Throws:
IOException- If theConnectionHandlercannot be bound.
-
close
public final void close()Closes this connection handler so that it will no longer accept new client connections, disconnecting any existing connections, and releasing any other resources associated with the connection handler.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
doClose
protected void doClose()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. -
addAdditionalMeters
Computes additional meters that is specific to the connection handler implementation. The default implementation is to do nothing.- Parameters:
registry- where additional meters should be added.
-
addAdditionalMonitorObjectClassNames
Adds the object class names that should be included in the monitor entry related to this connection handler to the provided attribute.- Parameters:
ocAttr- The object class attribute on which the object class names are added.
-