com.sun.corba.se.spi.orb.ORB Java Examples

The following examples show how to use com.sun.corba.se.spi.orb.ORB. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CDROutputStream.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public CDROutputStream(ORB orb,
                       GIOPVersion version,
                       byte encodingVersion,
                       boolean littleEndian,
                       BufferManagerWrite bufferManager,
                       byte streamFormatVersion,
                       boolean usePooledByteBuffers)
{
    impl = OutputStreamFactory.newOutputStream(orb, version,
                                               encodingVersion);
    impl.init(orb, littleEndian, bufferManager,
              streamFormatVersion, usePooledByteBuffers);

    impl.setParent(this);
    this.orb = orb ;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_ENCODING ) ;
}
 
Example #2
Source File: AnyImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void insert_Value(Serializable v)
{
    //debug.log ("insert_Value");
    object = v;

    TypeCode tc;

    if ( v == null ) {
        tc = orb.get_primitive_tc (TCKind.tk_value);
    } else {
        // See note in getPrimitiveTypeCodeForClass.  We
        // have to use the latest type code fixes in this
        // case since there is no way to know what ORB will
        // actually send this Any.  In RMI-IIOP, when using
        // Util.writeAny, we can do the versioning correctly,
        // and use the insert_Value(Serializable, TypeCode)
        // method.
        //
        // The ORB singleton uses the latest version.
        tc = createTypeCodeForClass (v.getClass(), (ORB)ORB.init());
    }

    typeCode = TypeCodeImpl.convertToNative(orb, tc);
    isInitialized = true;
}
 
Example #3
Source File: SpecialMethod.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public CorbaMessageMediator invoke(java.lang.Object servant,
                                   CorbaMessageMediator request,
                                   byte[] objectId,
                                   ObjectAdapter objectAdapter)
{
    ORB orb = (ORB)request.getBroker() ;
    ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.OA_INVOCATION ) ;

    if ((servant == null) || (servant instanceof NullServant)) {
        return request.getProtocolHandler().createSystemExceptionResponse(
            request, wrapper.badSkeleton(), null);
    } else {
        return request.getProtocolHandler().createSystemExceptionResponse(
            request, wrapper.getinterfaceNotImplemented(), null);
    }
}
 
Example #4
Source File: AnyImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void insert_Value(Serializable v)
{
    //debug.log ("insert_Value");
    object = v;

    TypeCode tc;

    if ( v == null ) {
        tc = orb.get_primitive_tc (TCKind.tk_value);
    } else {
        // See note in getPrimitiveTypeCodeForClass.  We
        // have to use the latest type code fixes in this
        // case since there is no way to know what ORB will
        // actually send this Any.  In RMI-IIOP, when using
        // Util.writeAny, we can do the versioning correctly,
        // and use the insert_Value(Serializable, TypeCode)
        // method.
        //
        // The ORB singleton uses the latest version.
        tc = createTypeCodeForClass (v.getClass(), (ORB)ORB.init());
    }

    typeCode = TypeCodeImpl.convertToNative(orb, tc);
    isInitialized = true;
}
 
Example #5
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private CDROutputObject createAppropriateOutputObject(
    CorbaMessageMediator messageMediator,
    Message msg, LocateReplyMessage reply)
{
    CDROutputObject outputObject;

    if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
        // locate msgs 1.0 & 1.1 :=> grow,
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         this,
                         GIOPVersion.V1_0,
                         (CorbaConnection) messageMediator.getConnection(),
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    } else {
        // 1.2 :=> stream
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         messageMediator,
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    }
    return outputObject;
}
 
Example #6
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example #7
Source File: BufferManagerFactory.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static BufferManagerRead newBufferManagerRead(
        GIOPVersion version, byte encodingVersion, ORB orb) {

    // REVISIT - On the reading side, shouldn't we monitor the incoming
    // fragments on a given connection to determine what fragment size
    // they're using, then use that ourselves?

    if (encodingVersion != Message.CDR_ENC_VERSION) {
        return new BufferManagerReadGrow(orb);
    }

    switch (version.intValue())
    {
        case GIOPVersion.VERSION_1_0:
            return new BufferManagerReadGrow(orb);
        case GIOPVersion.VERSION_1_1:
        case GIOPVersion.VERSION_1_2:
            // The stream reader can handle fragmented and
            // non fragmented messages
            return new BufferManagerReadStream(orb);
        default:
            // REVISIT - what is appropriate?
            throw new INTERNAL("Unknown GIOP version: "
                               + version);
    }
}
 
Example #8
Source File: ORBUtility.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/** 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
Source File: CDROutputObject.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public CDROutputObject(ORB orb, CorbaMessageMediator mediator,
                       GIOPVersion giopVersion,
                       CorbaConnection connection, Message header,
                       byte streamFormatVersion)
{
    this(
        orb,
        giopVersion,
        header,
        BufferManagerFactory.
        newBufferManagerWrite(giopVersion,
                              header.getEncodingVersion(),
                              orb),
        streamFormatVersion,
        mediator);
    this.connection = connection ;
}
 
Example #10
Source File: Util.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example #11
Source File: TypeCodeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public TypeCodeImpl(ORB orb,
                    int creationKind,
                    String id,
                    String name)
{
    this(orb) ;

    if (creationKind == TCKind._tk_objref ||
        creationKind == TCKind._tk_native ||
        creationKind == TCKind._tk_abstract_interface)
        {
            _kind           = creationKind;
            setId(id);
            _name           = name;
        } // else initializes to null
}
 
Example #12
Source File: CDROutputObject.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public CDROutputObject(ORB orb,
                       MessageMediator messageMediator,
                       Message header,
                       byte streamFormatVersion)
{
    this(
        orb,
        ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
        header,
        BufferManagerFactory.newBufferManagerWrite(
            ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
            header.getEncodingVersion(),
            orb),
        streamFormatVersion,
        (CorbaMessageMediator)messageMediator);
}
 
Example #13
Source File: BufferManagerFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static BufferManagerRead newBufferManagerRead(
        int strategy, byte encodingVersion, ORB orb) {

    if (encodingVersion != Message.CDR_ENC_VERSION) {
        if (strategy != BufferManagerFactory.GROW) {
            ORBUtilSystemException wrapper =
                ORBUtilSystemException.get((ORB)orb,
                                           CORBALogDomains.RPC_ENCODING);
            throw wrapper.invalidBuffMgrStrategy("newBufferManagerRead");
        }
        return new BufferManagerReadGrow(orb);
    }
    switch (strategy) {
        case BufferManagerFactory.GROW:
            return new BufferManagerReadGrow(orb);
        case BufferManagerFactory.COLLECT:
            throw new INTERNAL("Collect strategy invalid for reading");
        case BufferManagerFactory.STREAM:
            return new BufferManagerReadStream(orb);
        default:
            throw new INTERNAL("Unknown buffer manager read strategy: "
                               + strategy);
    }
}
 
Example #14
Source File: IIOPProfileTemplateImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public IIOPProfileTemplateImpl( ORB orb, GIOPVersion version, IIOPAddress primary )
{
    this.orb = orb ;
    this.giopVersion = version ;
    this.primary = primary ;
    if (giopVersion.getMinor() == 0)
        // Adding tagged components is not allowed for IIOP 1.0,
        // so this template is complete and should be made immutable.
        makeImmutable() ;
}
 
Example #15
Source File: LocateRequestMessage_1_2.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
LocateRequestMessage_1_2(ORB orb, int _request_id, TargetAddress _target) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPLocateRequest, 0);
    this.orb = orb;
    request_id = _request_id;
    target = _target;
}
 
Example #16
Source File: SocketOrChannelContactInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected SocketOrChannelContactInfoImpl(
    ORB orb,
    CorbaContactInfoList contactInfoList)
{
    this.orb = orb;
    this.contactInfoList = contactInfoList;
}
 
Example #17
Source File: NewObjectKeyTemplateBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public NewObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
    String orbid, ObjectAdapterId oaid )
{
    super( orb, magic, scid, serverid, orbid, oaid ) ;
    // subclass must set the version, since we don't have the object key here.

    if (magic != ObjectKeyFactoryImpl.JAVAMAGIC_NEWER)
        throw wrapper.badMagic( new Integer( magic ) ) ;
}
 
Example #18
Source File: ORBUtility.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static CorbaClientDelegate makeClientDelegate( IOR ior )
{
    ORB orb = ior.getORB() ;
    CorbaContactInfoList ccil = orb.getCorbaContactInfoListFactory().create( ior ) ;
    CorbaClientDelegate del = orb.getClientDelegateFactory().create(ccil);
    return del ;
}
 
Example #19
Source File: AnyImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * returns an output stream that an Any value can be marshaled into.
 *
 * @result          the OutputStream to marshal value of Any into
 */
public org.omg.CORBA.portable.OutputStream create_output_stream()
{
    //debug.log ("create_output_stream");
    final ORB finalorb = this.orb;
    return AccessController.doPrivileged(new PrivilegedAction<AnyOutputStream>() {
        @Override
        public AnyOutputStream run() {
            return new AnyOutputStream(finalorb);
        }
    });
}
 
Example #20
Source File: IORImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/** Construct an IOR from an IORTemplate by applying the same
* object id to each TaggedProfileTemplate in the IORTemplate.
*/
public IORImpl( ORB orb, String typeId, IORTemplate iortemp, ObjectId id)
{
    this( orb, typeId ) ;

    this.iortemps = IORFactories.makeIORTemplateList() ;
    this.iortemps.add( iortemp ) ;

    addTaggedProfiles( iortemp, id ) ;

    makeImmutable() ;
}
 
Example #21
Source File: CorbaMessageMediatorImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void handleThrowableDuringServerDispatch(
    CorbaMessageMediator messageMediator,
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) {
        dprint(".handleThrowableDuringServerDispatch: "
               + opAndId(messageMediator) + ": "
               + throwable);
    }

    // If we haven't unmarshaled the header, we probably don't
    // have enough information to even send back a reply.

    // REVISIT
    // Cannot do this check.  When target addressing disposition does
    // not match (during header unmarshaling) it throws an exception
    // to be handled here.
    /*
    if (! ((CDRInputObject)messageMediator.getInputObject())
        .unmarshaledHeader()) {
        return;
    }
    */
    handleThrowableDuringServerDispatch(messageMediator,
                                        throwable,
                                        completionStatus,
                                        1);
}
 
Example #22
Source File: CorbaMessageMediatorImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected void runRemoveThreadInfo(CorbaMessageMediator messageMediator)
{
    // Once you get here then the final reply is available (i.e.,
    // postinvoke and interceptors have completed.
    if (messageMediator.executeRemoveThreadInfoInResponseConstructor()) {
        messageMediator.setExecuteRemoveThreadInfoInResponseConstructor(false);
        ((ORB)messageMediator.getBroker()).popInvocationInfo() ;
    }
}
 
Example #23
Source File: ServerRequestImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public ServerRequestImpl (CorbaMessageMediator req, ORB orb) {
    _opName = req.getOperationName();
    _ins    = (InputStream)req.getInputObject();
    _ctx    = null;         // if we support contexts, this would
                            // presumably also  be available on
                            // the server invocation
    _orb = orb;
    _wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.OA_INVOCATION ) ;
}
 
Example #24
Source File: RequestMessage_1_0.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
RequestMessage_1_0(ORB orb, ServiceContexts _service_contexts,
        int _request_id, boolean _response_expected, byte[] _object_key,
        String _operation, Principal _requesting_principal) {
    super(Message.GIOPBigMagic, false, Message.GIOPRequest, 0);
    this.orb = orb;
    service_contexts = _service_contexts;
    request_id = _request_id;
    response_expected = _response_expected;
    object_key = _object_key;
    operation = _operation;
    requesting_principal = _requesting_principal;
}
 
Example #25
Source File: TypeCodeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public TypeCodeImpl(ORB orb)
{
    // initialized to tk_null
    _orb = orb;
    wrapper = ORBUtilSystemException.get(
        (com.sun.corba.se.spi.orb.ORB)orb, CORBALogDomains.RPC_PRESENTATION ) ;
}
 
Example #26
Source File: AnyImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static AnyImpl convertToNative(ORB orb, Any any) {
    if (any instanceof AnyImpl) {
        return (AnyImpl)any;
    } else {
        AnyImpl anyImpl = new AnyImpl(orb, any);
        anyImpl.typeCode = TypeCodeImpl.convertToNative(orb, anyImpl.typeCode);
        return anyImpl;
    }
}
 
Example #27
Source File: OutputStreamFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static TypeCodeOutputStream newTypeCodeOutputStream(
        final ORB orb) {
    return AccessController.doPrivileged(
        new PrivilegedAction<TypeCodeOutputStream>() {
            @Override
            public TypeCodeOutputStream run() {
                return new TypeCodeOutputStream(orb);
            }
    });
}
 
Example #28
Source File: POAFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void init( ORB orb )
{
    this.orb = orb ;
    wrapper = POASystemException.get( orb,
        CORBALogDomains.OA_LIFECYCLE ) ;
    omgWrapper = OMGSystemException.get( orb,
        CORBALogDomains.OA_LIFECYCLE ) ;
    delegateImpl = new DelegateImpl( orb, this ) ;
    registerRootPOA() ;

    POACurrent poaCurrent = new POACurrent(orb);
    orb.getLocalResolver().register( ORBConstants.POA_CURRENT_NAME,
        ClosureFactory.makeConstant( poaCurrent ) ) ;
}
 
Example #29
Source File: ORBUtility.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if it was accurately determined that the remote ORB is
 * a foreign (non-JavaSoft) ORB.  Note:  If passed the ORBSingleton, this
 * will return false.
 */
public static boolean isForeignORB(ORB orb)
{
    if (orb == null)
        return false;

    try {
        return orb.getORBVersion().equals(ORBVersionFactory.getFOREIGN());
    } catch (SecurityException se) {
        return false;
    }
}
 
Example #30
Source File: TransportDefault.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public static CorbaContactInfoListFactory makeCorbaContactInfoListFactory(
    final ORB broker )
{
    return new CorbaContactInfoListFactory() {
        public void setORB(ORB orb) { }
        public CorbaContactInfoList create( IOR ior ) {
            return new CorbaContactInfoListImpl(
                (com.sun.corba.se.spi.orb.ORB)broker, ior ) ;
        }
    };
}