1 18 package org.apache.geronimo.interop.security; 19 20 import java.util.HashMap ; 21 22 import org.apache.geronimo.interop.properties.StringProperty; 23 24 25 public class Role { 26 public static Role getInstance(String rolename) { 27 Role role = (Role) _roleMap.get(rolename); 28 if (role == null) { 29 synchronized (_roleMap) { 30 role = (Role) _roleMap.get(rolename); 31 if (role == null) { 32 role = new Role(); 33 role.init(rolename); 34 _roleMap.put(rolename, role); 35 } 36 } 37 } 38 return role; 39 } 40 41 public static Role getExistingInstance(String rolename) { 42 return (Role) _roleMap.get(rolename); 43 } 44 45 47 public static final StringProperty assignedRolesProperty = 48 new StringProperty(Role.class, "assignedRoles") 49 .displayName("Assigned Roles") 50 .consoleHelp("Names of roles which have been explicitly assigned to this role.") 51 .list() 52 .sortOrder(1); 53 54 public static final StringProperty excludedRolesProperty = 55 new StringProperty(Role.class, "excludedRoles") 56 .displayName("Excluded Roles") 57 .consoleHelp("Names of roles which must be excluded from this role.") 58 .list() 59 .sortOrder(2); 60 61 public static final StringProperty excludedUsersProperty = 62 new StringProperty(Role.class, "excludedUsers") 63 .displayName("Excluded Users") 64 .consoleHelp("Names of users who must be excluded from this role.") 65 .list() 66 .sortOrder(3); 67 68 public static final StringProperty inheritedRolesProperty = 69 new StringProperty(Role.class, "inheritedRoles") 70 .displayName("Inherited Roles") 71 .consoleHelp("Names of roles which have been inherited from this role's assigned roles. This list is read only. It is derived from the assigned roles.") 72 .list() 73 .readOnly() 74 .sortOrder(4); 75 76 public static final StringProperty roleMembersProperty = 77 new StringProperty(Role.class, "roleMembers") 78 .displayName("Role Members") 79 .consoleHelp("Names of users who have been assigned this role, or who have inherited it from an assigned role. This list is read only. To add a user to a role, please edit the user's properties") 80 .list() 81 .readOnly() 82 .sortOrder(5); 83 84 86 public static final String CLIENT = "[client]"; 87 88 public static final String SYSTEM = "[system]"; 89 90 92 private static HashMap _roleMap = new HashMap (); 93 94 private String _name; 95 96 98 protected void init(String rolename) { 99 _name = rolename; 100 } 101 102 104 public String getName() { 105 return _name; 106 } 107 108 public String toString() { 109 return super.toString() + ":" + _name; 110 } 111 } 112 | Popular Tags |