Class ConnectionHandler<T extends ConnectionHandlerCfg>

    • Constructor Detail

      • ConnectionHandler

        public ConnectionHandler()
    • Method Detail

      • getConnectionHandlerName

        public abstract String 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

        public String getConnectionHandlerType()
        Returns the type of this connection handler. By default this returns getProtocol(). It should be returning the insecure protocol version.
        Returns:
        The type of this connection handler.
      • getEnabledSSLCipherSuites

        public Collection<String> 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

        public Collection<String> 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

        public abstract Dn getComponentEntryDN()
        Retrieves 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

        public abstract String 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

        public abstract Collection<com.forgerock.opendj.util.HostPort> 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

        public abstract Collection<ClientConnection> getClientConnections()
        Retrieves 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.
      • 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.
      • 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 context
        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:
        true if the provided configuration is acceptable for this connection handler, or false if not.
      • bind

        public abstract void bind()
                           throws IOException
        Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.
        Throws:
        IOException - If the ConnectionHandler cannot 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:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
      • 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.
      • getNumRequestHandlers

        protected int getNumRequestHandlers​(Integer numRequestHandlers,
                                            String friendlyName)
        Determine the number of request handlers.
        Parameters:
        numRequestHandlers - the number of request handlers from the configuration.
        friendlyName - the friendly name of this connection handler
        Returns:
        the number of request handlers from the configuration determined from the configuration or from the number of available processors on the current machine
      • toString

        public String toString()
        Retrieves a string representation of this connection handler.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this connection handler.
      • toString

        public abstract void toString​(StringBuilder buffer)
        Appends a string representation of this connection handler to the provided buffer.
        Parameters:
        buffer - The buffer to which the information should be appended.
      • addAdditionalMeters

        protected void addAdditionalMeters​(MeterRegistryHolder registry)
        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

        protected void addAdditionalMonitorObjectClassNames​(Attribute ocAttr)
        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.