1 22 package org.jboss.resource.adapter.jdbc.remote; 23 24 import org.jboss.invocation.Invocation; 25 import org.jboss.proxy.Interceptor; 26 27 import java.io.InputStream ; 28 import java.io.Reader ; 29 import java.lang.reflect.Method ; 30 31 35 public class StatementInterceptor extends Interceptor 36 { 37 static final long serialVersionUID = -8069364664602119774L; 38 39 public Object invoke(Invocation mi) throws Throwable 40 { 41 Method m = mi.getMethod(); 42 String methodName = m.getName(); 43 44 if (methodName.equals("setAsciiStream") || 45 methodName.equals("setBinaryStream")) 46 { 47 Object [] args = mi.getArguments(); 48 InputStream ins = (InputStream ) args[1]; 49 args[1] = new SerializableInputStream(ins); 50 } 51 else if (methodName.equals("setCharacterStream")) 52 { 53 Object [] args = mi.getArguments(); 54 Reader rdr = (Reader ) args[1]; 55 args[1] = new SerializableReader(rdr); 56 } 57 58 return getNext().invoke(mi); 59 } 60 } | Popular Tags |