org.jboss.portal.identity.db
Class HibernateUserModuleImpl

java.lang.Object
  extended by ServiceMBeanSupport
      extended by org.jboss.portal.jems.as.system.AbstractJBossService
          extended by org.jboss.portal.identity.service.IdentityModuleService
              extended by org.jboss.portal.identity.service.UserModuleService
                  extended by org.jboss.portal.identity.db.HibernateUserModuleImpl
All Implemented Interfaces:
UserModule

public class HibernateUserModuleImpl
extends UserModuleService

Version:
$Revision: 5448 $
Author:
Julien Viet

Field Summary
protected  SessionFactory sessionFactory
          .
protected  java.lang.String sessionFactoryJNDIName
          .
 
Fields inherited from class org.jboss.portal.identity.service.IdentityModuleService
moduleType
 
Constructor Summary
HibernateUserModuleImpl()
           
 
Method Summary
 User createUser(java.lang.String userName, java.lang.String password)
          Creates a new user with the specified name.
 User findUserById(java.lang.Object id)
          Retrieve a user by its id.
 User findUserById(java.lang.String id)
          Retrieve a user by its id.
 User findUserByUserName(java.lang.String userName)
          Retrieve a user by its name.
 java.util.Set findUsers(int offset, int limit)
          Get a range of users.
 java.util.Set findUsersFilteredByUserName(java.lang.String filter, int offset, int limit)
          Get a range of users.
protected  Session getCurrentSession()
          Can be subclasses to provide testing in a non JTA environement.
 java.lang.String getSessionFactoryJNDIName()
           
 int getUserCount()
          Returns the number of users.
 void removeUser(java.lang.Object id)
          Remove a user.
 void setSessionFactoryJNDIName(java.lang.String sessionFactoryJNDIName)
           
protected  void startService()
           
protected  void stopService()
           
 
Methods inherited from class org.jboss.portal.identity.service.UserModuleService
fireUserCreatedEvent, fireUserDestroyedEvent
 
Methods inherited from class org.jboss.portal.identity.service.IdentityModuleService
getConnectionJNDIName, getIdentityConfiguration, getIdentityContext, getIdentityEventBroadcaster, getInitOptions, getJNDIName, getModuleType, setConnectionJNDIName, setIdentityContext, setInitOptions, setJNDIName, setModuleType
 
Methods inherited from class org.jboss.portal.jems.as.system.AbstractJBossService
create, destroy, getState, getStateString, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionFactory

protected SessionFactory sessionFactory
.


sessionFactoryJNDIName

protected java.lang.String sessionFactoryJNDIName
.

Constructor Detail

HibernateUserModuleImpl

public HibernateUserModuleImpl()
Method Detail

startService

protected void startService()
                     throws java.lang.Exception
Overrides:
startService in class IdentityModuleService
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Overrides:
stopService in class IdentityModuleService
Throws:
java.lang.Exception

getSessionFactoryJNDIName

public java.lang.String getSessionFactoryJNDIName()

setSessionFactoryJNDIName

public void setSessionFactoryJNDIName(java.lang.String sessionFactoryJNDIName)

findUserByUserName

public User findUserByUserName(java.lang.String userName)
                        throws IdentityException
Description copied from interface: UserModule
Retrieve a user by its name.

Parameters:
userName - the user name
Returns:
the user
Throws:
IdentityException

findUserById

public User findUserById(java.lang.String id)
                  throws java.lang.IllegalArgumentException,
                         IdentityException,
                         NoSuchUserException
Description copied from interface: UserModule
Retrieve a user by its id.

Parameters:
id - the user id
Returns:
the user
Throws:
java.lang.IllegalArgumentException - if the id is null or not in the good format
IdentityException
NoSuchUserException

findUserById

public User findUserById(java.lang.Object id)
                  throws java.lang.IllegalArgumentException,
                         IdentityException,
                         NoSuchUserException
Description copied from interface: UserModule
Retrieve a user by its id.

Parameters:
id - the user id
Returns:
the user
Throws:
java.lang.IllegalArgumentException - if the id is null
IdentityException
NoSuchUserException

createUser

public User createUser(java.lang.String userName,
                       java.lang.String password)
                throws IdentityException
Description copied from interface: UserModule
Creates a new user with the specified name.

Returns:
the user
Throws:
IdentityException

removeUser

public void removeUser(java.lang.Object id)
                throws IdentityException
Description copied from interface: UserModule
Remove a user.

Parameters:
id - the user id
Throws:
IdentityException

findUsers

public java.util.Set findUsers(int offset,
                               int limit)
                        throws IdentityException
Description copied from interface: UserModule
Get a range of users.

Parameters:
offset - the offset of the first result to retrieve
limit - the maximum number of users to retrieve
Returns:
the user set
Throws:
IdentityException

findUsersFilteredByUserName

public java.util.Set findUsersFilteredByUserName(java.lang.String filter,
                                                 int offset,
                                                 int limit)
                                          throws IdentityException
Description copied from interface: UserModule
Get a range of users.

Parameters:
filter - a string filter applied to the user name.
offset - the offset of the frist result to retrieve
limit - the maximum number of users to retrieve
Returns:
the user set
Throws:
IdentityException

getUserCount

public int getUserCount()
                 throws IdentityException
Description copied from interface: UserModule
Returns the number of users.

Returns:
the number of users
Throws:
IdentityException

getCurrentSession

protected Session getCurrentSession()
                             throws java.lang.IllegalStateException
Can be subclasses to provide testing in a non JTA environement.

Throws:
java.lang.IllegalStateException - if no session factory is present