com.knowgate.ldap
Class LDAPModel

java.lang.Object
  extended by com.knowgate.ldap.LDAPModel
Direct Known Subclasses:
LDAPNovell

public abstract class LDAPModel
extends java.lang.Object

LDAP Abstract Base Class


Field Summary
static short ACCOUNT_CANCELLED
           
static short ACCOUNT_DEACTIVATED
           
static short DOMAIN_NOT_FOUND
           
static short INTERNAL_ERROR
           
static short INVALID_PASSWORD
           
protected  java.lang.String organizationalUnitPattern
           
static short PASSWORD_EXPIRED
           
static int PWD_CLEAR_TEXT
           
static int PWD_DTIP_RC4
           
static short SESSION_EXPIRED
           
static short USER_NOT_FOUND
           
static short WORKAREA_NOT_FOUND
           
static short WORKAREA_NOT_SET
           
 
Constructor Summary
LDAPModel()
           
 
Method Summary
abstract  void addAddress(java.sql.Connection oJdbc, java.lang.String sAddrId)
          Add an address from v_ldap_contacts view to an LDAP directory Addresses may be either public or private depending on the value of field v_ldap_contacts.bo_private.
abstract  void addOrReplaceAddress(java.sql.Connection oJdbc, java.lang.String sAddrId)
          Add or replace an Address This method is the same as addAddress() except that it does not raise an LDAPException if address already exists; in that case address is just replaced.
abstract  void addOrReplaceUser(java.sql.Connection oJdbc, java.lang.String sUserId)
          Add or replace a User from v_ldap_users SQL view to the LDAP directory
abstract  void addUser(java.sql.Connection oJdbc, java.lang.String sUserId)
          Add a User from v_ldap_users view to an LDAP directory Users are added under cn=user@mail.com,dc=users,dc=workarea_name,dc=domain_name,dc=hipergate,dc=org
abstract  void bind(java.lang.String sUser, java.lang.String sPass)
          Synchronously authenticates to the LDAP server using LDAP_V3.
abstract  void connect(java.lang.String sConnStr)
          Connect to LDAP Service At this point, there is no authentication, and any operations are conducted as an anonymous client.
abstract  void connectAndBind(java.util.Properties oProps)
          Connect to LDAP Server using a Properties object
abstract  void deleteAddress(java.sql.Connection oJdbc, java.lang.String sAddrId)
          Delete an address from LDAP directory
abstract  void deleteUser(java.sql.Connection oJdbc, java.lang.String sUserId)
          Delete a User from LDAP directory
abstract  void deleteWorkArea(java.lang.String sDomainNm, java.lang.String sWorkAreaNm)
          Delete a WorkArea from the LDAP directory All entries under dc=sDomainNm,dc=hipergate,dc=org that match dc=sWorkAreaNm are deleted
abstract  void disconnect()
          Synchronously disconnects from the LDAP server The disconnect method abandons any outstanding requests, issues an unbind request to the server, and then closes the socket.
abstract  void dropAll()
          Drop an entire LDAP directory
abstract  boolean exists(java.lang.String sSearchString)
          Check whether or not an LDAP entry exists The directory is searched from the connection string key.
 java.lang.String getPartitionName()
           
abstract  void loadDomain(java.sql.Connection oJdbc, int iDomainId)
          Load all users and contact address from a Domain into an LDAP directory
abstract  void loadWorkArea(java.sql.Connection oJdbc, java.lang.String sDomainNm, java.lang.String sWorkAreaNm)
          Load all users and contact address from a WorkArea into an LDAP directory
protected  java.lang.String makeName(java.lang.String sPattern, java.lang.String[] aParams)
          Replace parameters market as $1, $2, ...
 void setPartitionName(java.lang.String sName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

organizationalUnitPattern

protected java.lang.String organizationalUnitPattern

PWD_CLEAR_TEXT

public static final int PWD_CLEAR_TEXT
See Also:
Constant Field Values

PWD_DTIP_RC4

public static final int PWD_DTIP_RC4
See Also:
Constant Field Values

USER_NOT_FOUND

public static final short USER_NOT_FOUND
See Also:
Constant Field Values

INVALID_PASSWORD

public static final short INVALID_PASSWORD
See Also:
Constant Field Values

ACCOUNT_DEACTIVATED

public static final short ACCOUNT_DEACTIVATED
See Also:
Constant Field Values

SESSION_EXPIRED

public static final short SESSION_EXPIRED
See Also:
Constant Field Values

DOMAIN_NOT_FOUND

public static final short DOMAIN_NOT_FOUND
See Also:
Constant Field Values

WORKAREA_NOT_FOUND

public static final short WORKAREA_NOT_FOUND
See Also:
Constant Field Values

WORKAREA_NOT_SET

public static final short WORKAREA_NOT_SET
See Also:
Constant Field Values

ACCOUNT_CANCELLED

public static final short ACCOUNT_CANCELLED
See Also:
Constant Field Values

PASSWORD_EXPIRED

public static final short PASSWORD_EXPIRED
See Also:
Constant Field Values

INTERNAL_ERROR

public static final short INTERNAL_ERROR
See Also:
Constant Field Values
Constructor Detail

LDAPModel

public LDAPModel()
Method Detail

connect

public abstract void connect(java.lang.String sConnStr)
                      throws LDAPException

Connect to LDAP Service

At this point, there is no authentication, and any operations are conducted as an anonymous client.

Parameters:
sConnStr - ldap://host:port/distinguished_name
Example "ldap://fobos.kg.int:389/dc=hipergate,dc=org"
Throws:
LDAPException

connectAndBind

public abstract void connectAndBind(java.util.Properties oProps)
                             throws LDAPException

Connect to LDAP Server using a Properties object

Parameters:
oProps - Properties for connecting to LDAP server.
For example :
ldapconnect=ldap://fobos.kg.int:389/dc=hipergate,dc=org
ldapuser=cn=Manager,dc=hipergate,dc=org
ldappassword=manager
Throws:
LDAPException

bind

public abstract void bind(java.lang.String sUser,
                          java.lang.String sPass)
                   throws LDAPException

Synchronously authenticates to the LDAP server using LDAP_V3.

If the object has been disconnected from an LDAP server, this method attempts to reconnect to the server. If the object has already authenticated, the old authentication is discarded.

Parameters:
sUser - If non-null and non-empty, specifies that the connection and all operations through it should be authenticated with dn as the distinguished name.
sPass - If non-null and non-empty, specifies that the connection and all operations through it should be authenticated with dn as the distinguished name and passwd as password.
Throws:
LDAPException
java.lang.IllegalStateException - If not conencted to LDAP

disconnect

public abstract void disconnect()
                         throws LDAPException

Synchronously disconnects from the LDAP server

The disconnect method abandons any outstanding requests, issues an unbind request to the server, and then closes the socket.

Throws:
LDAPException

exists

public abstract boolean exists(java.lang.String sSearchString)
                        throws LDAPException

Check whether or not an LDAP entry exists

The directory is searched from the connection string key.
For example if ldapconnect connection property is ldap://192.168.1.1:389/dc=hipergate,dc=org then only entries under "dc=hipergate,dc=org" will be searched

Parameters:
sSearchString - LDAP search string, for example "cn=user@mail.com,dc=publicContacts,dc=my_workarea,dc=my_domain"
Throws:
LDAPException

dropAll

public abstract void dropAll()
                      throws LDAPException
Drop an entire LDAP directory

Throws:
LDAPException
java.lang.IllegalStateException - If not connected to LDAP

addAddress

public abstract void addAddress(java.sql.Connection oJdbc,
                                java.lang.String sAddrId)
                         throws LDAPException,
                                java.sql.SQLException

Add an address from v_ldap_contacts view to an LDAP directory

Addresses may be either public or private depending on the value of field v_ldap_contacts.bo_private. If bo_private is zero then the address is public, if bo_private is not zero then the address is private.
Private addresses are only visible to the user that created them.
Public addresses are stored at cn=user@mail.com,dc=publicContacts,dc=workarea_name,dc=domain_name,dc=hipergate,dc=org
Private addresses are stored at cn=user@mail.com,dc=privateContacts,cn=owner_guid,dc=users,dc=domain_name,dc=hipergate,dc=org

Parameters:
oJdbc - JDBC Connection
sAddrId - GUID of address to be added
Throws:
LDAPException - If address already exists at directory
java.sql.SQLException - If sAddrId is not found at v_ldap_contacts SQL view
java.lang.IllegalStateException - If not connected to LDAP

addOrReplaceAddress

public abstract void addOrReplaceAddress(java.sql.Connection oJdbc,
                                         java.lang.String sAddrId)
                                  throws LDAPException,
                                         java.sql.SQLException

Add or replace an Address

This method is the same as addAddress() except that it does not raise an LDAPException if address already exists; in that case address is just replaced.

Parameters:
oJdbc - JDBC Connection
sAddrId - GUID of address to be added or replaced
Throws:
LDAPException
java.sql.SQLException

deleteAddress

public abstract void deleteAddress(java.sql.Connection oJdbc,
                                   java.lang.String sAddrId)
                            throws LDAPException,
                                   java.sql.SQLException
Delete an address from LDAP directory

Parameters:
oJdbc - JDBC Connection
sAddrId - GUID of address to be deleted
Throws:
LDAPException
java.sql.SQLException - If sAddrId is not found at v_ldap_contacts SQL view
java.lang.IllegalStateException - If not connected to LDAP

addUser

public abstract void addUser(java.sql.Connection oJdbc,
                             java.lang.String sUserId)
                      throws LDAPException,
                             java.sql.SQLException

Add a User from v_ldap_users view to an LDAP directory

Users are added under cn=user@mail.com,dc=users,dc=workarea_name,dc=domain_name,dc=hipergate,dc=org

Parameters:
oJdbc - JDBC Connection
sUserId - GUID of user to be added
Throws:
LDAPException
java.sql.SQLException - If sUserId is not found at v_ldap_users SQL view
java.lang.IllegalStateException - If not connected to LDAP

addOrReplaceUser

public abstract void addOrReplaceUser(java.sql.Connection oJdbc,
                                      java.lang.String sUserId)
                               throws LDAPException,
                                      java.sql.SQLException
Add or replace a User from v_ldap_users SQL view to the LDAP directory

Parameters:
oJdbc - JDBC database connection
sUserId - GUID of user to be added or replaced
Throws:
LDAPException
java.sql.SQLException

deleteUser

public abstract void deleteUser(java.sql.Connection oJdbc,
                                java.lang.String sUserId)
                         throws LDAPException,
                                java.sql.SQLException
Delete a User from LDAP directory

Parameters:
oJdbc - JDBC Connection
sUserId - GUID of user to be added
Throws:
LDAPException
java.sql.SQLException - If sUserId is not found at v_ldap_users SQL view

loadDomain

public abstract void loadDomain(java.sql.Connection oJdbc,
                                int iDomainId)
                         throws LDAPException,
                                java.sql.SQLException

Load all users and contact address from a Domain into an LDAP directory

Parameters:
oJdbc - JDBC Connection
iDomainId - Numeric Identifier for Domain
Throws:
LDAPException
java.sql.SQLException

loadWorkArea

public abstract void loadWorkArea(java.sql.Connection oJdbc,
                                  java.lang.String sDomainNm,
                                  java.lang.String sWorkAreaNm)
                           throws LDAPException,
                                  java.sql.SQLException

Load all users and contact address from a WorkArea into an LDAP directory

Parameters:
oJdbc - JDBC Connection
sDomainNm - Name for Domain containing the WorkArea
sWorkAreaNm - WorkArea Name
Throws:
LDAPException
java.sql.SQLException

deleteWorkArea

public abstract void deleteWorkArea(java.lang.String sDomainNm,
                                    java.lang.String sWorkAreaNm)
                             throws LDAPException,
                                    java.lang.IllegalStateException

Delete a WorkArea from the LDAP directory

All entries under dc=sDomainNm,dc=hipergate,dc=org that match dc=sWorkAreaNm are deleted

Parameters:
sDomainNm - Domain Name
sWorkAreaNm - WorkArea Name
Throws:
LDAPException
java.lang.IllegalStateException - If not connected to LDAP

getPartitionName

public java.lang.String getPartitionName()

setPartitionName

public void setPartitionName(java.lang.String sName)

makeName

protected java.lang.String makeName(java.lang.String sPattern,
                                    java.lang.String[] aParams)
                             throws LDAPException
Replace parameters market as $1, $2, ... $n with given values For example: "cn=$1,dc=$2,dc=com" {"partition","domain"} will be returned as "cn=partition,dc=domain,dc=com"

Parameters:
sPattern - Base pattern with dollar parameters
Values - to be replaced at sPattern
Throws:
LDAPException