1 23 24 package com.sun.enterprise.security.acl; 25 26 import com.sun.enterprise.deployment.interfaces.SecurityRoleMapperFactory; 27 import com.sun.enterprise.deployment.interfaces.SecurityRoleMapper; 28 import java.util.Map ; 29 import java.util.HashMap ; 30 34 public class RoleMapperFactory implements SecurityRoleMapperFactory { 35 private static Map CONTEXT_TO_APPNAME = new HashMap (); 36 37 public RoleMapperFactory() { 38 } 39 40 44 public SecurityRoleMapper getRoleMapper(String appName) { 45 String contextId = appName; 48 String appname = getAppNameForContext(appName); 49 SecurityRoleMapper srm = null; 50 if(appname != null) 51 srm = RoleMapper.getRoleMapper(appname); 52 if(srm == null){ 53 srm = RoleMapper.getRoleMapper(contextId); 54 } 55 return srm; 56 } 57 58 62 public void removeRoleMapper(String appName) { 63 RoleMapper.removeRoleMapper(appName); 64 } 65 66 71 public void setRoleMapper(String appName, SecurityRoleMapper rmap) { 72 RoleMapper.setRoleMapper(appName, rmap); 73 } 74 75 public String getAppNameForContext(String contextId) { 76 return (String )CONTEXT_TO_APPNAME.get(contextId); 77 } 78 79 public void setAppNameForContext(String appName, String contextId) { 80 CONTEXT_TO_APPNAME.put(contextId, appName); 81 } 82 83 public void removeAppNameForContext(String contextId) { 84 CONTEXT_TO_APPNAME.remove(contextId); 85 } 86 87 } 88 | Popular Tags |