1 22 23 package org.jboss.ejb3.security; 24 25 import java.security.CodeSource ; 26 import org.jboss.aop.Advisor; 27 import org.jboss.aop.InstanceAdvisor; 28 import org.jboss.aop.advice.AspectFactory; 29 import org.jboss.aop.joinpoint.Joinpoint; 30 import org.jboss.ejb3.EJBContainer; 31 32 36 public class JaccAuthorizationInterceptorFactory implements AspectFactory 37 { 38 public Object createPerVM() 39 { 40 throw new RuntimeException ("PER_VM not supported for this interceptor factory, only PER_CLASS"); 41 } 42 43 public Object createPerClass(Advisor advisor) 44 { 45 try 46 { 47 String contextID = (String ) advisor.getDefaultMetaData().getMetaData("JACC", "ctx"); 48 49 51 CodeSource ejbCS = advisor.getClazz().getProtectionDomain().getCodeSource(); 52 53 String ejbName = ((EJBContainer)advisor).getEjbName(); 54 55 return new JaccAuthorizationInterceptor(ejbName, ejbCS); 56 } 57 catch (Exception e) 58 { 59 throw new RuntimeException (e); 60 } 61 } 62 63 public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor) 64 { 65 throw new RuntimeException ("PER_VM not supported for this interceptor factory, only PER_CLASS"); 66 } 67 68 public Object createPerJoinpoint(Advisor advisor, Joinpoint jp) 69 { 70 throw new RuntimeException ("PER_VM not supported for this interceptor factory, only PER_CLASS"); 71 } 72 73 public Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp) 74 { 75 throw new RuntimeException ("PER_VM not supported for this interceptor factory, only PER_CLASS"); 76 } 77 78 public String getName() 79 { 80 return getClass().getName(); 81 } 82 } 83 84 85 | Popular Tags |