LDAP Classes
Implements Java LDAP

com.novell.ldap
Class LDAPConstraints

java.lang.Object
  extended bycom.novell.ldap.LDAPConstraints
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
LDAPSearchConstraints

public class LDAPConstraints
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Defines options controlling LDAP operations on the directory.

An LDAPConstraints object is always associated with an LDAPConnection object; its values can be changed with LDAPConnection.setConstraints, or overridden by passing an LDAPConstraints object to an operation.

See Also:
LDAPConnection.setConstraints(LDAPConstraints), Serialized Form

Constructor Summary
LDAPConstraints()
          Constructs a new LDAPConstraints object that specifies the default set of constraints.
LDAPConstraints(int msLimit, boolean doReferrals, LDAPReferralHandler handler, int hop_limit)
          Constructs a new LDAPConstraints object specifying constraints that control wait time, and referral handling.
 
Method Summary
 java.lang.Object clone()
          Clones an LDAPConstraints object.
 LDAPControl[] getControls()
          Returns the controls to be sent to the server.
 int getHopLimit()
          Returns the maximum number of referrals to follow during automatic referral following.
 java.lang.Object getProperty(java.lang.String name)
          Gets a property of the constraints object which has been assigned with setProperty(String, Object).
 boolean getReferralFollowing()
          Specified whether or not referrals are followed automatically.
 int getTimeLimit()
          Returns the maximum number of milliseconds to wait for any operation under these constraints.
 void setControls(LDAPControl control)
          Sets a single control to be sent to the server.
 void setControls(LDAPControl[] controls)
          Sets controls to be sent to the server.
 void setHopLimit(int hop_limit)
          Sets the maximum number of referrals to follow in sequence during automatic referral following.
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets a property of the constraints object.
 void setReferralFollowing(boolean doReferrals)
          Specifies whether referrals are followed automatically or if referrals throw an LDAPReferralException.
 void setReferralHandler(LDAPReferralHandler handler)
          Specifies the object that will process authentication requests during automatic referral following.
 void setTimeLimit(int msLimit)
          Sets the maximum number of milliseconds the client waits for any operation under these constraints to complete.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPConstraints

public LDAPConstraints()
Constructs a new LDAPConstraints object that specifies the default set of constraints.


LDAPConstraints

public LDAPConstraints(int msLimit,
                       boolean doReferrals,
                       LDAPReferralHandler handler,
                       int hop_limit)
Constructs a new LDAPConstraints object specifying constraints that control wait time, and referral handling.

Parameters:
msLimit - The maximum time in milliseconds to wait for results. The default is 0, which means that there is no maximum time limit. This limit is enforced for an operation by the API, not by the server. The operation will be abandoned and terminated by the API with a result code of LDAPException.LDAP_TIMEOUT if the operation exceeds the time limit.

doReferrals - Determines whether to automatically follow referrals or not. Specify true to follow referrals automatically, and false to throw an LDAPReferralException if the server responds with a referral. False is the default value. The way referrals are followed automatically is determined by the setting of the handler parameter. It is ignored for asynchronous operations.

handler - The custom authentication handler called when LDAPConnection needs to authenticate, typically on following a referral. A null may be specified to indicate default authentication processing, i.e. referrals are followed with anonymous authentication. The handler object may be an implemention of either the LDAPBindHandler or LDAPAuthHandler interface. The implementation of these interfaces determines how authentication is performed when following referrals. It is ignored for asynchronous operations.

hop_limit - The maximum number of referrals to follow in a sequence during automatic referral following. The default value is 10. A value of 0 means no limit. The operation will be abandoned and terminated by the API with a result code of LDAPException.REFERRAL_LIMIT_EXCEEDED if the number of referrals in a sequence exceeds the limit. It is ignored for asynchronous operations.
See Also:
LDAPException.LDAP_TIMEOUT, LDAPException.REFERRAL_LIMIT_EXCEEDED, LDAPException.REFERRAL, LDAPReferralException, LDAPBindHandler, LDAPAuthHandler
Method Detail

getControls

public LDAPControl[] getControls()
Returns the controls to be sent to the server.

Returns:
The controls to be sent to the server, or null if none.
See Also:
setControls(LDAPControl), setControls(LDAPControl[])

getHopLimit

public int getHopLimit()
Returns the maximum number of referrals to follow during automatic referral following. The operation will be abandoned and terminated by the API with a result code of LDAPException.REFERRAL_LIMIT_EXCEEDED if the number of referrals in a sequence exceeds the limit. It is ignored for asynchronous operations.

Returns:
The maximum number of referrals to follow in sequence
See Also:
setHopLimit(int), LDAPException.REFERRAL_LIMIT_EXCEEDED

getProperty

public java.lang.Object getProperty(java.lang.String name)
Gets a property of the constraints object which has been assigned with setProperty(String, Object).

Parameters:
name - Name of the property to be returned.
Returns:
the object associated with the property, or null if the property is not set.
See Also:
setProperty(String, Object), LDAPConnection.getProperty(String)

getReferralFollowing

public boolean getReferralFollowing()
Specified whether or not referrals are followed automatically.

Returns:
True if referrals are followed automatically, or false if referrals throw an LDAPReferralException.


getTimeLimit

public int getTimeLimit()
Returns the maximum number of milliseconds to wait for any operation under these constraints.

If the value is 0, there is no maximum time limit on waiting for operation results. The actual granularity of the timeout depends platform. This limit is enforced the the API on an operation, not by the server. The operation will be abandoned and terminated by the API with a result code of LDAPException.LDAP_TIMEOUT if the operation exceeds the time limit.

Returns:
The maximum number of milliseconds to wait for the operation.
See Also:
LDAPException.LDAP_TIMEOUT

setControls

public void setControls(LDAPControl control)
Sets a single control to be sent to the server.

Parameters:
control - A single control to be sent to the server or null if none.

setControls

public void setControls(LDAPControl[] controls)
Sets controls to be sent to the server.

Parameters:
controls - An array of controls to be sent to the server or null if none.

setHopLimit

public void setHopLimit(int hop_limit)
Sets the maximum number of referrals to follow in sequence during automatic referral following.

Parameters:
hop_limit - The maximum number of referrals to follow in a sequence during automatic referral following. The default value is 10. A value of 0 means no limit. The operation will be abandoned and terminated by the API with a result code of LDAPException.REFERRAL_LIMIT_EXCEEDED if the number of referrals in a sequence exceeds the limit. It is ignored for asynchronous operations.
See Also:
LDAPException.REFERRAL_LIMIT_EXCEEDED

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws LDAPException
Sets a property of the constraints object.

No property names have been defined at this time, but the mechanism is in place in order to support revisional as well as dynamic and proprietary extensions to operation modifiers.

Parameters:
name - Name of the property to set.

value - Value to assign to the property. property is not supported.
Throws:
java.lang.NullPointerException - if name or value are null
LDAPException
See Also:
getProperty(String ), LDAPConnection.getProperty(String)

setReferralFollowing

public void setReferralFollowing(boolean doReferrals)
Specifies whether referrals are followed automatically or if referrals throw an LDAPReferralException.

Referrals of any type other than to an LDAP server (for example, a referral URL other than ldap://something) are ignored on automatic referral following.

The default is false.

Parameters:
doReferrals - True to follow referrals automatically. False to throw an LDAPReferralException if the server returns a referral.

setReferralHandler

public void setReferralHandler(LDAPReferralHandler handler)
Specifies the object that will process authentication requests during automatic referral following.

The default is null.

Parameters:
handler - An object that implements LDAPBindHandler or LDAPAuthHandler
See Also:
LDAPAuthHandler, LDAPBindHandler

setTimeLimit

public void setTimeLimit(int msLimit)
Sets the maximum number of milliseconds the client waits for any operation under these constraints to complete.

If the value is 0, there is no maximum time limit enforced by the API on waiting for the operation results. The actual granularity of the timeout depends on the platform. The operation will be abandoned and terminated by the API with a result code of LDAPException.LDAP_TIMEOUT if the operation exceeds the time limit.

Parameters:
msLimit - The maximum milliseconds to wait.
See Also:
LDAPException.LDAP_TIMEOUT

clone

public java.lang.Object clone()
Clones an LDAPConstraints object.

Returns:
An LDAPConstraints object.

LDAP Classes
Implements Java LDAP

Copyright © 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000