com.knowgate.ldap
Class LDAPNovell

java.lang.Object
  extended by com.knowgate.ldap.LDAPModel
      extended by com.knowgate.ldap.LDAPNovell

public class LDAPNovell
extends LDAPModel

Very Basic LDAP interface API implementation


Field Summary
 
Fields inherited from class com.knowgate.ldap.LDAPModel
ACCOUNT_CANCELLED, ACCOUNT_DEACTIVATED, DOMAIN_NOT_FOUND, INTERNAL_ERROR, INVALID_PASSWORD, organizationalUnitPattern, PASSWORD_EXPIRED, PWD_CLEAR_TEXT, PWD_DTIP_RC4, SESSION_EXPIRED, USER_NOT_FOUND, WORKAREA_NOT_FOUND, WORKAREA_NOT_SET
 
Constructor Summary
LDAPNovell()
           
 
Method Summary
 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.
 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.
 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
 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
 void bind(java.lang.String sUser, java.lang.String sPass)
          Synchronously authenticates to the LDAP server using LDAP_V3.
 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.
 void connectAndBind(java.util.Properties oProps)
          Connect to LDAP Server using a Properties object
 void deleteAddress(java.sql.Connection oJdbc, java.lang.String sAddrId)
          Delete an address from LDAP directory
 void deleteUser(java.sql.Connection oJdbc, java.lang.String sUserId)
          Delete a User from LDAP directory
 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
 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.
 void dropAll()
          Drop an entire LDAP directory
 boolean exists(java.lang.String sSearchString)
          Check whether or not an LDAP entry exists The directory is searched from the connection string key.
 void loadDomain(java.sql.Connection oJdbc, int iDomainId)
          Load all users and contact address from a Domain into an LDAP directory
 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
static void main(java.lang.String[] argv)
           
 
Methods inherited from class com.knowgate.ldap.LDAPModel
getPartitionName, makeName, setPartitionName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPNovell

public LDAPNovell()
Method Detail

connect

public 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.

Specified by:
connect in class LDAPModel
Parameters:
sConnStr - ldap://host:port/distinguished_name
Example "ldap://fobos.kg.int:389/dc=hipergate,dc=org"
Throws:
LDAPException

connectAndBind

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

Connect to LDAP Server using a Properties object

Specified by:
connectAndBind in class LDAPModel
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

disconnect

public 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.

Specified by:
disconnect in class LDAPModel
Throws:
LDAPException

bind

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

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.

Specified by:
bind in class LDAPModel
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

exists

public 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

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

addAddress

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

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

Specified by:
addAddress in class LDAPModel
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 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.

Specified by:
addOrReplaceAddress in class LDAPModel
Parameters:
oJdbc - JDBC Connection
sAddrId - GUID of address to be added or replaced
Throws:
LDAPException
java.sql.SQLException

deleteAddress

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

Specified by:
deleteAddress in class LDAPModel
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 void addUser(java.sql.Connection oJdbc,
                    java.lang.String sUserId)
             throws LDAPException,
                    java.sql.SQLException,
                    java.lang.IllegalStateException

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

Specified by:
addUser in class LDAPModel
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 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

Specified by:
addOrReplaceUser in class LDAPModel
Parameters:
oJdbc - JDBC database connection
sUserId - GUID of user to be added or replaced
Throws:
LDAPException
java.sql.SQLException

deleteUser

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

Specified by:
deleteUser in class LDAPModel
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 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

Specified by:
loadDomain in class LDAPModel
Parameters:
oJdbc - JDBC Connection
iDomainId - Numeric Identifier for Domain
Throws:
LDAPException
java.sql.SQLException

loadWorkArea

public 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

Specified by:
loadWorkArea in class LDAPModel
Parameters:
oJdbc - JDBC Connection
sDomainNm - Name for Domain containing the WorkArea
sWorkAreaNm - WorkArea Name
Throws:
LDAPException
java.sql.SQLException

deleteWorkArea

public 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

Specified by:
deleteWorkArea in class LDAPModel
Parameters:
sDomainNm - Domain Name
sWorkAreaNm - WorkArea Name
Throws:
LDAPException
java.lang.IllegalStateException - If not connected to LDAP

dropAll

public void dropAll()
             throws LDAPException,
                    java.lang.IllegalStateException
Drop an entire LDAP directory

Specified by:
dropAll in class LDAPModel
Throws:
LDAPException
java.lang.IllegalStateException - If not connected to LDAP

main

public static void main(java.lang.String[] argv)
                 throws java.lang.ClassNotFoundException,
                        java.io.IOException,
                        java.sql.SQLException,
                        LDAPException
Throws:
java.lang.ClassNotFoundException
java.io.IOException
java.sql.SQLException
LDAPException