org.jboss.portal.identity.db
Class HibernateRoleModuleImpl

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.RoleModuleService
                  extended by org.jboss.portal.identity.db.HibernateRoleModuleImpl
All Implemented Interfaces:
RoleModule

public class HibernateRoleModuleImpl
extends RoleModuleService

Version:
$Revision: 5448 $
Author:
Julien Viet , Thomas Heute , Roy Russo : roy at jboss dot org

Field Summary
protected  SessionFactory sessionFactory
          .
protected  java.lang.String sessionFactoryJNDIName
          .
 
Fields inherited from class org.jboss.portal.identity.service.IdentityModuleService
moduleType
 
Constructor Summary
HibernateRoleModuleImpl()
           
 
Method Summary
 Role createRole(java.lang.String name, java.lang.String displayName)
          Create a new role with the specified name.
 Role findRoleById(java.lang.Object id)
          Retrieves a role by its id.
 Role findRoleById(java.lang.String id)
          Retrieves a role by its id.
 Role findRoleByName(java.lang.String name)
          Retrieves a role by its name
 java.util.Set findRoleMembers(java.lang.String roleName, int offset, int limit, java.lang.String userNameFilter)
           
 java.util.Set findRoles()
          Get all the roles
 java.util.Set findRolesByNames(java.lang.String[] names)
          Retrieve a collection of role from the role names.
protected  Session getCurrentSession()
          Can be subclasses to provide testing in a non JTA environement.
 java.util.Set getRoles(User user)
           
 int getRolesCount()
          Returns the number of roles.
 java.lang.String getSessionFactoryJNDIName()
           
 void removeRole(java.lang.Object id)
          Remove a role.
 void setRoles(User user, java.util.Set roles)
           
 void setSessionFactoryJNDIName(java.lang.String sessionFactoryJNDIName)
           
protected  void startService()
           
protected  void stopService()
           
 
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

HibernateRoleModuleImpl

public HibernateRoleModuleImpl()
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)

findRoleByName

public Role findRoleByName(java.lang.String name)
                    throws IdentityException
Description copied from interface: RoleModule
Retrieves a role by its name

Parameters:
name - the role name
Returns:
the role
Throws:
IdentityException

findRolesByNames

public java.util.Set findRolesByNames(java.lang.String[] names)
                               throws IdentityException
Description copied from interface: RoleModule
Retrieve a collection of role from the role names.

Parameters:
names - the role names
Returns:
a collection of roles
Throws:
IdentityException

findRoleById

public Role findRoleById(java.lang.String id)
                  throws java.lang.IllegalArgumentException,
                         IdentityException
Description copied from interface: RoleModule
Retrieves a role by its id.

Parameters:
id - the role id
Returns:
the role
Throws:
java.lang.IllegalArgumentException
IdentityException

findRoleById

public Role findRoleById(java.lang.Object id)
                  throws IdentityException
Description copied from interface: RoleModule
Retrieves a role by its id.

Parameters:
id - the role id
Returns:
the role
Throws:
IdentityException

createRole

public Role createRole(java.lang.String name,
                       java.lang.String displayName)
                throws IdentityException
Description copied from interface: RoleModule
Create a new role with the specified name.

Parameters:
name - the role name
displayName - the role display name
Returns:
the role
Throws:
IdentityException

removeRole

public void removeRole(java.lang.Object id)
                throws IdentityException
Description copied from interface: RoleModule
Remove a role.

Parameters:
id - the role id
Throws:
IdentityException

getRolesCount

public int getRolesCount()
                  throws IdentityException
Description copied from interface: RoleModule
Returns the number of roles.

Returns:
the number of roles
Throws:
IdentityException

findRoles

public java.util.Set findRoles()
                        throws IdentityException
Description copied from interface: RoleModule
Get all the roles

Returns:
the roles
Throws:
IdentityException

findRoleMembers

public java.util.Set findRoleMembers(java.lang.String roleName,
                                     int offset,
                                     int limit,
                                     java.lang.String userNameFilter)
                              throws IdentityException
Throws:
IdentityException

setRoles

public void setRoles(User user,
                     java.util.Set roles)
              throws IdentityException
Throws:
IdentityException

getRoles

public java.util.Set getRoles(User user)
                       throws IdentityException
Throws:
IdentityException

getCurrentSession

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