netscape.ldap.beans

Class LDAPBasePropertySupport

Implemented Interfaces:
Serializable
Known Direct Subclasses:
LDAPGetEntries, LDAPGetProperty, LDAPIsMember, LDAPSimpleAuth

public class LDAPBasePropertySupport
extends java.lang.Object
implements Serializable

This is a base class that is extended by various specialized LDAP Beans. It provides the common properties and accessors used by them.

Field Summary

static int
AMBIGUOUS_RESULTS
static int
AUTHENTICATION_ERROR
static int
CONNECT_ERROR
static int
INVALID_PARAMETER
static int
NO_SUCH_OBJECT
static int
OK
static int
PROPERTY_NOT_FOUND

Constructor Summary

LDAPBasePropertySupport()
Constructor with no parameters

Method Summary

void
addPropertyChangeListener(PropertyChangeListener listener)
Add a client to be notified when an authentication result is in
protected void
connect(LDAPConnection conn, String host, int port)
Sets up basic connection privileges for Communicator if necessary, and connects
String
convertToString(String[] aResult)
Utility method to convert an array of Strings to a single String with line feeds between elements.
void
firePropertyChange(String propName, Object oldValue, Object newValue)
Support for bound property notification
String
getAuthDN()
Returns the DN to authenticate as; null or empty for anonymous.
String
getAuthPassword()
Returns the password for the DN to authenticate as
String
getBase()
Returns the directory base to search at.
boolean
getDebug()
Returns true if debug output is on
int
getErrorCode()
Returns the latest error code
String
getFilter()
Returns the search filter
String
getHost()
Returns the host to search at.
int
getPort()
Returns the port to search at.
int
getScope()
Get the current search scope
String
getUserID()
Return the user ID.
String
getUserName()
Returns the user name
protected void
printDebug(String s)
void
removePropertyChangeListener(PropertyChangeListener listener)
Remove a client which had requested notification on authentication
void
setAuthDN(String authDN)
Sets the DN to authenticate as; null or empty for anonymous.
void
setAuthPassword(String authPassword)
Sets the password for the DN to authenticate as
void
setBase(String theBase)
Sets the starting base
void
setDebug(boolean on)
Turns debug output on or off
protected void
setDefaultReferralCredentials(LDAPConnection conn)
void
setErrorCode(int code)
Sets an error code for retrieval by a client
void
setFilter(String filter)
Sets the search filter
void
setHost(String theHost)
Sets host string.
void
setPort(int thePort)
Sets port number.
void
setScope(int scope)
Set the search scope using an integer
void
setUserID(String name)
Set the user ID.
void
setUserName(String name)
Set the user name.

Field Details

AMBIGUOUS_RESULTS

public static final int AMBIGUOUS_RESULTS

Field Value:
5


AUTHENTICATION_ERROR

public static final int AUTHENTICATION_ERROR

Field Value:
3


CONNECT_ERROR

public static final int CONNECT_ERROR

Field Value:
2


INVALID_PARAMETER

public static final int INVALID_PARAMETER

Field Value:
1


NO_SUCH_OBJECT

public static final int NO_SUCH_OBJECT

Field Value:
6


OK

public static final int OK

Field Value:
0


PROPERTY_NOT_FOUND

public static final int PROPERTY_NOT_FOUND

Field Value:
4

Constructor Details

LDAPBasePropertySupport

public LDAPBasePropertySupport()
Constructor with no parameters

Method Details

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a client to be notified when an authentication result is in

Parameters:
listener - a client to be notified of changes


connect

protected void connect(LDAPConnection conn,
                       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()


convertToString

public String convertToString(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


firePropertyChange

public void firePropertyChange(String propName,
                               Object oldValue,
                               Object newValue)
Support for bound property notification

Parameters:
propName - Name of changed property
oldValue - Previous value of property
newValue - New value of property


getAuthDN

public String getAuthDN()
Returns the DN to authenticate as; null or empty for anonymous.

Returns:
DN to authenticate as


getAuthPassword

public String getAuthPassword()
Returns the password for the DN to authenticate as

Returns:
Password of DN to authenticate as


getBase

public String getBase()
Returns the directory base to search at.

Returns:
directory base to search


getDebug

public boolean getDebug()
Returns true if debug output is on

Returns:
true if debug output is on


getErrorCode

public int getErrorCode()
Returns the latest error code

Returns:
The latest error code


getFilter

public String getFilter()
Returns the search filter

Returns:
search filter


getHost

public String getHost()
Returns the host to search at.

Returns:
DNS name or dotted IP name of host to search at


getPort

public int getPort()
Returns the port to search at.

Returns:
Port to search at


getScope

public int getScope()
Get the current search scope

Returns:
the current search scope as integer


getUserID

public String getUserID()
Return the user ID.

Returns:
name the user id


getUserName

public String getUserName()
Returns the user name

Returns:
The user name


printDebug

protected void printDebug(String s)


removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a client which had requested notification on authentication

Parameters:
listener - a client to not be notified of changes


setAuthDN

public void setAuthDN(String authDN)
Sets the DN to authenticate as; null or empty for anonymous.

Parameters:
authDN - the DN to authenticate as


setAuthPassword

public void setAuthPassword(String authPassword)
Sets the password for the DN to authenticate as

Parameters:
authPassword - the password to use in authentication


setBase

public void setBase(String theBase)
Sets the starting base

Parameters:
theBase - starting base


setDebug

public void setDebug(boolean on)
Turns debug output on or off

Parameters:
on - true for debug output


setDefaultReferralCredentials

protected void setDefaultReferralCredentials(LDAPConnection conn)


setErrorCode

public void setErrorCode(int code)
Sets an error code for retrieval by a client

Parameters:
code - An error code


setFilter

public void setFilter(String filter)
Sets the search filter

Parameters:
filter - search filter


setHost

public void setHost(String theHost)
Sets host string.

Parameters:
theHost - host name


setPort

public void setPort(int thePort)
Sets port number.

Parameters:
thePort - port


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


setUserID

public void setUserID(String name)
Set the user ID.

Parameters:
name - the value of the user id


setUserName

public void setUserName(String name)
Set the user name. The name should be of the form "Polly Plum".

Parameters:
name - The user name