com.pow2.user.dao
Class LDAPUserDAO

java.lang.Object
  extended bycom.pow2.user.dao.LDAPUserDAO
All Implemented Interfaces:
UserDAO

public class LDAPUserDAO
extends Object
implements UserDAO

Author:
Luca Fossato

Field Summary
protected  org.apache.log4j.Category cat
          Log4J category
protected static String KEY_LDAP_BASEDN
          key for ldap server base dn
protected static String KEY_LDAP_HOST
          key for ldap hostname value
protected static String KEY_LDAP_LOGINDN
          key for ldap server login dn
protected static String KEY_LDAP_PASSWD
          key for ldap server password
protected static String KEY_LDAP_PORT
          key for ldap server port value
protected static String KEY_LDAP_USER_EMAIL
          key for the LDAP user email attribute
protected static String KEY_LDAP_USER_FIRSTNAME
          key for the LDAP user first name attribute
protected static String KEY_LDAP_USER_ID
          key for the LDAP user id attribute
protected static String KEY_LDAP_USER_LASTNAME
          key for the LDAP user last name attribute
protected static String KEY_LDAP_USER_LOGIN
          key for the LDAP user login attribute
protected static String KEY_LDAP_USER_PASSWD
          key for the LDAP user passwd attribute
 
Method Summary
protected  void closeConnection(com.novell.ldap.LDAPConnection con)
          disconnect with the server
 void deleteUser(String id)
          Delete the User having the input id from the database.
protected  com.novell.ldap.LDAPConnection getConnection()
          Connect and bind with the LDAP server.
 String getProviderType()
          Get the data provider type
 User getUser(String login, String passwd)
          Update the input User object with the user informations retrieved from the data provider.
 void getUser(User user)
          Get the registered User identified by the input login and passwd properties.
protected static LDAPUserDAO instance()
          Get the unique instance of LDAPUserDAO class.
 boolean loginExists(String login)
          Test if the input login property already exists into the application database.
 boolean loginExists(User user)
          Test if the input user login property already exists into the application database.
 void setUser(User user)
          Persist the user informations into the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected org.apache.log4j.Category cat
Log4J category


KEY_LDAP_HOST

protected static final String KEY_LDAP_HOST
key for ldap hostname value

See Also:
Constant Field Values

KEY_LDAP_PORT

protected static final String KEY_LDAP_PORT
key for ldap server port value

See Also:
Constant Field Values

KEY_LDAP_BASEDN

protected static final String KEY_LDAP_BASEDN
key for ldap server base dn

See Also:
Constant Field Values

KEY_LDAP_LOGINDN

protected static final String KEY_LDAP_LOGINDN
key for ldap server login dn

See Also:
Constant Field Values

KEY_LDAP_PASSWD

protected static final String KEY_LDAP_PASSWD
key for ldap server password

See Also:
Constant Field Values

KEY_LDAP_USER_ID

protected static final String KEY_LDAP_USER_ID
key for the LDAP user id attribute

See Also:
Constant Field Values

KEY_LDAP_USER_LOGIN

protected static final String KEY_LDAP_USER_LOGIN
key for the LDAP user login attribute

See Also:
Constant Field Values

KEY_LDAP_USER_PASSWD

protected static final String KEY_LDAP_USER_PASSWD
key for the LDAP user passwd attribute

See Also:
Constant Field Values

KEY_LDAP_USER_FIRSTNAME

protected static final String KEY_LDAP_USER_FIRSTNAME
key for the LDAP user first name attribute

See Also:
Constant Field Values

KEY_LDAP_USER_LASTNAME

protected static final String KEY_LDAP_USER_LASTNAME
key for the LDAP user last name attribute

See Also:
Constant Field Values

KEY_LDAP_USER_EMAIL

protected static final String KEY_LDAP_USER_EMAIL
key for the LDAP user email attribute

See Also:
Constant Field Values
Method Detail

instance

protected static LDAPUserDAO instance()
Get the unique instance of LDAPUserDAO class.
This method is protected; use UserDAOFactory.getUserDAO() instead.

Returns:
the instance of LDAPUserDAO class

getProviderType

public String getProviderType()
Get the data provider type

Specified by:
getProviderType in interface UserDAO
Returns:
the data provider type

getUser

public User getUser(String login,
                    String passwd)
             throws Exception
Update the input User object with the user informations retrieved from the data provider.
This method uses the User login and passwd properties to execute the login procedure.

Specified by:
getUser in interface UserDAO
Parameters:
login - the user login
passwd - the user password
Returns:
the retrieved User object if the login is succesfull; null if login fails
Throws:
Exception - if any error occurs

getUser

public void getUser(User user)
             throws Exception
Get the registered User identified by the input login and passwd properties.

Specified by:
getUser in interface UserDAO
Parameters:
user - the user object with the login and passwd properties properly set.
Returns:
the registered User object if the login procedure is successful; null otherwise
Throws:
Exception - Description of the Exception

setUser

public void setUser(User user)
             throws Exception
Persist the user informations into the database.
This method updates or insert a new User entry into the database depending on the user id value.

Specified by:
setUser in interface UserDAO
Parameters:
user - the user object to persist into the database
Throws:
Exception - if any error occurs

deleteUser

public void deleteUser(String id)
                throws Exception
Delete the User having the input id from the database.

Specified by:
deleteUser in interface UserDAO
Parameters:
id - the identifier of the user to remove from the database
Throws:
Exception - if any error occurs

loginExists

public boolean loginExists(User user)
                    throws Exception
Test if the input user login property already exists into the application database.

Specified by:
loginExists in interface UserDAO
Parameters:
user - the user object
Returns:
true if the input user login already exists into the application database; false otherwise
Throws:
Exception - if any error occurs

loginExists

public boolean loginExists(String login)
                    throws Exception
Test if the input login property already exists into the application database.

Specified by:
loginExists in interface UserDAO
Parameters:
login - the login string
Returns:
true if the input login already exists into the application database; false otherwise
Throws:
Exception - if any error occurs

getConnection

protected com.novell.ldap.LDAPConnection getConnection()
                                                throws Exception
Connect and bind with the LDAP server.
Connection is done using the LDAP properties retrieved from the Prefs object.

Throws:
Exception

closeConnection

protected void closeConnection(com.novell.ldap.LDAPConnection con)
                        throws Exception
disconnect with the server

Throws:
Exception


Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.