Java Code Examples for com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate#iteratorById()
The following examples show how to use
com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate#iteratorById() .
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: CorbaMessageMediatorImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
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 2
Source File: CorbaMessageMediatorImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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 3
Source File: CorbaMessageMediatorImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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 4
Source File: DefaultIORToSocketInfoImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public List getSocketInfo(IOR ior) { SocketInfo socketInfo; List result = new ArrayList(); IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) ior.getProfile().getTaggedProfileTemplate() ; IIOPAddress primary = iiopProfileTemplate.getPrimaryAddress() ; String hostname = primary.getHost().toLowerCase(); int port = primary.getPort(); // NOTE: we could check for 0 (i.e., CSIv2) but, for a // non-CSIv2-configured client ORB talking to a CSIv2 configured // server ORB you might end up with an empty contact info list // which would then report a failure which would not be as // instructive as leaving a ContactInfo with a 0 port in the list. socketInfo = createSocketInfo(hostname, port); result.add(socketInfo); Iterator iterator = iiopProfileTemplate.iteratorById( TAG_ALTERNATE_IIOP_ADDRESS.value); while (iterator.hasNext()) { AlternateIIOPAddressComponent alternate = (AlternateIIOPAddressComponent) iterator.next(); hostname = alternate.getAddress().getHost().toLowerCase(); port = alternate.getAddress().getPort(); socketInfo= createSocketInfo(hostname, port); result.add(socketInfo); } return result; }
Example 5
Source File: ORBUtility.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * @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 6
Source File: DefaultIORToSocketInfoImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
public List getSocketInfo(IOR ior) { SocketInfo socketInfo; List result = new ArrayList(); IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) ior.getProfile().getTaggedProfileTemplate() ; IIOPAddress primary = iiopProfileTemplate.getPrimaryAddress() ; String hostname = primary.getHost().toLowerCase(); int port = primary.getPort(); // NOTE: we could check for 0 (i.e., CSIv2) but, for a // non-CSIv2-configured client ORB talking to a CSIv2 configured // server ORB you might end up with an empty contact info list // which would then report a failure which would not be as // instructive as leaving a ContactInfo with a 0 port in the list. socketInfo = createSocketInfo(hostname, port); result.add(socketInfo); Iterator iterator = iiopProfileTemplate.iteratorById( TAG_ALTERNATE_IIOP_ADDRESS.value); while (iterator.hasNext()) { AlternateIIOPAddressComponent alternate = (AlternateIIOPAddressComponent) iterator.next(); hostname = alternate.getAddress().getHost().toLowerCase(); port = alternate.getAddress().getPort(); socketInfo= createSocketInfo(hostname, port); result.add(socketInfo); } return result; }
Example 7
Source File: ORBUtility.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * @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 8
Source File: DefaultIORToSocketInfoImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public List getSocketInfo(IOR ior) { SocketInfo socketInfo; List result = new ArrayList(); IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) ior.getProfile().getTaggedProfileTemplate() ; IIOPAddress primary = iiopProfileTemplate.getPrimaryAddress() ; String hostname = primary.getHost().toLowerCase(); int port = primary.getPort(); // NOTE: we could check for 0 (i.e., CSIv2) but, for a // non-CSIv2-configured client ORB talking to a CSIv2 configured // server ORB you might end up with an empty contact info list // which would then report a failure which would not be as // instructive as leaving a ContactInfo with a 0 port in the list. socketInfo = createSocketInfo(hostname, port); result.add(socketInfo); Iterator iterator = iiopProfileTemplate.iteratorById( TAG_ALTERNATE_IIOP_ADDRESS.value); while (iterator.hasNext()) { AlternateIIOPAddressComponent alternate = (AlternateIIOPAddressComponent) iterator.next(); hostname = alternate.getAddress().getHost().toLowerCase(); port = alternate.getAddress().getPort(); socketInfo= createSocketInfo(hostname, port); result.add(socketInfo); } return result; }
Example 9
Source File: DefaultIORToSocketInfoImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public List getSocketInfo(IOR ior) { SocketInfo socketInfo; List result = new ArrayList(); IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) ior.getProfile().getTaggedProfileTemplate() ; IIOPAddress primary = iiopProfileTemplate.getPrimaryAddress() ; String hostname = primary.getHost().toLowerCase(); int port = primary.getPort(); // NOTE: we could check for 0 (i.e., CSIv2) but, for a // non-CSIv2-configured client ORB talking to a CSIv2 configured // server ORB you might end up with an empty contact info list // which would then report a failure which would not be as // instructive as leaving a ContactInfo with a 0 port in the list. socketInfo = createSocketInfo(hostname, port); result.add(socketInfo); Iterator iterator = iiopProfileTemplate.iteratorById( TAG_ALTERNATE_IIOP_ADDRESS.value); while (iterator.hasNext()) { AlternateIIOPAddressComponent alternate = (AlternateIIOPAddressComponent) iterator.next(); hostname = alternate.getAddress().getHost().toLowerCase(); port = alternate.getAddress().getPort(); socketInfo= createSocketInfo(hostname, port); result.add(socketInfo); } return result; }
Example 10
Source File: ORBUtility.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * @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 11
Source File: ORBUtility.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * @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 12
Source File: MessageBase.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
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 13
Source File: MessageBase.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
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 14
Source File: MessageBase.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
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 15
Source File: MessageBase.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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 16
Source File: MessageBase.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
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 17
Source File: CorbaClientRequestDispatcherImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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); } } }
Example 18
Source File: CorbaClientRequestDispatcherImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
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); } } }
Example 19
Source File: MessageBase.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
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 20
Source File: MessageBase.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
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; }