org.apache.jetspeed.services.security
Class SecurityCacheImpl

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.jetspeed.services.security.SecurityCacheImpl
All Implemented Interfaces:
org.apache.turbine.services.Initable, javax.jms.MessageListener, SecurityCacheService, org.apache.turbine.services.Service

public class SecurityCacheImpl
extends org.apache.turbine.services.TurbineBaseService
implements SecurityCacheService, javax.jms.MessageListener

The Security Cache Service caches roles and permissions (ACLs)

Version:
$Id: SecurityCacheImpl.java,v 1.12 2004/07/29 03:45:35 jford Exp $
Author:
David Sean Taylor, Mark Orciuch

Field Summary
protected  java.util.Map acls
           
protected  java.util.Map perms
           
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.jetspeed.services.security.SecurityCacheService
SERVICE_NAME
 
Constructor Summary
SecurityCacheImpl()
           
 
Method Summary
 void addPermission(java.lang.String roleName, Permission permission)
           
 void addRole(Role role)
          Retrieves a role from the cache for the given username.
 void addRole(java.lang.String username, Role role)
           
 void addRole(java.lang.String username, Role role, Group group)
           
 CachedAcl getAcl(java.lang.String username)
           
 Permission getPermission(java.lang.String roleName, java.lang.String permissionName)
           
 java.util.Iterator getPermissions(java.lang.String roleName)
           
 Role getRole(java.lang.String roleName)
           
 Role getRole(java.lang.String username, java.lang.String roleName)
          Retrieves a role from the cache for the given username.
 Role getRole(java.lang.String username, java.lang.String roleName, java.lang.String groupName)
           
 java.util.Iterator getRoles(java.lang.String username)
           
protected static SecurityCacheService getService()
           
 boolean hasPermission(java.lang.String roleName, java.lang.String permissionName)
           
 boolean hasRole(java.lang.String username, java.lang.String roleName)
           
 boolean hasRole(java.lang.String username, java.lang.String roleName, java.lang.String groupName)
           
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
 void load(java.lang.String username)
           
 void loadRolePermissions()
           
 void loadRolePermissions(java.lang.String roleName)
           
 void onMessage(javax.jms.Message message)
           
 void removeAllGroups(java.lang.String groupName)
           
 void removeAllPermissions(java.lang.String permissionName)
           
 void removeAllRoles(java.lang.String rolename)
          This method is called when a role has been removed from the system.
 void removePermission(java.lang.String roleName, java.lang.String permissionName)
           
 void removeRole(java.lang.String username, java.lang.String roleName)
          This method is called to remove a role from a user's acl in the default group
 void removeRole(java.lang.String username, java.lang.String roleName, java.lang.String groupName)
          This method is called to remove a role from a user's acl in the specified group
 void unload(java.lang.String username)
           
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init, shutdown
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
 

Field Detail

acls

protected java.util.Map acls

perms

protected java.util.Map perms
Constructor Detail

SecurityCacheImpl

public SecurityCacheImpl()
Method Detail

getService

protected static SecurityCacheService getService()

load

public void load(java.lang.String username)
          throws JetspeedSecurityException
Specified by:
load in interface SecurityCacheService
Throws:
JetspeedSecurityException

unload

public void unload(java.lang.String username)
Specified by:
unload in interface SecurityCacheService

getRole

public Role getRole(java.lang.String roleName)

getRole

public Role getRole(java.lang.String username,
                    java.lang.String roleName)
Description copied from interface: SecurityCacheService
Retrieves a role from the cache for the given username.

Specified by:
getRole in interface SecurityCacheService
Parameters:
username - The name key of the user.
roleName - The name of the role.

getRole

public Role getRole(java.lang.String username,
                    java.lang.String roleName,
                    java.lang.String groupName)
Specified by:
getRole in interface SecurityCacheService

addRole

public void addRole(Role role)
Description copied from interface: SecurityCacheService
Retrieves a role from the cache for the given username.

Specified by:
addRole in interface SecurityCacheService

addRole

public void addRole(java.lang.String username,
                    Role role)
Specified by:
addRole in interface SecurityCacheService

addRole

public void addRole(java.lang.String username,
                    Role role,
                    Group group)
Specified by:
addRole in interface SecurityCacheService

hasRole

public boolean hasRole(java.lang.String username,
                       java.lang.String roleName)
Specified by:
hasRole in interface SecurityCacheService

hasRole

public boolean hasRole(java.lang.String username,
                       java.lang.String roleName,
                       java.lang.String groupName)
Specified by:
hasRole in interface SecurityCacheService

removeRole

public void removeRole(java.lang.String username,
                       java.lang.String roleName)
This method is called to remove a role from a user's acl in the default group

Specified by:
removeRole in interface SecurityCacheService

removeRole

public void removeRole(java.lang.String username,
                       java.lang.String roleName,
                       java.lang.String groupName)
This method is called to remove a role from a user's acl in the specified group

Specified by:
removeRole in interface SecurityCacheService

getAcl

public CachedAcl getAcl(java.lang.String username)
Specified by:
getAcl in interface SecurityCacheService

getRoles

public java.util.Iterator getRoles(java.lang.String username)
Specified by:
getRoles in interface SecurityCacheService

getPermission

public Permission getPermission(java.lang.String roleName,
                                java.lang.String permissionName)
Specified by:
getPermission in interface SecurityCacheService

addPermission

public void addPermission(java.lang.String roleName,
                          Permission permission)
Specified by:
addPermission in interface SecurityCacheService

hasPermission

public boolean hasPermission(java.lang.String roleName,
                             java.lang.String permissionName)
Specified by:
hasPermission in interface SecurityCacheService

removePermission

public void removePermission(java.lang.String roleName,
                             java.lang.String permissionName)
Specified by:
removePermission in interface SecurityCacheService

getPermissions

public java.util.Iterator getPermissions(java.lang.String roleName)
Specified by:
getPermissions in interface SecurityCacheService

removeAllRoles

public void removeAllRoles(java.lang.String rolename)
This method is called when a role has been removed from the system. All cached acls will have the role removed.

Specified by:
removeAllRoles in interface SecurityCacheService

removeAllPermissions

public void removeAllPermissions(java.lang.String permissionName)
Specified by:
removeAllPermissions in interface SecurityCacheService

loadRolePermissions

public void loadRolePermissions()
Specified by:
loadRolePermissions in interface SecurityCacheService

init

public void init(javax.servlet.ServletConfig conf)
          throws org.apache.turbine.services.InitializationException
This is the early initialization method called by the Turbine Service framework

Parameters:
conf - The ServletConfig
Throws:
throws - a InitializationException if the service fails to initialize
org.apache.turbine.services.InitializationException

removeAllGroups

public void removeAllGroups(java.lang.String groupName)
See Also:
org.apache.jetspeed.services.security.SecurityCacheService#removeGroup(java.lang.String)

onMessage

public void onMessage(javax.jms.Message message)
Specified by:
onMessage in interface javax.jms.MessageListener
See Also:
MessageListener.onMessage(javax.jms.Message)

loadRolePermissions

public void loadRolePermissions(java.lang.String roleName)


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.