toolbox.services.ldap.simple
Class SimpleUserServiceImpl

Package class diagram package SimpleUserServiceImpl
java.lang.Object
  extended by toolbox.services.BaseService
      extended by toolbox.services.ldap.LDAPService
          extended by toolbox.services.ldap.simple.SimpleUserServiceImpl
All Implemented Interfaces:
SimpleUserService, Service

public class SimpleUserServiceImpl
extends LDAPService
implements SimpleUserService

The default implementation of the SimpleUserService interface.


Constructor Summary
SimpleUserServiceImpl()
          Default constructor.
 
Method Summary
 void addUser(SimpleUser user)
          Add a user to the directory.
 void bind(java.lang.String uid, java.lang.String password)
          Perform a bind using the provided uid and password values.
 void create(java.lang.String name, java.lang.String confHome, ServiceEnvironment env, XMLProperties xmlProps)
          Create this service.
 java.util.List findUsers(SimpleUser params)
          Find users in the directory making use of populate properties in the given SimpleUser instance.
 java.util.List getGroupNames(java.lang.String uid)
          Return a List of the group names that the given uid belongs to.
 SimpleUser getUser(java.lang.String uid)
          Return a single user entry from the directory.
 SimpleUser getUserByDn(java.lang.String dn)
          Return a single user entry from the directory using the DN value.
 void removeUser(java.lang.String uid)
          Remove a user from the directory.
 void setSimpleGroupService(SimpleGroupService grpSvc)
          Injection point for the SimpleGroupService dependency.
 void updateUser(SimpleUser user)
          Update a user in the directory.
 
Methods inherited from class toolbox.services.ldap.LDAPService
destroy, getLDAPWorker, search, search
 
Methods inherited from class toolbox.services.BaseService
getConfigHome, getName, getProperties, getProperty, getXMLProperties, logConfig, logFine, logFiner, logFinest, logInfo, logSevere, logWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleUserServiceImpl

public SimpleUserServiceImpl()
Default constructor.

Method Detail

create

public void create(java.lang.String name,
                   java.lang.String confHome,
                   ServiceEnvironment env,
                   XMLProperties xmlProps)
            throws ServiceException
Create this service.

Specified by:
create in interface Service
Overrides:
create in class LDAPService
Parameters:
name - The name of the service.
confHome - The path to the configuration home directory.
env - ServiceEnvironment of this service.
xmlProps - XML configuration properties.
Throws:
ServiceException - if the service cannot be created.

addUser

public void addUser(SimpleUser user)
             throws SimpleUserException
Add a user to the directory.

Specified by:
addUser in interface SimpleUserService
Parameters:
user - SimpleUser instance to add to the directory.
Throws:
SimpleUserException - if the user cannot be added.

updateUser

public void updateUser(SimpleUser user)
                throws SimpleUserException
Update a user in the directory.

Specified by:
updateUser in interface SimpleUserService
Parameters:
user - SimpleUser instance to update in the directory.
Throws:
SimpleUserException - if the the user cannot be updated.

getUser

public SimpleUser getUser(java.lang.String uid)
                   throws SimpleUserException
Return a single user entry from the directory.

Specified by:
getUser in interface SimpleUserService
Parameters:
uid - String containing the uid of the user to return.
Returns:
SimpleUser instance.
Throws:
SimpleUserException - if the user cannot be returned.

getUserByDn

public SimpleUser getUserByDn(java.lang.String dn)
                       throws SimpleUserException
Return a single user entry from the directory using the DN value.

Specified by:
getUserByDn in interface SimpleUserService
Parameters:
dn - String containing the dn of the user to return.
Returns:
SimpleUser instance.
Throws:
SimpleUserException - if the user cannot be returned.

removeUser

public void removeUser(java.lang.String uid)
                throws SimpleUserException
Remove a user from the directory.

Specified by:
removeUser in interface SimpleUserService
Parameters:
uid - String containing the uid of the user to remove.
Throws:
SimpleUserException - if the user cannot be removed.

findUsers

public java.util.List findUsers(SimpleUser params)
                         throws SimpleUserException
Find users in the directory making use of populate properties in the given SimpleUser instance.

Specified by:
findUsers in interface SimpleUserService
Parameters:
params - SimpleUser instance containing the properties to search on.
Returns:
List containing SimpleUser instances.
Throws:
SimpleUserException - if the search cannot be performed.

getGroupNames

public java.util.List getGroupNames(java.lang.String uid)
                             throws SimpleUserException
Return a List of the group names that the given uid belongs to.

Specified by:
getGroupNames in interface SimpleUserService
Parameters:
uid - String containing the uid to use in the group search.
Returns:
List containing the group names.
Throws:
SimpleUserException

bind

public void bind(java.lang.String uid,
                 java.lang.String password)
          throws SimpleUserException
Perform a bind using the provided uid and password values. This is useful to perform simple authentication.

Specified by:
bind in interface SimpleUserService
Parameters:
uid - String containing uid that must be used during the bind.
password - String containing the password to use.
Throws:
java.lang.Exception - if the bind is unsuccessful.
SimpleUserException

setSimpleGroupService

public void setSimpleGroupService(SimpleGroupService grpSvc)
Injection point for the SimpleGroupService dependency.

Parameters:
grpSvc - SimpleGroupService instance.