KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > services > security > SecurityCacheService


1 /*
2  * Copyright 2000-2001,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.jetspeed.services.security;
18
19 import java.util.Iterator JavaDoc;
20
21 import org.apache.jetspeed.om.security.Group;
22 import org.apache.jetspeed.om.security.Permission;
23 import org.apache.jetspeed.om.security.Role;
24 import org.apache.turbine.services.Service;
25
26 /**
27  * The Security Cache Service caches roles and permissions (ACLs)
28  *
29  * @author <a HREF="mailto:taylor@apache.org">David Sean Taylor</a>
30  * @version $Id: SecurityCacheService.java,v 1.8 2004/02/23 03:58:11 jford Exp $
31  */

32
33
34 public interface SecurityCacheService extends Service
35 {
36    /** The name of this service */
37    public String JavaDoc SERVICE_NAME = "SecurityCache";
38
39    /*
40     * Loads the security cache for the given user.
41     *
42     * @param username the user to cache all role and permission information for.
43     */

44     public void load(String JavaDoc username)
45         throws JetspeedSecurityException;
46
47     /*
48      * UnLoads the security cache for the given user.
49      *
50      * @param username the user to cache all role and permission information for.
51      */

52     public void unload(String JavaDoc username);
53
54
55     public void loadRolePermissions();
56
57     /**
58      * Retrieves a role from the cache for the given username.
59      *
60      * @param username The name key of the user.
61      * @param roleName The name of the role.
62      */

63     public Role getRole(String JavaDoc username, String JavaDoc roleName);
64     
65     public Role getRole(String JavaDoc username, String JavaDoc roleName, String JavaDoc groupName);
66     
67     /**
68      * Retrieves a role from the cache for the given username.
69      *
70      */

71     public void addRole(Role role);
72
73     public void addRole(String JavaDoc username, Role role);
74     
75     public void addRole(String JavaDoc username, Role role, Group group);
76
77     public boolean hasRole(String JavaDoc username, String JavaDoc roleName);
78     
79     public boolean hasRole(String JavaDoc username, String JavaDoc roleName, String JavaDoc groupName);
80
81     public void removeRole(String JavaDoc username, String JavaDoc roleName);
82     
83     public void removeRole(String JavaDoc username, String JavaDoc roleName, String JavaDoc groupName);
84
85     public Iterator JavaDoc getRoles(String JavaDoc username);
86
87     public CachedAcl getAcl(String JavaDoc username);
88
89     public Permission getPermission(String JavaDoc roleName, String JavaDoc permissionName);
90     
91     public void addPermission(String JavaDoc roleName, Permission permission);
92
93     public boolean hasPermission(String JavaDoc roleName, String JavaDoc permissionName);
94
95     public void removePermission(String JavaDoc roleName, String JavaDoc permissionName);
96
97     public Iterator JavaDoc getPermissions(String JavaDoc roleName);
98
99     public void removeAllRoles(String JavaDoc rolename);
100
101     public void removeAllPermissions(String JavaDoc permissionName);
102
103 }
104
105
106
107
Popular Tags