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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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 41
Project: openjdk-jdk10   File: LocateReplyMessage_1_0.java   Source Code and License 5 votes vote down vote up
LocateReplyMessage_1_0(ORB orb, int _request_id,
        int _locate_status, IOR _ior) {
    super(Message.GIOPBigMagic, false, Message.GIOPLocateReply, 0);
    this.orb = orb;
    request_id = _request_id;
    locate_status = _locate_status;
    ior = _ior;
}
 
Example 42
Project: OpenJSharp   File: ORBUtility.java   Source Code and License 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 43
Project: openjdk-jdk10   File: ClientRequestInfoImpl.java   Source Code and License 5 votes vote down vote up
private IOR getLocatedIOR()
{
    IOR ior;
    CorbaContactInfoList contactInfoList = (CorbaContactInfoList)
        messageMediator.getContactInfo().getContactInfoList();
    ior = contactInfoList.getEffectiveTargetIOR();
    return ior;
}
 
Example 44
Project: openjdk-jdk10   File: RequestInfoImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Retrieves the IOR of the ForwardRequest exception.
 */
protected IOR getForwardRequestIOR() {
    if( this.forwardRequestIOR == null ) {
        if( this.forwardRequest != null ) {
            this.forwardRequestIOR = ORBUtility.getIOR(
                this.forwardRequest.forward ) ;
        }
    }

    return this.forwardRequestIOR;
}
 
Example 45
Project: openjdk-jdk10   File: CorbaContactInfoListIteratorImpl.java   Source Code and License 4 votes vote down vote up
public void reportRedirect(CorbaContactInfo contactInfo,
                           IOR forwardedIOR)
{
    updateEffectiveTargetIOR(forwardedIOR);
}
 
Example 46
Project: openjdk-jdk10   File: CDRInputStream_1_0.java   Source Code and License 4 votes vote down vote up
public org.omg.CORBA.Object read_Object(Class clz)
{
    // In any case, we must first read the IOR.
    IOR ior = IORFactories.makeIOR(parent) ;
    if (ior.isNil())
        return null ;

    PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ;
    String codeBase = ior.getProfile().getCodebase() ;
    PresentationManager.StubFactory stubFactory = null ;

    if (clz == null) {
        RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ;
        String className = rid.getClassName() ;
        boolean isIDLInterface = rid.isIDLType() ;

        if (className == null || className.equals( "" ))
            stubFactory = null ;
        else
            try {
                stubFactory = sff.createStubFactory( className,
                    isIDLInterface, codeBase, (Class)null,
                    (ClassLoader)null );
            } catch (Exception exc) {
                // Could not create stubFactory, so use null.
                // XXX stubFactory handling is still too complex:
                // Can we resolve the stubFactory question once in
                // a single place?
                stubFactory = null ;
            }
    } else if (StubAdapter.isStubClass( clz )) {
        stubFactory = PresentationDefaults.makeStaticStubFactory(
            clz ) ;
    } else {
        // clz is an interface class
        boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;

        stubFactory = sff.createStubFactory( clz.getName(),
            isIDL, codeBase, clz, clz.getClassLoader() ) ;
    }

    return internalIORToObject( ior, stubFactory, orb ) ;
}
 
Example 47
Project: openjdk-jdk10   File: LocateReplyMessage_1_1.java   Source Code and License 4 votes vote down vote up
public IOR getIOR() {
    return this.ior;
}
 
Example 48
Project: OpenJSharp   File: SendingContextServiceContext.java   Source Code and License 4 votes vote down vote up
public IOR getIOR()
{
    return ior ;
}
 
Example 49
Project: openjdk-jdk10   File: ReplyMessage_1_2.java   Source Code and License 4 votes vote down vote up
public IOR getIOR() {
    return this.ior;
}
 
Example 50
Project: OpenJSharp   File: CorbaContactInfoListIterator.java   Source Code and License 4 votes vote down vote up
public void reportRedirect(CorbaContactInfo contactInfo,
IOR forwardedIOR);
 
Example 51
Project: openjdk-jdk10   File: ORBUtility.java   Source Code and License 4 votes vote down vote up
/** 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 52
Project: openjdk-jdk10   File: RequestInfoImpl.java   Source Code and License 4 votes vote down vote up
protected org.omg.CORBA.Object iorToObject( IOR ior )
{
    return ORBUtility.makeObjectReference( ior ) ;
}
 
Example 53
Project: openjdk-jdk10   File: CorbaContactInfoListImpl.java   Source Code and License 4 votes vote down vote up
public synchronized void setTargetIOR(IOR targetIOR)
{
    this.targetIOR = targetIOR;
    setEffectiveTargetIOR(targetIOR);
}
 
Example 54
Project: openjdk-jdk10   File: INSServerRequestDispatcher.java   Source Code and License 4 votes vote down vote up
public IOR locate(ObjectKey okey) {
    // send a locate forward with the right IOR. If the insKey is not
    // registered then it will throw OBJECT_NOT_EXIST Exception
    String insKey = new String( okey.getBytes(orb) );
    return getINSReference( insKey );
}
 
Example 55
Project: OpenJSharp   File: JIDLLocalCRDImpl.java   Source Code and License 4 votes vote down vote up
public JIDLLocalCRDImpl( ORB orb, int scid, IOR ior )
{
    super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ) ;
}
 
Example 56
Project: openjdk-jdk10   File: IORTemplateListImpl.java   Source Code and License 4 votes vote down vote up
public IOR makeIOR( ORB orb, String typeid, ObjectId oid )
{
    return new IORImpl( orb, typeid, this, oid ) ;
}
 
Example 57
Project: openjdk-jdk10   File: ReplyMessage_1_2.java   Source Code and License 4 votes vote down vote up
public void setIOR( IOR ior ) {
    this.ior = ior;
}
 
Example 58
Project: OpenJSharp   File: IORTemplateImpl.java   Source Code and License 4 votes vote down vote up
public IOR makeIOR( ORB orb, String typeid, ObjectId oid )
{
    return new IORImpl( orb, typeid, this, oid ) ;
}
 
Example 59
Project: OpenJSharp   File: MinimalServantCacheLocalCRDImpl.java   Source Code and License 4 votes vote down vote up
public MinimalServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior )
{
    super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ) ;
}
 
Example 60
Project: OpenJSharp   File: CorbaClientRequestDispatcherImpl.java   Source Code and License 4 votes vote down vote up
protected void performCodeSetNegotiation(CorbaMessageMediator messageMediator)
{
    CorbaConnection conn =
        (CorbaConnection) messageMediator.getConnection();
    IOR ior =
        ((CorbaContactInfo)messageMediator.getContactInfo())
        .getEffectiveTargetIOR();
    GIOPVersion giopVersion = messageMediator.getGIOPVersion();

    // XXX This seems to be a broken double checked locking idiom: FIX IT!

    // conn.getCodeSetContext() is null when no other requests have
    // been made on this connection to trigger code set negotation.
    if (conn != null &&
        conn.getCodeSetContext() == null &&
        !giopVersion.equals(GIOPVersion.V1_0)) {

        synchronized(conn) {
            // Double checking.  Don't let any other
            // threads use this connection until the
            // code sets are straight.
            if (conn.getCodeSetContext() != null)
                return;

            // This only looks at the first code set component.  If
            // there can be multiple locations with multiple code sets,
            // this requires more work.
            IIOPProfileTemplate temp =
                (IIOPProfileTemplate)ior.getProfile().
                getTaggedProfileTemplate();
            Iterator iter = temp.iteratorById(TAG_CODE_SETS.value);
            if (!iter.hasNext()) {
                // Didn't have a code set component.  The default will
                // be to use ISO8859-1 for char data and throw an
                // exception if wchar data is used.
                return;
            }

            // Get the native and conversion code sets the
            // server specified in its IOR
            CodeSetComponentInfo serverCodeSets
                = ((CodeSetsComponent)iter.next()).getCodeSetComponentInfo();

            // Perform the negotiation between this ORB's code sets and
            // the ones from the IOR
            CodeSetComponentInfo.CodeSetContext result
                = CodeSetConversion.impl().negotiate(
                      conn.getBroker().getORBData().getCodeSetComponentInfo(),
                      serverCodeSets);

            conn.setCodeSetContext(result);
        }
    }
}