Package netscape.ldap.beans
Class LDAPBasePropertySupport
- java.lang.Object
-
- netscape.ldap.beans.LDAPBasePropertySupport
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
LDAPGetEntries,LDAPGetProperty,LDAPIsMember,LDAPSimpleAuth
public class LDAPBasePropertySupport extends java.lang.Object implements java.io.SerializableThis is a base class that is extended by various specialized LDAP Beans. It provides the common properties and accessors used by them.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intAMBIGUOUS_RESULTSstatic intAUTHENTICATION_ERRORstatic intCONNECT_ERRORstatic intINVALID_PARAMETERstatic intNO_SUCH_OBJECTstatic intOKstatic intPROPERTY_NOT_FOUND
-
Constructor Summary
Constructors Constructor Description LDAPBasePropertySupport()Constructor with no parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Add a client to be notified when an authentication result is inprotected voidconnect(LDAPConnection conn, java.lang.String host, int port)Sets up basic connection privileges for Communicator if necessary, and connectsjava.lang.StringconvertToString(java.lang.String[] aResult)Utility method to convert an array of Strings to a single String with line feeds between elements.voidfirePropertyChange(java.lang.String propName, java.lang.Object oldValue, java.lang.Object newValue)Support for bound property notificationjava.lang.StringgetAuthDN()Returns the DN to authenticate as; null or empty for anonymous.java.lang.StringgetAuthPassword()Returns the password for the DN to authenticate asjava.lang.StringgetBase()Returns the directory base to search at.booleangetDebug()Returns true if debug output is onintgetErrorCode()Returns the latest error codejava.lang.StringgetFilter()Returns the search filterjava.lang.StringgetHost()Returns the host to search at.intgetPort()Returns the port to search at.intgetScope()Get the current search scopejava.lang.StringgetUserID()Return the user ID.java.lang.StringgetUserName()Returns the user nameprotected voidprintDebug(java.lang.String s)voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Remove a client which had requested notification on authenticationvoidsetAuthDN(java.lang.String authDN)Sets the DN to authenticate as; null or empty for anonymous.voidsetAuthPassword(java.lang.String authPassword)Sets the password for the DN to authenticate asvoidsetBase(java.lang.String theBase)Sets the starting basevoidsetDebug(boolean on)Turns debug output on or offprotected voidsetDefaultReferralCredentials(LDAPConnection conn)voidsetErrorCode(int code)Sets an error code for retrieval by a clientvoidsetFilter(java.lang.String filter)Sets the search filtervoidsetHost(java.lang.String theHost)Sets host string.voidsetPort(int thePort)Sets port number.voidsetScope(int scope)Set the search scope using an integervoidsetUserID(java.lang.String name)Set the user ID.voidsetUserName(java.lang.String name)Set the user name.
-
-
-
Field Detail
-
OK
public static final int OK
- See Also:
- Constant Field Values
-
INVALID_PARAMETER
public static final int INVALID_PARAMETER
- See Also:
- Constant Field Values
-
CONNECT_ERROR
public static final int CONNECT_ERROR
- See Also:
- Constant Field Values
-
AUTHENTICATION_ERROR
public static final int AUTHENTICATION_ERROR
- See Also:
- Constant Field Values
-
PROPERTY_NOT_FOUND
public static final int PROPERTY_NOT_FOUND
- See Also:
- Constant Field Values
-
AMBIGUOUS_RESULTS
public static final int AMBIGUOUS_RESULTS
- See Also:
- Constant Field Values
-
NO_SUCH_OBJECT
public static final int NO_SUCH_OBJECT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getHost
public java.lang.String getHost()
Returns the host to search at.- Returns:
- DNS name or dotted IP name of host to search at
-
setHost
public void setHost(java.lang.String theHost)
Sets host string.- Parameters:
theHost- host name
-
getPort
public int getPort()
Returns the port to search at.- Returns:
- Port to search at
-
setPort
public void setPort(int thePort)
Sets port number.- Parameters:
thePort- port
-
getBase
public java.lang.String getBase()
Returns the directory base to search at.- Returns:
- directory base to search
-
setBase
public void setBase(java.lang.String theBase)
Sets the starting base- Parameters:
theBase- starting base
-
getAuthDN
public java.lang.String getAuthDN()
Returns the DN to authenticate as; null or empty for anonymous.- Returns:
- DN to authenticate as
-
setAuthDN
public void setAuthDN(java.lang.String authDN)
Sets the DN to authenticate as; null or empty for anonymous.- Parameters:
authDN- the DN to authenticate as
-
getAuthPassword
public java.lang.String getAuthPassword()
Returns the password for the DN to authenticate as- Returns:
- Password of DN to authenticate as
-
setAuthPassword
public void setAuthPassword(java.lang.String authPassword)
Sets the password for the DN to authenticate as- Parameters:
authPassword- the password to use in authentication
-
getUserName
public java.lang.String getUserName()
Returns the user name- Returns:
- The user name
-
setUserName
public void setUserName(java.lang.String name)
Set the user name. The name should be of the form "Polly Plum".- Parameters:
name- The user name
-
getUserID
public java.lang.String getUserID()
Return the user ID.- Returns:
- name the user id
-
setUserID
public void setUserID(java.lang.String name)
Set the user ID.- Parameters:
name- the value of the user id
-
getScope
public int getScope()
Get the current search scope- Returns:
- the current search scope as integer
-
setScope
public void setScope(int scope)
Set the search scope using an integer- Parameters:
scope- one of LDAPConnection.SCOPE_BASE, LDAPConnection.SCOPE_SUB, LDAPConnection.SCOPE_ONE
-
getFilter
public java.lang.String getFilter()
Returns the search filter- Returns:
- search filter
-
setFilter
public void setFilter(java.lang.String filter)
Sets the search filter- Parameters:
filter- search filter
-
getDebug
public boolean getDebug()
Returns true if debug output is on- Returns:
- true if debug output is on
-
setDebug
public void setDebug(boolean on)
Turns debug output on or off- Parameters:
on- true for debug output
-
getErrorCode
public int getErrorCode()
Returns the latest error code- Returns:
- The latest error code
-
setErrorCode
public void setErrorCode(int code)
Sets an error code for retrieval by a client- Parameters:
code- An error code
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a client to be notified when an authentication result is in- Parameters:
listener- a client to be notified of changes
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a client which had requested notification on authentication- Parameters:
listener- a client to not be notified of changes
-
firePropertyChange
public void firePropertyChange(java.lang.String propName, java.lang.Object oldValue, java.lang.Object newValue)Support for bound property notification- Parameters:
propName- Name of changed propertyoldValue- Previous value of propertynewValue- New value of property
-
printDebug
protected void printDebug(java.lang.String s)
-
connect
protected void connect(LDAPConnection conn, java.lang.String host, int port) throws LDAPException
Sets up basic connection privileges for Communicator if necessary, and connects- Parameters:
host- Host to connect to.port- Port number.- Throws:
LDAPException- from connect()
-
setDefaultReferralCredentials
protected void setDefaultReferralCredentials(LDAPConnection conn)
-
convertToString
public java.lang.String convertToString(java.lang.String[] aResult)
Utility method to convert an array of Strings to a single String with line feeds between elements.- Parameters:
aResult- The array of Strings to convert- Returns:
- A String with the elements separated by line feeds
-
-