Java Code Examples for org.omg.CORBA.portable.Delegate

The following are top voted examples for showing how to use org.omg.CORBA.portable.Delegate. 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: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 2
Project: OpenJSharp   File: StubInvocationHandlerImpl.java   View source code 6 votes vote down vote up
private boolean isLocal()
{
    boolean result = false ;
    Delegate delegate = StubAdapter.getDelegate( stub ) ;

    if (delegate instanceof CorbaClientDelegate) {
        CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
        ContactInfoList cil = cdel.getContactInfoList() ;
        if (cil instanceof CorbaContactInfoList) {
            CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
            LocalClientRequestDispatcher lcrd =
                ccil.getLocalClientRequestDispatcher() ;
            result = lcrd.useLocalInvocation( null ) ;
        }
    }

    return result ;
}
 
Example 3
Project: OpenJSharp   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 4
Project: openjdk-jdk10   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 5
Project: openjdk-jdk10   File: StubInvocationHandlerImpl.java   View source code 6 votes vote down vote up
private boolean isLocal()
{
    boolean result = false ;
    Delegate delegate = StubAdapter.getDelegate( stub ) ;

    if (delegate instanceof CorbaClientDelegate) {
        CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
        ContactInfoList cil = cdel.getContactInfoList() ;
        if (cil instanceof CorbaContactInfoList) {
            CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
            LocalClientRequestDispatcher lcrd =
                ccil.getLocalClientRequestDispatcher() ;
            result = lcrd.useLocalInvocation( null ) ;
        }
    }

    return result ;
}
 
Example 6
Project: openjdk-jdk10   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 7
Project: openjdk9   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 8
Project: openjdk9   File: StubInvocationHandlerImpl.java   View source code 6 votes vote down vote up
private boolean isLocal()
{
    boolean result = false ;
    Delegate delegate = StubAdapter.getDelegate( stub ) ;

    if (delegate instanceof CorbaClientDelegate) {
        CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
        ContactInfoList cil = cdel.getContactInfoList() ;
        if (cil instanceof CorbaContactInfoList) {
            CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
            LocalClientRequestDispatcher lcrd =
                ccil.getLocalClientRequestDispatcher() ;
            result = lcrd.useLocalInvocation( null ) ;
        }
    }

    return result ;
}
 
Example 9
Project: openjdk9   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 10
Project: lookaside_java-1.8.0-openjdk   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 11
Project: lookaside_java-1.8.0-openjdk   File: StubInvocationHandlerImpl.java   View source code 6 votes vote down vote up
private boolean isLocal()
{
    boolean result = false ;
    Delegate delegate = StubAdapter.getDelegate( stub ) ;

    if (delegate instanceof CorbaClientDelegate) {
        CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
        ContactInfoList cil = cdel.getContactInfoList() ;
        if (cil instanceof CorbaContactInfoList) {
            CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
            LocalClientRequestDispatcher lcrd =
                ccil.getLocalClientRequestDispatcher() ;
            result = lcrd.useLocalInvocation( null ) ;
        }
    }

    return result ;
}
 
Example 12
Project: lookaside_java-1.8.0-openjdk   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 13
Project: jdk8u_corba   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 14
Project: jdk8u_corba   File: StubInvocationHandlerImpl.java   View source code 6 votes vote down vote up
private boolean isLocal()
{
    boolean result = false ;
    Delegate delegate = StubAdapter.getDelegate( stub ) ;

    if (delegate instanceof CorbaClientDelegate) {
        CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
        ContactInfoList cil = cdel.getContactInfoList() ;
        if (cil instanceof CorbaContactInfoList) {
            CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
            LocalClientRequestDispatcher lcrd =
                ccil.getLocalClientRequestDispatcher() ;
            result = lcrd.useLocalInvocation( null ) ;
        }
    }

    return result ;
}
 
Example 15
Project: jdk8u_corba   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 16
Project: javify   File: PolicyHelper.java   View source code 6 votes vote down vote up
/**
 * Cast the passed object into the Policy. If the
 * object has a different java type, create an instance
 * of the _PolicyStub, using the same delegate, as for
 * the passed parameter. Hence, unlike java type cast,
 * this method may return a different object, than has been passed.
 *
 * @param obj the object to narrow.
 * @return narrowed instance.
 * @throws BAD_PARAM if the passed object is not a Policy.
 */
public static Policy narrow(org.omg.CORBA.Object obj)
{
  if (obj == null)
    return null;
  else if (obj instanceof Policy)
    return (Policy) obj;
  else
    {
      // Check for the policy id cannot be performed because
      // this helper must read various subclasses of the Policy,
      // and the IOR profile currently supports only one id.

      Delegate delegate = ((ObjectImpl) obj)._get_delegate();
      return new _PolicyStub(delegate);
    }
}
 
Example 17
Project: javify   File: NamingContextHelper.java   View source code 6 votes vote down vote up
/**
 * Cast the passed object into the NamingContext. If the
 * object has a different java type, create an instance
 * of the NamingContext, using the same delegate, as for
 * the passed parameter.
 *
 * If the object repository Id indicates that it is an instance of
 *  {@link NamingContextExt} that is a subclass of the NamingContext,
 * the functionality is  delegated to {@link NamingContextHelper#narrow}.
 *
 * @param obj the object to cast.
 * @return casted instance.
 *
 * @throws BAD_PARAM if the passed object is not an instance of
 * {@link NamingContext} or {@link NamingContextExt}.
 */
public static NamingContext narrow(org.omg.CORBA.Object obj)
{
  if (obj == null)
    return null;
  else if (obj instanceof NamingContext)
    return (NamingContext) obj;
  else if (obj._is_a(id()))
    {
      Delegate delegate = ((ObjectImpl) obj)._get_delegate();
      return new _NamingContextStub(delegate);
    }
  else if (obj._is_a(NamingContextExtHelper.id()))
    return NamingContextExtHelper.narrow(obj);
  else
    throw new BAD_PARAM();
}
 
Example 18
Project: javify   File: OrbFunctional.java   View source code 6 votes vote down vote up
/**
 * Get the IOR reference string for the given object. The string embeds
 * information about the object repository Id, its access key and the server
 * internet address and port. With this information, the object can be found
 * by another ORB, possibly located on remote computer.
 *
 * @param forObject CORBA object
 * @return the object IOR representation.
 *
 * @throws BAD_PARAM if the object has not been previously connected to this
 * ORB.
 *
 * @throws BAD_OPERATION in the unlikely case if the local host address cannot
 * be resolved.
 *
 * @see string_to_object(String)
 */
public String object_to_string(org.omg.CORBA.Object forObject)
{
  // Handle the case when the object is known, but not local.
  if (forObject instanceof ObjectImpl)
    {
      Delegate delegate = ((ObjectImpl) forObject)._get_delegate();
      if (delegate instanceof SimpleDelegate)
        return ((SimpleDelegate) delegate).getIor().toStringifiedReference();
    }

  // Handle the case when the object is local.
  Connected_objects.cObject rec = connected_objects.getKey(forObject);

  if (rec == null)
    throw new BAD_PARAM("The object " + forObject +
      " has not been previously connected to this ORB"
    );

  IOR ior = createIOR(rec);

  return ior.toStringifiedReference();
}
 
Example 19
Project: jvm-stm   File: PolicyHelper.java   View source code 6 votes vote down vote up
/**
 * Cast the passed object into the Policy. If the
 * object has a different java type, create an instance
 * of the _PolicyStub, using the same delegate, as for
 * the passed parameter. Hence, unlike java type cast,
 * this method may return a different object, than has been passed.
 *
 * @param obj the object to narrow.
 * @return narrowed instance.
 * @throws BAD_PARAM if the passed object is not a Policy.
 */
public static Policy narrow(org.omg.CORBA.Object obj)
{
  if (obj == null)
    return null;
  else if (obj instanceof Policy)
    return (Policy) obj;
  else
    {
      // Check for the policy id cannot be performed because
      // this helper must read various subclasses of the Policy,
      // and the IOR profile currently supports only one id.

      Delegate delegate = ((ObjectImpl) obj)._get_delegate();
      return new _PolicyStub(delegate);
    }
}
 
Example 20
Project: jvm-stm   File: NamingContextHelper.java   View source code 6 votes vote down vote up
/**
 * Cast the passed object into the NamingContext. If the
 * object has a different java type, create an instance
 * of the NamingContext, using the same delegate, as for
 * the passed parameter.
 *
 * If the object repository Id indicates that it is an instance of
 *  {@link NamingContextExt} that is a subclass of the NamingContext,
 * the functionality is  delegated to {@link NamingContextHelper#narrow}.
 *
 * @param obj the object to cast.
 * @return casted instance.
 *
 * @throws BAD_PARAM if the passed object is not an instance of
 * {@link NamingContext} or {@link NamingContextExt}.
 */
public static NamingContext narrow(org.omg.CORBA.Object obj)
{
  if (obj == null)
    return null;
  else if (obj instanceof NamingContext)
    return (NamingContext) obj;
  else if (obj._is_a(id()))
    {
      Delegate delegate = ((ObjectImpl) obj)._get_delegate();
      return new _NamingContextStub(delegate);
    }
  else if (obj._is_a(NamingContextExtHelper.id()))
    return NamingContextExtHelper.narrow(obj);
  else
    throw new BAD_PARAM();
}
 
Example 21
Project: jvm-stm   File: OrbFunctional.java   View source code 6 votes vote down vote up
/**
 * Get the IOR reference string for the given object. The string embeds
 * information about the object repository Id, its access key and the server
 * internet address and port. With this information, the object can be found
 * by another ORB, possibly located on remote computer.
 *
 * @param forObject CORBA object
 * @return the object IOR representation.
 *
 * @throws BAD_PARAM if the object has not been previously connected to this
 * ORB.
 *
 * @throws BAD_OPERATION in the unlikely case if the local host address cannot
 * be resolved.
 *
 * @see string_to_object(String)
 */
public String object_to_string(org.omg.CORBA.Object forObject)
{
  // Handle the case when the object is known, but not local.
  if (forObject instanceof ObjectImpl)
    {
      Delegate delegate = ((ObjectImpl) forObject)._get_delegate();
      if (delegate instanceof SimpleDelegate)
        return ((SimpleDelegate) delegate).getIor().toStringifiedReference();
    }

  // Handle the case when the object is local.
  Connected_objects.cObject rec = connected_objects.getKey(forObject);

  if (rec == null)
    throw new BAD_PARAM("The object " + forObject +
      " has not been previously connected to this ORB"
    );

  IOR ior = createIOR(rec);

  return ior.toStringifiedReference();
}
 
Example 22
Project: infobip-open-jdk-8   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 23
Project: infobip-open-jdk-8   File: StubInvocationHandlerImpl.java   View source code 6 votes vote down vote up
private boolean isLocal()
{
    boolean result = false ;
    Delegate delegate = StubAdapter.getDelegate( stub ) ;

    if (delegate instanceof CorbaClientDelegate) {
        CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
        ContactInfoList cil = cdel.getContactInfoList() ;
        if (cil instanceof CorbaContactInfoList) {
            CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
            LocalClientRequestDispatcher lcrd =
                ccil.getLocalClientRequestDispatcher() ;
            result = lcrd.useLocalInvocation( null ) ;
        }
    }

    return result ;
}
 
Example 24
Project: infobip-open-jdk-8   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 25
Project: openjdk-source-code-learn   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 26
Project: openjdk-source-code-learn   File: StubInvocationHandlerImpl.java   View source code 6 votes vote down vote up
private boolean isLocal()
{
    boolean result = false ;
    Delegate delegate = StubAdapter.getDelegate( stub ) ;

    if (delegate instanceof CorbaClientDelegate) {
        CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
        ContactInfoList cil = cdel.getContactInfoList() ;
        if (cil instanceof CorbaContactInfoList) {
            CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
            LocalClientRequestDispatcher lcrd =
                ccil.getLocalClientRequestDispatcher() ;
            result = lcrd.useLocalInvocation( null ) ;
        }
    }

    return result ;
}
 
Example 27
Project: openjdk-source-code-learn   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 28
Project: OLD-OpenJDK8   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 29
Project: OLD-OpenJDK8   File: StubInvocationHandlerImpl.java   View source code 6 votes vote down vote up
private boolean isLocal()
{
    boolean result = false ;
    Delegate delegate = StubAdapter.getDelegate( stub ) ;

    if (delegate instanceof CorbaClientDelegate) {
        CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
        ContactInfoList cil = cdel.getContactInfoList() ;
        if (cil instanceof CorbaContactInfoList) {
            CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
            LocalClientRequestDispatcher lcrd =
                ccil.getLocalClientRequestDispatcher() ;
            result = lcrd.useLocalInvocation( null ) ;
        }
    }

    return result ;
}
 
Example 30
Project: OLD-OpenJDK8   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 31
Project: JamVM-PH   File: PolicyHelper.java   View source code 6 votes vote down vote up
/**
 * Cast the passed object into the Policy. If the
 * object has a different java type, create an instance
 * of the _PolicyStub, using the same delegate, as for
 * the passed parameter. Hence, unlike java type cast,
 * this method may return a different object, than has been passed.
 *
 * @param obj the object to narrow.
 * @return narrowed instance.
 * @throws BAD_PARAM if the passed object is not a Policy.
 */
public static Policy narrow(org.omg.CORBA.Object obj)
{
  if (obj == null)
    return null;
  else if (obj instanceof Policy)
    return (Policy) obj;
  else
    {
      // Check for the policy id cannot be performed because
      // this helper must read various subclasses of the Policy,
      // and the IOR profile currently supports only one id.

      Delegate delegate = ((ObjectImpl) obj)._get_delegate();
      return new _PolicyStub(delegate);
    }
}
 
Example 32
Project: JamVM-PH   File: NamingContextHelper.java   View source code 6 votes vote down vote up
/**
 * Cast the passed object into the NamingContext. If the
 * object has a different java type, create an instance
 * of the NamingContext, using the same delegate, as for
 * the passed parameter.
 *
 * If the object repository Id indicates that it is an instance of
 *  {@link NamingContextExt} that is a subclass of the NamingContext,
 * the functionality is  delegated to {@link NamingContextHelper#narrow}.
 *
 * @param obj the object to cast.
 * @return casted instance.
 *
 * @throws BAD_PARAM if the passed object is not an instance of
 * {@link NamingContext} or {@link NamingContextExt}.
 */
public static NamingContext narrow(org.omg.CORBA.Object obj)
{
  if (obj == null)
    return null;
  else if (obj instanceof NamingContext)
    return (NamingContext) obj;
  else if (obj._is_a(id()))
    {
      Delegate delegate = ((ObjectImpl) obj)._get_delegate();
      return new _NamingContextStub(delegate);
    }
  else if (obj._is_a(NamingContextExtHelper.id()))
    return NamingContextExtHelper.narrow(obj);
  else
    throw new BAD_PARAM();
}
 
Example 33
Project: JamVM-PH   File: OrbFunctional.java   View source code 6 votes vote down vote up
/**
 * Get the IOR reference string for the given object. The string embeds
 * information about the object repository Id, its access key and the server
 * internet address and port. With this information, the object can be found
 * by another ORB, possibly located on remote computer.
 *
 * @param forObject CORBA object
 * @return the object IOR representation.
 *
 * @throws BAD_PARAM if the object has not been previously connected to this
 * ORB.
 *
 * @throws BAD_OPERATION in the unlikely case if the local host address cannot
 * be resolved.
 *
 * @see string_to_object(String)
 */
public String object_to_string(org.omg.CORBA.Object forObject)
{
  // Handle the case when the object is known, but not local.
  if (forObject instanceof ObjectImpl)
    {
      Delegate delegate = ((ObjectImpl) forObject)._get_delegate();
      if (delegate instanceof SimpleDelegate)
        return ((SimpleDelegate) delegate).getIor().toStringifiedReference();
    }

  // Handle the case when the object is local.
  Connected_objects.cObject rec = connected_objects.getKey(forObject);

  if (rec == null)
    throw new BAD_PARAM("The object " + forObject +
      " has not been previously connected to this ORB"
    );

  IOR ior = createIOR(rec);

  return ior.toStringifiedReference();
}
 
Example 34
Project: openjdk-orb   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 35
Project: openjdk-orb   File: StubInvocationHandlerImpl.java   View source code 6 votes vote down vote up
private boolean isLocal()
{
    boolean result = false ;
    Delegate delegate = StubAdapter.getDelegate( stub ) ;

    if (delegate instanceof CorbaClientDelegate) {
        CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
        ContactInfoList cil = cdel.getContactInfoList() ;
        if (cil instanceof CorbaContactInfoList) {
            CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
            LocalClientRequestDispatcher lcrd =
                ccil.getLocalClientRequestDispatcher() ;
            result = lcrd.useLocalInvocation( null ) ;
        }
    }

    return result ;
}
 
Example 36
Project: openjdk-orb   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 37
Project: classpath   File: PolicyHelper.java   View source code 6 votes vote down vote up
/**
 * Cast the passed object into the Policy. If the
 * object has a different java type, create an instance
 * of the _PolicyStub, using the same delegate, as for
 * the passed parameter. Hence, unlike java type cast,
 * this method may return a different object, than has been passed.
 *
 * @param obj the object to narrow.
 * @return narrowed instance.
 * @throws BAD_PARAM if the passed object is not a Policy.
 */
public static Policy narrow(org.omg.CORBA.Object obj)
{
  if (obj == null)
    return null;
  else if (obj instanceof Policy)
    return (Policy) obj;
  else
    {
      // Check for the policy id cannot be performed because
      // this helper must read various subclasses of the Policy,
      // and the IOR profile currently supports only one id.

      Delegate delegate = ((ObjectImpl) obj)._get_delegate();
      return new _PolicyStub(delegate);
    }
}
 
Example 38
Project: classpath   File: NamingContextHelper.java   View source code 6 votes vote down vote up
/**
 * Cast the passed object into the NamingContext. If the
 * object has a different java type, create an instance
 * of the NamingContext, using the same delegate, as for
 * the passed parameter.
 *
 * If the object repository Id indicates that it is an instance of
 *  {@link NamingContextExt} that is a subclass of the NamingContext,
 * the functionality is  delegated to {@link NamingContextHelper#narrow}.
 *
 * @param obj the object to cast.
 * @return casted instance.
 *
 * @throws BAD_PARAM if the passed object is not an instance of
 * {@link NamingContext} or {@link NamingContextExt}.
 */
public static NamingContext narrow(org.omg.CORBA.Object obj)
{
  if (obj == null)
    return null;
  else if (obj instanceof NamingContext)
    return (NamingContext) obj;
  else if (obj._is_a(id()))
    {
      Delegate delegate = ((ObjectImpl) obj)._get_delegate();
      return new _NamingContextStub(delegate);
    }
  else if (obj._is_a(NamingContextExtHelper.id()))
    return NamingContextExtHelper.narrow(obj);
  else
    throw new BAD_PARAM();
}
 
Example 39
Project: classpath   File: OrbFunctional.java   View source code 6 votes vote down vote up
/**
 * Get the IOR reference string for the given object. The string embeds
 * information about the object repository Id, its access key and the server
 * internet address and port. With this information, the object can be found
 * by another ORB, possibly located on remote computer.
 *
 * @param forObject CORBA object
 * @return the object IOR representation.
 *
 * @throws BAD_PARAM if the object has not been previously connected to this
 * ORB.
 *
 * @throws BAD_OPERATION in the unlikely case if the local host address cannot
 * be resolved.
 *
 * @see string_to_object(String)
 */
public String object_to_string(org.omg.CORBA.Object forObject)
{
  // Handle the case when the object is known, but not local.
  if (forObject instanceof ObjectImpl)
    {
      Delegate delegate = ((ObjectImpl) forObject)._get_delegate();
      if (delegate instanceof SimpleDelegate)
        return ((SimpleDelegate) delegate).getIor().toStringifiedReference();
    }

  // Handle the case when the object is local.
  Connected_objects.cObject rec = connected_objects.getKey(forObject);

  if (rec == null)
    throw new BAD_PARAM("The object " + forObject +
      " has not been previously connected to this ORB"
    );

  IOR ior = createIOR(rec);

  return ior.toStringifiedReference();
}
 
Example 40
Project: openjdk-icedtea7   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

    if (!StubAdapter.isStub(other)) {
        return false;
    }

    Delegate delegate = StubAdapter.getDelegate( other ) ;
    if (delegate == null)
        return false ;

    if (delegate instanceof CorbaClientDelegateImpl) {
        CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
            delegate ;
        IOR otherIor = otherDel.contactInfoList.getTargetIOR();
        return this.contactInfoList.getTargetIOR().equals(otherIor);
    }

    // Come here if other is not implemented by our ORB.
    return false;
}