KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > wsm > axis > security > model > MemoryUserListImpl


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

22
23 import java.util.Collection JavaDoc;
24 import java.util.Hashtable JavaDoc;
25 import java.util.Map JavaDoc;
26
27 import org.apache.beehive.wsm.axis.security.Group;
28 import org.apache.beehive.wsm.axis.security.User;
29 import org.apache.beehive.wsm.axis.security.UserList;
30 import org.apache.beehive.wsm.axis.security.Role;
31
32 public class MemoryUserListImpl implements UserList {
33
34     private Map JavaDoc<String JavaDoc,User> users;
35     private Map JavaDoc<String JavaDoc,Group> groups;
36     private Map JavaDoc<String JavaDoc,Role> roles;
37
38     public MemoryUserListImpl()
39     {
40         users = new Hashtable JavaDoc<String JavaDoc,User>();
41         groups = new Hashtable JavaDoc<String JavaDoc,Group>();
42         roles = new Hashtable JavaDoc<String JavaDoc,Role>();
43     }
44
45     public void addUser ( User user )
46     {
47         users.put(user.getName(), user);
48     }
49
50     public User getUser ( String JavaDoc name )
51     {
52         return users.get( name );
53     }
54
55     public Collection JavaDoc<User> getUsers ()
56     {
57         return users.values();
58     }
59
60
61     public void addGroup ( Group group )
62     {
63         groups.put(group.getName(), group );
64     }
65
66     public Group getGroup ( String JavaDoc name )
67     {
68         return groups.get( name );
69     }
70
71     public Collection JavaDoc<Group> getGroups ()
72     {
73         return groups.values();
74     }
75
76
77     public void addRole ( Role role )
78     {
79         roles.put(role.getName(), role);
80     }
81
82     public Role getRole ( String JavaDoc role )
83     {
84         return roles.get( role );
85     }
86
87     public Collection JavaDoc<Role> getRoles ()
88     {
89         return roles.values();
90     }
91
92 }
93
94
Popular Tags