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