Java Code Examples for com.sun.corba.se.spi.ior.IOR

The following are top voted examples for showing how to use com.sun.corba.se.spi.ior.IOR. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: PIHandlerImpl.java   View source code 6 votes vote down vote up
/**
 * Handles exceptions for the starting and intermediate points for
 * server request interceptors.  This is common code that has been
 * factored out into this utility method.
 * <p>
 * This method will NOT work for ending points.
 */
private void serverPIHandleExceptions( ServerRequestInfoImpl info )
{
    int endingPointCall = info.getEndingPointCall();
    if(endingPointCall == ServerRequestInfoImpl.CALL_SEND_EXCEPTION) {
        // If a system exception was thrown, throw it to caller:
        throw (SystemException)info.getException();
    }
    else if( (endingPointCall == ServerRequestInfoImpl.CALL_SEND_OTHER) &&
             (info.getForwardRequestException() != null) )
    {
        // If an interceptor throws a forward request, convert it
        // into a ForwardException for easier handling:
        IOR ior = info.getForwardRequestIOR();
        throw new ForwardException( orb, ior );
    }
}
 
Example 2
Project: openjdk-jdk10   File: LocalClientRequestDispatcherBase.java   View source code 6 votes vote down vote up
protected LocalClientRequestDispatcherBase(ORB orb, int scid, IOR ior)
{
    this.orb = orb ;

    TaggedProfile prof = ior.getProfile() ;
    servantIsLocal = orb.getORBData().isLocalOptimizationAllowed() &&
        prof.isLocal();

    ObjectKeyTemplate oktemp = prof.getObjectKeyTemplate() ;
    this.scid = oktemp.getSubcontractId() ;
    RequestDispatcherRegistry sreg = orb.getRequestDispatcherRegistry() ;
    oaf = sreg.getObjectAdapterFactory( scid ) ;
    oaid = oktemp.getObjectAdapterId() ;
    ObjectId oid = prof.getObjectId() ;
    objectId = oid.getId() ;
}
 
Example 3
Project: openjdk-jdk10   File: CorbaContactInfoListImpl.java   View source code 6 votes vote down vote up
protected void addRemoteContactInfos(
    IOR  effectiveTargetIOR,
    List effectiveTargetIORContactInfoList)
{
    ContactInfo contactInfo;
    List socketInfos = orb.getORBData()
        .getIORToSocketInfo().getSocketInfo(effectiveTargetIOR);
    Iterator iterator = socketInfos.iterator();
    while (iterator.hasNext()) {
        SocketInfo socketInfo = (SocketInfo) iterator.next();
        String type = socketInfo.getType();
        String host = socketInfo.getHost().toLowerCase();
        int    port = socketInfo.getPort();
        contactInfo = createContactInfo(type, host, port);
        effectiveTargetIORContactInfoList.add(contactInfo);
    }
}
 
Example 4
Project: OpenJSharp   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

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

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

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

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 5
Project: OpenJSharp   File: ClientRequestInfoImpl.java   View source code 6 votes vote down vote up
/**
 * See RequestInfoImpl for javadoc.
 */
public Object forward_reference (){
    checkAccess( MID_FORWARD_REFERENCE );
    // Check to make sure we are in LOCATION_FORWARD
    // state as per ptc/00-08-06, table 21-1
    // footnote 2.
    if( replyStatus != LOCATION_FORWARD.value ) {
        throw stdWrapper.invalidPiCall1() ;
    }

    // Do not cache this value since if an interceptor raises
    // forward request then the next interceptor in the
    // list should see the new value.
    IOR ior = getLocatedIOR();
    return iorToObject(ior);
}
 
Example 6
Project: openjdk-jdk10   File: BootstrapResolverImpl.java   View source code 6 votes vote down vote up
public BootstrapResolverImpl(ORB orb, String host, int port) {
    wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.ORB_RESOLVER ) ;

    // Create a new IOR with the magic of INIT
    byte[] initialKey = "INIT".getBytes() ;
    ObjectKey okey = orb.getObjectKeyFactory().create(initialKey) ;

    IIOPAddress addr = IIOPFactories.makeIIOPAddress( orb, host, port ) ;
    IIOPProfileTemplate ptemp = IIOPFactories.makeIIOPProfileTemplate(
        orb, GIOPVersion.V1_0, addr);

    IORTemplate iortemp = IORFactories.makeIORTemplate( okey.getTemplate() ) ;
    iortemp.add( ptemp ) ;

    IOR initialIOR = iortemp.makeIOR( (com.sun.corba.se.spi.orb.ORB)orb,
        "", okey.getId() ) ;

    bootstrapDelegate = ORBUtility.makeClientDelegate( initialIOR ) ;
}
 
Example 7
Project: openjdk-jdk10   File: ORBUtility.java   View source code 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 8
Project: openjdk-jdk10   File: InterceptorInvoker.java   View source code 6 votes vote down vote up
/**
 * Update the client delegate in the event of a ForwardRequest, given the
 * information in the passed-in info object.
 */
private void updateClientRequestDispatcherForward(
    ClientRequestInfoImpl info )
{
    ForwardRequest forwardRequest = info.getForwardRequestException();

    // ForwardRequest may be null if the forwarded IOR is set internal
    // to the ClientRequestDispatcher rather than explicitly through Portable
    // Interceptors.  In this case, we need not update the client
    // delegate ForwardRequest object.
    if( forwardRequest != null ) {
        org.omg.CORBA.Object object = forwardRequest.forward;

        // Convert the forward object into an IOR:
        IOR ior = ORBUtility.getIOR( object ) ;
        info.setLocatedIOR( ior );
    }
}
 
Example 9
Project: openjdk-jdk10   File: MessageBase.java   View source code 6 votes vote down vote up
public static LocateReplyMessage createLocateReply(
        ORB orb, GIOPVersion gv, byte encodingVersion,
        int request_id, int locate_status, IOR ior) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new LocateReplyMessage_1_0(orb, request_id,
                                          locate_status, ior);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new LocateReplyMessage_1_1(orb, request_id,
                                          locate_status, ior);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        LocateReplyMessage msg =
            new LocateReplyMessage_1_2(orb, request_id,
                                       locate_status, ior);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 10
Project: openjdk-jdk10   File: CorbaClientDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
 * and does the equality check based on IOR equality.
 */
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
    if (other == null)
        return false ;

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

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

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

    // Come here if other is not implemented by our ORB.
    return false;
}
 
Example 11
Project: openjdk-jdk10   File: CorbaServerRequestDispatcherImpl.java   View source code 6 votes vote down vote up
/** XXX/REVISIT:
 * We do not want to look for a servant in the POA/ServantManager case,
 * but we could in most other cases.  The OA could have a method that
 * returns true if the servant MAY exist, and false only if the servant
 * definitely DOES NOT exist.
 *
 * XXX/REVISIT:
 * We may wish to indicate OBJECT_HERE by some mechanism other than
 * returning a null result.
 *
 * Called from ORB.locate when a LocateRequest arrives.
 * Result is not always absolutely correct: may indicate OBJECT_HERE
 * for non-existent objects, which is resolved on invocation.  This
 * "bug" is unavoidable, since in general the object may be destroyed
 * between a locate and a request.  Note that this only checks that
 * the appropriate ObjectAdapter is available, not that the servant
 * actually exists.
 * Need to signal one of OBJECT_HERE, OBJECT_FORWARD, OBJECT_NOT_EXIST.
 * @return Result is null if object is (possibly) implemented here, otherwise
 * an IOR indicating objref to forward the request to.
 * @exception OBJECT_NOT_EXIST is thrown if we know the object does not
 * exist here, and we are not forwarding.
 */
public IOR locate(ObjectKey okey)
{
    try {
        if (orb.subcontractDebugFlag)
            dprint(".locate->");

        ObjectKeyTemplate oktemp = okey.getTemplate() ;

        try {
            checkServerId(okey);
        } catch (ForwardException fex) {
            return fex.getIOR() ;
        }

        // Called only for its side-effect of throwing appropriate exceptions
        findObjectAdapter(oktemp);

        return null ;
    } finally {
        if (orb.subcontractDebugFlag)
            dprint(".locate<-");
    }
}
 
Example 12
Project: OpenJSharp   File: CorbaContactInfoListImpl.java   View source code 6 votes vote down vote up
protected void addRemoteContactInfos(
    IOR  effectiveTargetIOR,
    List effectiveTargetIORContactInfoList)
{
    ContactInfo contactInfo;
    List socketInfos = orb.getORBData()
        .getIORToSocketInfo().getSocketInfo(effectiveTargetIOR);
    Iterator iterator = socketInfos.iterator();
    while (iterator.hasNext()) {
        SocketInfo socketInfo = (SocketInfo) iterator.next();
        String type = socketInfo.getType();
        String host = socketInfo.getHost().toLowerCase();
        int    port = socketInfo.getPort();
        contactInfo = createContactInfo(type, host, port);
        effectiveTargetIORContactInfoList.add(contactInfo);
    }
}
 
Example 13
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   View source code 6 votes vote down vote up
private byte getStreamFormatVersionForThisRequest(IOR ior,
                                                  GIOPVersion giopVersion)
{

    byte localMaxVersion
        = ORBUtility.getMaxStreamFormatVersion();

    IOR effectiveTargetIOR =
        ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR();
    IIOPProfileTemplate temp =
        (IIOPProfileTemplate)effectiveTargetIOR.getProfile().getTaggedProfileTemplate();
    Iterator iter = temp.iteratorById(TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value);
    if (!iter.hasNext()) {
        // Didn't have the max stream format version tagged
        // component.
        if (giopVersion.lessThan(GIOPVersion.V1_3))
            return ORBConstants.STREAM_FORMAT_VERSION_1;
        else
            return ORBConstants.STREAM_FORMAT_VERSION_2;
    }

    byte remoteMaxVersion
        = ((MaxStreamFormatVersionComponent)iter.next()).getMaxStreamFormatVersion();

    return (byte)Math.min(localMaxVersion, remoteMaxVersion);
}
 
Example 14
Project: openjdk-jdk10   File: GIOPVersion.java   View source code 5 votes vote down vote up
/**
 * This chooses the appropriate GIOP version.
 *
 * @return the GIOP version 13.00 if Java serialization is enabled, or
 *         smallest(profGIOPVersion, orbGIOPVersion)
 */
public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {

    GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
    IIOPProfile prof = ior.getProfile() ;
    GIOPVersion profVersion = prof.getGIOPVersion();

    // Check if the profile is from a legacy Sun ORB.

    ORBVersion targetOrbVersion = prof.getORBVersion();
    if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) &&
            targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) {
        // we are dealing with a SUN legacy orb which emits 1.1 IORs,
        // in spite of being able to handle only GIOP 1.0 messages.
        return V1_0;
    }

    // Now the target has to be (FOREIGN | NEWER*)

    byte prof_major = profVersion.getMajor();
    byte prof_minor = profVersion.getMinor();

    byte orb_major = orbVersion.getMajor();
    byte orb_minor = orbVersion.getMinor();

    if (orb_major < prof_major) {
        return orbVersion;
    } else if (orb_major > prof_major) {
        return profVersion;
    } else { // both major version are the same
        if (orb_minor <= prof_minor) {
            return orbVersion;
        } else {
            return profVersion;
        }
    }
}
 
Example 15
Project: OpenJSharp   File: RequestDispatcherDefault.java   View source code 5 votes vote down vote up
public static LocalClientRequestDispatcherFactory makeMinimalServantCacheLocalClientRequestDispatcherFactory( final ORB orb )
{
    return new LocalClientRequestDispatcherFactory() {
        public LocalClientRequestDispatcher create( int id, IOR ior ) {
            return new MinimalServantCacheLocalCRDImpl( orb, id, ior ) ;
        }
    } ;
}
 
Example 16
Project: OpenJSharp   File: RequestDispatcherDefault.java   View source code 5 votes vote down vote up
public static LocalClientRequestDispatcherFactory makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory( final ORB orb )
{
    return new LocalClientRequestDispatcherFactory() {
        public LocalClientRequestDispatcher create( int id, IOR ior ) {
            return new InfoOnlyServantCacheLocalCRDImpl( orb, id, ior ) ;
        }
    } ;
}
 
Example 17
Project: OpenJSharp   File: RequestDispatcherDefault.java   View source code 5 votes vote down vote up
public static LocalClientRequestDispatcherFactory makeJIDLLocalClientRequestDispatcherFactory( final ORB orb )
{
    return new LocalClientRequestDispatcherFactory() {
        public LocalClientRequestDispatcher create( int id, IOR ior ) {
            return new JIDLLocalCRDImpl( orb, id, ior ) ;
        }
    } ;
}
 
Example 18
Project: OpenJSharp   File: RequestDispatcherDefault.java   View source code 5 votes vote down vote up
public static LocalClientRequestDispatcherFactory makePOALocalClientRequestDispatcherFactory( final ORB orb )
{
    return new LocalClientRequestDispatcherFactory() {
        public LocalClientRequestDispatcher create( int id, IOR ior ) {
            return new POALocalCRDImpl( orb, id, ior ) ;
        }
    } ;
}
 
Example 19
Project: openjdk-jdk10   File: POALocalCRDImpl.java   View source code 5 votes vote down vote up
public POALocalCRDImpl( ORB orb, int scid, IOR ior)
{
    super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior );
    wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    poaWrapper = POASystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
}
 
Example 20
Project: OpenJSharp   File: IORImpl.java   View source code 5 votes vote down vote up
public boolean isEquivalent(IOR ior)
{
    Iterator myIterator = iterator() ;
    Iterator otherIterator = ior.iterator() ;
    while (myIterator.hasNext() && otherIterator.hasNext()) {
        TaggedProfile myProfile = (TaggedProfile)(myIterator.next()) ;
        TaggedProfile otherProfile = (TaggedProfile)(otherIterator.next()) ;
        if (!myProfile.isEquivalent( otherProfile ))
            return false ;
    }

    return myIterator.hasNext() == otherIterator.hasNext() ;
}
 
Example 21
Project: openjdk-jdk10   File: RequestDispatcherDefault.java   View source code 5 votes vote down vote up
public static LocalClientRequestDispatcherFactory makeJIDLLocalClientRequestDispatcherFactory( final ORB orb )
{
    return new LocalClientRequestDispatcherFactory() {
        public LocalClientRequestDispatcher create( int id, IOR ior ) {
            return new JIDLLocalCRDImpl( orb, id, ior ) ;
        }
    } ;
}
 
Example 22
Project: openjdk-jdk10   File: CachedCodeBase.java   View source code 5 votes vote down vote up
public static synchronized void cleanCache( ORB orb ) {
    synchronized (iorMapLock) {
        for (IOR ior : iorMap.keySet()) {
            if (ior.getORB() == orb) {
                iorMap.remove(ior);
            }
        }
    }
}
 
Example 23
Project: OpenJSharp   File: INSServerRequestDispatcher.java   View source code 5 votes vote down vote up
/**
 * getINSReference if it is registered in INSObjectKeyMap.
 */
private IOR getINSReference( String insKey ) {
    IOR entry = ORBUtility.getIOR( orb.getLocalResolver().resolve( insKey ) ) ;
    if( entry != null ) {
        // If entry is not null then the locate is with an INS Object key,
        // so send a location forward with the right IOR.
        return entry;
    }

    throw wrapper.servantNotFound() ;
}
 
Example 24
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   View source code 5 votes vote down vote up
public CorbaMessageMediator createLocationForward(
    CorbaMessageMediator messageMediator, IOR ior, ServiceContexts svc)
{
    ReplyMessage reply
        = MessageBase.createReply(
              (ORB)messageMediator.getBroker(),
              messageMediator.getGIOPVersion(),
              messageMediator.getEncodingVersion(),
              messageMediator.getRequestId(),
              ReplyMessage.LOCATION_FORWARD,
              getServiceContextsForReply(messageMediator, svc),
              ior);

    return createResponseHelper(messageMediator, reply, ior);
}
 
Example 25
Project: openjdk-jdk10   File: ObjectReferenceProducerBase.java   View source code 5 votes vote down vote up
public org.omg.CORBA.Object make_object (String repositoryId,
    byte[] objectId)
{
    ObjectId oid = IORFactories.makeObjectId( objectId ) ;
    IOR ior = getIORFactory().makeIOR( orb, repositoryId, oid ) ;

    return ORBUtility.makeObjectReference( ior ) ;
}
 
Example 26
Project: OpenJSharp   File: ReplyMessage_1_0.java   View source code 5 votes vote down vote up
ReplyMessage_1_0(ORB orb, ServiceContexts _service_contexts,
        int _request_id, int _reply_status, IOR _ior) {
    super(Message.GIOPBigMagic, false, Message.GIOPReply, 0);
    this.orb = orb;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    service_contexts = _service_contexts;
    request_id = _request_id;
    reply_status = _reply_status;
    ior = _ior;
}
 
Example 27
Project: openjdk-jdk10   File: DefaultSocketFactory.java   View source code 5 votes vote down vote up
public SocketInfo getEndPointInfo(ORB orb,
                                    IOR ior,
                                    SocketInfo socketInfo)
{
    IIOPProfileTemplate temp =
        (IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate() ;
    IIOPAddress primary = temp.getPrimaryAddress() ;

    return new EndPointInfoImpl(ORBSocketFactory.IIOP_CLEAR_TEXT,
                                primary.getPort(),
                                primary.getHost().toLowerCase());
}
 
Example 28
Project: openjdk-jdk10   File: IDLJavaSerializationOutputStream.java   View source code 5 votes vote down vote up
public final void write_Object(org.omg.CORBA.Object value) {
    if (value == null) {
        IOR nullIOR = IORFactories.makeIOR(orb);
        nullIOR.write(parent);
        return;
    }
    // IDL to Java formal 01-06-06 1.21.4.2
    if (value instanceof org.omg.CORBA.LocalObject) {
        throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);
    }
    IOR ior = ORBUtility.connectAndGetIOR(orb, value);
    ior.write(parent);
    return;
}
 
Example 29
Project: openjdk-jdk10   File: IORImpl.java   View source code 5 votes vote down vote up
public boolean equals( Object obj )
{
    if (obj == null)
        return false ;

    if (!(obj instanceof IOR))
        return false ;

    IOR other = (IOR)obj ;

    return super.equals( obj ) && typeId.equals( other.getTypeId() ) ;
}
 
Example 30
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   View source code 5 votes vote down vote up
public CorbaMessageMediator createLocationForward(
    CorbaMessageMediator messageMediator, IOR ior, ServiceContexts svc)
{
    ReplyMessage reply
        = MessageBase.createReply(
              (ORB)messageMediator.getBroker(),
              messageMediator.getGIOPVersion(),
              messageMediator.getEncodingVersion(),
              messageMediator.getRequestId(),
              ReplyMessage.LOCATION_FORWARD,
              getServiceContextsForReply(messageMediator, svc),
              ior);

    return createResponseHelper(messageMediator, reply, ior);
}
 
Example 31
Project: openjdk-jdk10   File: ORBUtility.java   View source code 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 32
Project: OpenJSharp   File: DefaultSocketFactory.java   View source code 5 votes vote down vote up
public SocketInfo getEndPointInfo(ORB orb,
                                    IOR ior,
                                    SocketInfo socketInfo)
{
    IIOPProfileTemplate temp =
        (IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate() ;
    IIOPAddress primary = temp.getPrimaryAddress() ;

    return new EndPointInfoImpl(ORBSocketFactory.IIOP_CLEAR_TEXT,
                                primary.getPort(),
                                primary.getHost().toLowerCase());
}
 
Example 33
Project: openjdk-jdk10   File: RequestDispatcherDefault.java   View source code 5 votes vote down vote up
public static LocalClientRequestDispatcherFactory makePOALocalClientRequestDispatcherFactory( final ORB orb )
{
    return new LocalClientRequestDispatcherFactory() {
        public LocalClientRequestDispatcher create( int id, IOR ior ) {
            return new POALocalCRDImpl( orb, id, ior ) ;
        }
    } ;
}
 
Example 34
Project: openjdk-jdk10   File: ORBUtility.java   View source code 5 votes vote down vote up
/**
 * @return the Java serialization encoding version.
 */
public static byte getEncodingVersion(ORB orb, IOR ior) {

    // Is Java serialization enabled?
    // Check the JavaSerializationComponent (tagged component)
    // in the IIOPProfile. If present, the peer ORB's GIOP is capable
    // of using Java serialization instead of CDR serialization.
    // In such a case, use Java serialization, iff the java serialization
    // versions match.

    if (orb.getORBData().isJavaSerializationEnabled()) {
        IIOPProfile prof = ior.getProfile();
        IIOPProfileTemplate profTemp =
            (IIOPProfileTemplate) prof.getTaggedProfileTemplate();
        java.util.Iterator iter = profTemp.iteratorById(
                              ORBConstants.TAG_JAVA_SERIALIZATION_ID);
        if (iter.hasNext()) {
            JavaSerializationComponent jc =
                (JavaSerializationComponent) iter.next();
            byte jcVersion = jc.javaSerializationVersion();
            if (jcVersion >= Message.JAVA_ENC_VERSION) {
                return Message.JAVA_ENC_VERSION;
            } else if (jcVersion > Message.CDR_ENC_VERSION) {
                return jc.javaSerializationVersion();
            } else {
                // throw error?
                // Since encodingVersion is <= 0 (CDR_ENC_VERSION).
            }
        }
    }
    return Message.CDR_ENC_VERSION; // default
}
 
Example 35
Project: openjdk-jdk10   File: ORBUtility.java   View source code 5 votes vote down vote up
/** This method is used to create untyped object references.
*/
public static org.omg.CORBA.Object makeObjectReference( IOR ior )
{
    CorbaClientDelegate del = makeClientDelegate( ior ) ;
    org.omg.CORBA.Object objectImpl = new CORBAObjectImpl() ;
    StubAdapter.setDelegate( objectImpl, del ) ;
    return objectImpl ;
}
 
Example 36
Project: openjdk-jdk10   File: CorbaContactInfoListImpl.java   View source code 5 votes vote down vote up
public synchronized void setEffectiveTargetIOR(IOR effectiveTargetIOR)
{
    this.effectiveTargetIOR = effectiveTargetIOR;
    effectiveTargetIORContactInfoList = null;
    if (primaryContactInfo != null &&
        orb.getORBData().getIIOPPrimaryToContactInfo() != null)
    {
        orb.getORBData().getIIOPPrimaryToContactInfo()
            .reset(primaryContactInfo);
    }
    primaryContactInfo = null;
    setLocalSubcontract();
}
 
Example 37
Project: OpenJSharp   File: CorbaContactInfoListIteratorImpl.java   View source code 5 votes vote down vote up
public void updateEffectiveTargetIOR(IOR newIOR)
{
    contactInfoList.setEffectiveTargetIOR(newIOR);
    // If we report the exception in _request (i.e., beginRequest
    // we cannot throw RemarshalException to the stub because _request
    // does not declare that exception.
    // To keep the two-level dispatching (first level chooses ContactInfo,
    // second level is specific to that ContactInfo/EPT) we need to
    // ensure that the request dispatchers get their iterator from the
    // InvocationStack (i.e., ThreadLocal). That way if the list iterator
    // needs a complete update it happens right here.
    ((CorbaInvocationInfo)orb.getInvocationInfo())
        .setContactInfoListIterator(contactInfoList.iterator());
}
 
Example 38
Project: OpenJSharp   File: SocketOrChannelContactInfoImpl.java   View source code 5 votes vote down vote up
public SocketOrChannelContactInfoImpl(
    ORB orb,
    CorbaContactInfoList contactInfoList,
    IOR effectiveTargetIOR,
    short addressingDisposition,
    String socketType,
    String hostname,
    int port)
{
    this(orb, contactInfoList, socketType, hostname, port);
    this.effectiveTargetIOR = effectiveTargetIOR;
    this.addressingDisposition = addressingDisposition;
}
 
Example 39
Project: openjdk-jdk10   File: IORImpl.java   View source code 5 votes vote down vote up
public org.omg.IOP.IOR getIOPIOR() {
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
    write(os);
    InputStream is = (InputStream) (os.create_input_stream());
    return org.omg.IOP.IORHelper.read(is);
}
 
Example 40
Project: OpenJSharp   File: IDLJavaSerializationOutputStream.java   View source code 5 votes vote down vote up
public final void write_Object(org.omg.CORBA.Object value) {
    if (value == null) {
        IOR nullIOR = IORFactories.makeIOR(orb);
        nullIOR.write(parent);
        return;
    }
    // IDL to Java formal 01-06-06 1.21.4.2
    if (value instanceof org.omg.CORBA.LocalObject) {
        throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);
    }
    IOR ior = ORBUtility.connectAndGetIOR(orb, value);
    ior.write(parent);
    return;
}