KickJava   Java API By Example, From Geeks To Geeks.

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


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.commons.codec.digest.DigestUtils;
28
29 import org.apache.beehive.wsm.axis.security.User;
30 import org.apache.beehive.wsm.axis.security.Group;
31 import org.apache.beehive.wsm.axis.security.UserList;
32 import org.apache.beehive.wsm.axis.security.Role;
33
34
35 public class MemoryGroupImpl implements Group {
36
37     private String JavaDoc name;
38
39     private Map JavaDoc<String JavaDoc,User> users;
40     private Map JavaDoc<String JavaDoc,Role> roles;
41
42     public MemoryGroupImpl ()
43     {
44         users = new Hashtable JavaDoc<String JavaDoc,User>();
45         roles = new Hashtable JavaDoc<String JavaDoc,Role>();
46     }
47
48     public void setName ( String JavaDoc name )
49     {
50         this.name = name;
51     }
52
53     public String JavaDoc getName ()
54     {
55         return name;
56     }
57
58
59     public void addUser( User user )
60     {
61         users.put(user.getName(), user);
62     }
63
64     public User getUser ( String JavaDoc user )
65     {
66         return users.get(user);
67     }
68
69     public Collection JavaDoc<User> getUsers ()
70     {
71         return users.values();
72     }
73
74
75     public void addRole( Role role )
76     {
77         roles.put(role.getName(), role);
78     }
79
80     public Role getRole ( String JavaDoc role )
81     {
82         return roles.get(role);
83     }
84
85     public Collection JavaDoc<Role> getRoles ()
86     {
87         return roles.values();
88     }
89
90 }
91
92
Popular Tags