1 22 package org.jboss.invocation.unified.marshall; 23 24 import org.jboss.remoting.marshal.serializable.SerializableUnMarshaller; 25 import org.jboss.remoting.marshal.UnMarshaller; 26 import org.jboss.remoting.marshal.UnMarshallerDecorator; 27 import org.jboss.remoting.InvocationRequest; 28 import org.jboss.invocation.MarshalledInvocation; 29 import org.jboss.tm.TransactionPropagationContextUtil; 30 import org.jboss.tm.TransactionPropagationContextImporter; 31 32 import java.io.InputStream ; 33 import java.io.IOException ; 34 import java.util.Map ; 35 36 42 public class InvocationUnMarshaller extends SerializableUnMarshaller implements UnMarshallerDecorator 43 { 44 public final static String DATATYPE = "invocation"; 45 46 public Object read(InputStream inputStream, Map metadata) throws IOException , ClassNotFoundException 47 { 48 Object ret = super.read(inputStream, metadata); 49 50 51 return removeDecoration(ret); 52 } 53 54 public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException 55 { 56 InvocationUnMarshaller unmarshaller = new InvocationUnMarshaller(); 57 unmarshaller.setClassLoader(this.customClassLoader); 58 return unmarshaller; 59 } 60 61 public Object removeDecoration(Object obj) throws IOException 62 { 63 if(obj instanceof InvocationRequest) 64 { 65 InvocationRequest remoteInv = (InvocationRequest) obj; 66 Object param = remoteInv.getParameter(); 67 68 if(param instanceof MarshalledInvocation) 69 { 70 MarshalledInvocation mi = (MarshalledInvocation) param; 71 Object txCxt = mi.getTransactionPropagationContext(); 72 if(txCxt != null) 73 { 74 TransactionPropagationContextImporter tpcImporter = TransactionPropagationContextUtil.getTPCImporter(); 75 mi.setTransaction(tpcImporter.importTransactionPropagationContext(txCxt)); 76 } 77 } 78 } 79 return obj; 80 } 81 82 } | Popular Tags |