Java Code Examples for javax.rmi.CORBA.Stub

The following are top voted examples for showing how to use javax.rmi.CORBA.Stub. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 2
Project: jdk8u-jdk   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 3
Project: jdk8u_jdk   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 4
Project: lookaside_java-1.8.0-openjdk   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 5
Project: javify   File: PortableRemoteObjectDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Find or create a tie for this target and mark it as being used by the given
 * object.
 */
public void exportObject(Remote obj)
  throws RemoteException
{
  if (obj instanceof Stub)
    Util.registerTarget(StubDelegateImpl.getTieFromStub((Stub) obj), obj);
  else if (obj instanceof Tie)
    {
      Tie t = (Tie) obj;
      Util.registerTarget(t, null);
    }
}
 
Example 6
Project: javify   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Compare two stubs for equality.
 */
public boolean equals(Stub self, java.lang.Object obj)
{
  if (obj instanceof ObjectImpl)
    {
      ObjectImpl other = (ObjectImpl) obj;
      Delegate d1 = other._get_delegate();
      Delegate d2 = self._get_delegate();
      if (d1 == null || d2 == null)
        return d1 == d2;
      else
        return d1.equals(d2);
    }
  else return false;
}
 
Example 7
Project: javify   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the IOR reference of the connected ORB.
 *
 * @see ORB#object_to_string(org.omg.CORBA.Object);
 */
public String toString(Stub self)
{
  try
    {
      return self._orb().object_to_string(self);
    }
  catch (Exception ex)
    {
      return null;
    }
}
 
Example 8
Project: javify   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Read as CORBA object when the ORB is known. The ORB must be set under the
 * previous call of Stub.connect. The Stub is automatically registered with
 * this ORB.
 */
public void readObject(Stub self, ObjectInputStream input, ORB orb)
  throws IOException, ClassNotFoundException
{
  byte[] b = (byte[]) input.readObject();
  BufferredCdrInput in = new BufferredCdrInput(b);

  if (orb != null)
    in.setOrb(orb);

  ObjectImpl r = (ObjectImpl) in.read_Object();

  self._set_delegate(r._get_delegate());
}
 
Example 9
Project: javify   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Write as CORBA object. The ORB must be either set under the previous call
 * of Stub.connect or it is taken from the org.omg.CORBA.portable.Delegate.
 * The Stub is automatically registered with this ORB (if not already done).
 */
public void writeObject(Stub self, ObjectOutputStream output, ORB orb)
  throws IOException
{
  BufferedCdrOutput out = new BufferedCdrOutput();
  out.setOrb(orb == null ? self._orb() : orb);
  out.write_Object(self);

  output.writeObject(out.buffer.toByteArray());
}
 
Example 10
Project: javify   File: UtilDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Checks if the given stub is local.
 *
 * @param stub a stub to check.
 * @return true if the stub is local, false otherwise.
 */
public boolean isLocal(Stub stub)
  throws RemoteException
{
  try
    {
      return stub._is_local();
    }
  catch (SystemException e)
    {
      RemoteException rex = new RemoteException();
      rex.initCause(e);
      throw rex;
    }
}
 
Example 11
Project: jvm-stm   File: PortableRemoteObjectDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Find or create a tie for this target and mark it as being used by the given
 * object.
 */
public void exportObject(Remote obj)
  throws RemoteException
{
  if (obj instanceof Stub)
    Util.registerTarget(StubDelegateImpl.getTieFromStub((Stub) obj), obj);
  else if (obj instanceof Tie)
    {
      Tie t = (Tie) obj;
      Util.registerTarget(t, null);
    }
}
 
Example 12
Project: jvm-stm   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Compare two stubs for equality.
 */
public boolean equals(Stub self, java.lang.Object obj)
{
  if (obj instanceof ObjectImpl)
    {
      ObjectImpl other = (ObjectImpl) obj;
      Delegate d1 = other._get_delegate();
      Delegate d2 = self._get_delegate();
      if (d1 == null || d2 == null)
        return d1 == d2;
      else
        return d1.equals(d2);
    }
  else return false;
}
 
Example 13
Project: jvm-stm   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the IOR reference of the connected ORB.
 * 
 * @see ORB#object_to_string(org.omg.CORBA.Object);
 */
public String toString(Stub self)
{
  try
    {
      return self._orb().object_to_string(self);
    }
  catch (Exception ex)
    {
      return null;
    }
}
 
Example 14
Project: jvm-stm   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Read as CORBA object when the ORB is known. The ORB must be set under the
 * previous call of Stub.connect. The Stub is automatically registered with
 * this ORB.
 */
public void readObject(Stub self, ObjectInputStream input, ORB orb)
  throws IOException, ClassNotFoundException
{
  byte[] b = (byte[]) input.readObject();
  BufferredCdrInput in = new BufferredCdrInput(b);

  if (orb != null)
    in.setOrb(orb);

  ObjectImpl r = (ObjectImpl) in.read_Object();

  self._set_delegate(r._get_delegate());
}
 
Example 15
Project: jvm-stm   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Write as CORBA object. The ORB must be either set under the previous call
 * of Stub.connect or it is taken from the org.omg.CORBA.portable.Delegate.
 * The Stub is automatically registered with this ORB (if not already done).
 */
public void writeObject(Stub self, ObjectOutputStream output, ORB orb)
  throws IOException
{
  BufferedCdrOutput out = new BufferedCdrOutput();
  out.setOrb(orb == null ? self._orb() : orb);
  out.write_Object(self);

  output.writeObject(out.buffer.toByteArray());
}
 
Example 16
Project: jvm-stm   File: UtilDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Checks if the given stub is local.
 * 
 * @param stub a stub to check.
 * @return true if the stub is local, false otherwise.
 */
public boolean isLocal(Stub stub)
  throws RemoteException
{
  try
    {
      return stub._is_local();
    }
  catch (SystemException e)
    {
      RemoteException rex = new RemoteException();
      rex.initCause(e);
      throw rex;
    }
}
 
Example 17
Project: infobip-open-jdk-8   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 18
Project: jdk8u-dev-jdk   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 19
Project: jdk7-jdk   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 20
Project: openjdk-source-code-learn   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 21
Project: OLD-OpenJDK8   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 22
Project: JamVM-PH   File: PortableRemoteObjectDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Find or create a tie for this target and mark it as being used by the given
 * object.
 */
public void exportObject(Remote obj)
  throws RemoteException
{
  if (obj instanceof Stub)
    Util.registerTarget(StubDelegateImpl.getTieFromStub((Stub) obj), obj);
  else if (obj instanceof Tie)
    {
      Tie t = (Tie) obj;
      Util.registerTarget(t, null);
    }
}
 
Example 23
Project: JamVM-PH   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Compare two stubs for equality.
 */
public boolean equals(Stub self, java.lang.Object obj)
{
  if (obj instanceof ObjectImpl)
    {
      ObjectImpl other = (ObjectImpl) obj;
      Delegate d1 = other._get_delegate();
      Delegate d2 = self._get_delegate();
      if (d1 == null || d2 == null)
        return d1 == d2;
      else
        return d1.equals(d2);
    }
  else return false;
}
 
Example 24
Project: JamVM-PH   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the IOR reference of the connected ORB.
 * 
 * @see ORB#object_to_string(org.omg.CORBA.Object);
 */
public String toString(Stub self)
{
  try
    {
      return self._orb().object_to_string(self);
    }
  catch (Exception ex)
    {
      return null;
    }
}
 
Example 25
Project: JamVM-PH   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Read as CORBA object when the ORB is known. The ORB must be set under the
 * previous call of Stub.connect. The Stub is automatically registered with
 * this ORB.
 */
public void readObject(Stub self, ObjectInputStream input, ORB orb)
  throws IOException, ClassNotFoundException
{
  byte[] b = (byte[]) input.readObject();
  BufferredCdrInput in = new BufferredCdrInput(b);

  if (orb != null)
    in.setOrb(orb);

  ObjectImpl r = (ObjectImpl) in.read_Object();

  self._set_delegate(r._get_delegate());
}
 
Example 26
Project: JamVM-PH   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Write as CORBA object. The ORB must be either set under the previous call
 * of Stub.connect or it is taken from the org.omg.CORBA.portable.Delegate.
 * The Stub is automatically registered with this ORB (if not already done).
 */
public void writeObject(Stub self, ObjectOutputStream output, ORB orb)
  throws IOException
{
  BufferedCdrOutput out = new BufferedCdrOutput();
  out.setOrb(orb == null ? self._orb() : orb);
  out.write_Object(self);

  output.writeObject(out.buffer.toByteArray());
}
 
Example 27
Project: JamVM-PH   File: UtilDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Checks if the given stub is local.
 * 
 * @param stub a stub to check.
 * @return true if the stub is local, false otherwise.
 */
public boolean isLocal(Stub stub)
  throws RemoteException
{
  try
    {
      return stub._is_local();
    }
  catch (SystemException e)
    {
      RemoteException rex = new RemoteException();
      rex.initCause(e);
      throw rex;
    }
}
 
Example 28
Project: openjdk-jdk7u-jdk   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 29
Project: classpath   File: PortableRemoteObjectDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Find or create a tie for this target and mark it as being used by the given
 * object.
 */
public void exportObject(Remote obj)
  throws RemoteException
{
  if (obj instanceof Stub)
    Util.registerTarget(StubDelegateImpl.getTieFromStub((Stub) obj), obj);
  else if (obj instanceof Tie)
    {
      Tie t = (Tie) obj;
      Util.registerTarget(t, null);
    }
}
 
Example 30
Project: classpath   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Compare two stubs for equality.
 */
public boolean equals(Stub self, java.lang.Object obj)
{
  if (obj instanceof ObjectImpl)
    {
      ObjectImpl other = (ObjectImpl) obj;
      Delegate d1 = other._get_delegate();
      Delegate d2 = self._get_delegate();
      if (d1 == null || d2 == null)
        return d1 == d2;
      else
        return d1.equals(d2);
    }
  else return false;
}
 
Example 31
Project: classpath   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the IOR reference of the connected ORB.
 *
 * @see ORB#object_to_string(org.omg.CORBA.Object);
 */
public String toString(Stub self)
{
  try
    {
      return self._orb().object_to_string(self);
    }
  catch (Exception ex)
    {
      return null;
    }
}
 
Example 32
Project: classpath   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Read as CORBA object when the ORB is known. The ORB must be set under the
 * previous call of Stub.connect. The Stub is automatically registered with
 * this ORB.
 */
public void readObject(Stub self, ObjectInputStream input, ORB orb)
  throws IOException, ClassNotFoundException
{
  byte[] b = (byte[]) input.readObject();
  BufferredCdrInput in = new BufferredCdrInput(b);

  if (orb != null)
    in.setOrb(orb);

  ObjectImpl r = (ObjectImpl) in.read_Object();

  self._set_delegate(r._get_delegate());
}
 
Example 33
Project: classpath   File: StubDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Write as CORBA object. The ORB must be either set under the previous call
 * of Stub.connect or it is taken from the org.omg.CORBA.portable.Delegate.
 * The Stub is automatically registered with this ORB (if not already done).
 */
public void writeObject(Stub self, ObjectOutputStream output, ORB orb)
  throws IOException
{
  BufferedCdrOutput out = new BufferedCdrOutput();
  out.setOrb(orb == null ? self._orb() : orb);
  out.write_Object(self);

  output.writeObject(out.buffer.toByteArray());
}
 
Example 34
Project: classpath   File: UtilDelegateImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Checks if the given stub is local.
 *
 * @param stub a stub to check.
 * @return true if the stub is local, false otherwise.
 */
public boolean isLocal(Stub stub)
  throws RemoteException
{
  try
    {
      return stub._is_local();
    }
  catch (SystemException e)
    {
      RemoteException rex = new RemoteException();
      rex.initCause(e);
      throw rex;
    }
}
 
Example 35
Project: openjdk-icedtea7   File: IIOPProxyImpl.java   Source Code and License 5 votes vote down vote up
@Override
public Object getOrb(Object stub) {
    try {
        return ((Stub)stub)._orb();
    } catch (org.omg.CORBA.BAD_OPERATION x) {
        throw new UnsupportedOperationException(x);
    }
}
 
Example 36
Project: tomee   File: Corbas.java   Source Code and License 5 votes vote down vote up
public static Object connect(final Object obj) throws IOException {
    if (obj instanceof Stub) {
        final Stub stub = (Stub) obj;
        final ORB orb = getORB();
        stub.connect(orb);
    }
    return obj;
}
 
Example 37
Project: OpenJSharp   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public boolean isStub(Object obj) {
    return (obj instanceof Stub);
}
 
Example 38
Project: OpenJSharp   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public Object getDelegate(Object stub) {
    return ((Stub)stub)._get_delegate();
}
 
Example 39
Project: OpenJSharp   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void setDelegate(Object stub, Object delegate) {
    ((Stub)stub)._set_delegate((Delegate)delegate);
}
 
Example 40
Project: OpenJSharp   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void connect(Object stub, Object orb)
    throws RemoteException
{
    ((Stub)stub).connect((ORB)orb);
}
 
Example 41
Project: jdk8u-jdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public boolean isStub(Object obj) {
    return (obj instanceof Stub);
}
 
Example 42
Project: jdk8u-jdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public Object getDelegate(Object stub) {
    return ((Stub)stub)._get_delegate();
}
 
Example 43
Project: jdk8u-jdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void setDelegate(Object stub, Object delegate) {
    ((Stub)stub)._set_delegate((Delegate)delegate);
}
 
Example 44
Project: jdk8u-jdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void connect(Object stub, Object orb)
    throws RemoteException
{
    ((Stub)stub).connect((ORB)orb);
}
 
Example 45
Project: jdk8u_jdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public boolean isStub(Object obj) {
    return (obj instanceof Stub);
}
 
Example 46
Project: jdk8u_jdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public Object getDelegate(Object stub) {
    return ((Stub)stub)._get_delegate();
}
 
Example 47
Project: jdk8u_jdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void setDelegate(Object stub, Object delegate) {
    ((Stub)stub)._set_delegate((Delegate)delegate);
}
 
Example 48
Project: jdk8u_jdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void connect(Object stub, Object orb)
    throws RemoteException
{
    ((Stub)stub).connect((ORB)orb);
}
 
Example 49
Project: lookaside_java-1.8.0-openjdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public boolean isStub(Object obj) {
    return (obj instanceof Stub);
}
 
Example 50
Project: lookaside_java-1.8.0-openjdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public Object getDelegate(Object stub) {
    return ((Stub)stub)._get_delegate();
}
 
Example 51
Project: lookaside_java-1.8.0-openjdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void setDelegate(Object stub, Object delegate) {
    ((Stub)stub)._set_delegate((Delegate)delegate);
}
 
Example 52
Project: lookaside_java-1.8.0-openjdk   File: IIOPProxyImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void connect(Object stub, Object orb)
    throws RemoteException
{
    ((Stub)stub).connect((ORB)orb);
}
 
Example 53
Project: javify   File: RmiUtilities.java   Source Code and License 4 votes vote down vote up
/**
 * Check if the object must be wrapped into Tie, connected to the ORB and then
 * the corresponding Stub be written.
 */
public boolean isTieRequired(Object object)
{
  return object instanceof Remote && !(object instanceof Stub);
}
 
Example 54
Project: javify   File: StubDelegateImpl.java   Source Code and License 4 votes vote down vote up
/**
 * Connect when the POA is specified.
 */
public static void connect(Stub self, ORB orb, POA poa)
  throws RemoteException
{
  ORB oorb = null;
  try
    {
      Delegate d = self._get_delegate();
      if (d != null)
        oorb = d.orb(self);
    }
  catch (Exception e)
    {
      // Failed to get Delegate or ORB.
      // (possible ony for user-written Stubs).
    }

  if (oorb != null)
    {
      if (!oorb.equals(orb))
        throw new RemoteException("Stub " + self
          + " is connected to another ORB, " + orb);
      else
        return;
    }

  Tie t = null;
  if (self instanceof Remote)
    t = Util.getTie((Remote) self);

  // Find by name pattern.
  if (t == null)
    t = getTieFromStub(self);

  Delegate delegate;

  if (t instanceof Servant)
    {
      try
        {
          if (poa == null)
            {
              poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
              // Activate if not active.
              if (poa.the_POAManager().get_state().value() == State._HOLDING)
                poa.the_POAManager().activate();
            }

          ObjectImpl obj = (ObjectImpl) poa.servant_to_reference((Servant) t);
          delegate = obj._get_delegate();
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  else if (t instanceof ObjectImpl)
    {
      ObjectImpl o = (ObjectImpl) t;
      orb.connect(o);
      delegate = o._get_delegate();
    }
  else
    throw new BAD_PARAM("The Tie must be either Servant or ObjectImpl");

  self._set_delegate(delegate);
}
 
Example 55
Project: javify   File: StubDelegateImpl.java   Source Code and License 4 votes vote down vote up
/**
 * Get the hash code (from IOR reference).
 */
public int hashCode(Stub self)
{
  Delegate d = self._get_delegate();
  return d==null?0:d.hashCode();
}
 
Example 56
Project: javify   File: StubDelegateImpl.java   Source Code and License 4 votes vote down vote up
/**
 * This should never be called. The ORB must be supplied.
 *
 * @see #connect
 */
public void readObject(Stub self, ObjectInputStream input)
  throws IOException, ClassNotFoundException
{
  readObject(self, input, null);
}
 
Example 57
Project: javify   File: StubDelegateImpl.java   Source Code and License 4 votes vote down vote up
/**
 * Write as CORBA object. The ORB is taken from the
 * org.omg.CORBA.portable.Delegate. The Stub is automatically registered with
 * this ORB (if not already done).
 */
public void writeObject(Stub self, ObjectOutputStream output)
  throws IOException
{
  writeObject(self, output, null);
}
 
Example 58
Project: jvm-stm   File: RmiUtilities.java   Source Code and License 4 votes vote down vote up
/**
 * Check if the object must be wrapped into Tie, connected to the ORB and then
 * the corresponding Stub be written.
 */
public boolean isTieRequired(Object object)
{
  return object instanceof Remote && !(object instanceof Stub);
}
 
Example 59
Project: jvm-stm   File: StubDelegateImpl.java   Source Code and License 4 votes vote down vote up
/**
 * Connect when the POA is specified.
 */
public static void connect(Stub self, ORB orb, POA poa)
  throws RemoteException
{
  ORB oorb = null;
  try
    {
      Delegate d = self._get_delegate();
      if (d != null)
        oorb = d.orb(self);
    }
  catch (Exception e)
    {
      // Failed to get Delegate or ORB.
      // (possible ony for user-written Stubs).
    }

  if (oorb != null)
    {
      if (!oorb.equals(orb))
        throw new RemoteException("Stub " + self
          + " is connected to another ORB, " + orb);
      else
        return;
    }

  Tie t = null;
  if (self instanceof Remote)
    t = Util.getTie((Remote) self);

  // Find by name pattern.
  if (t == null)
    t = getTieFromStub(self);

  Delegate delegate;

  if (t instanceof Servant)
    {
      try
        {
          if (poa == null)
            {
              poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
              // Activate if not active.
              if (poa.the_POAManager().get_state().value() == State._HOLDING)
                poa.the_POAManager().activate();
            }

          ObjectImpl obj = (ObjectImpl) poa.servant_to_reference((Servant) t);
          delegate = obj._get_delegate();
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  else if (t instanceof ObjectImpl)
    {
      ObjectImpl o = (ObjectImpl) t;
      orb.connect(o);
      delegate = o._get_delegate();
    }
  else
    throw new BAD_PARAM("The Tie must be either Servant or ObjectImpl");

  self._set_delegate(delegate);
}
 
Example 60
Project: jvm-stm   File: StubDelegateImpl.java   Source Code and License 4 votes vote down vote up
/**
 * Get the hash code (from IOR reference).
 */
public int hashCode(Stub self)
{
  Delegate d = self._get_delegate();
  return d==null?0:d.hashCode();
}