本文整理汇总了Java中com.sun.corba.se.spi.ior.iiop.IIOPProfile.getGIOPVersion方法的典型用法代码示例。如果您正苦于以下问题:Java IIOPProfile.getGIOPVersion方法的具体用法?Java IIOPProfile.getGIOPVersion怎么用?Java IIOPProfile.getGIOPVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.corba.se.spi.ior.iiop.IIOPProfile
的用法示例。
在下文中一共展示了IIOPProfile.getGIOPVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: chooseRequestVersion
import com.sun.corba.se.spi.ior.iiop.IIOPProfile; //导入方法依赖的package包/类
/**
* 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;
}
}
}