com.bankframe.ei.ldap
Class LDAPServerContext

java.lang.Object
  extended bycom.bankframe.ei.ldap.LDAPServerContext
All Implemented Interfaces:
java.io.Serializable

public class LDAPServerContext
extends java.lang.Object
implements java.io.Serializable

This class provides the connectivity to an LDAP server. Connecting to the server requires several configuration parameters, these are defined as the following constant fields in this class

  1. PROVIDER_URL - URL of the ldap server, and the context in the server to access
  2. INITIAL_CONTEXT_FACTORY - The JNDI factory class to use to make the connection
  3. SECURITY_AUTHENTICATION - The authentication method
  4. SECURITY_PRINCIPAL - The user to authenticate
  5. SECURITY_CREDENTIALS - The password to use for authentication
  6. SECURITY_PROTOCOL - Specifies whether to connect using Secure Sockets Layer
  7. BASE_DN - Specifies the base distinguished name of this context
  8. CONTEXT_ALIAS - Specifies the name of the alias that defines the above settings
  9. RDN_ATTRIBUTE - Specifies the name of the attribute that is used to form the dn
  10. DEFAULT_SEARCH_FILTER - Specifies a default search filter to use for searches
These parameters are passed to the constructor as key-value pairs in a Hashtable. All the parameters may not be required, for example the LDAP server may not require authentication

The physical connection to the server will not be established until it is actually required ie. when one of create(), get(), update(), remove() or list() is called. The physical connection will be closed when the context is destroyed, it can also be closed explicitly by calling the close() method. The open() method can be used to explicitly establish the physical connection.

Author:
etu
See Also:
Serialized Form

Field Summary
static java.lang.String BASE_DN
           
static java.lang.String CONTEXT_ALIAS
           
static java.lang.String DEFAULT_INITIAL_CONTEXT_FACTORY
           
static java.lang.String DEFAULT_SEARCH_FILTER
           
static java.lang.String INITIAL_CONTEXT_FACTORY
           
static java.lang.String PROVIDER_URL
           
static java.lang.String RDN_ATTRIBUTE
           
static java.lang.String REFERRAL
           
static java.lang.String SECURITY_AUTHENTICATION
           
static java.lang.String SECURITY_CREDENTIALS
           
static java.lang.String SECURITY_PRINCIPAL
           
static java.lang.String SECURITY_PROTOCOL
           
 
Constructor Summary
LDAPServerContext(java.util.Hashtable ldapServerProperties)
          This constructor creates a LDAPServerContext instance using the configuration settings in the hashtable.
 
Method Summary
 void close()
          This method closes the connection to the server
 void create(java.lang.String rdn, javax.naming.directory.Attributes attrs)
          This method creates a new entry in the context with the specified attributes
 javax.naming.directory.Attributes get(java.lang.String rdn)
          This method retrieves the attributes of an existing entry
 java.lang.String getDn(java.lang.String rdn)
          This method gets the fully qualified distinguished name of the specified object
 javax.naming.directory.DirContext getJndiContext()
          This method gets a reference to the JNDI context for this connection
 java.lang.Object getProperty(java.lang.String name)
          This method gets a property setting for this context
 java.util.Enumeration list()
          This method lists the names of all the entries in this context
 void open()
          This method opens a connection with the LDAP server
 void putProperty(java.lang.String name, java.lang.Object value)
          This method updates or adds a property setting in this context
 void remove(java.lang.String rdn)
          This method removes an entry from the context
 javax.naming.NamingEnumeration search(java.lang.String filter, java.lang.Object[] filterArgs)
          This method searches for objects matching the specified filter, in the current context and in all sub-contexts.
 java.lang.String toString()
          This method converts this context to a string representation.
 void update(java.lang.String rdn, javax.naming.directory.Attributes attrs)
          This method updates the attributes of an existing entry
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROVIDER_URL

public static final java.lang.String PROVIDER_URL
See Also:
Constant Field Values

INITIAL_CONTEXT_FACTORY

public static final java.lang.String INITIAL_CONTEXT_FACTORY
See Also:
Constant Field Values

SECURITY_AUTHENTICATION

public static final java.lang.String SECURITY_AUTHENTICATION
See Also:
Constant Field Values

SECURITY_PRINCIPAL

public static final java.lang.String SECURITY_PRINCIPAL
See Also:
Constant Field Values

SECURITY_CREDENTIALS

public static final java.lang.String SECURITY_CREDENTIALS
See Also:
Constant Field Values

SECURITY_PROTOCOL

public static final java.lang.String SECURITY_PROTOCOL
See Also:
Constant Field Values

REFERRAL

public static final java.lang.String REFERRAL
See Also:
Constant Field Values

BASE_DN

public static final java.lang.String BASE_DN
See Also:
Constant Field Values

CONTEXT_ALIAS

public static final java.lang.String CONTEXT_ALIAS
See Also:
Constant Field Values

RDN_ATTRIBUTE

public static final java.lang.String RDN_ATTRIBUTE
See Also:
Constant Field Values

DEFAULT_SEARCH_FILTER

public static final java.lang.String DEFAULT_SEARCH_FILTER
See Also:
Constant Field Values

DEFAULT_INITIAL_CONTEXT_FACTORY

public static final java.lang.String DEFAULT_INITIAL_CONTEXT_FACTORY
See Also:
Constant Field Values
Constructor Detail

LDAPServerContext

public LDAPServerContext(java.util.Hashtable ldapServerProperties)
This constructor creates a LDAPServerContext instance using the configuration settings in the hashtable. The required values are described in the documentation for this class

Parameters:
ldapServerProperties - Hashtable containing the configuration information
Method Detail

close

public void close()
           throws javax.naming.NamingException
This method closes the connection to the server

Throws:
javax.naming.NamingException - if an error occurs

create

public void create(java.lang.String rdn,
                   javax.naming.directory.Attributes attrs)
            throws javax.naming.NamingException
This method creates a new entry in the context with the specified attributes

Parameters:
rdn - Relative Distinguished Name of the new entry
attrs - Attributes of the new entry
Throws:
javax.naming.NamingException - if the entry cannot be created

get

public javax.naming.directory.Attributes get(java.lang.String rdn)
                                      throws javax.naming.NamingException
This method retrieves the attributes of an existing entry

Parameters:
rdn - Relative Distinguished Name of the entry to retrieve
Throws:
javax.naming.NamingException - if the entry cannot be rerieved

getDn

public java.lang.String getDn(java.lang.String rdn)
                       throws javax.naming.NamingException
This method gets the fully qualified distinguished name of the specified object

Parameters:
rdn - Relative distinguished name of the object
Throws:
javax.naming.NamingException - on error

getJndiContext

public javax.naming.directory.DirContext getJndiContext()
                                                 throws javax.naming.NamingException
This method gets a reference to the JNDI context for this connection

Throws:
javax.naming.NamingException

getProperty

public java.lang.Object getProperty(java.lang.String name)
This method gets a property setting for this context

Parameters:
name - Name of the property to retrieve

list

public java.util.Enumeration list()
                           throws javax.naming.NamingException
This method lists the names of all the entries in this context

Throws:
javax.naming.NamingException - on error

open

public void open()
          throws javax.naming.NamingException
This method opens a connection with the LDAP server

Throws:
javax.naming.NamingException - if the connection cannot be opened

putProperty

public void putProperty(java.lang.String name,
                        java.lang.Object value)
                 throws javax.naming.NamingException
This method updates or adds a property setting in this context

Parameters:
name - Name of the property to add/update
value - Value of the property
Throws:
javax.naming.NamingException - if an error occurs

remove

public void remove(java.lang.String rdn)
            throws javax.naming.NamingException
This method removes an entry from the context

Parameters:
rdn - Relative Distinguished Name of the entry to remove
Throws:
javax.naming.NamingException - on error

search

public javax.naming.NamingEnumeration search(java.lang.String filter,
                                             java.lang.Object[] filterArgs)
                                      throws javax.naming.NamingException,
                                             javax.naming.directory.InvalidSearchFilterException
This method searches for objects matching the specified filter, in the current context and in all sub-contexts. Returns an Enumeration of SearchResults

Throws:
javax.naming.NamingException
javax.naming.directory.InvalidSearchFilterException

toString

public java.lang.String toString()
This method converts this context to a string representation. For information purposes only


update

public void update(java.lang.String rdn,
                   javax.naming.directory.Attributes attrs)
            throws javax.naming.NamingException
This method updates the attributes of an existing entry

Parameters:
rdn - Relative Distinguished Name of the entry to update
attrs - The attributes to update
Throws:
javax.naming.NamingException - on error


Copyright © 2004 Siebel Systems, Inc. All rights reserved.