Java Code Examples for com.sun.corba.se.spi.presentation.rmi.StubAdapter.isStub()

The following are Jave code examples for showing how to use isStub() of the com.sun.corba.se.spi.presentation.rmi.StubAdapter 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: OpenJSharp   File: AnyImpl.java   View Source Code Vote up 6 votes
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_Object(org.omg.CORBA.Object o)
{
    //debug.log ("insert_Object");
    if ( o == null ) {
        typeCode = orb.get_primitive_tc(TCKind._tk_objref);
    } else {
        if (StubAdapter.isStub(o)) {
            String[] ids = StubAdapter.getTypeIds( o ) ;
            typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
        } else {
            throw wrapper.badInsertobjParam(
                CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
        }
    }

    object = o;
    isInitialized = true;
}
 
Example 2
Project: OpenJSharp   File: CorbaClientDelegateImpl.java   View Source Code Vote up 6 votes
/**
 * 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 3
Project: OpenJSharp   File: PortableRemoteObject.java   View Source Code Vote up 6 votes
/**
 * 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.");
        }
    }
}
 
Example 4
Project: OpenJSharp   File: ORBUtility.java   View Source Code Vote up 6 votes
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 5
Project: openjdk-jdk10   File: AnyImpl.java   View Source Code Vote up 6 votes
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_Object(org.omg.CORBA.Object o)
{
    //debug.log ("insert_Object");
    if ( o == null ) {
        typeCode = orb.get_primitive_tc(TCKind._tk_objref);
    } else {
        if (StubAdapter.isStub(o)) {
            String[] ids = StubAdapter.getTypeIds( o ) ;
            typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
        } else {
            throw wrapper.badInsertobjParam(
                CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
        }
    }

    object = o;
    isInitialized = true;
}
 
Example 6
Project: openjdk-jdk10   File: CorbaClientDelegateImpl.java   View Source Code Vote up 6 votes
/**
 * 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 7
Project: openjdk-jdk10   File: PortableRemoteObject.java   View Source Code Vote up 6 votes
/**
 * 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.");
        }
    }
}
 
Example 8
Project: openjdk-jdk10   File: ORBUtility.java   View Source Code Vote up 6 votes
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 9
Project: jdk8u_corba   File: AnyImpl.java   View Source Code Vote up 6 votes
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_Object(org.omg.CORBA.Object o)
{
    //debug.log ("insert_Object");
    if ( o == null ) {
        typeCode = orb.get_primitive_tc(TCKind._tk_objref);
    } else {
        if (StubAdapter.isStub(o)) {
            String[] ids = StubAdapter.getTypeIds( o ) ;
            typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
        } else {
            throw wrapper.badInsertobjParam(
                CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
        }
    }

    object = o;
    isInitialized = true;
}
 
Example 10
Project: jdk8u_corba   File: PortableRemoteObject.java   View Source Code Vote up 6 votes
/**
 * 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.");
        }
    }
}
 
Example 11
Project: openjdk9   File: CorbaClientDelegateImpl.java   View Source Code Vote up 6 votes
/**
 * 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 12
Project: openjdk9   File: PortableRemoteObject.java   View Source Code Vote up 6 votes
/**
 * 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.");
        }
    }
}
 
Example 13
Project: openjdk9   File: ORBUtility.java   View Source Code Vote up 6 votes
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 14
Project: jdk8u_corba   File: ORBUtility.java   View Source Code Vote up 6 votes
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 15
Project: lookaside_java-1.8.0-openjdk   File: PortableRemoteObject.java   View Source Code Vote up 6 votes
/**
 * 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.");
        }
    }
}
 
Example 16
Project: lookaside_java-1.8.0-openjdk   File: ORBUtility.java   View Source Code Vote up 6 votes
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 17
Project: giv-planner   File: Test75.java   View Source Code Vote up 6 votes
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_Object(org.omg.CORBA.Object o)
{
//debug.log ("insert_Object");
if ( o == null ) {
    typeCode = orb.get_primitive_tc(TCKind._tk_objref);
} else {
    if (StubAdapter.isStub(o)) {
    String[] ids = StubAdapter.getTypeIds( o ) ;
    typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
    } else {
    throw wrapper.badInsertobjParam( 
        CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
    }
}

object = o;
isInitialized = true;
}
 
Example 18
Project: infobip-open-jdk-8   File: AnyImpl.java   View Source Code Vote up 6 votes
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_Object(org.omg.CORBA.Object o)
{
    //debug.log ("insert_Object");
    if ( o == null ) {
        typeCode = orb.get_primitive_tc(TCKind._tk_objref);
    } else {
        if (StubAdapter.isStub(o)) {
            String[] ids = StubAdapter.getTypeIds( o ) ;
            typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
        } else {
            throw wrapper.badInsertobjParam(
                CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
        }
    }

    object = o;
    isInitialized = true;
}
 
Example 19
Project: infobip-open-jdk-8   File: CorbaClientDelegateImpl.java   View Source Code Vote up 6 votes
/**
 * 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 20
Project: infobip-open-jdk-8   File: PortableRemoteObject.java   View Source Code Vote up 6 votes
/**
 * 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.");
        }
    }
}
 
Example 21
Project: infobip-open-jdk-8   File: ORBUtility.java   View Source Code Vote up 6 votes
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 22
Project: openjdk-orb   File: ORBUtility.java   View Source Code Vote up 6 votes
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 23
Project: openjdk-source-code-learn   File: CorbaClientDelegateImpl.java   View Source Code Vote up 6 votes
/**
 * 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 24
Project: openjdk-source-code-learn   File: PortableRemoteObject.java   View Source Code Vote up 6 votes
/**
 * 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.");
        }
    }
}
 
Example 25
Project: openjdk-source-code-learn   File: ORBUtility.java   View Source Code Vote up 6 votes
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 26
Project: OLD-OpenJDK8   File: AnyImpl.java   View Source Code Vote up 6 votes
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_Object(org.omg.CORBA.Object o)
{
    //debug.log ("insert_Object");
    if ( o == null ) {
        typeCode = orb.get_primitive_tc(TCKind._tk_objref);
    } else {
        if (StubAdapter.isStub(o)) {
            String[] ids = StubAdapter.getTypeIds( o ) ;
            typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
        } else {
            throw wrapper.badInsertobjParam(
                CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
        }
    }

    object = o;
    isInitialized = true;
}
 
Example 27
Project: OLD-OpenJDK8   File: CorbaClientDelegateImpl.java   View Source Code Vote up 6 votes
/**
 * 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 28
Project: OLD-OpenJDK8   File: PortableRemoteObject.java   View Source Code Vote up 6 votes
/**
 * 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.");
        }
    }
}
 
Example 29
Project: openjdk-icedtea7   File: AnyImpl.java   View Source Code Vote up 6 votes
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_Object(org.omg.CORBA.Object o)
{
    //debug.log ("insert_Object");
    if ( o == null ) {
        typeCode = orb.get_primitive_tc(TCKind._tk_objref);
    } else {
        if (StubAdapter.isStub(o)) {
            String[] ids = StubAdapter.getTypeIds( o ) ;
            typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
        } else {
            throw wrapper.badInsertobjParam(
                CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
        }
    }

    object = o;
    isInitialized = true;
}
 
Example 30
Project: openjdk-icedtea7   File: CorbaClientDelegateImpl.java   View Source Code Vote up 6 votes
/**
 * 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 31
Project: openjdk-icedtea7   File: PortableRemoteObject.java   View Source Code Vote up 6 votes
/**
 * 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.");
        }
    }
}
 
Example 32
Project: openjdk-icedtea7   File: ORBUtility.java   View Source Code Vote up 6 votes
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 33
Project: openjdk-jdk10   File: ORBImpl.java   View Source Code Vote up 5 votes
/**
 * If this operation is called with an id, <code>"Y"</code>, and an
 * object, <code>YY</code>, then a subsequent call to
 * <code>ORB.resolve_initial_references( "Y" )</code> will
 * return object <code>YY</code>.
 *
 * @param id The ID by which the initial reference will be known.
 * @param obj The initial reference itself.
 * @throws InvalidName if this operation is called with an empty string id
 *     or this operation is called with an id that is already registered,
 *     including the default names defined by OMG.
 * @throws BAD_PARAM if the obj parameter is null.
 */
public void register_initial_reference(
    String id, org.omg.CORBA.Object obj ) throws InvalidName
{
    CorbaServerRequestDispatcher insnd ;

    synchronized (this) {
        checkShutdownState();
    }

    if ((id == null) || (id.length() == 0))
        throw new InvalidName() ;

    synchronized (this) {
        checkShutdownState();
    }

    synchronized (resolverLock) {
        insnd = insNamingDelegate ;

        java.lang.Object obj2 = localResolver.resolve( id ) ;
        if (obj2 != null)
            throw new InvalidName(id + " already registered") ;

        localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
    }

    synchronized (this) {
        if (StubAdapter.isStub(obj))
            // Make all remote object references available for INS.
            requestDispatcherRegistry.registerServerRequestDispatcher(
                insnd, id ) ;
    }
}
 
Example 34
Project: OpenJSharp   File: PortableRemoteObject.java   View Source Code Vote up 5 votes
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
Example 35
Project: OpenJSharp   File: IDLJavaSerializationOutputStream.java   View Source Code Vote up 5 votes
/**
 * Checks for objects that are instances of java.rmi.Remote
 * that need to be serialized as proxy (Stub) objects.
 */
protected final Object replaceObject(Object obj) throws IOException {
    try {
        if ((obj instanceof java.rmi.Remote) &&
                !(StubAdapter.isStub(obj))) {
            return Utility.autoConnect(obj, orb, true);
        }
    } catch (Exception e) {
        IOException ie = new IOException("replaceObject failed");
        ie.initCause(e);
        throw ie;
    }
    return obj;
}
 
Example 36
Project: openjdk-jdk10   File: ServerRequestInfoImpl.java   View Source Code Vote up 5 votes
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 37
Project: OpenJSharp   File: ServerRequestInfoImpl.java   View Source Code Vote up 5 votes
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 38
Project: OpenJSharp   File: ORBImpl.java   View Source Code Vote up 5 votes
/**
 * If this operation is called with an id, <code>"Y"</code>, and an
 * object, <code>YY</code>, then a subsequent call to
 * <code>ORB.resolve_initial_references( "Y" )</code> will
 * return object <code>YY</code>.
 *
 * @param id The ID by which the initial reference will be known.
 * @param obj The initial reference itself.
 * @throws InvalidName if this operation is called with an empty string id
 *     or this operation is called with an id that is already registered,
 *     including the default names defined by OMG.
 * @throws BAD_PARAM if the obj parameter is null.
 */
public void register_initial_reference(
    String id, org.omg.CORBA.Object obj ) throws InvalidName
{
    CorbaServerRequestDispatcher insnd ;

    synchronized (this) {
        checkShutdownState();
    }

    if ((id == null) || (id.length() == 0))
        throw new InvalidName() ;

    synchronized (this) {
        checkShutdownState();
    }

    synchronized (resolverLock) {
        insnd = insNamingDelegate ;

        java.lang.Object obj2 = localResolver.resolve( id ) ;
        if (obj2 != null)
            throw new InvalidName(id + " already registered") ;

        localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
    }

    synchronized (this) {
        if (StubAdapter.isStub(obj))
            // Make all remote object references available for INS.
            requestDispatcherRegistry.registerServerRequestDispatcher(
                insnd, id ) ;
    }
}
 
Example 39
Project: openjdk-jdk10   File: CorbaClientDelegateImpl.java   View Source Code Vote up 5 votes
public boolean is_equivalent(org.omg.CORBA.Object obj,
                             org.omg.CORBA.Object ref)
{
    if ( ref == null )
        return false;

    // If ref is a local object, it is not a Stub!
    if (!StubAdapter.isStub(ref))
        return false ;

    Delegate del = StubAdapter.getDelegate(ref) ;
    if (del == null)
        return false ;

    // Optimize the x.is_equivalent( x ) case
    if (del == this)
        return true;

    // If delegate was created by a different ORB, return false
    if (!(del instanceof CorbaClientDelegateImpl))
        return false ;

    CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
    CorbaContactInfoList ccil =
        (CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
    return this.contactInfoList.getTargetIOR().isEquivalent(
        ccil.getTargetIOR() );
}
 
Example 40
Project: openjdk-jdk10   File: PortableRemoteObject.java   View Source Code Vote up 5 votes
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
Example 41
Project: openjdk-jdk10   File: IDLJavaSerializationOutputStream.java   View Source Code Vote up 5 votes
/**
 * Checks for objects that are instances of java.rmi.Remote
 * that need to be serialized as proxy (Stub) objects.
 */
protected final Object replaceObject(Object obj) throws IOException {
    try {
        if ((obj instanceof java.rmi.Remote) &&
                !(StubAdapter.isStub(obj))) {
            return Utility.autoConnect(obj, orb, true);
        }
    } catch (Exception e) {
        IOException ie = new IOException("replaceObject failed");
        ie.initCause(e);
        throw ie;
    }
    return obj;
}
 
Example 42
Project: openjdk-jdk10   File: IDLJavaSerializationInputStream.java   View Source Code Vote up 5 votes
/**
 * Connect the Stub to the ORB.
 */
protected final Object resolveObject(Object obj) throws IOException {
    try {
        if (StubAdapter.isStub(obj)) {
            StubAdapter.connect(obj, orb);
        }
    } catch (java.rmi.RemoteException re) {
        IOException ie = new IOException("resolveObject failed");
        ie.initCause(re);
        throw ie;
    }
    return obj;
}
 
Example 43
Project: openjdk9   File: PortableRemoteObject.java   View Source Code Vote up 5 votes
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
Example 44
Project: openjdk9   File: IDLJavaSerializationOutputStream.java   View Source Code Vote up 5 votes
/**
 * Checks for objects that are instances of java.rmi.Remote
 * that need to be serialized as proxy (Stub) objects.
 */
protected final Object replaceObject(Object obj) throws IOException {
    try {
        if ((obj instanceof java.rmi.Remote) &&
                !(StubAdapter.isStub(obj))) {
            return Utility.autoConnect(obj, orb, true);
        }
    } catch (Exception e) {
        IOException ie = new IOException("replaceObject failed");
        ie.initCause(e);
        throw ie;
    }
    return obj;
}
 
Example 45
Project: openjdk9   File: IDLJavaSerializationInputStream.java   View Source Code Vote up 5 votes
/**
 * Connect the Stub to the ORB.
 */
protected final Object resolveObject(Object obj) throws IOException {
    try {
        if (StubAdapter.isStub(obj)) {
            StubAdapter.connect(obj, orb);
        }
    } catch (java.rmi.RemoteException re) {
        IOException ie = new IOException("resolveObject failed");
        ie.initCause(re);
        throw ie;
    }
    return obj;
}
 
Example 46
Project: openjdk9   File: ServerRequestInfoImpl.java   View Source Code Vote up 5 votes
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 47
Project: openjdk9   File: ORBImpl.java   View Source Code Vote up 5 votes
/**
 * If this operation is called with an id, <code>"Y"</code>, and an
 * object, <code>YY</code>, then a subsequent call to
 * <code>ORB.resolve_initial_references( "Y" )</code> will
 * return object <code>YY</code>.
 *
 * @param id The ID by which the initial reference will be known.
 * @param obj The initial reference itself.
 * @throws InvalidName if this operation is called with an empty string id
 *     or this operation is called with an id that is already registered,
 *     including the default names defined by OMG.
 * @throws BAD_PARAM if the obj parameter is null.
 */
public void register_initial_reference(
    String id, org.omg.CORBA.Object obj ) throws InvalidName
{
    CorbaServerRequestDispatcher insnd ;

    synchronized (this) {
        checkShutdownState();
    }

    if ((id == null) || (id.length() == 0))
        throw new InvalidName() ;

    synchronized (this) {
        checkShutdownState();
    }

    synchronized (resolverLock) {
        insnd = insNamingDelegate ;

        java.lang.Object obj2 = localResolver.resolve( id ) ;
        if (obj2 != null)
            throw new InvalidName(id + " already registered") ;

        localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
    }

    synchronized (this) {
        if (StubAdapter.isStub(obj))
            // Make all remote object references available for INS.
            requestDispatcherRegistry.registerServerRequestDispatcher(
                insnd, id ) ;
    }
}
 
Example 48
Project: lookaside_java-1.8.0-openjdk   File: ServerRequestInfoImpl.java   View Source Code Vote up 5 votes
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 49
Project: lookaside_java-1.8.0-openjdk   File: ORBImpl.java   View Source Code Vote up 5 votes
/**
 * If this operation is called with an id, <code>"Y"</code>, and an
 * object, <code>YY</code>, then a subsequent call to
 * <code>ORB.resolve_initial_references( "Y" )</code> will
 * return object <code>YY</code>.
 *
 * @param id The ID by which the initial reference will be known.
 * @param obj The initial reference itself.
 * @throws InvalidName if this operation is called with an empty string id
 *     or this operation is called with an id that is already registered,
 *     including the default names defined by OMG.
 * @throws BAD_PARAM if the obj parameter is null.
 */
public void register_initial_reference(
    String id, org.omg.CORBA.Object obj ) throws InvalidName
{
    CorbaServerRequestDispatcher insnd ;

    synchronized (this) {
        checkShutdownState();
    }

    if ((id == null) || (id.length() == 0))
        throw new InvalidName() ;

    synchronized (this) {
        checkShutdownState();
    }

    synchronized (resolverLock) {
        insnd = insNamingDelegate ;

        java.lang.Object obj2 = localResolver.resolve( id ) ;
        if (obj2 != null)
            throw new InvalidName(id + " already registered") ;

        localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
    }

    synchronized (this) {
        if (StubAdapter.isStub(obj))
            // Make all remote object references available for INS.
            requestDispatcherRegistry.registerServerRequestDispatcher(
                insnd, id ) ;
    }
}
 
Example 50
Project: lookaside_java-1.8.0-openjdk   File: PortableRemoteObject.java   View Source Code Vote up 5 votes
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
Example 51
Project: jdk8u_corba   File: ServerRequestInfoImpl.java   View Source Code Vote up 5 votes
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 52
Project: lookaside_java-1.8.0-openjdk   File: IDLJavaSerializationInputStream.java   View Source Code Vote up 5 votes
/**
 * Connect the Stub to the ORB.
 */
protected final Object resolveObject(Object obj) throws IOException {
    try {
        if (StubAdapter.isStub(obj)) {
            StubAdapter.connect(obj, orb);
        }
    } catch (java.rmi.RemoteException re) {
        IOException ie = new IOException("resolveObject failed");
        ie.initCause(re);
        throw ie;
    }
    return obj;
}
 
Example 53
Project: infobip-open-jdk-8   File: CorbaClientDelegateImpl.java   View Source Code Vote up 5 votes
public boolean is_equivalent(org.omg.CORBA.Object obj,
                             org.omg.CORBA.Object ref)
{
    if ( ref == null )
        return false;

    // If ref is a local object, it is not a Stub!
    if (!StubAdapter.isStub(ref))
        return false ;

    Delegate del = StubAdapter.getDelegate(ref) ;
    if (del == null)
        return false ;

    // Optimize the x.is_equivalent( x ) case
    if (del == this)
        return true;

    // If delegate was created by a different ORB, return false
    if (!(del instanceof CorbaClientDelegateImpl))
        return false ;

    CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
    CorbaContactInfoList ccil =
        (CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
    return this.contactInfoList.getTargetIOR().isEquivalent(
        ccil.getTargetIOR() );
}
 
Example 54
Project: infobip-open-jdk-8   File: PortableRemoteObject.java   View Source Code Vote up 5 votes
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
Example 55
Project: infobip-open-jdk-8   File: IDLJavaSerializationOutputStream.java   View Source Code Vote up 5 votes
/**
 * Checks for objects that are instances of java.rmi.Remote
 * that need to be serialized as proxy (Stub) objects.
 */
protected final Object replaceObject(Object obj) throws IOException {
    try {
        if ((obj instanceof java.rmi.Remote) &&
                !(StubAdapter.isStub(obj))) {
            return Utility.autoConnect(obj, orb, true);
        }
    } catch (Exception e) {
        IOException ie = new IOException("replaceObject failed");
        ie.initCause(e);
        throw ie;
    }
    return obj;
}
 
Example 56
Project: infobip-open-jdk-8   File: IDLJavaSerializationInputStream.java   View Source Code Vote up 5 votes
/**
 * Connect the Stub to the ORB.
 */
protected final Object resolveObject(Object obj) throws IOException {
    try {
        if (StubAdapter.isStub(obj)) {
            StubAdapter.connect(obj, orb);
        }
    } catch (java.rmi.RemoteException re) {
        IOException ie = new IOException("resolveObject failed");
        ie.initCause(re);
        throw ie;
    }
    return obj;
}
 
Example 57
Project: infobip-open-jdk-8   File: ServerRequestInfoImpl.java   View Source Code Vote up 5 votes
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 58
Project: infobip-open-jdk-8   File: ORBImpl.java   View Source Code Vote up 5 votes
/**
 * If this operation is called with an id, <code>"Y"</code>, and an
 * object, <code>YY</code>, then a subsequent call to
 * <code>ORB.resolve_initial_references( "Y" )</code> will
 * return object <code>YY</code>.
 *
 * @param id The ID by which the initial reference will be known.
 * @param obj The initial reference itself.
 * @throws InvalidName if this operation is called with an empty string id
 *     or this operation is called with an id that is already registered,
 *     including the default names defined by OMG.
 * @throws BAD_PARAM if the obj parameter is null.
 */
public void register_initial_reference(
    String id, org.omg.CORBA.Object obj ) throws InvalidName
{
    CorbaServerRequestDispatcher insnd ;

    synchronized (this) {
        checkShutdownState();
    }

    if ((id == null) || (id.length() == 0))
        throw new InvalidName() ;

    synchronized (this) {
        checkShutdownState();
    }

    synchronized (resolverLock) {
        insnd = insNamingDelegate ;

        java.lang.Object obj2 = localResolver.resolve( id ) ;
        if (obj2 != null)
            throw new InvalidName(id + " already registered") ;

        localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
    }

    synchronized (this) {
        if (StubAdapter.isStub(obj))
            // Make all remote object references available for INS.
            requestDispatcherRegistry.registerServerRequestDispatcher(
                insnd, id ) ;
    }
}
 
Example 59
Project: openjdk-source-code-learn   File: CorbaClientDelegateImpl.java   View Source Code Vote up 5 votes
public boolean is_equivalent(org.omg.CORBA.Object obj,
                             org.omg.CORBA.Object ref)
{
    if ( ref == null )
        return false;

    // If ref is a local object, it is not a Stub!
    if (!StubAdapter.isStub(ref))
        return false ;

    Delegate del = StubAdapter.getDelegate(ref) ;
    if (del == null)
        return false ;

    // Optimize the x.is_equivalent( x ) case
    if (del == this)
        return true;

    // If delegate was created by a different ORB, return false
    if (!(del instanceof CorbaClientDelegateImpl))
        return false ;

    CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
    CorbaContactInfoList ccil =
        (CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
    return this.contactInfoList.getTargetIOR().isEquivalent(
        ccil.getTargetIOR() );
}
 
Example 60
Project: openjdk-source-code-learn   File: PortableRemoteObject.java   View Source Code Vote up 5 votes
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
Example 61
Project: openjdk-orb   File: CorbaClientDelegateImpl.java   View Source Code Vote up 5 votes
public boolean is_equivalent(org.omg.CORBA.Object obj,
                             org.omg.CORBA.Object ref)
{
    if ( ref == null )
        return false;

    // If ref is a local object, it is not a Stub!
    if (!StubAdapter.isStub(ref))
        return false ;

    Delegate del = StubAdapter.getDelegate(ref) ;
    if (del == null)
        return false ;

    // Optimize the x.is_equivalent( x ) case
    if (del == this)
        return true;

    // If delegate was created by a different ORB, return false
    if (!(del instanceof CorbaClientDelegateImpl))
        return false ;

    CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
    CorbaContactInfoList ccil =
        (CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
    return this.contactInfoList.getTargetIOR().isEquivalent(
        ccil.getTargetIOR() );
}
 
Example 62
Project: openjdk-source-code-learn   File: IDLJavaSerializationInputStream.java   View Source Code Vote up 5 votes
/**
 * Connect the Stub to the ORB.
 */
protected final Object resolveObject(Object obj) throws IOException {
    try {
        if (StubAdapter.isStub(obj)) {
            StubAdapter.connect(obj, orb);
        }
    } catch (java.rmi.RemoteException re) {
        IOException ie = new IOException("resolveObject failed");
        ie.initCause(re);
        throw ie;
    }
    return obj;
}
 
Example 63
Project: OLD-OpenJDK8   File: ORBImpl.java   View Source Code Vote up 5 votes
/**
 * If this operation is called with an id, <code>"Y"</code>, and an
 * object, <code>YY</code>, then a subsequent call to
 * <code>ORB.resolve_initial_references( "Y" )</code> will
 * return object <code>YY</code>.
 *
 * @param id The ID by which the initial reference will be known.
 * @param obj The initial reference itself.
 * @throws InvalidName if this operation is called with an empty string id
 *     or this operation is called with an id that is already registered,
 *     including the default names defined by OMG.
 * @throws BAD_PARAM if the obj parameter is null.
 */
public void register_initial_reference(
    String id, org.omg.CORBA.Object obj ) throws InvalidName
{
    CorbaServerRequestDispatcher insnd ;

    synchronized (this) {
        checkShutdownState();
    }

    if ((id == null) || (id.length() == 0))
        throw new InvalidName() ;

    synchronized (this) {
        checkShutdownState();
    }

    synchronized (resolverLock) {
        insnd = insNamingDelegate ;

        java.lang.Object obj2 = localResolver.resolve( id ) ;
        if (obj2 != null)
            throw new InvalidName(id + " already registered") ;

        localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
    }

    synchronized (this) {
        if (StubAdapter.isStub(obj))
            // Make all remote object references available for INS.
            requestDispatcherRegistry.registerServerRequestDispatcher(
                insnd, id ) ;
    }
}
 
Example 64
Project: openjdk-source-code-learn   File: ServerRequestInfoImpl.java   View Source Code Vote up 5 votes
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 65
Project: openjdk-source-code-learn   File: ORBImpl.java   View Source Code Vote up 5 votes
/**
 * If this operation is called with an id, <code>"Y"</code>, and an
 * object, <code>YY</code>, then a subsequent call to
 * <code>ORB.resolve_initial_references( "Y" )</code> will
 * return object <code>YY</code>.
 *
 * @param id The ID by which the initial reference will be known.
 * @param obj The initial reference itself.
 * @throws InvalidName if this operation is called with an empty string id
 *     or this operation is called with an id that is already registered,
 *     including the default names defined by OMG.
 * @throws BAD_PARAM if the obj parameter is null.
 */
public void register_initial_reference(
    String id, org.omg.CORBA.Object obj ) throws InvalidName
{
    CorbaServerRequestDispatcher insnd ;

    if ((id == null) || (id.length() == 0))
        throw new InvalidName() ;

    synchronized (this) {
        checkShutdownState();
    }

    synchronized (resolverLock) {
        insnd = insNamingDelegate ;

        java.lang.Object obj2 = localResolver.resolve( id ) ;
        if (obj2 != null)
            throw new InvalidName(id + " already registered") ;

        localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
    }

    synchronized (this) {
        if (StubAdapter.isStub(obj))
            // Make all remote object references available for INS.
            requestDispatcherRegistry.registerServerRequestDispatcher(
                insnd, id ) ;
    }
}
 
Example 66
Project: OLD-OpenJDK8   File: CorbaClientDelegateImpl.java   View Source Code Vote up 5 votes
public boolean is_equivalent(org.omg.CORBA.Object obj,
                             org.omg.CORBA.Object ref)
{
    if ( ref == null )
        return false;

    // If ref is a local object, it is not a Stub!
    if (!StubAdapter.isStub(ref))
        return false ;

    Delegate del = StubAdapter.getDelegate(ref) ;
    if (del == null)
        return false ;

    // Optimize the x.is_equivalent( x ) case
    if (del == this)
        return true;

    // If delegate was created by a different ORB, return false
    if (!(del instanceof CorbaClientDelegateImpl))
        return false ;

    CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
    CorbaContactInfoList ccil =
        (CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
    return this.contactInfoList.getTargetIOR().isEquivalent(
        ccil.getTargetIOR() );
}
 
Example 67
Project: OLD-OpenJDK8   File: PortableRemoteObject.java   View Source Code Vote up 5 votes
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
Example 68
Project: OLD-OpenJDK8   File: IDLJavaSerializationOutputStream.java   View Source Code Vote up 5 votes
/**
 * Checks for objects that are instances of java.rmi.Remote
 * that need to be serialized as proxy (Stub) objects.
 */
protected final Object replaceObject(Object obj) throws IOException {
    try {
        if ((obj instanceof java.rmi.Remote) &&
                !(StubAdapter.isStub(obj))) {
            return Utility.autoConnect(obj, orb, true);
        }
    } catch (Exception e) {
        IOException ie = new IOException("replaceObject failed");
        ie.initCause(e);
        throw ie;
    }
    return obj;
}
 
Example 69
Project: OLD-OpenJDK8   File: IDLJavaSerializationInputStream.java   View Source Code Vote up 5 votes
/**
 * Connect the Stub to the ORB.
 */
protected final Object resolveObject(Object obj) throws IOException {
    try {
        if (StubAdapter.isStub(obj)) {
            StubAdapter.connect(obj, orb);
        }
    } catch (java.rmi.RemoteException re) {
        IOException ie = new IOException("resolveObject failed");
        ie.initCause(re);
        throw ie;
    }
    return obj;
}
 
Example 70
Project: openjdk-orb   File: ServerRequestInfoImpl.java   View Source Code Vote up 5 votes
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 71
Project: openjdk-icedtea7   File: CorbaClientDelegateImpl.java   View Source Code Vote up 5 votes
public boolean is_equivalent(org.omg.CORBA.Object obj,
                             org.omg.CORBA.Object ref)
{
    if ( ref == null )
        return false;

    // If ref is a local object, it is not a Stub!
    if (!StubAdapter.isStub(ref))
        return false ;

    Delegate del = StubAdapter.getDelegate(ref) ;
    if (del == null)
        return false ;

    // Optimize the x.is_equivalent( x ) case
    if (del == this)
        return true;

    // If delegate was created by a different ORB, return false
    if (!(del instanceof CorbaClientDelegateImpl))
        return false ;

    CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
    CorbaContactInfoList ccil =
        (CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
    return this.contactInfoList.getTargetIOR().isEquivalent(
        ccil.getTargetIOR() );
}
 
Example 72
Project: openjdk-icedtea7   File: PortableRemoteObject.java   View Source Code Vote up 5 votes
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
Example 73
Project: openjdk-icedtea7   File: IDLJavaSerializationOutputStream.java   View Source Code Vote up 5 votes
/**
 * Checks for objects that are instances of java.rmi.Remote
 * that need to be serialized as proxy (Stub) objects.
 */
protected final Object replaceObject(Object obj) throws IOException {
    try {
        if ((obj instanceof java.rmi.Remote) &&
                !(StubAdapter.isStub(obj))) {
            return Utility.autoConnect(obj, orb, true);
        }
    } catch (Exception e) {
        IOException ie = new IOException("replaceObject failed");
        ie.initCause(e);
        throw ie;
    }
    return obj;
}
 
Example 74
Project: openjdk-icedtea7   File: IDLJavaSerializationInputStream.java   View Source Code Vote up 5 votes
/**
 * Connect the Stub to the ORB.
 */
protected final Object resolveObject(Object obj) throws IOException {
    try {
        if (StubAdapter.isStub(obj)) {
            StubAdapter.connect(obj, orb);
        }
    } catch (java.rmi.RemoteException re) {
        IOException ie = new IOException("resolveObject failed");
        ie.initCause(re);
        throw ie;
    }
    return obj;
}
 
Example 75
Project: openjdk-icedtea7   File: ServerRequestInfoImpl.java   View Source Code Vote up 5 votes
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 76
Project: openjdk-icedtea7   File: ORBImpl.java   View Source Code Vote up 5 votes
/**
 * If this operation is called with an id, <code>"Y"</code>, and an
 * object, <code>YY</code>, then a subsequent call to
 * <code>ORB.resolve_initial_references( "Y" )</code> will
 * return object <code>YY</code>.
 *
 * @param id The ID by which the initial reference will be known.
 * @param obj The initial reference itself.
 * @throws InvalidName if this operation is called with an empty string id
 *     or this operation is called with an id that is already registered,
 *     including the default names defined by OMG.
 * @throws BAD_PARAM if the obj parameter is null.
 */
public void register_initial_reference(
    String id, org.omg.CORBA.Object obj ) throws InvalidName
{
    CorbaServerRequestDispatcher insnd ;

    synchronized (this) {
        checkShutdownState();
    }

    if ((id == null) || (id.length() == 0))
        throw new InvalidName() ;

    synchronized (this) {
        checkShutdownState();
    }

    synchronized (resolverLock) {
        insnd = insNamingDelegate ;

        java.lang.Object obj2 = localResolver.resolve( id ) ;
        if (obj2 != null)
            throw new InvalidName(id + " already registered") ;

        localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
    }

    synchronized (this) {
        if (StubAdapter.isStub(obj))
            // Make all remote object references available for INS.
            requestDispatcherRegistry.registerServerRequestDispatcher(
                insnd, id ) ;
    }
}
 
Example 77
Project: OpenJSharp   File: ORBUtility.java   View Source Code Vote up 4 votes
/** This method obtains an IOR from a CORBA object reference.
* It will return null if obj is a local object, a null object,
* or an object implemented by a different ORB.  It will
* throw BAD_OPERATION if obj is an unconnected RMI-IIOP object.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION (from oi._get_delegate) if obj is a
* normal objref, but does not have a delegate set.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR getIOR( org.omg.CORBA.Object obj )
{
    if (obj == null)
        throw wrapper.nullObjectReference() ;

    IOR ior = null ;
    if (StubAdapter.isStub(obj)) {
        org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
            obj ) ;

        if (del instanceof CorbaClientDelegate) {
            CorbaClientDelegate cdel = (CorbaClientDelegate)del ;
            ContactInfoList cil = cdel.getContactInfoList() ;

            if (cil instanceof CorbaContactInfoList) {
                CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
                ior = ccil.getTargetIOR() ;
                if (ior == null)
                    throw wrapper.nullIor() ;

                return ior ;
            } else {
                // This is our code, but the ContactInfoList is not a
                // CorbaContactInfoList.  This should not happen, because
                // we are in the CORBA application of the DCSA framework.
                // This is a coding error, and thus an INTERNAL exception
                // should be thrown.
                // XXX needs minor code
                throw new INTERNAL() ;
            }
        }

        // obj is implemented by a foreign ORB, because the Delegate is not a
        // ClientDelegate.
        // XXX this case could be handled by marshalling and
        // unmarshalling.  However, object_to_string cannot be used
        // here, as it is implemented with getIOR.  Note that this
        // will require access to an ORB, so that we can create streams
        // as needed.  The ORB is available simply as io._orb().
        throw wrapper.objrefFromForeignOrb() ;
    } else
        throw wrapper.localObjectNotAllowed() ;
}
 
Example 78
Project: openjdk-jdk10   File: ORBUtility.java   View Source Code Vote up 4 votes
/** This method obtains an IOR from a CORBA object reference.
* It will return null if obj is a local object, a null object,
* or an object implemented by a different ORB.  It will
* throw BAD_OPERATION if obj is an unconnected RMI-IIOP object.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION (from oi._get_delegate) if obj is a
* normal objref, but does not have a delegate set.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR getIOR( org.omg.CORBA.Object obj )
{
    if (obj == null)
        throw wrapper.nullObjectReference() ;

    IOR ior = null ;
    if (StubAdapter.isStub(obj)) {
        org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
            obj ) ;

        if (del instanceof CorbaClientDelegate) {
            CorbaClientDelegate cdel = (CorbaClientDelegate)del ;
            ContactInfoList cil = cdel.getContactInfoList() ;

            if (cil instanceof CorbaContactInfoList) {
                CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
                ior = ccil.getTargetIOR() ;
                if (ior == null)
                    throw wrapper.nullIor() ;

                return ior ;
            } else {
                // This is our code, but the ContactInfoList is not a
                // CorbaContactInfoList.  This should not happen, because
                // we are in the CORBA application of the DCSA framework.
                // This is a coding error, and thus an INTERNAL exception
                // should be thrown.
                // XXX needs minor code
                throw new INTERNAL() ;
            }
        }

        // obj is implemented by a foreign ORB, because the Delegate is not a
        // ClientDelegate.
        // XXX this case could be handled by marshalling and
        // unmarshalling.  However, object_to_string cannot be used
        // here, as it is implemented with getIOR.  Note that this
        // will require access to an ORB, so that we can create streams
        // as needed.  The ORB is available simply as io._orb().
        throw wrapper.objrefFromForeignOrb() ;
    } else
        throw wrapper.localObjectNotAllowed() ;
}
 
Example 79
Project: openjdk9   File: ORBUtility.java   View Source Code Vote up 4 votes
/** This method obtains an IOR from a CORBA object reference.
* It will return null if obj is a local object, a null object,
* or an object implemented by a different ORB.  It will
* throw BAD_OPERATION if obj is an unconnected RMI-IIOP object.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION (from oi._get_delegate) if obj is a
* normal objref, but does not have a delegate set.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR getIOR( org.omg.CORBA.Object obj )
{
    if (obj == null)
        throw wrapper.nullObjectReference() ;

    IOR ior = null ;
    if (StubAdapter.isStub(obj)) {
        org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
            obj ) ;

        if (del instanceof CorbaClientDelegate) {
            CorbaClientDelegate cdel = (CorbaClientDelegate)del ;
            ContactInfoList cil = cdel.getContactInfoList() ;

            if (cil instanceof CorbaContactInfoList) {
                CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
                ior = ccil.getTargetIOR() ;
                if (ior == null)
                    throw wrapper.nullIor() ;

                return ior ;
            } else {
                // This is our code, but the ContactInfoList is not a
                // CorbaContactInfoList.  This should not happen, because
                // we are in the CORBA application of the DCSA framework.
                // This is a coding error, and thus an INTERNAL exception
                // should be thrown.
                // XXX needs minor code
                throw new INTERNAL() ;
            }
        }

        // obj is implemented by a foreign ORB, because the Delegate is not a
        // ClientDelegate.
        // XXX this case could be handled by marshalling and
        // unmarshalling.  However, object_to_string cannot be used
        // here, as it is implemented with getIOR.  Note that this
        // will require access to an ORB, so that we can create streams
        // as needed.  The ORB is available simply as io._orb().
        throw wrapper.objrefFromForeignOrb() ;
    } else
        throw wrapper.localObjectNotAllowed() ;
}
 
Example 80
Project: lookaside_java-1.8.0-openjdk   File: ORBUtility.java   View Source Code Vote up 4 votes
/** This method obtains an IOR from a CORBA object reference.
* It will return null if obj is a local object, a null object,
* or an object implemented by a different ORB.  It will
* throw BAD_OPERATION if obj is an unconnected RMI-IIOP object.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION (from oi._get_delegate) if obj is a
* normal objref, but does not have a delegate set.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR getIOR( org.omg.CORBA.Object obj )
{
    if (obj == null)
        throw wrapper.nullObjectReference() ;

    IOR ior = null ;
    if (StubAdapter.isStub(obj)) {
        org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
            obj ) ;

        if (del instanceof CorbaClientDelegate) {
            CorbaClientDelegate cdel = (CorbaClientDelegate)del ;
            ContactInfoList cil = cdel.getContactInfoList() ;

            if (cil instanceof CorbaContactInfoList) {
                CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
                ior = ccil.getTargetIOR() ;
                if (ior == null)
                    throw wrapper.nullIor() ;

                return ior ;
            } else {
                // This is our code, but the ContactInfoList is not a
                // CorbaContactInfoList.  This should not happen, because
                // we are in the CORBA application of the DCSA framework.
                // This is a coding error, and thus an INTERNAL exception
                // should be thrown.
                // XXX needs minor code
                throw new INTERNAL() ;
            }
        }

        // obj is implemented by a foreign ORB, because the Delegate is not a
        // ClientDelegate.
        // XXX this case could be handled by marshalling and
        // unmarshalling.  However, object_to_string cannot be used
        // here, as it is implemented with getIOR.  Note that this
        // will require access to an ORB, so that we can create streams
        // as needed.  The ORB is available simply as io._orb().
        throw wrapper.objrefFromForeignOrb() ;
    } else
        throw wrapper.localObjectNotAllowed() ;
}
 
Example 81
Project: infobip-open-jdk-8   File: ORBUtility.java   View Source Code Vote up 4 votes
/** This method obtains an IOR from a CORBA object reference.
* It will return null if obj is a local object, a null object,
* or an object implemented by a different ORB.  It will
* throw BAD_OPERATION if obj is an unconnected RMI-IIOP object.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION (from oi._get_delegate) if obj is a
* normal objref, but does not have a delegate set.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR getIOR( org.omg.CORBA.Object obj )
{
    if (obj == null)
        throw wrapper.nullObjectReference() ;

    IOR ior = null ;
    if (StubAdapter.isStub(obj)) {
        org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
            obj ) ;

        if (del instanceof CorbaClientDelegate) {
            CorbaClientDelegate cdel = (CorbaClientDelegate)del ;
            ContactInfoList cil = cdel.getContactInfoList() ;

            if (cil instanceof CorbaContactInfoList) {
                CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
                ior = ccil.getTargetIOR() ;
                if (ior == null)
                    throw wrapper.nullIor() ;

                return ior ;
            } else {
                // This is our code, but the ContactInfoList is not a
                // CorbaContactInfoList.  This should not happen, because
                // we are in the CORBA application of the DCSA framework.
                // This is a coding error, and thus an INTERNAL exception
                // should be thrown.
                // XXX needs minor code
                throw new INTERNAL() ;
            }
        }

        // obj is implemented by a foreign ORB, because the Delegate is not a
        // ClientDelegate.
        // XXX this case could be handled by marshalling and
        // unmarshalling.  However, object_to_string cannot be used
        // here, as it is implemented with getIOR.  Note that this
        // will require access to an ORB, so that we can create streams
        // as needed.  The ORB is available simply as io._orb().
        throw wrapper.objrefFromForeignOrb() ;
    } else
        throw wrapper.localObjectNotAllowed() ;
}
 
Example 82
Project: openjdk-orb   File: ORBUtility.java   View Source Code Vote up 4 votes
/** This method obtains an IOR from a CORBA object reference.
* It will return null if obj is a local object, a null object,
* or an object implemented by a different ORB.  It will
* throw BAD_OPERATION if obj is an unconnected RMI-IIOP object.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION (from oi._get_delegate) if obj is a
* normal objref, but does not have a delegate set.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR getIOR( org.omg.CORBA.Object obj )
{
    if (obj == null)
        throw wrapper.nullObjectReference() ;

    IOR ior = null ;
    if (StubAdapter.isStub(obj)) {
        org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
            obj ) ;

        if (del instanceof CorbaClientDelegate) {
            CorbaClientDelegate cdel = (CorbaClientDelegate)del ;
            ContactInfoList cil = cdel.getContactInfoList() ;

            if (cil instanceof CorbaContactInfoList) {
                CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
                ior = ccil.getTargetIOR() ;
                if (ior == null)
                    throw wrapper.nullIor() ;

                return ior ;
            } else {
                // This is our code, but the ContactInfoList is not a
                // CorbaContactInfoList.  This should not happen, because
                // we are in the CORBA application of the DCSA framework.
                // This is a coding error, and thus an INTERNAL exception
                // should be thrown.
                // XXX needs minor code
                throw new INTERNAL() ;
            }
        }

        // obj is implemented by a foreign ORB, because the Delegate is not a
        // ClientDelegate.
        // XXX this case could be handled by marshalling and
        // unmarshalling.  However, object_to_string cannot be used
        // here, as it is implemented with getIOR.  Note that this
        // will require access to an ORB, so that we can create streams
        // as needed.  The ORB is available simply as io._orb().
        throw wrapper.objrefFromForeignOrb() ;
    } else
        throw wrapper.localObjectNotAllowed() ;
}
 
Example 83
Project: openjdk-icedtea7   File: ORBUtility.java   View Source Code Vote up 4 votes
/** This method obtains an IOR from a CORBA object reference.
* It will return null if obj is a local object, a null object,
* or an object implemented by a different ORB.  It will
* throw BAD_OPERATION if obj is an unconnected RMI-IIOP object.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION (from oi._get_delegate) if obj is a
* normal objref, but does not have a delegate set.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR getIOR( org.omg.CORBA.Object obj )
{
    if (obj == null)
        throw wrapper.nullObjectReference() ;

    IOR ior = null ;
    if (StubAdapter.isStub(obj)) {
        org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
            obj ) ;

        if (del instanceof CorbaClientDelegate) {
            CorbaClientDelegate cdel = (CorbaClientDelegate)del ;
            ContactInfoList cil = cdel.getContactInfoList() ;

            if (cil instanceof CorbaContactInfoList) {
                CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
                ior = ccil.getTargetIOR() ;
                if (ior == null)
                    throw wrapper.nullIor() ;

                return ior ;
            } else {
                // This is our code, but the ContactInfoList is not a
                // CorbaContactInfoList.  This should not happen, because
                // we are in the CORBA application of the DCSA framework.
                // This is a coding error, and thus an INTERNAL exception
                // should be thrown.
                // XXX needs minor code
                throw new INTERNAL() ;
            }
        }

        // obj is implemented by a foreign ORB, because the Delegate is not a
        // ClientDelegate.
        // XXX this case could be handled by marshalling and
        // unmarshalling.  However, object_to_string cannot be used
        // here, as it is implemented with getIOR.  Note that this
        // will require access to an ORB, so that we can create streams
        // as needed.  The ORB is available simply as io._orb().
        throw wrapper.objrefFromForeignOrb() ;
    } else
        throw wrapper.localObjectNotAllowed() ;
}