javax.rmi.CORBA.Util.getTie()方法的使用及代码示例

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

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

Util.getTie介绍

暂无

代码示例

代码示例来源: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.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.glassfish.security/security

protected void exportObject(java.rmi.Remote remote)
throws java.rmi.RemoteException {
  // create servant and tie
  PortableRemoteObject.exportObject(remote);
  Tie servantsTie = javax.rmi.CORBA.Util.getTie(remote);
  // Note: at this point the Tie doesnt have a delegate inside it,
  // so it is not really "exported".
  // The following call does orb.connect() which is the real exporting
  servantsTie.orb(orb);
}

代码示例来源:origin: org.glassfish.main.security/security

protected void exportObject(java.rmi.Remote remote)
throws java.rmi.RemoteException {
  // create servant and tie
  PortableRemoteObject.exportObject(remote);
  Tie servantsTie = javax.rmi.CORBA.Util.getTie(remote);
  // Note: at this point the Tie doesnt have a delegate inside it,
  // so it is not really "exported".
  // The following call does orb.connect() which is the real exporting
  servantsTie.orb(orb);
}

代码示例来源:origin: org.objectweb.jonas/jonas-ejb-container

/**
 * constructor.
 * @param r remote ref
 */
public JHandleIIOP(final Remote r) {
  try {
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE, "r=" + r);
    }
    Servant servant = (Servant) Util.getTie(r);
    org.omg.CORBA.Object o = servant._this_object();
    this.ior = Utility.getORB().object_to_string(o);
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE, "ior=" + ior);
    }
  } catch (Exception e) {
    logger.log(Level.SEVERE, "cannot get Handle: ", e);
  }
}

代码示例来源:origin: org.objectweb.jonas/jonas-ejb-container

/**
 * constructor.
 * @param h EJBHome
 * @param cl classloader used for EJB
 */
public JHomeHandleIIOP(final EJBHome h, final ClassLoader cl) {
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE, "h=" + h);
  }
  try {
    Servant servant = (Servant) Util.getTie(h);
    org.omg.CORBA.Object o = servant._this_object();
    this.ior = Utility.getORB().object_to_string(o);
    this.cl = cl;
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE, "ior=" + ior);
    }
  } catch (Exception e) {
    logger.log(Level.SEVERE, "cannot get Handle: ", e);
  }
}

代码示例来源: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.cmi/cmi-core-common

public static String remote_to_string(final Remote remote) throws NamingException {
  Servant servant = (Servant) Util.getTie(remote);
  org.omg.CORBA.Object o = servant._this_object();
  return getORB().object_to_string(o);
}

代码示例来源:origin: org.ow2.cmi/cmi-core-common

public static String remote_to_string(final Remote remote) throws NamingException {
  Servant servant = (Servant) Util.getTie(remote);
  org.omg.CORBA.Object o = servant._this_object();
  return getORB().object_to_string(o);
}

代码示例来源: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.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: jboss/jboss-javaee-specs

if (Util.getTie(obj) != null)

代码示例来源:origin: org.jboss.spec.javax.rmi/jboss-rmi-api_1.0_spec

if (Util.getTie(obj) != null)

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

/**
 * Export an RMI object as a CORBA object
 * @see javax.rmi.CORBA.PortableRemoteObjectDelegate#exportObject(java.rmi.Remote)
 */
public void exportObject( java.rmi.Remote obj ) throws java.rmi.RemoteException
{
  if (obj == null)
  {
    throw new IllegalArgumentException();
  }
  if ( obj instanceof Stub )
  {
    throw new java.rmi.server.ExportException( "Attempted to export a stub class" );
  }
  Tie tie = Util.getTie( obj );
  if ( tie != null )
  {
    throw new java.rmi.server.ExportException( "Object already exported" );
  }
  tie = toTie( obj );
  tie.orb( getORB() );
  Util.registerTarget( tie, obj );
}

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

Tie theTie = Util.getTie(obj);

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

public java.rmi.Remote toStub(java.rmi.Remote value)
    throws java.rmi.NoSuchObjectException {
  if (value instanceof javax.rmi.CORBA.Stub)
    return value;
  javax.rmi.CORBA.Tie tie = javax.rmi.CORBA.Util.getTie(value);
  if (tie == null) {
    // Throwable trace =
    // org.apache.yoko.rmi.api.PortableRemoteObjectExt.getStateTrace ();
    // log.info("Instance of "+value.getClass()+" is not exported in
    // "+RMIState.current().getName()+" tie="+tie+";
    // "+(trace==null?"trace is null":""), trace);
    throw new java.rmi.NoSuchObjectException("object not exported");
  }
  RMIServant servant = (RMIServant) tie;
  try {
    org.omg.PortableServer.POA poa = servant.getRMIState().getPOA();
    org.omg.CORBA.Object ref = poa.servant_to_reference(servant);
    return (java.rmi.Remote) narrow(ref, servant.getJavaClass());
  } catch (org.omg.PortableServer.POAPackage.ServantNotActive ex) {
    throw new RuntimeException("internal error: " + ex.getMessage(), ex);
  } catch (org.omg.PortableServer.POAPackage.WrongPolicy ex) {
    throw new RuntimeException("internal error: " + ex.getMessage(), ex);
  }
}

代码示例来源: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: jboss/jboss-javaee-specs

Tie theTie = Util.getTie(obj);
if (theTie != null)

代码示例来源:origin: org.jboss.spec.javax.rmi/jboss-rmi-api_1.0_spec

Tie theTie = Util.getTie(obj);
if (theTie != null)

代码示例来源:origin: org.ow2.cmi/cmi-rmi

if(protocol.equals("iiop")) {
  logger.debug("Unexporting for iiop...");
  Tie theTie = Util.getTie(obj);
  if (theTie != null) {
    Util.unexportObject(obj);

相关文章