User: reverbel Date: 01/11/26 15:48:44 Modified: iiop/src/main/org/jboss/ejb/plugins/iiop/server IIOPContainerInvoker.java Log: Entity bean's PKs (de)serialization changed to use customized object input/output streams, rather than MarshalledObjects. (The MarshalledObject implementations of toArray()/toObject() are now commented out.) The container invoker now implements the LocalInvoker interface, used by co-located (in-VM) IIOP invocations. Revision Changes Path 1.10 +94 -10 contrib/iiop/src/main/org/jboss/ejb/plugins/iiop/server/IIOPContainerInvoker.java Index: IIOPContainerInvoker.java =================================================================== RCS file: /cvsroot/jboss/contrib/iiop/src/main/org/jboss/ejb/plugins/iiop/server/IIOPContainerInvoker.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- IIOPContainerInvoker.java 2001/11/21 12:24:22 1.9 +++ IIOPContainerInvoker.java 2001/11/26 23:48:44 1.10 @@ -16,6 +16,7 @@ import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.ServerException; +import java.security.Principal; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -35,6 +36,7 @@ import javax.naming.Reference; import javax.naming.spi.ObjectFactory; import javax.rmi.PortableRemoteObject; +import javax.transaction.Transaction; import org.omg.CORBA.Any; import org.omg.CORBA.BAD_OPERATION; @@ -75,6 +77,7 @@ import org.jboss.ejb.plugins.iiop.EJBMetaDataImpl; import org.jboss.ejb.plugins.iiop.HandleImpl; import org.jboss.ejb.plugins.iiop.HomeHandleImpl; +import org.jboss.ejb.plugins.iiop.LocalInvoker; import org.jboss.ejb.plugins.iiop.RmiIdlUtil; import org.jboss.iiop.rmi.AttributeAnalysis; import org.jboss.iiop.rmi.OperationAnalysis; @@ -114,11 +117,11 @@ * CORBA reference for the corresponding <code>EJBObject</code>. * * @author <a href="mailto:[EMAIL PROTECTED]">Francisco Reverbel</a> - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ public class IIOPContainerInvoker extends Servant - implements InvokeHandler, ContainerInvoker + implements InvokeHandler, ContainerInvoker, LocalInvoker { // Constants -------------------------------------------------------------- @@ -621,7 +624,7 @@ InputStream in, ResponseHandler handler) { - System.err.println("EJBObject invocation: " + opName); + //System.err.println("EJBObject invocation: " + opName); ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(container.getClassLoader()); @@ -690,6 +693,51 @@ } } + // Implementation of the interface LocalInvoker ---------------------------- + + public Object invoke(String opName, + Object[] arguments, + Transaction tx, + Principal identity, + Object credential) + throws Exception + { + //System.err.println("EJBObject local invocation: " + opName); + + ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(container.getClassLoader()); + + try { + SkeletonStrategy op = + (SkeletonStrategy) beanMethodInvokerMap.get(opName); + if (op == null) { + throw new BAD_OPERATION(opName); + } + + Object id; + try { + id = toObject(poaCurrent.get_object_id()); + //System.out.println(" id class is " + // + id.getClass().getName()); + } + catch (Exception e) { + e.printStackTrace(System.err); + throw new UnknownException(e); + } + + MethodInvocation mi = new MethodInvocation(id, + op.getMethod(), + arguments, + null, /* tx */ + null, /* identity */ + null /* credential */); + return container.invoke(mi); + } + finally { + Thread.currentThread().setContextClassLoader(oldCl); + } + } + // Static methods ---------------------------------------------------------- /** @@ -820,7 +868,7 @@ { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(os); + ObjectOutputStream oos = new CustomObjectOutputStream(os); oos.writeObject(obj); oos.flush(); @@ -862,9 +910,8 @@ throws IOException, ClassNotFoundException { ByteArrayInputStream is = new ByteArrayInputStream(a); - ObjectInputStream ois = new ObjectInputStream(is); - - + ObjectInputStream ois = new CustomObjectInputStreamWithClassloader(is, + Thread.currentThread().getContextClassLoader()); Object obj = ois.readObject(); is.close(); return obj; @@ -888,7 +935,7 @@ private class HomeServant extends Servant - implements InvokeHandler { + implements InvokeHandler, LocalInvoker { // Implementation of the interface InvokeHandler ------------------------ @@ -909,7 +956,7 @@ InputStream in, ResponseHandler handler) { - System.err.println("EJBHome invocation: " + opName); + //System.err.println("EJBHome invocation: " + opName); ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader( @@ -966,6 +1013,43 @@ Thread.currentThread().setContextClassLoader(oldCl); } } + + // Implementation of the interface LocalInvoker ------------------------- + + public Object invoke(String opName, + Object[] arguments, + Transaction tx, + Principal identity, + Object credential) + throws Exception + { + //System.err.println("EJBHome local invocation: " + opName); + + ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader( + container.getClassLoader()); + + try { + SkeletonStrategy op = + (SkeletonStrategy) beanMethodInvokerMap.get(opName); + if (op == null) { + throw new BAD_OPERATION(opName); + } + + MethodInvocation mi = + new MethodInvocation(null, + op.getMethod(), + arguments, + null, /* tx */ + null, /* identity */ + null /* credential */); + return container.invokeHome(mi); + } + finally { + Thread.currentThread().setContextClassLoader(oldCl); + } + } + } // Inner class HomeFactory ------------------------------------------------- @@ -990,5 +1074,5 @@ EJBHome.class); } } - + }
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development