コード例 #1
0
  @Test
  public void testUnExport() throws Exception {
    RMITestImpl servant = new RMITestImpl();

    assertNotNull(Util.getTie(servant));

    PortableRemoteObject.unexportObject(servant);

    assertNull(Util.getTie(servant));
  }
コード例 #2
0
 public Revokedconsent create(String arg0, String arg1) throws CreateException, RemoteException {
   while (true) {
     if (!Util.isLocal(this)) {
       InputStream in = null;
       try {
         try {
           org.omg.CORBA_2_3.portable.OutputStream out =
               (org.omg.CORBA_2_3.portable.OutputStream)
                   _request("create__CORBA_WStringValue__CORBA_WStringValue", true);
           out.write_value(arg0, String.class);
           out.write_value(arg1, String.class);
           in = (InputStream) _invoke(out);
           return (Revokedconsent) in.read_Object(Revokedconsent.class);
         } catch (ApplicationException ex) {
           in = (InputStream) ex.getInputStream();
           String id = in.read_string();
           if (id.equals("IDL:javax/ejb/CreateEx:1.0")) {
             throw (CreateException) in.read_value(CreateException.class);
           }
           throw new UnexpectedException(id);
         } catch (RemarshalException ex) {
           continue;
         }
       } catch (SystemException ex) {
         throw Util.mapSystemException(ex);
       } finally {
         _releaseReply(in);
       }
     } else {
       ServantObject so =
           _servant_preinvoke(
               "create__CORBA_WStringValue__CORBA_WStringValue",
               com.ardais.bigr.iltds.beans.RevokedconsentHome.class);
       if (so == null) {
         continue;
       }
       try {
         Revokedconsent result =
             ((com.ardais.bigr.iltds.beans.RevokedconsentHome) so.servant).create(arg0, arg1);
         return (Revokedconsent) Util.copyObject(result, _orb());
       } catch (Throwable ex) {
         Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
         if (exCopy instanceof CreateException) {
           throw (CreateException) exCopy;
         }
         throw Util.wrapException(exCopy);
       } finally {
         _servant_postinvoke(so);
       }
     }
   }
 }
コード例 #3
0
  /** Returns the maximum stream format version supported by our ValueHandler. */
  public static byte getMaxStreamFormatVersion() {
    ValueHandler vh = Util.createValueHandler();

    if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
      return ORBConstants.STREAM_FORMAT_VERSION_1;
    else return ((ValueHandlerMultiFormat) vh).getMaximumStreamFormatVersion();
  }
 private OutputStream _get_homeHandle(
     org.omg.CORBA_2_3.portable.InputStream in, ResponseHandler reply) throws Throwable {
   HomeHandle result = target.getHomeHandle();
   OutputStream out = reply.createReply();
   Util.writeAbstractObject(out, result);
   return out;
 }
コード例 #5
0
  public PresentationManager.StubFactory createStubFactory(
      String className,
      boolean isIDLStub,
      String remoteCodeBase,
      Class expectedClass,
      ClassLoader classLoader) {
    Class cls = null;

    try {
      cls = Util.loadClass(className, remoteCodeBase, classLoader);
    } catch (ClassNotFoundException exc) {
      throw wrapper.classNotFound3(CompletionStatus.COMPLETED_MAYBE, exc, className);
    }

    PresentationManager pm = ORB.getPresentationManager();

    if (IDLEntity.class.isAssignableFrom(cls) && !Remote.class.isAssignableFrom(cls)) {
      // IDL stubs must always use static factories.
      PresentationManager.StubFactoryFactory sff = pm.getStubFactoryFactory(false);
      PresentationManager.StubFactory sf =
          sff.createStubFactory(className, true, remoteCodeBase, expectedClass, classLoader);
      return sf;
    } else {
      PresentationManager.ClassData classData = pm.getClassData(cls);
      return makeDynamicStubFactory(pm, classData, classLoader);
    }
  }
コード例 #6
0
 private OutputStream _get_primaryKey(
     org.omg.CORBA_2_3.portable.InputStream in, ResponseHandler reply) throws Throwable {
   Object result = target.getPrimaryKey();
   OutputStream out = reply.createReply();
   Util.writeAny(out, result);
   return out;
 }
コード例 #7
0
 public PtsOperation create() throws CreateException, RemoteException {
   while (true) {
     if (!Util.isLocal(this)) {
       InputStream in = null;
       try {
         try {
           OutputStream out = _request("create", true);
           in = (InputStream) _invoke(out);
           return (PtsOperation) in.read_Object(PtsOperation.class);
         } catch (ApplicationException ex) {
           in = (InputStream) ex.getInputStream();
           String id = in.read_string();
           if (id.equals("IDL:javax/ejb/CreateEx:1.0")) {
             throw (CreateException) in.read_value(CreateException.class);
           }
           throw new UnexpectedException(id);
         } catch (RemarshalException ex) {
           continue;
         }
       } catch (SystemException ex) {
         throw Util.mapSystemException(ex);
       } finally {
         _releaseReply(in);
       }
     } else {
       ServantObject so =
           _servant_preinvoke("create", com.ardais.bigr.iltds.beans.PtsOperationHome.class);
       if (so == null) {
         continue;
       }
       try {
         PtsOperation result =
             ((com.ardais.bigr.iltds.beans.PtsOperationHome) so.servant).create();
         return (PtsOperation) Util.copyObject(result, _orb());
       } catch (Throwable ex) {
         Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
         if (exCopy instanceof CreateException) {
           throw (CreateException) exCopy;
         }
         throw Util.wrapException(exCopy);
       } finally {
         _servant_postinvoke(so);
       }
     }
   }
 }
コード例 #8
0
 public EJBHome getEJBHome() throws RemoteException {
   while (true) {
     if (!Util.isLocal(this)) {
       InputStream in = null;
       try {
         try {
           OutputStream out = _request("_get_EJBHome", true);
           in = _invoke(out);
           return (EJBHome) in.read_Object(EJBHome.class);
         } catch (ApplicationException ex) {
           in = ex.getInputStream();
           String id = in.read_string();
           throw new UnexpectedException(id);
         } catch (RemarshalException ex) {
           continue;
         }
       } catch (SystemException ex) {
         throw Util.mapSystemException(ex);
       } finally {
         _releaseReply(in);
       }
     } else {
       ServantObject so = _servant_preinvoke("_get_EJBHome", javax.ejb.HomeHandle.class);
       if (so == null) {
         continue;
       }
       try {
         EJBHome result = ((javax.ejb.HomeHandle) so.servant).getEJBHome();
         return (EJBHome) Util.copyObject(result, _orb());
       } catch (Throwable ex) {
         Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
         throw Util.wrapException(exCopy);
       } finally {
         _servant_postinvoke(so);
       }
     }
   }
 }
 private OutputStream remove__java_lang_Object(
     org.omg.CORBA_2_3.portable.InputStream in, ResponseHandler reply) throws Throwable {
   Object arg0 = Util.readAny(in);
   try {
     target.remove(arg0);
   } catch (RemoveException ex) {
     String id = "IDL:javax/ejb/RemoveEx:1.0";
     org.omg.CORBA_2_3.portable.OutputStream out =
         (org.omg.CORBA_2_3.portable.OutputStream) reply.createExceptionReply();
     out.write_string(id);
     out.write_value(ex, RemoveException.class);
     return out;
   }
   OutputStream out = reply.createReply();
   return out;
 }
コード例 #10
0
 /*     */ public String implementation(String paramString) /*     */ {
   /*     */ try
   /*     */ {
     /*  88 */ if (this.vhandler == null) {
       /*  89 */ this.vhandler = ValueHandlerImpl.getInstance(false);
       /*     */ }
     /*     */
     /*  94 */ String str = Util.getCodebase(this.vhandler.getClassFromType(paramString));
     /*  95 */ if (str == null) {
       /*  96 */ return "";
       /*     */ }
     /*  98 */ return str;
     /*     */ } catch (ClassNotFoundException localClassNotFoundException) {
     /* 100 */ throw this.wrapper.missingLocalValueImpl(
         CompletionStatus.COMPLETED_MAYBE, localClassNotFoundException);
     /*     */ }
   /*     */ }
 private OutputStream create(org.omg.CORBA_2_3.portable.InputStream in, ResponseHandler reply)
     throws Throwable {
   IcpOperation result;
   try {
     result = target.create();
   } catch (CreateException ex) {
     String id = "IDL:javax/ejb/CreateEx:1.0";
     org.omg.CORBA_2_3.portable.OutputStream out =
         (org.omg.CORBA_2_3.portable.OutputStream) reply.createExceptionReply();
     out.write_string(id);
     out.write_value(ex, CreateException.class);
     return out;
   }
   OutputStream out = reply.createReply();
   Util.writeRemoteObject(out, result);
   return out;
 }
 public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply)
     throws SystemException {
   try {
     org.omg.CORBA_2_3.portable.InputStream in = (org.omg.CORBA_2_3.portable.InputStream) _in;
     if (method.equals("executeCommand")) {
       Command arg0 = (Command) in.read_value(Command.class);
       Object result = target.executeCommand(arg0);
       OutputStream out = reply.createReply();
       Util.writeAny(out, result);
       return out;
     }
     throw new BAD_OPERATION();
   } catch (SystemException ex) {
     throw ex;
   } catch (Throwable ex) {
     throw new UnknownException(ex);
   }
 }
コード例 #13
0
 public void remove(Object arg0) throws RemoteException, RemoveException {
   while (true) {
     if (!Util.isLocal(this)) {
       InputStream in = null;
       try {
         try {
           OutputStream out = _request("remove__java_lang_Object", true);
           Util.writeAny(out, arg0);
           _invoke(out);
           return;
         } catch (ApplicationException ex) {
           in = (InputStream) ex.getInputStream();
           String id = in.read_string();
           if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) {
             throw (RemoveException) in.read_value(RemoveException.class);
           }
           throw new UnexpectedException(id);
         } catch (RemarshalException ex) {
           continue;
         }
       } catch (SystemException ex) {
         throw Util.mapSystemException(ex);
       } finally {
         _releaseReply(in);
       }
     } else {
       ServantObject so = _servant_preinvoke("remove__java_lang_Object", javax.ejb.EJBHome.class);
       if (so == null) {
         continue;
       }
       try {
         Object arg0Copy = (Object) Util.copyObject(arg0, _orb());
         ((javax.ejb.EJBHome) so.servant).remove(arg0Copy);
         return;
       } catch (Throwable ex) {
         Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
         if (exCopy instanceof RemoveException) {
           throw (RemoveException) exCopy;
         }
         throw Util.wrapException(exCopy);
       } finally {
         _servant_postinvoke(so);
       }
     }
   }
 }
コード例 #14
0
  /**
   * Sends a request message to the server, receives the reply from the server, and returns an
   * <code>Object</code> result to the caller.
   */
  public Object invoke(String operationName, StubStrategy stubStrategy, Object[] params)
      throws Throwable {
    if (operationName.equals("_get_handle") && this instanceof javax.ejb.EJBObject) {
      if (handle == null) {
        handle = new HandleImplIIOP(this);
      }
      return handle;
    } else if (operationName.equals("_get_homeHandle") && this instanceof javax.ejb.EJBHome) {
      if (handle == null) {
        handle = new HomeHandleImplIIOP(this);
      }
      return handle;
    } else if (!_is_local()) {
      // remote call path

      // To check whether this is a local stub or not we must call
      // org.omg.CORBA.portable.ObjectImpl._is_local(), and _not_
      // javax.rmi.CORBA.Util.isLocal(Stub s), which in Sun's JDK
      // always return false.

      InputStream in = null;
      try {
        try {
          OutputStream out = (OutputStream) _request(operationName, true);
          stubStrategy.writeParams(out, params);
          trace("sent request: " + operationName);
          in = (InputStream) _invoke(out);
          if (stubStrategy.isNonVoid()) {
            trace("received reply");
            return stubStrategy.readRetval(in);
            // Object retval = stubStrategy.readRetval(in);
            // trace("retval: " + retval);
            // return retval;
          } else return null;
        } catch (ApplicationException ex) {
          trace("got application exception");
          in = (InputStream) ex.getInputStream();
          throw stubStrategy.readException(ex.getId(), in);
        } catch (RemarshalException ex) {
          trace("got remarshal exception");
          return invoke(operationName, stubStrategy, params);
        }
      } catch (SystemException ex) {
        if (EjbLogger.EJB3_INVOCATION_LOGGER.isTraceEnabled()) {
          EjbLogger.EJB3_INVOCATION_LOGGER.trace("CORBA system exception in IIOP stub", ex);
        }
        throw Util.mapSystemException(ex);
      } finally {
        _releaseReply(in);
      }
    } else {
      // local call path
      org.omg.CORBA.portable.ServantObject so = _servant_preinvoke(operationName, Object.class);
      if (so == null) return invoke(operationName, stubStrategy, params);
      try {
        // params = Util.copyObjects(params, _orb());
        Object retval =
            ((LocalIIOPInvoker) so.servant)
                .invoke(
                    operationName,
                    params,
                    null, /* tx */
                    null, /* identity */
                    null /* credential */);
        return stubStrategy.convertLocalRetval(retval);
        // retval = stubStrategy.convertLocalRetval(retval);
        // return Util.copyObject(retval, _orb());
      } catch (Throwable e) {
        // Throwable ex = (Throwable)Util.copyObject(e, _orb());
        Throwable ex = e;
        if (stubStrategy.isDeclaredException(ex)) throw ex;
        else throw Util.wrapException(ex);
      } finally {
        _servant_postinvoke(so);
      }
    }
  }
コード例 #15
0
 /** Return default ValueHandler */
 public static ValueHandler createValueHandler() {
   return Util.createValueHandler();
 }
コード例 #16
0
  @Test
  public void testExport() throws Exception {
    RMITestImpl servant = new RMITestImpl();

    assertNotNull(Util.getTie(servant));
  }
コード例 #17
0
 /*     */ public java.lang.Object invoke(
     java.lang.Object paramObject, final Method paramMethod, java.lang.Object[] paramArrayOfObject)
     /*     */ throws Throwable
       /*     */ {
   /* 126 */ String str = this.classData.getIDLNameTranslator().getIDLName(paramMethod);
   /*     */
   /* 128 */ DynamicMethodMarshaller localDynamicMethodMarshaller =
       this.pm.getDynamicMethodMarshaller(paramMethod);
   /*     */
   /* 131 */ Delegate localDelegate = null;
   /*     */ try {
     /* 133 */ localDelegate = StubAdapter.getDelegate(this.stub);
     /*     */ } catch (SystemException localSystemException1) {
     /* 135 */ throw Util.mapSystemException(localSystemException1);
     /*     */ }
   /*     */ java.lang.Object localObject1;
   /* 138 */ if (!isLocal()) {
     /*     */ try {
       /* 140 */ InputStream localInputStream = null;
       /*     */ try
       /*     */ {
         /* 143 */ OutputStream localOutputStream =
             (OutputStream) localDelegate.request(this.stub, str, true);
         /*     */
         /* 148 */ localDynamicMethodMarshaller.writeArguments(
             localOutputStream, paramArrayOfObject);
         /*     */
         /* 151 */ localInputStream =
             (InputStream) localDelegate.invoke(this.stub, localOutputStream);
         /*     */
         /* 155 */ return localDynamicMethodMarshaller.readResult(localInputStream);
         /*     */ } catch (ApplicationException localApplicationException) {
         /* 157 */ throw localDynamicMethodMarshaller.readException(localApplicationException);
         /*     */ } catch (RemarshalException localRemarshalException) {
         /* 159 */ return invoke(paramObject, paramMethod, paramArrayOfObject);
         /*     */ } finally {
         /* 161 */ localDelegate.releaseReply(this.stub, localInputStream);
         /*     */ }
       /*     */ } catch (SystemException localSystemException2) {
       /* 164 */ throw Util.mapSystemException(localSystemException2);
       /*     */ }
     /*     */ }
   /*     */
   /* 168 */ ORB localORB = (ORB) localDelegate.orb(this.stub);
   /* 169 */ ServantObject localServantObject =
       localDelegate.servant_preinvoke(this.stub, str, paramMethod.getDeclaringClass());
   /*     */
   /* 171 */ if (localServantObject == null)
     /* 172 */ return invoke(this.stub, paramMethod, paramArrayOfObject);
   /*     */ try
   /*     */ {
     /* 175 */ localObject1 =
         localDynamicMethodMarshaller.copyArguments(paramArrayOfObject, localORB);
     /*     */
     /* 177 */ if (!paramMethod.isAccessible())
     /*     */ {
       /* 181 */ AccessController.doPrivileged(
           new PrivilegedAction() {
             /*     */ public java.lang.Object run() {
               /* 183 */ paramMethod.setAccessible(true);
               /* 184 */ return null;
               /*     */ }
             /*     */ });
       /*     */ }
     /*     */
     /* 189 */ localObject3 =
         paramMethod.invoke(localServantObject.servant, (java.lang.Object[]) localObject1);
     /*     */
     /* 191 */ return localDynamicMethodMarshaller.copyResult(localObject3, localORB);
     /*     */ } catch (InvocationTargetException localInvocationTargetException) {
     /* 193 */ java.lang.Object localObject3 = localInvocationTargetException.getCause();
     /*     */
     /* 195 */ java.lang.Object localObject4 = (Throwable) Util.copyObject(localObject3, localORB);
     /* 196 */ if (localDynamicMethodMarshaller.isDeclaredException((Throwable) localObject4)) {
       /* 197 */ throw ((Throwable) localObject4);
       /*     */ }
     /* 199 */ throw Util.wrapException((Throwable) localObject4);
     /*     */ } catch (Throwable localThrowable) {
     /* 201 */ if ((localThrowable instanceof ThreadDeath)) {
       /* 202 */ throw ((ThreadDeath) localThrowable);
       /*     */ }
     /*     */
     /* 207 */ throw Util.wrapException(localThrowable);
     /*     */ } finally {
     /* 209 */ localDelegate.servant_postinvoke(this.stub, localServantObject);
     /*     */ }
   /*     */ }