Package netscape.ldap

Class LDAPConstraints

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    LDAPSearchConstraints

    public class LDAPConstraints
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    Represents a set of operation preferences. You can set these preferences for a particular operation by creating an LDAPConstraints object, specifying your preferences, and passing the object to the proper LDAPConnection method.

    Version:
    1.0
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      LDAPConstraints()
      Constructs an LDAPConstraints object that specifies the default set of constraints.
      LDAPConstraints​(int msLimit, boolean doReferrals, LDAPBind bind_proc, int hop_limit)
      Constructs a new LDAPConstraints object and allows you to specify the constraints in that object.
      LDAPConstraints​(int msLimit, boolean doReferrals, LDAPRebind rebind_proc, int hop_limit)
      Constructs a new LDAPConstraints object and allows you to specify the constraints in that object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Makes a copy of an existing set of constraints.
      LDAPBind getBindProc()
      Returns the object that provides the mechanism for authenticating to the server on referrals.
      LDAPControl[] getClientControls()
      Returns any client controls to be applied by the client to LDAP operations.
      int getHopLimit()
      Returns the maximum number of hops to follow during a referral.
      LDAPRebind getRebindProc()
      Returns the object that provides the method for getting authentication information.
      boolean getReferrals()
      Specifies whether nor not referrals are followed automatically.
      LDAPControl[] getServerControls()
      Returns any server controls to be applied by the server to LDAP operations.
      int getTimeLimit()
      Returns the maximum number of milliseconds to wait for any operation under these constraints.
      void setBindProc​(LDAPBind bind_proc)
      Sets the object that provides the mechanism for authenticating to the server on referrals.
      void setClientControls​(LDAPControl control)
      Sets a client control for LDAP operations.
      void setClientControls​(LDAPControl[] controls)
      Sets an array of client controls for LDAP operations.
      void setHopLimit​(int hop_limit)
      Sets maximum number of hops to follow in sequence during a referral.
      void setRebindProc​(LDAPRebind rebind_proc)
      Specifies the object that provides the method for getting authentication information.
      void setReferrals​(boolean doReferrals)
      Specifies whether or not referrals are followed automatically.
      void setServerControls​(LDAPControl control)
      Sets a server control for LDAP operations.
      void setServerControls​(LDAPControl[] controls)
      Sets an array of server controls for LDAP operations.
      void setTimeLimit​(int msLimit)
      Sets the maximum number of milliseconds to wait for any operation under these constraints.
      java.lang.String toString()
      Return a string representation of the object for debugging
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • LDAPConstraints

        public LDAPConstraints()
        Constructs an LDAPConstraints object that specifies the default set of constraints.
      • LDAPConstraints

        public LDAPConstraints​(int msLimit,
                               boolean doReferrals,
                               LDAPRebind rebind_proc,
                               int hop_limit)
        Constructs a new LDAPConstraints object and allows you to specify the constraints in that object.

        Parameters:
        msLimit - maximum time in milliseconds to wait for results (0 by default, which means that there is no maximum time limit)
        doReferrals - specify true to follow referrals automatically, or False to throw an LDAPReferralException error if the server sends back a referral (False by default)
        rebind_proc - specifies the object that implements the LDAPRebind interface (you need to define this class). The object will be used when the client follows referrals automatically. The object provides the client with a method for getting the distinguished name and password used to authenticate to another LDAP server during a referral. (This field is null by default.)
        hop_limit - maximum number of referrals to follow in a sequence when attempting to resolve a request
        See Also:
        LDAPConnection.setOption(int, java.lang.Object)
      • LDAPConstraints

        public LDAPConstraints​(int msLimit,
                               boolean doReferrals,
                               LDAPBind bind_proc,
                               int hop_limit)
        Constructs a new LDAPConstraints object and allows you to specify the constraints in that object.

        Parameters:
        msLimit - Mmaximum time in milliseconds to wait for results (0 by default, which means that there is no maximum time limit)
        doReferrals - specify true to follow referrals automatically, or False to throw an LDAPReferralException error if the server sends back a referral (False by default)
        bind_proc - specifies the object that implements the LDAPBind interface (you need to define this class). The object will be used to authenticate to the server on referrals. (This field is null by default.)
        hop_limit - maximum number of referrals to follow in a sequence when attempting to resolve a request
        See Also:
        LDAPConnection.setOption(int, java.lang.Object)
    • Method Detail

      • getTimeLimit

        public int getTimeLimit()
        Returns the maximum number of milliseconds to wait for any operation under these constraints. If 0, there is no maximum time limit on waiting for the operation results.
        Returns:
        maximum number of milliseconds to wait for operation results.
      • getReferrals

        public boolean getReferrals()
        Specifies whether nor not referrals are followed automatically. Returns true if referrals are to be followed automatically, or false if referrals throw an LDAPReferralException.
        Returns:
        true if referrals are followed automatically, false if referrals throw an LDAPReferralException.
      • getBindProc

        public LDAPBind getBindProc()
        Returns the object that provides the mechanism for authenticating to the server on referrals. This object must implement the LDAPBind interface.
        Returns:
        object to use to authenticate to the server on referrals.
        See Also:
        LDAPBind
      • getRebindProc

        public LDAPRebind getRebindProc()
        Returns the object that provides the method for getting authentication information. This object must implement the LDAPRebind interface.
        Returns:
        object to use to obtain information for authenticating to other LDAP servers during referrals.
        See Also:
        LDAPRebind, LDAPRebindAuth
      • getHopLimit

        public int getHopLimit()
        Returns the maximum number of hops to follow during a referral.
        Returns:
        maximum number of hops to follow during a referral.
      • setTimeLimit

        public void setTimeLimit​(int msLimit)
        Sets the maximum number of milliseconds to wait for any operation under these constraints. If 0, there is no maximum time limit on waiting for the operation results. If the time limit is exceeded, an LDAPException with the result code LDAPException.TIME_LIMIT is thrown.
        Parameters:
        msLimit - Maximum number of milliseconds to wait for operation results (0 by default, which means that there is no maximum time limit.)
        See Also:
        LDAPException.LDAP_TIMEOUT
      • setReferrals

        public void setReferrals​(boolean doReferrals)
        Specifies whether or not referrals are followed automatically. Specify true if referrals are to be followed automatically, or false if referrals are to throw an LDAPReferralException. (By default, this is set to false.)

        If you set this to true, you need to create an object of this class that implements either the LDAPRebind or LDAPBind interface. The LDAPRebind object identifies the method for retrieving authentication information which will be used when connecting to other LDAP servers during referrals. This object should be passed to the setRebindProc method. Alternatively, the LDAPBind object identifies an authentication mechanism to be used instead of the default authentication mechanism when following referrals. This object should be passed to the setBindProc method.

        Parameters:
        doReferrals - set to true if referrals should be followed automatically, or False if referrals should throw an LDAPReferralException
        See Also:
        LDAPBind, LDAPRebind, LDAPRebindAuth
      • setBindProc

        public void setBindProc​(LDAPBind bind_proc)
        Sets the object that provides the mechanism for authenticating to the server on referrals. This object must implement the LDAPBind interface.(By default, this is null.) This method sets the LDAPRebind object to null for this constraint.
        Parameters:
        bind_proc - object to use to authenticate to the server on referrals
        See Also:
        LDAPBind
      • setRebindProc

        public void setRebindProc​(LDAPRebind rebind_proc)
        Specifies the object that provides the method for getting authentication information. This object must belong to a class that implements the LDAPRebind interface. (By default, this is null.) This method sets the LDAPBind object to null for this constraint.
        Parameters:
        rebind_proc - object to use to obtain information for authenticating to other LDAP servers during referrals
      • setHopLimit

        public void setHopLimit​(int hop_limit)
        Sets maximum number of hops to follow in sequence during a referral. (By default, this is 5.)
        Parameters:
        hop_limit - maximum number of hops to follow during a referral
      • setClientControls

        public void setClientControls​(LDAPControl control)
        Sets a client control for LDAP operations.
        Parameters:
        control - client control for LDAP operations
        See Also:
        LDAPControl
      • setClientControls

        public void setClientControls​(LDAPControl[] controls)
        Sets an array of client controls for LDAP operations.
        Parameters:
        controls - array of client controls for LDAP operations
        See Also:
        LDAPControl
      • setServerControls

        public void setServerControls​(LDAPControl control)
        Sets a server control for LDAP operations.
        Parameters:
        control - server control for LDAP operations
        See Also:
        LDAPControl
      • setServerControls

        public void setServerControls​(LDAPControl[] controls)
        Sets an array of server controls for LDAP operations.
        Parameters:
        controls - an array of server controls for LDAP operations
        See Also:
        LDAPControl
      • toString

        public java.lang.String toString()
        Return a string representation of the object for debugging
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the object
      • clone

        public java.lang.Object clone()
        Makes a copy of an existing set of constraints.
        Overrides:
        clone in class java.lang.Object
        Returns:
        a copy of an existing set of constraints