1 25 26 package org.objectweb.easybeans.rpc; 27 28 import static org.objectweb.easybeans.util.marshalling.Serialization.loadObject; 29 import static org.objectweb.easybeans.util.marshalling.Serialization.storeObject; 30 31 import java.io.IOException ; 32 33 import org.objectweb.easybeans.rpc.api.EJBRequest; 34 import org.objectweb.easybeans.rpc.api.RPCException; 35 39 public class JEJBRequest implements EJBRequest { 40 41 44 private static final long serialVersionUID = -3588466669344863787L; 45 46 49 private String methodName = null; 50 51 55 private long methodHash; 56 57 60 private byte[] byteArgs; 61 62 65 private transient Object [] args = null; 66 67 70 private String containerId = null; 71 72 75 private String factoryName = null; 76 77 80 private Long beanId = null; 81 82 92 public JEJBRequest(final String methodName, final long methodHash, final Object [] args, final String containerId, 93 final String factoryName, final Long beanId) throws RPCException { 94 this.methodHash = methodHash; 95 this.methodName = methodName; 96 97 try { 98 byteArgs = storeObject(args); 99 } catch (IOException e) { 100 throw new RPCException("Cannot serialize the arguments of the request.", e); 101 } 102 this.args = args; 103 this.containerId = containerId; 104 this.factoryName = factoryName; 105 this.beanId = beanId; 106 } 107 108 111 public String getMethodName() { 112 return methodName; 113 } 114 115 121 public long getMethodHash() { 122 return methodHash; 123 } 124 125 129 public Object [] getMethodArgs() throws IllegalStateException { 130 if (args == null) { 131 try { 133 args = (Object []) loadObject(byteArgs); 134 } catch (IOException e) { 135 throw new IllegalStateException ("Cannot get arguments of the request", e); 136 } catch (ClassNotFoundException e) { 137 throw new IllegalStateException ("Cannot get arguments of the request", e); 138 } 139 } 140 return args; 141 } 142 143 147 public String getContainerId() { 148 return containerId; 149 } 150 151 154 public String getFactory() { 155 return factoryName; 156 } 157 158 161 public Long getBeanId() { 162 return beanId; 163 } 164 165 } 166 | Popular Tags |