Class LDAPServerConnector

  • All Implemented Interfaces:
    ConnectorInterface, VersionInfoInterface

    public class LDAPServerConnector
    extends Connector
    implements ConnectorInterface
    LDAPServerConnector is an LDAP server that returns a client connection from the getNextClient method. The returned connector interface is initialized with an LDAP client connection. Calls to the returned connector should be getNextEntry() to retrieve the next client request (e.g. bind, search etc), putEntry() to send search results to the LDAP client and finally replyEntry() to send the status message that completes the client request.

    The returned connector is not thread safe. Alls calls to putEntry and replyEntry uses the previous getNextEntry request attributes in the data sent to the client. Specifically, the LDAP message id and response operation code is reused from the client request.

    • Field Detail

      • PARAM_TCP_BACKLOG

        public static final java.lang.String PARAM_TCP_BACKLOG
        Configuration parameter name: "backlog"
        See Also:
        Constant Field Values
      • PARAM_SYSTEM_TCP_BACKLOG

        public static final java.lang.String PARAM_SYSTEM_TCP_BACKLOG
        Configuration parameter name: "com.ibm.di.tcp.backlog"
        See Also:
        Constant Field Values
    • Constructor Detail

      • LDAPServerConnector

        public LDAPServerConnector()
        Default constructor.
    • Method Detail

      • getResHash

        public static ResourceHash getResHash()
        Returns:
        The resource object.
      • getServerConnector

        public LDAPServerConnector getServerConnector()
        Retrieves server connector.
        Returns:
        the server connector if this connector is handling an LDAP client session.
      • setServerConnector

        public void setServerConnector​(LDAPServerConnector serverConnector)
        Sets the server connector for this connector.
        Parameters:
        serverConnector - the server connector to set.
      • isAccepting

        public boolean isAccepting()
        Checks if the connector is waiting for a client connection.
        Returns:
        true if this connector is currently waiting for a client connection.
      • isTerminating

        public boolean isTerminating()
        Checks if a termination request is sent.
        Returns:
        true if this connector has the termination flag set.
      • terminateServer

        public void terminateServer()
                             throws java.lang.Exception
        This method tries to terminate the server by setting the termination flag for the connector returned by getServerConnector and immediately connecting to its port (which should fail).
        Specified by:
        terminateServer in interface ConnectorInterface
        Overrides:
        terminateServer in class Connector
        Throws:
        java.lang.Exception - if an error occurs.
      • initialize

        public void initialize​(java.lang.Object obj)
                        throws java.lang.Exception
        Initialize the connector. To initialize this connector with an LDAP client session provide a java.net.Socket object for the obj parameter. In all other cases, the connector will initialize an LDAP server session.
        Specified by:
        initialize in interface ConnectorInterface
        Overrides:
        initialize in class Connector
        Parameters:
        obj - Null, Socket or ConnectorMode class
        Throws:
        java.lang.Exception - if an error occurs.
      • terminate

        public void terminate()
                       throws java.lang.Exception
        Terminate the connector. This function closes all connection and releases all resources used by the connector. This function also calls the parser's closeParser() method if a parser is active.
        Specified by:
        terminate in interface ConnectorInterface
        Overrides:
        terminate in class Connector
        Throws:
        java.lang.Exception - if an error occurs.
      • putEntry

        public void putEntry​(Entry entry)
                      throws java.lang.Exception
        Sends a search result entry to the LDAP client in response to a search request. The previously received client request must be a Search request or this method will most likely cause trouble for the LDAP client since the message id from the previous request is used in the search result packet.
        Specified by:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        Parameters:
        entry - The entry. It must contain the $dn attribute plus other LDAP attributes.
        Throws:
        java.lang.Exception - if an error occurs.
      • replyEntry

        public void replyEntry​(Entry conn)
                        throws java.lang.Exception
        Send an LDAP result message in response to the last request from the LDAP Client. The attributes used in the result packet are: ldap.status to set the status code, ldap.errormessage to provide additional info in case ldap.status is not zero, ldap.matcheddn to tell the client about the offending DN if any and finally ldap.referrals to refer the client to another LDAP server. The default value for all attributes is NULL and ZERO (e.g. OK) for the ldap.status attribute. You generally only have to set attribute values in case there is an error or you want to refer to another server.
        Specified by:
        replyEntry in interface ConnectorInterface
        Overrides:
        replyEntry in class Connector
        Parameters:
        conn - the entry, result of the Output Mapping
        Throws:
        java.lang.Exception - if an error occurs.
      • isAbandoned

        public boolean isAbandoned​(int messageID)
                            throws java.lang.Exception
        This method returns true if there is an abandon message in the queue with the specified message ID.
        Parameters:
        messageID - The LDAP Message ID
        Returns:
        true if there is an abandoned message with the provided id, false otherwise.
        Throws:
        java.lang.Exception - if an error occurs.
      • createControl

        public LDAPControl createControl​(java.lang.String oid)
        Creates an instance of the LDAPControl class.
        Parameters:
        oid - the extended operation id
        Returns:
        the newly created object.
      • getVersion

        public java.lang.String getVersion()
        Version information.
        Specified by:
        getVersion in interface VersionInfoInterface
        Returns:
        the version information
      • setKeepAlive

        public void setKeepAlive​(boolean value)