1 22 package org.jboss.ejb.plugins; 23 24 25 import org.jboss.ejb.Container; 26 import org.jboss.ejb.Interceptor; 27 import org.jboss.invocation.Invocation; 28 import org.jboss.logging.Logger; 29 30 import java.lang.reflect.Method ; 31 32 40 public abstract class AbstractInterceptor 41 implements Interceptor 42 { 43 45 47 48 protected Interceptor nextInterceptor; 49 50 protected Logger log = Logger.getLogger(this.getClass()); 51 52 protected Container container; 53 54 56 58 60 62 public void setContainer(Container container) 63 { 64 this.container = container; 65 } 66 67 public Container getContainer() 68 { 69 return container; 70 } 71 72 public void setNext(final Interceptor interceptor) 73 { 74 nextInterceptor = interceptor; 76 } 77 78 public Interceptor getNext() 79 { 80 return nextInterceptor; 81 } 82 83 public void create() throws Exception 84 { 85 } 87 88 public void start() throws Exception 89 { 90 } 92 93 public void stop() 94 { 95 } 97 98 public void destroy() 99 { 100 } 102 103 public Object invokeHome(final Invocation mi) throws Exception 104 { 105 return getNext().invokeHome(mi); 107 } 108 109 public Object invoke(final Invocation mi) throws Exception 110 { 111 return getNext().invoke(mi); 113 } 114 115 123 public boolean isAppException(Invocation invocation, Throwable e) 124 { 125 Method m = invocation.getMethod(); 126 Class [] exceptions = m.getExceptionTypes(); 127 boolean isAppException = false; 128 for(int n = 0; isAppException == false && n < exceptions.length; n ++) 129 { 130 Class exType = exceptions[n]; 131 isAppException = exType.isInstance(e); 132 } 133 return isAppException; 134 } 135 136 } 138 | Popular Tags |