javax.rmi.CORBA.Util类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(220)

本文整理了Java中javax.rmi.CORBA.Util类的一些代码示例,展示了Util类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util类的具体详情如下:
包路径:javax.rmi.CORBA.Util
类名称:Util

Util介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

in = (InputStream) ex.getInputStream();
    final InputStream finalIn1 = in;
    throw doPrivileged(new PrivilegedAction<Exception>() {
    EjbLogger.EJB3_INVOCATION_LOGGER.trace("CORBA system exception in IIOP stub", ex);
  throw Util.mapSystemException(ex);
} finally {
  _releaseReply(in);

代码示例来源:origin: wildfly/wildfly

public void write(OutputStream out, Object obj) {
    Util.writeAny(out, obj);
  }
}

代码示例来源:origin: wildfly/wildfly

public Object read(InputStream in) {
    return (Serializable) Util.readAny(in);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

public Transporter beginEarlyTransaction() throws RemoteException {
  if (!Util.isLocal(this)) {
    try {
      org.omg.CORBA_2_3.portable.InputStream in = null;
        return readTransporter(in);
      } catch (ApplicationException ex) {
        in = (org.omg.CORBA_2_3.portable.InputStream)ex.getInputStream();
        String id = in.read_string();
        throw new UnexpectedException(id);
      } catch (RemarshalException ex) {
        return beginTransaction();
      throw Util.mapSystemException(ex);
      return (Transporter)Util.copyObject(result, _orb());
    } catch (Throwable ex) {
      Throwable exCopy = (Throwable)Util.copyObject(ex, _orb());
      throw Util.wrapException(exCopy);
    } finally {
      _servant_postinvoke(so);

代码示例来源:origin: org.jacorb/jacorb

/**
 * Deactivate the exported RMI object.
 * @param obj   The RMI object
 * @see javax.rmi.CORBA.PortableRemoteObjectDelegate#unexportObject(java.rmi.Remote)
 */
public void unexportObject( java.rmi.Remote obj ) throws java.rmi.NoSuchObjectException
{
  Tie tie = Util.getTie( obj );
  if ( tie == null )
  {
    throw new java.rmi.NoSuchObjectException( "Object not exported" );
  }
  Util.unexportObject( obj );
}

代码示例来源:origin: org.ow2.carol/carol

/**
 * Bind an object by using a secure POA (csiv2)
 * @param name name of the object
 * @param r remote object to bind
 * @throws Exception if the object cannot be bound
 */
private void bindWithSpecificPoa(final Name name, final Remote r) throws Exception {
  POA securedPOA = createSecurePOA(name.toString());
  org.omg.PortableServer.Servant servant = (org.omg.PortableServer.Servant) Util.getTie(r);
  securedPOA.activate_object_with_id(name.toString().getBytes(), servant);
  getWrappedContext().bind(name, securedPOA.servant_to_reference(servant));
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

/**
 * Makes a server object ready to receive remote calls. Note
 * that subclasses of PortableRemoteObject do not need to call this
 * method, as it is called by the constructor.
 * @param obj the server object to export.
 * @exception RemoteException if export fails.
 */
public void exportObject(Remote obj)
  throws RemoteException {
  if (obj == null) {
    throw new NullPointerException("invalid argument");
  }
  // Has this object already been exported to IIOP?
  if (Util.getTie(obj) != null) {
    // Yes, so this is an error...
    throw new ExportException (obj.getClass().getName() + " already exported");
  }
  // Can we load a Tie?
  Tie theTie = Utility.loadTie(obj);
  if (theTie != null) {
    // Yes, so export it to IIOP...
    Util.registerTarget(theTie,obj);
  } else {
    // No, so export to JRMP. If this is called twice for the
    // same object, it will throw an ExportException...
    UnicastRemoteObject.exportObject(obj);
  }
}

代码示例来源:origin: org.jacorb/jacorb

/**
 * From javax.rmi.CORBA.Util.
 */
public static String getCodebase(Class clz)
{
  return javax.rmi.CORBA.Util.getCodebase(clz);
}

代码示例来源:origin: org.jacorb/jacorb

/**
 * From javax.rmi.CORBA.Util.
 */
public static Class loadClass(String className, String remoteCodebase,
    ClassLoader loader) throws ClassNotFoundException
{
  return javax.rmi.CORBA.Util
      .loadClass(className, remoteCodebase, loader);
}

代码示例来源:origin: org.jacorb/jacorb

private Class loadClass(String clazzName, Class source) throws ClassNotFoundException
{
  return Util.loadClass(clazzName, Util.getCodebase(source), source.getClassLoader());
}

代码示例来源:origin: org.apache.yoko/yoko-rmi-impl

public Object run() {
    try {
      javax.rmi.CORBA.ValueHandler handler = javax.rmi.CORBA.Util
          .createValueHandler();
      String repId = handler.getRMIRepositoryID(type);
      repid_field.set(desc, repId);
      String codebase = javax.rmi.CORBA.Util
          .getCodebase(type);
      codebase_field.set(desc, codebase);
      return desc;
    } catch (java.lang.IllegalAccessException ex) {
      throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(
          "no such field: " + ex).initCause(ex);
    }
  }
});

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public Object copyResult( Object result, ORB orb ) throws RemoteException
{
  if (needsResultCopy)
    return Util.copyObject( result, orb ) ;
  else
    return result ;
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public Object[] copyArguments( Object[] args,
  ORB orb ) throws RemoteException
{
  if (needsArgumentCopy)
    return Util.copyObjects( args, orb ) ;
  else
    return args ;
}

代码示例来源:origin: org.apache.yoko/yoko-rmi-impl

public void connect(javax.rmi.CORBA.Stub stub, org.omg.CORBA.ORB orb)
    throws java.rmi.RemoteException {
  try {
    org.omg.CORBA.portable.Delegate delegate;
    try {
      delegate = stub._get_delegate();
    } catch (org.omg.CORBA.BAD_OPERATION ex) {
      throw new java.rmi.RemoteException("stub has no identity", ex);
    }
    if (delegate.orb(stub) != orb) {
      org.omg.CORBA.portable.OutputStream out = orb
          .create_output_stream();
      out.write_Object(stub);
      org.omg.CORBA.portable.InputStream in = out
          .create_input_stream();
      org.omg.CORBA.portable.ObjectImpl impl = (org.omg.CORBA.portable.ObjectImpl) in
          .read_Object();
      stub._set_delegate(impl._get_delegate());
    }
  } catch (org.omg.CORBA.SystemException ex) {
    throw javax.rmi.CORBA.Util.mapSystemException(ex);
  }
}

代码示例来源:origin: org.apache.yoko/yoko-rmi-impl

public void unexportObject(Remote obj)
    throws java.rmi.NoSuchObjectException {
  javax.rmi.CORBA.Util.unexportObject(obj);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

public Transporter getDefaultReadOnlyClasses() throws RemoteException {
  if (!Util.isLocal(this)) {
    try {
      org.omg.CORBA_2_3.portable.InputStream in = null;
        return readTransporter(in);
      } catch (ApplicationException ex) {
        in = (org.omg.CORBA_2_3.portable.InputStream)ex.getInputStream();
        String id = in.read_string();
        throw new UnexpectedException(id);
      } catch (RemarshalException ex) {
        return getLogin();
      throw Util.mapSystemException(ex);
      return (Transporter)Util.copyObject(result, _orb());
    } catch (Throwable ex) {
      Throwable exCopy = (Throwable)Util.copyObject(ex, _orb());
      throw Util.wrapException(exCopy);
    } finally {
      _servant_postinvoke(so);

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
  throws NoSuchObjectException {
  if (obj == null) {
    throw new NullPointerException("invalid argument");
  }
  if (StubAdapter.isStub(obj) ||
    obj instanceof java.rmi.server.RemoteStub) {
    throw new NoSuchObjectException(
      "Can only unexport a server object.");
  }
  Tie theTie = Util.getTie(obj);
  if (theTie != null) {
    Util.unexportObject(obj);
  } else {
    if (Utility.loadTie(obj) == null) {
      UnicastRemoteObject.unexportObject(obj,true);
    } else {
      throw new NoSuchObjectException("Object not exported.");
    }
  }
}

代码示例来源:origin: org.ow2.carol/carol

/**
 * Rebind an object by using a secure POA (csiv2)
 * @param name name of the object
 * @param r remote object to bind
 * @throws Exception if the object cannot be bound
 */
private void rebindWithSpecificPoa(final Name name, final Remote r) throws Exception {
  POA securedPOA = createSecurePOA(name.toString());
  org.omg.PortableServer.Servant servant = (org.omg.PortableServer.Servant) Util.getTie(r);
  securedPOA.activate_object_with_id(name.toString().getBytes(), servant);
  getWrappedContext().rebind(name, securedPOA.servant_to_reference(servant));
}

代码示例来源:origin: org.apache.yoko/yoko-rmi-impl

public void exportObject(Remote obj) throws java.rmi.RemoteException {
  RMIState state = RMIState.current();
  try {
    state.checkShutDown();
  } catch (BAD_INV_ORDER ex) {
    throw new RemoteException("RMIState is deactivated", ex);
  }
  Tie tie = javax.rmi.CORBA.Util.getTie(obj);
  if (tie != null)
    throw new java.rmi.RemoteException("object already exported");
  RMIServant servant = new RMIServant(state);
  javax.rmi.CORBA.Util.registerTarget(servant, obj);
  logger.finer("exporting instance of " + obj.getClass().getName()
      + " in " + state.getName());
  try {
    servant._id = state.getPOA().activate_object(servant);
  } catch (org.omg.PortableServer.POAPackage.ServantAlreadyActive ex) {
    throw new java.rmi.RemoteException("internal error: " + ex.getMessage(), ex);
  } catch (org.omg.PortableServer.POAPackage.WrongPolicy ex) {
    throw new java.rmi.RemoteException("internal error: " + ex.getMessage(), ex);
  }
}

代码示例来源:origin: org.apache.yoko/yoko-rmi-impl

String getImplementation(String id) {
  try {
    String result = "";
    Class clz = getClassFromRepositoryID(id);
    if (clz != null) {
      result = javax.rmi.CORBA.Util.getCodebase(clz);
      if (result == null) {
        if (logger.isLoggable(Level.FINE)) {
          logger.fine("failed to find implementation " + id);
        }
        return "";
      }
    }
    if (logger.isLoggable(Level.FINER)) {
      logger.finer("getImplementation " + id + " => " + result);
    }
    return result;
  } catch (RuntimeException ex) {
    logger.log(Level.FINE, "error implementation class from id", ex); 
    throw ex;
  }
}

相关文章