1 4 5 package org.jfox.ejb.connector; 6 7 import org.jfox.ioc.connector.AbstractHandler; 8 import org.jfox.ioc.connector.Container; 9 import org.jfox.ioc.connector.Invocation; 10 11 15 16 public class EJBHandler extends AbstractHandler { 17 18 public EJBHandler(Container container) { 19 super(container); 20 } 21 22 public Class getInvocationClass() { 23 return EJBInvocation.class; 24 } 25 26 public Object execute(Invocation invocation) throws Throwable { 27 if(!isInitialized()) { 28 throw new Exception ("Handler not started."); 29 } 30 ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); 31 35 ClassLoader cl = this.getClass().getClassLoader(); 36 Thread.currentThread().setContextClassLoader(cl); 37 try { 38 return doExecute(invocation); 39 } 40 finally { 41 Thread.currentThread().setContextClassLoader(oldCl); 42 } 43 44 } 45 46 52 protected Object doExecute(Invocation invocation) throws Throwable { 53 61 return ((EJBContainer)getContainer()).invoke((EJBInvocation)invocation); 62 } 63 64 public static void main(String [] args) { 65 66 } 67 } 68 | Popular Tags |