dain        2005/06/28 04:34:25

  Modified:    modules/core/src/java/org/openejb/corba CORBAHandle.java
                        CorbaApplicationServer.java StandardServant.java
  Log:

  Add primary key to CORBAHandle so we can delete with handle easily
  When copying results, make sure to copy into the correct class loader
  
  Revision  Changes    Path
  1.3       +11 -3     
openejb/modules/core/src/java/org/openejb/corba/CORBAHandle.java
  
  Index: CORBAHandle.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/CORBAHandle.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CORBAHandle.java  25 Jun 2005 07:00:29 -0000      1.2
  +++ CORBAHandle.java  28 Jun 2005 08:34:24 -0000      1.3
  @@ -73,9 +73,11 @@
    */
   public class CORBAHandle implements Handle, Serializable {
       private String ior;
  +    private Object primaryKey;
   
  -    public CORBAHandle(String ior) {
  +    public CORBAHandle(String ior, Object primaryKey) {
           this.ior = ior;
  +        this.primaryKey = primaryKey;
       }
   
       public EJBObject getEJBObject() throws RemoteException {
  @@ -86,14 +88,20 @@
           }
       }
   
  +    public Object getPrimaryKey() {
  +        return primaryKey;
  +    }
  +
       private void writeObject(ObjectOutputStream out) throws IOException {
           HandleDelegate handleDelegate = getHandleDelegate();
           handleDelegate.writeEJBObject(getEJBObject(), out);
  +        out.writeObject(primaryKey);
       }
   
       private void readObject(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
           HandleDelegate handleDelegate = getHandleDelegate();
           EJBObject obj = handleDelegate.readEJBObject(in);
  +        primaryKey = in.readObject();
   
           try {
               ior = getOrb().object_to_string((org.omg.CORBA.Object) obj);
  
  
  
  1.3       +3 -3      
openejb/modules/core/src/java/org/openejb/corba/CorbaApplicationServer.java
  
  Index: CorbaApplicationServer.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/CorbaApplicationServer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CorbaApplicationServer.java       26 Jun 2005 08:17:54 -0000      1.2
  +++ CorbaApplicationServer.java       28 Jun 2005 08:34:25 -0000      1.3
  @@ -87,7 +87,7 @@
       public javax.ejb.Handle getHandle(ProxyInfo proxyInfo) {
           org.omg.CORBA.Object ejbObject = (org.omg.CORBA.Object) 
getEJBObject(proxyInfo);
           String ior = getOrb().object_to_string(ejbObject);
  -        Handle handle = new CORBAHandle(ior);
  +        Handle handle = new CORBAHandle(ior, proxyInfo.getPrimaryKey());
           return handle;
       }
   
  
  
  
  1.9       +20 -5     
openejb/modules/core/src/java/org/openejb/corba/StandardServant.java
  
  Index: StandardServant.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/StandardServant.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardServant.java      26 Jun 2005 08:17:54 -0000      1.8
  +++ StandardServant.java      28 Jun 2005 08:34:25 -0000      1.9
  @@ -242,7 +242,7 @@
                       } else if (method.equals(GETHOMEHANDLE)) {
                           result = ejbContainer.getEjbHome().getHomeHandle();
                       } else if (method.equals(REMOVE_W_HAND)) {
  -                        Handle handle = (Handle) arguments[0];
  +                        CORBAHandle handle = (CORBAHandle) arguments[0];
                           try {
                               if 
(ejbContainer.getProxyInfo().isStatelessSessionBean()) {
                                   if (handle == null) {
  @@ -253,10 +253,25 @@
                                       throw new RemoteException("Handle does 
not hold a " + remoteInterface.getName());
                                   }
                               } else {
  -                                EJBObject ejbObject = handle.getEJBObject();
  -                                ejbObject.remove();
  +                                // create the invocation object
  +                                EJBInvocation invocation = new 
EJBInvocationImpl(ejbInterfaceType, handle.getPrimaryKey(), index, arguments);
  +
  +                                // invoke the container
  +                                InvocationResult invocationResult = 
ejbContainer.invoke(invocation);
  +
  +                                // process the result
  +                                if (invocationResult.isException()) {
  +                                    // all other exceptions are written to 
stream
  +                                    // if this is an unknown exception type 
it will
  +                                    // be thrown out of writeException
  +                                    return Util.writeUserException(method, 
reply, invocationResult.getException());
  +                                }
  +                                invocationResult.getResult();
  +//
  +//                                
ejbContainer.getEjbHome().remove(handle.getPrimaryKey());
                               }
                           } catch (RemoveException e) {
  +
                               return Util.writeUserException(method, reply, e);
                           }
                           result = null;
  
  
  

Reply via email to