dain 2005/06/25 23:11:23
Modified: modules/core/src/java/org/openejb/corba/util
ClientContextHolderStub.java
Log:
Handles and EJB objects can now be passed over corba
Revision Changes Path
1.5 +22 -2
openejb/modules/core/src/java/org/openejb/corba/util/ClientContextHolderStub.java
Index: ClientContextHolderStub.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/util/ClientContextHolderStub.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ClientContextHolderStub.java 24 Jun 2005 07:54:14 -0000 1.4
+++ ClientContextHolderStub.java 26 Jun 2005 03:11:23 -0000 1.5
@@ -44,8 +44,13 @@
*/
package org.openejb.corba.util;
+import javax.naming.Context;
+import javax.naming.InitialContext;
import javax.rmi.CORBA.Stub;
+import javax.ejb.EJBHome;
+import org.omg.CORBA.ORB;
+import org.openejb.corba.CORBAEJBMemento;
import org.openejb.corba.ClientContext;
import org.openejb.corba.ClientContextHolder;
import org.openejb.corba.ClientContextManager;
@@ -62,6 +67,21 @@
public ClientContext getClientContext() {
return clientContext;
+ }
+
+ public final Object writeReplace() {
+ String ior = getOrb().object_to_string(this);
+ return new CORBAEJBMemento(ior, this instanceof EJBHome);
+ }
+
+ private static ORB getOrb() {
+ try {
+ Context context = new InitialContext();
+ ORB orb = (ORB) context.lookup("java:comp/ORB");
+ return orb;
+ } catch (Throwable e) {
+ throw new org.omg.CORBA.MARSHAL("Cound not find ORB in jndi at
java:comp/ORB", 0, org.omg.CORBA.CompletionStatus.COMPLETED_YES);
+ }
}
}