use of org.osgi.framework.Version in project linuxtools by eclipse.
the class LaunchConfigTabTest method testTrackOriginsValidity.
@Test
public void testTrackOriginsValidity() throws Exception {
ILaunchConfigurationWorkingCopy wc = initConfig();
IProject project = CDebugUtils.verifyCProject(config).getProject();
Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(project);
if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) {
dynamicTab.getTrackOriginsButton().setSelection(true);
tab.performApply(wc);
assertTrue(tab.isValid(wc));
dynamicTab.getUndefValueButton().setSelection(false);
tab.performApply(wc);
assertFalse(tab.isValid(wc));
}
}
use of org.osgi.framework.Version in project linuxtools by eclipse.
the class ImageQuery method getJavaVersion.
public double getJavaVersion() {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String result = exec(new String[] { "sh", "-c", "java -version 2>&1 | grep version | cut -d\\\" -f2 | cut -d_ -f1" });
if (result != null) {
// $NON-NLS-1$ //$NON-NLS-2$
result = result.replaceAll("\n", "");
Version v = new Version(result);
// $NON-NLS-1$
String newV = v.getMajor() + "." + v.getMinor();
return Double.valueOf(newV);
} else {
return 0;
}
}
use of org.osgi.framework.Version in project Lucee by lucee.
the class CFMLEngineFactory method _update.
/**
* updates the engine when a update is available
*
* @return has updated
* @throws IOException
* @throws ServletException
*/
private boolean _update(final Identification id) throws IOException, ServletException {
if (singelton != null)
singelton.reset();
final File newLucee = downloadCore(id);
if (newLucee == null)
return false;
final Version v = null;
try {
bundleCollection = BundleLoader.loadBundles(this, getFelixCacheDirectory(), getBundleDirectory(), newLucee, bundleCollection);
final CFMLEngine e = getEngine(bundleCollection);
if (e == null)
throw new IOException("can't load engine");
version = e.getInfo().getVersion();
// engine = e;
setEngine(e);
// e.reset();
callListeners(e);
} catch (final Exception e) {
System.gc();
try {
newLucee.delete();
} catch (final Exception ee) {
}
log(e);
e.printStackTrace();
return false;
}
log(Logger.LOG_DEBUG, "Version (" + v + ")installed");
return true;
}
use of org.osgi.framework.Version in project knime-core by knime.
the class NodeAndBundleInformation method load.
/**
* Restores the information object from the given node settings object. Used in persistor.
*
* @param settings a node settings object
* @param version the workflow version
* @return bundle info object, at least the factory name will not be <code>null</code>
* @throws InvalidSettingsException if the node settings contain invalid entries
* @noreference This method is not intended to be referenced by clients.
*/
public static NodeAndBundleInformation load(final NodeSettingsRO settings, final FileWorkflowPersistor.LoadVersion version) throws InvalidSettingsException {
String factoryClass = settings.getString("factory");
if (factoryClass == null) {
throw new InvalidSettingsException("Factory class is null");
}
String bundleSymbolicName;
String bundleName;
String bundleVendor;
String nodeName;
Version bundleVersion;
String featureSymbolicName;
String featureName;
String featureVendor;
Version featureVersion;
if (version.ordinal() < FileWorkflowPersistor.LoadVersion.V260.ordinal()) {
nodeName = null;
bundleName = null;
bundleVendor = null;
bundleSymbolicName = null;
featureSymbolicName = null;
featureName = null;
featureVendor = null;
featureVersion = null;
} else {
nodeName = settings.getString("node-name");
bundleName = settings.getString("node-bundle-name");
bundleSymbolicName = fixExtensionName(settings.getString("node-bundle-symbolic-name"));
bundleVendor = settings.getString("node-bundle-vendor");
featureSymbolicName = fixExtensionName(settings.getString("node-feature-symbolic-name", null));
featureName = settings.getString("node-feature-name", null);
featureVendor = settings.getString("node-feature-vendor", null);
String v = settings.getString("node-feature-version", "");
try {
if (!v.isEmpty()) {
featureVersion = Version.parseVersion(v);
} else {
featureVersion = null;
}
} catch (IllegalArgumentException iae) {
throw new InvalidSettingsException("Invalid feature version \"" + v + "\"", iae);
}
}
String v = settings.getString("node-bundle-version", "");
try {
if (!v.isEmpty()) {
bundleVersion = Version.parseVersion(v);
} else {
bundleVersion = null;
}
} catch (IllegalArgumentException iae) {
throw new InvalidSettingsException("Invalid version \"" + v + "\"", iae);
}
return new NodeAndBundleInformation(factoryClass, bundleSymbolicName, bundleName, bundleVendor, nodeName, bundleVersion, featureSymbolicName, featureName, featureVendor, featureVersion);
}
use of org.osgi.framework.Version in project knime-core by knime.
the class NodeAndBundleInformation method save.
/**
* Saves the information into the given node settings object. Called by persistor.
*
* @param settings a node settings object
* @noreference This method is not intended to be referenced by clients.
*/
public void save(final NodeSettingsWO settings) {
settings.addString("factory", getFactoryClass());
// new in 2.6
settings.addString("node-name", getNodeName().orElse(null));
settings.addString("node-bundle-name", getBundleName().orElse(null));
settings.addString("node-bundle-symbolic-name", getBundleSymbolicName().orElse(null));
settings.addString("node-bundle-vendor", getBundleVendor().orElse(null));
// new in 2.10
final Version bundleVersion = getBundleVersion().orElse(Version.emptyVersion);
settings.addString("node-bundle-version", bundleVersion.toString());
// new in 3.0
settings.addString("node-feature-name", getFeatureName().orElse(null));
settings.addString("node-feature-symbolic-name", getFeatureSymbolicName().orElse(null));
settings.addString("node-feature-vendor", getFeatureVendor().orElse(null));
final Version featureVersion = getFeatureVersion().orElse(Version.emptyVersion);
settings.addString("node-feature-version", featureVersion.toString());
}
Aggregations