本文整理汇总了Java中org.eclipse.equinox.p2.metadata.Version.compareTo方法的典型用法代码示例。如果您正苦于以下问题:Java Version.compareTo方法的具体用法?Java Version.compareTo怎么用?Java Version.compareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.equinox.p2.metadata.Version
的用法示例。
在下文中一共展示了Version.compareTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkIfFeatureExist
import org.eclipse.equinox.p2.metadata.Version; //导入方法依赖的package包/类
private boolean checkIfFeatureExist(String featureID, Iterator<IInstallableUnit> iterator) {
System.out.println("Received Feature ID with Version : " + featureID);
String[] featureInfo = featureID.split("_");
String updatedFeatureID = featureInfo[0];
System.out.println("The version being tested : " + featureInfo[1]);
Version featureVersion = generateOSGIVersion(featureInfo[1]);
updatedFeatureID = updatedFeatureID + "." + FEATURE_JAR_IU_ID_SFX;
System.out.println("Checking Availability of " + updatedFeatureID + "Version : " + featureVersion
+ " in the given repository");
while (iterator.hasNext()) {
IInstallableUnit iu = iterator.next();
String featureIuId = iu.getId();
Version IUVersion = iu.getVersion();
if (featureIuId != null && featureIuId.startsWith(WSO2_FEATURE_PREFIX)
&& featureIuId.endsWith(FEATURE_JAR_IU_ID_SFX)) {
if (featureIuId.equals(updatedFeatureID)) {
if (IUVersion.compareTo(featureVersion) == 0) {
System.out.println(
"\n===========================xxxxxxxxxxxxxxxxxxx==================================\n");
System.out.println("-------------------------P2 Structure is valid----------------- \n \n ");
System.out.println("\n=====================================================================\n");
System.out.println("\n=====================================================================\n");
System.out.println("=========== " + featureID + " Version : " + featureVersion
+ " is Available in the Updates Repository =============\n");
System.out.println("\n=====================================================================\n");
return true;
}
}
}
}
System.out.println("\n=====================================================================\n");
System.out.println("\n=====================================================================\n");
System.out.println("=========== " + updatedFeatureID + "Version : " + featureVersion
+ " is not available in the given repository, Exiting system with error code ======================");
return false;
}
示例2: checkIfUpdatesAvailable
import org.eclipse.equinox.p2.metadata.Version; //导入方法依赖的package包/类
private IStatus checkIfUpdatesAvailable(IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateCheckerJob_1, SUB_MONITOR_INDEX);
Collection<IInstallableUnit> installedWSO2Features = updateManager
.getInstalledWSO2Features(progress.newChild(1));
BufferedReader buffReader = downloadMetaFile();
// read the meta file
if (buffReader == null) {
promptUserError(Messages.UpdateMetaFileReaderJob_3, ERROR_TITLE);
return Status.CANCEL_STATUS;
}
Map<String, String> availaleDevStudioFeatureVerions = new HashMap<String, String>();
availaleDevStudioFeatureVerions = readMetaDataFiletoMap(buffReader);
deleteDownloadedTempFile();
if (availaleDevStudioFeatureVerions.isEmpty()) {
log.error(Messages.UpdateCheckerJob_4);
return Status.CANCEL_STATUS;
}
for (IInstallableUnit iInstallableUnit : installedWSO2Features) {
if (availaleDevStudioFeatureVerions.containsKey(iInstallableUnit.getId())) {
Version availableVersion = generateVersionFromString(
availaleDevStudioFeatureVerions.get(iInstallableUnit.getId()));
Version upperLimit = generateUpperLimitforUpdates(iInstallableUnit.getVersion());
if (availableVersion != null
&& availableVersion.compareTo(iInstallableUnit.getVersion()) == AVAILABLE_VERSION_GREATER
&& availableVersion.compareTo(upperLimit) == AVAILABLE_VERSION_LESS) {
updateCount = updateCount + 1;
} else if (availableVersion == null) {
log.error(Messages.UpdateCheckerJob_4);
promptUserError(ERROR_MESSAGE, ERROR_TITLE);
return Status.CANCEL_STATUS;
}
}
}
if (updateCount > 0) {
return Status.OK_STATUS; // OK if there are updates
}
return Status.CANCEL_STATUS;
}
示例3: isNewVersionCompatible
import org.eclipse.equinox.p2.metadata.Version; //导入方法依赖的package包/类
private boolean isNewVersionCompatible(String currVersion, Version availableVerion) {
Version upperLimit = generateUpperLimitforUpdates(currVersion);
if (availableVerion.compareTo(upperLimit) == LESS_THAN) {
return true;
}
return false;
}