Java Code Examples for com.sun.corba.se.spi.ior.IOR#getIOPIOR()

The following examples show how to use com.sun.corba.se.spi.ior.IOR#getIOPIOR() . 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: MessageBase.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 2
Source File: MessageBase.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 3
Source File: MessageBase.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 4
Source File: MessageBase.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 5
Source File: MessageBase.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 6
Source File: MessageBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 7
Source File: MessageBase.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 8
Source File: MessageBase.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 9
Source File: MessageBase.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 10
Source File: MessageBase.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}