1 22 package org.jboss.ejb; 23 24 import javax.security.jacc.PolicyContextException ; 25 import javax.security.jacc.PolicyContextHandler ; 26 27 31 public class BeanMetaDataPolicyContextHandler implements PolicyContextHandler 32 { 33 public static final String METADATA_CONTEXT_KEY = "org.jboss.ejb.BeanMetaData"; 34 private static ThreadLocal metaDataContext = new ThreadLocal (); 35 36 static void setMetaData(Object metadata) 37 { 38 metaDataContext.set(metadata); 39 } 40 41 47 public Object getContext(String key, Object data) 48 throws PolicyContextException 49 { 50 Object context = null; 51 if( key.equalsIgnoreCase(METADATA_CONTEXT_KEY) == true ) 52 context = metaDataContext.get(); 53 return context; 54 } 55 56 public String [] getKeys() 57 throws PolicyContextException 58 { 59 String [] keys = {METADATA_CONTEXT_KEY}; 60 return keys; 61 } 62 63 public boolean supports(String key) 64 throws PolicyContextException 65 { 66 return key.equalsIgnoreCase(METADATA_CONTEXT_KEY); 67 } 68 } 69 | Popular Tags |