org.eclipse.equinox.p2.metadata.Version Java Examples
The following examples show how to use
org.eclipse.equinox.p2.metadata.Version.
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: Feature.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Converts a string version range into an OSGi VersionRange object. * Ex : [3.1.0, 4.0.0) * * @param versionRange - string version range */ public void setVersionRange(String versionRange) { boolean startIncluded = true; boolean endIncluded = true; versionRange = versionRange.trim(); if (versionRange.startsWith("(")) { startIncluded = false; } // remove the first charactor versionRange = versionRange.substring(1); if (versionRange.endsWith(")")) { endIncluded = false; } // remove the last charactor versionRange = versionRange.substring(0, versionRange.length() - 1); String startVersion = versionRange.substring(0, versionRange.indexOf(',')); // end version starts after ", " therefore, versionRange.indexOf(',') + 2 String endVersion = versionRange.substring(versionRange.indexOf(',') + 2, versionRange.length()); this.versionRange = new VersionRange(Version.create(startVersion), startIncluded, Version.create(endVersion), endIncluded); }
Example #2
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 6 votes |
public String makeVersion ( final IInstallableUnit iu, final boolean withQualifier ) throws Exception { Version version; final String tychoVersion = iu.getProperty ( "maven-version" ); if ( !IGNORE_TYCHO && tychoVersion != null ) { final IVersionFormat format = Version.compile ( "n[.n=0;[.n=0;[.n=0;]]][[-.]S='';]" ); version = format.parse ( tychoVersion ); } else { version = iu.getVersion (); } if ( withQualifier ) { return toString ( version ); } else { return withoutQualifier ( version ); } }
Example #3
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 6 votes |
public String makeVersion ( final IInstallableUnit iu, final boolean withQualifier ) throws Exception { Version version; final String tychoVersion = iu.getProperty ( "maven-version" ); if ( !IGNORE_TYCHO && tychoVersion != null ) { final IVersionFormat format = Version.compile ( "n[.n=0;[.n=0;[.n=0;]]][[-.]S='';]" ); version = format.parse ( tychoVersion ); } else { version = iu.getVersion (); } if ( withQualifier ) { return toString ( version ); } else { return withoutQualifier ( version ); } }
Example #4
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private Object[] getSegments ( final Version version ) { final Object[] result = new Object[version.getSegmentCount ()]; for ( int i = 0; i < version.getSegmentCount (); i++ ) { result[i] = version.getSegment ( i ); } return result; }
Example #5
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 5 votes |
protected String withoutQualifier ( final Version version ) { if ( version.getSegmentCount () >= 4 ) { return String.format ( "%s.%s.%s", version.getSegment ( 0 ), version.getSegment ( 1 ), version.getSegment ( 2 ) ); } else { return toString ( version ); } }
Example #6
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private Object[] getSegments ( final Version version ) { final Object[] result = new Object[version.getSegmentCount ()]; for ( int i = 0; i < version.getSegmentCount (); i++ ) { result[i] = version.getSegment ( i ); } return result; }
Example #7
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 5 votes |
protected String withoutQualifier ( final Version version ) { if ( version.getSegmentCount () >= 4 ) { return String.format ( "%s.%s.%s", version.getSegment ( 0 ), version.getSegment ( 1 ), version.getSegment ( 2 ) ); } else { return toString ( version ); } }
Example #8
Source File: UpdateMetaFileReaderJob.java From developer-studio with Apache License 2.0 | 5 votes |
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; }
Example #9
Source File: UpdateMetaFileReaderJob.java From developer-studio with Apache License 2.0 | 5 votes |
private Version generateUpperLimitforUpdates(Version version) { String installedVersion = version.toString(); String[] majorMinorUpperLmit = installedVersion.split("\\."); int currentMinorVerions = Integer.parseInt(majorMinorUpperLmit[1]); int nextMinorVersion = currentMinorVerions + 1; Version upperLimit = Version.createOSGi(Integer.parseInt(majorMinorUpperLmit[0]), Integer.parseInt(String.valueOf(nextMinorVersion)), Integer.parseInt(majorMinorUpperLmit[2]), majorMinorUpperLmit[3]); return upperLimit; }
Example #10
Source File: UpdateMetaFileReaderJob.java From developer-studio with Apache License 2.0 | 5 votes |
/** * version would come as 4.0.0-201512221344 we need to create the * installable unit version object from the version string * * @param versionString */ private Version generateVersionFromString(String versionString) { String[] minorMajorNumbers = versionString.split("\\."); // . is \\. in Version availableVersion = Version.createOSGi(Integer.parseInt(minorMajorNumbers[0]), Integer.parseInt(minorMajorNumbers[1]), Integer.parseInt(minorMajorNumbers[2]), minorMajorNumbers[3]); return availableVersion; }
Example #11
Source File: UpdateManager.java From developer-studio with Apache License 2.0 | 5 votes |
private boolean isNewVersionCompatible(String currVersion, Version availableVerion) { Version upperLimit = generateUpperLimitforUpdates(currVersion); if (availableVerion.compareTo(upperLimit) == LESS_THAN) { return true; } return false; }
Example #12
Source File: UpdateManager.java From developer-studio with Apache License 2.0 | 5 votes |
private Version generateUpperLimitforUpdates(String installedVersion) { String[] majorMinorUpperLmit = installedVersion.split("\\."); int currentMinorVerions = Integer.parseInt(majorMinorUpperLmit[1]); int nextMinorVersion = currentMinorVerions + 1; Version upperLimit = Version.createOSGi(Integer.parseInt(majorMinorUpperLmit[0]), Integer.parseInt(String.valueOf(nextMinorVersion)), Integer.parseInt(majorMinorUpperLmit[2]), majorMinorUpperLmit[3]); return upperLimit; }
Example #13
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 4 votes |
private String toString ( final Version version ) { return version.getOriginal (); }
Example #14
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 4 votes |
private String toString ( final Version version ) { return version.getOriginal (); }