1 26 package org.objectweb.jonas_lib.security.jacc; 27 28 import java.util.HashMap ; 29 import java.util.Map ; 30 31 import javax.security.jacc.PolicyContextException ; 32 33 38 public class JPolicyConfigurationKeeper { 39 40 43 private static Map policyConfigurations = new HashMap (); 44 45 48 private JPolicyConfigurationKeeper() { 49 } 50 51 55 public static void addConfiguration(JPolicyConfiguration config) { 56 try { 57 policyConfigurations.put(config.getContextID(), config); 58 } catch (PolicyContextException pce) { 59 throw new RuntimeException ("Cannot add the policy configuration object '" + config + "'"); 60 } 61 } 62 63 67 public static void removeConfiguration(JPolicyConfiguration config) { 68 try { 69 if (policyConfigurations.containsKey(config.getContextID())) { 70 policyConfigurations.remove(config.getContextID()); 71 } 72 } catch (PolicyContextException pce) { 73 throw new RuntimeException ("Cannot remove the policy configuration object '" + config + "'"); 74 } 75 } 76 77 82 public static JPolicyConfiguration getConfiguration(String contextId) { 83 return (JPolicyConfiguration) policyConfigurations.get(contextId); 84 } 85 } | Popular Tags |