Java Code Examples for org.omg.CORBA.portable.ObjectImpl._get_delegate

The following are Jave code examples for showing how to use _get_delegate of the org.omg.CORBA.portable.ObjectImpl class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: javify   File: OrbFunctional.java   View Source Code Vote up 6 votes
/**
 * Prepare object for connecting it to this ORB.
 *
 * @param object the object being connected.
 *
 * @throws BAD_PARAM if the object does not implement the
 * {@link InvokeHandler}).
 */
protected void prepareObject(org.omg.CORBA.Object object, IOR ior)
  throws BAD_PARAM
{
  /*
   * if (!(object instanceof InvokeHandler)) throw new
   * BAD_PARAM(object.getClass().getName() + " does not implement
   * InvokeHandler. " );
   */

  // If no delegate is set, set the default delegate.
  if (object instanceof ObjectImpl)
    {
      ObjectImpl impl = (ObjectImpl) object;
      try
        {
          if (impl._get_delegate() == null)
            impl._set_delegate(new SimpleDelegate(this, ior));
        }
      catch (BAD_OPERATION ex)
        {
          // Some colaborants may throw this exception.
          impl._set_delegate(new SimpleDelegate(this, ior));
        }
    }
}
 
Example 2
Project: jvm-stm   File: OrbFunctional.java   View Source Code Vote up 6 votes
/**
 * Prepare object for connecting it to this ORB.
 *
 * @param object the object being connected.
 *
 * @throws BAD_PARAM if the object does not implement the
 * {@link InvokeHandler}).
 */
protected void prepareObject(org.omg.CORBA.Object object, IOR ior)
  throws BAD_PARAM
{
  /*
   * if (!(object instanceof InvokeHandler)) throw new
   * BAD_PARAM(object.getClass().getName() + " does not implement
   * InvokeHandler. " );
   */

  // If no delegate is set, set the default delegate.
  if (object instanceof ObjectImpl)
    {
      ObjectImpl impl = (ObjectImpl) object;
      try
        {
          if (impl._get_delegate() == null)
            impl._set_delegate(new SimpleDelegate(this, ior));
        }
      catch (BAD_OPERATION ex)
        {
          // Some colaborants may throw this exception.
          impl._set_delegate(new SimpleDelegate(this, ior));
        }
    }
}
 
Example 3
Project: JamVM-PH   File: OrbFunctional.java   View Source Code Vote up 6 votes
/**
 * Prepare object for connecting it to this ORB.
 *
 * @param object the object being connected.
 *
 * @throws BAD_PARAM if the object does not implement the
 * {@link InvokeHandler}).
 */
protected void prepareObject(org.omg.CORBA.Object object, IOR ior)
  throws BAD_PARAM
{
  /*
   * if (!(object instanceof InvokeHandler)) throw new
   * BAD_PARAM(object.getClass().getName() + " does not implement
   * InvokeHandler. " );
   */

  // If no delegate is set, set the default delegate.
  if (object instanceof ObjectImpl)
    {
      ObjectImpl impl = (ObjectImpl) object;
      try
        {
          if (impl._get_delegate() == null)
            impl._set_delegate(new SimpleDelegate(this, ior));
        }
      catch (BAD_OPERATION ex)
        {
          // Some colaborants may throw this exception.
          impl._set_delegate(new SimpleDelegate(this, ior));
        }
    }
}
 
Example 4
Project: classpath   File: OrbFunctional.java   View Source Code Vote up 6 votes
/**
 * Prepare object for connecting it to this ORB.
 *
 * @param object the object being connected.
 *
 * @throws BAD_PARAM if the object does not implement the
 * {@link InvokeHandler}).
 */
protected void prepareObject(org.omg.CORBA.Object object, IOR ior)
  throws BAD_PARAM
{
  /*
   * if (!(object instanceof InvokeHandler)) throw new
   * BAD_PARAM(object.getClass().getName() + " does not implement
   * InvokeHandler. " );
   */

  // If no delegate is set, set the default delegate.
  if (object instanceof ObjectImpl)
    {
      ObjectImpl impl = (ObjectImpl) object;
      try
        {
          if (impl._get_delegate() == null)
            impl._set_delegate(new SimpleDelegate(this, ior));
        }
      catch (BAD_OPERATION ex)
        {
          // Some colaborants may throw this exception.
          impl._set_delegate(new SimpleDelegate(this, ior));
        }
    }
}
 
Example 5
Project: javify   File: StubDelegateImpl.java   View Source Code Vote up 5 votes
/**
 * 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 6
Project: javify   File: OrbFunctional.java   View Source Code Vote up 5 votes
/**
 * Convert ior reference to CORBA object.
 */
public org.omg.CORBA.Object ior_to_object(IOR ior)
{
  org.omg.CORBA.Object object = find_local_object(ior);
  if (object == null)
    {
      // Check maybe the local object on another ORB, but same VM.
      object = CollocatedOrbs.searchLocalObject(ior);
      if (object == null)
        {
          // Surely remote object.
          ObjectImpl impl = StubLocator.search(this, ior);
          try
            {
              if (impl._get_delegate() == null)
                impl._set_delegate(new IorDelegate(this, ior));
            }
          catch (BAD_OPERATION ex)
            {
              // Some colaborants may throw this exception
              // in response to the attempt to get the unset delegate.
              impl._set_delegate(new IorDelegate(this, ior));
            }

          object = impl;
        }
    }
  return object;
}
 
Example 7
Project: jvm-stm   File: StubDelegateImpl.java   View Source Code Vote up 5 votes
/**
 * 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 8
Project: jvm-stm   File: OrbFunctional.java   View Source Code Vote up 5 votes
/**
 * Convert ior reference to CORBA object.
 */
public org.omg.CORBA.Object ior_to_object(IOR ior)
{
  org.omg.CORBA.Object object = find_local_object(ior);
  if (object == null)
    {
      // Check maybe the local object on another ORB, but same VM.
      object = CollocatedOrbs.searchLocalObject(ior);
      if (object == null)
        {
          // Surely remote object.
          ObjectImpl impl = StubLocator.search(this, ior);
          try
            {
              if (impl._get_delegate() == null)
                impl._set_delegate(new IorDelegate(this, ior));
            }
          catch (BAD_OPERATION ex)
            {
              // Some colaborants may throw this exception
              // in response to the attempt to get the unset delegate.
              impl._set_delegate(new IorDelegate(this, ior));
            }

          object = impl;
        }
    }
  return object;
}
 
Example 9
Project: JamVM-PH   File: StubDelegateImpl.java   View Source Code Vote up 5 votes
/**
 * 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 10
Project: JamVM-PH   File: OrbFunctional.java   View Source Code Vote up 5 votes
/**
 * Convert ior reference to CORBA object.
 */
public org.omg.CORBA.Object ior_to_object(IOR ior)
{
  org.omg.CORBA.Object object = find_local_object(ior);
  if (object == null)
    {
      // Check maybe the local object on another ORB, but same VM.
      object = CollocatedOrbs.searchLocalObject(ior);
      if (object == null)
        {
          // Surely remote object.
          ObjectImpl impl = StubLocator.search(this, ior);
          try
            {
              if (impl._get_delegate() == null)
                impl._set_delegate(new IorDelegate(this, ior));
            }
          catch (BAD_OPERATION ex)
            {
              // Some colaborants may throw this exception
              // in response to the attempt to get the unset delegate.
              impl._set_delegate(new IorDelegate(this, ior));
            }

          object = impl;
        }
    }
  return object;
}
 
Example 11
Project: classpath   File: StubDelegateImpl.java   View Source Code Vote up 5 votes
/**
 * 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 12
Project: classpath   File: OrbFunctional.java   View Source Code Vote up 5 votes
/**
 * Convert ior reference to CORBA object.
 */
public org.omg.CORBA.Object ior_to_object(IOR ior)
{
  org.omg.CORBA.Object object = find_local_object(ior);
  if (object == null)
    {
      // Check maybe the local object on another ORB, but same VM.
      object = CollocatedOrbs.searchLocalObject(ior);
      if (object == null)
        {
          // Surely remote object.
          ObjectImpl impl = StubLocator.search(this, ior);
          try
            {
              if (impl._get_delegate() == null)
                impl._set_delegate(new IorDelegate(this, ior));
            }
          catch (BAD_OPERATION ex)
            {
              // Some colaborants may throw this exception
              // in response to the attempt to get the unset delegate.
              impl._set_delegate(new IorDelegate(this, ior));
            }

          object = impl;
        }
    }
  return object;
}
 
Example 13
Project: javify   File: StubDelegateImpl.java   View Source Code Vote up 4 votes
/**
 * 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 14
Project: javify   File: gnuRequest.java   View Source Code Vote up 4 votes
/**
 * Submit the request, suspending the current thread until the answer is
 * received.
 *
 * This implementation requires to set the IOR property ({@link #setIOR(IOR)}
 * before calling this method.
 *
 * @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously
 * set.
 *
 * @throws SystemException if this exception has been thrown on remote side.
 * The exact exception type and the minor code are the same as they have been
 * for the exception, thrown on remoted side.
 */
public synchronized void invoke() throws BAD_INV_ORDER
{
  waitWhileBusy();
  complete = false;
  running = true;

  if (ior == null)
    throw new BAD_INV_ORDER("Set IOR property first");

  try
    {
      Forwardings:
      while (true)
        {
          try
            {
              p_invoke();
              break Forwardings;
            }
          catch (ForwardRequest e)
            {
              try
                {
                  ObjectImpl impl = (ObjectImpl) e.forward;
                  SimpleDelegate delegate =
                    (SimpleDelegate) impl._get_delegate();
                  ior = delegate.getIor();
                }
              catch (Exception ex)
                {
                  BAD_PARAM bad =
                    new BAD_PARAM("Unsupported forwarding target");
                  bad.initCause(ex);
                  throw bad;
                }
            }
        }
    }
  finally
    {
      running = false;
      complete = true;
    }
}
 
Example 15
Project: jvm-stm   File: StubDelegateImpl.java   View Source Code Vote up 4 votes
/**
 * 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 16
Project: jvm-stm   File: gnuRequest.java   View Source Code Vote up 4 votes
/**
 * Submit the request, suspending the current thread until the answer is
 * received.
 *
 * This implementation requires to set the IOR property ({@link #setIOR(IOR)}
 * before calling this method.
 *
 * @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously
 * set.
 *
 * @throws SystemException if this exception has been thrown on remote side.
 * The exact exception type and the minor code are the same as they have been
 * for the exception, thrown on remoted side.
 */
public synchronized void invoke() throws BAD_INV_ORDER
{
  waitWhileBusy();
  complete = false;
  running = true;

  if (ior == null)
    throw new BAD_INV_ORDER("Set IOR property first");

  try
    {
      Forwardings:
      while (true)
        {
          try
            {
              p_invoke();
              break Forwardings;
            }
          catch (ForwardRequest e)
            {
              try
                {
                  ObjectImpl impl = (ObjectImpl) e.forward;
                  SimpleDelegate delegate =
                    (SimpleDelegate) impl._get_delegate();
                  ior = delegate.getIor();
                }
              catch (Exception ex)
                {
                  BAD_PARAM bad =
                    new BAD_PARAM("Unsupported forwarding target");
                  bad.initCause(ex);
                  throw bad;
                }
            }
        }
    }
  finally
    {
      running = false;
      complete = true;
    }
}
 
Example 17
Project: JamVM-PH   File: StubDelegateImpl.java   View Source Code Vote up 4 votes
/**
 * 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 18
Project: JamVM-PH   File: gnuRequest.java   View Source Code Vote up 4 votes
/**
 * Submit the request, suspending the current thread until the answer is
 * received.
 *
 * This implementation requires to set the IOR property ({@link #setIOR(IOR)}
 * before calling this method.
 *
 * @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously
 * set.
 *
 * @throws SystemException if this exception has been thrown on remote side.
 * The exact exception type and the minor code are the same as they have been
 * for the exception, thrown on remoted side.
 */
public synchronized void invoke() throws BAD_INV_ORDER
{
  waitWhileBusy();
  complete = false;
  running = true;

  if (ior == null)
    throw new BAD_INV_ORDER("Set IOR property first");

  try
    {
      Forwardings:
      while (true)
        {
          try
            {
              p_invoke();
              break Forwardings;
            }
          catch (ForwardRequest e)
            {
              try
                {
                  ObjectImpl impl = (ObjectImpl) e.forward;
                  SimpleDelegate delegate =
                    (SimpleDelegate) impl._get_delegate();
                  ior = delegate.getIor();
                }
              catch (Exception ex)
                {
                  BAD_PARAM bad =
                    new BAD_PARAM("Unsupported forwarding target");
                  bad.initCause(ex);
                  throw bad;
                }
            }
        }
    }
  finally
    {
      running = false;
      complete = true;
    }
}
 
Example 19
Project: classpath   File: StubDelegateImpl.java   View Source Code Vote up 4 votes
/**
 * 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 20
Project: classpath   File: gnuRequest.java   View Source Code Vote up 4 votes
/**
 * Submit the request, suspending the current thread until the answer is
 * received.
 *
 * This implementation requires to set the IOR property ({@link #setIOR(IOR)}
 * before calling this method.
 *
 * @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously
 * set.
 *
 * @throws SystemException if this exception has been thrown on remote side.
 * The exact exception type and the minor code are the same as they have been
 * for the exception, thrown on remoted side.
 */
public synchronized void invoke() throws BAD_INV_ORDER
{
  waitWhileBusy();
  complete = false;
  running = true;

  if (ior == null)
    throw new BAD_INV_ORDER("Set IOR property first");

  try
    {
      Forwardings:
      while (true)
        {
          try
            {
              p_invoke();
              break Forwardings;
            }
          catch (ForwardRequest e)
            {
              try
                {
                  ObjectImpl impl = (ObjectImpl) e.forward;
                  SimpleDelegate delegate =
                    (SimpleDelegate) impl._get_delegate();
                  ior = delegate.getIor();
                }
              catch (Exception ex)
                {
                  BAD_PARAM bad =
                    new BAD_PARAM("Unsupported forwarding target");
                  bad.initCause(ex);
                  throw bad;
                }
            }
        }
    }
  finally
    {
      running = false;
      complete = true;
    }
}