1 25 26 package org.objectweb.easybeans.security.jacc.provider; 27 28 import java.util.HashMap ; 29 import java.util.Map ; 30 31 import javax.security.jacc.PolicyContextException ; 32 33 38 public final class JPolicyConfigurationKeeper { 39 40 43 private static Map <String , JPolicyConfiguration> policyConfigurations = new HashMap <String , JPolicyConfiguration>(); 44 45 48 private JPolicyConfigurationKeeper() { 49 } 50 51 55 public static void addConfiguration(final 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(final 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(final String contextId) { 83 return policyConfigurations.get(contextId); 84 } 85 } 86 | Popular Tags |