/** * Returns the string representation of this version range. * * <p> * The format of the version range string will be a version string if the * right end point is <i>Infinity</i> ({@code null}) or an interval string. * * @return The string representation of this version range. */ @Override public String toString() { String s = versionRangeString; if (s != null) { return s; } String leftVersion = left.toString(); if (right == null) { StringBuffer result = new StringBuffer(leftVersion.length() + 1); result.append(left.toString0()); return versionRangeString = result.toString(); } String rightVerion = right.toString(); StringBuffer result = new StringBuffer(leftVersion.length() + rightVerion.length() + 5); result.append(leftClosed ? LEFT_CLOSED : LEFT_OPEN); result.append(left.toString0()); result.append(ENDPOINT_DELIMITER); result.append(right.toString0()); result.append(rightClosed ? RIGHT_CLOSED : RIGHT_OPEN); return versionRangeString = result.toString(); }
/** * This method shows addon info on Spring Roo Shell * * @param bundle * @param bundleVersion */ private void addOnInfo(final ObrBundle bundle, final Version bundleVersion) { logInfo("Name", bundle.getPresentationName()); logInfo("BSN", bundle.getSymbolicName()); logInfo("Version", bundleVersion.toString()); logInfo("JAR Size", bundle.getSize() + " bytes"); logInfo("JAR URL", bundle.getUri()); StringBuilder sb = new StringBuilder(); for (final String command : bundle.getCommands()) { sb.append(command).append(", "); } logInfo("Commands", sb.toString()); }
@Override public String marshal(final Version v) throws Exception { return v.toString(); } }
/** * @return the Java Language Server version */ public static String getVersion() { return context == null ? "Unknown" : context.getBundle().getVersion().toString(); }
private String getSwaggerUiRoot(Bundle b, String swaggerUiVersion) { if (swaggerUiVersion == null) { swaggerUiVersion = b.getVersion().toString(); } URL entry = b.getEntry(SwaggerUiResolver.UI_RESOURCES_ROOT_START + swaggerUiVersion); if (entry != null) { return entry.toString() + "/"; } return null; } }
@Override public void startBundle(String symbolicName, String version) throws Exception { for (Bundle bundle : syscontext.getBundles()) { if (bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) { bundle.start(); return; } } throw new IllegalStateException("Bundle '" + symbolicName + ":" + version + "' was not found"); }
private Collection<Bundle> getMatchingBundles(final String symbolicName, final String version) { Collection<Bundle> bundles = new ArrayList<>(); for (Bundle b : bundleContext.getBundles()) { if (b.getSymbolicName().equals(symbolicName) && (version == null || b.getVersion().toString().equals(version))) { bundles.add(b); } } return bundles; }
@Override public boolean apply(Bundle input) { return input.getSymbolicName() != null && input.getVersion() != null && symbolicName.matcher(input.getSymbolicName()).matches() && (version == null || version.matcher(input.getVersion().toString()).matches()); } }
/** * @deprecated */ public String getSpecificationVersion() { return getVersion().toString(); }
/** * @deprecated */ public String getSpecificationVersion() { return getVersion().toString(); }
public ContentImpl (String bundleSymbolicName, Version version) { this.contentName = bundleSymbolicName; this.nameValueMap = new HashMap<String, String>(); nameValueMap.put("version", version.toString()); setup(); }
static Requirement getIdentityRequirement(String name, Version version) { version = version == null ? Version.emptyVersion : version; String filter = "(&(" + IdentityNamespace.IDENTITY_NAMESPACE + "=" + name + ")(" + IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE + "=" + version.toString() + "))"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$ Map<String, String> directives = Collections.<String, String> singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter); return new ModuleRequirement(IdentityNamespace.IDENTITY_NAMESPACE, directives, Collections.<String, Object> emptyMap(), null); }
private static String formatVersion(String version) { try { Version v = new Version(version); return v.toString(); } catch (IllegalArgumentException e) { } return version; }
public String getVersion() { logger.debug(LOG_ENTRY, "getVersion"); String result = resource.getVersion().toString(); logger.debug(LOG_EXIT, "getVersion", result); return result; }
public static BundleDTO newBundleDTO(Bundle bundle) { if (bundle == null) { return null; } BundleDTO dto = new BundleDTO(); dto.id = bundle.getBundleId(); dto.lastModified = bundle.getLastModified(); dto.state = bundle.getState(); dto.symbolicName = bundle.getSymbolicName(); dto.version = bundle.getVersion().toString(); return dto; }
/** * Get the bundle or composite's version * @return version */ public String getVersion () { String result = String.valueOf(getAttributes().get(Constants.VERSION_ATTRIBUTE)); return Version.parseVersion(result).toString(); }
/** * {@inheritDoc} */ @Override public String readVersion() throws InvalidVersionException { return InspectIT.getDefault().getBundle().getVersion().toString(); }
private void setFrameworkVersion(BundleDescription systemBundle) { ExportPackageDescription[] packages = systemBundle.getExportPackages(); for (int i = 0; i < packages.length; i++) if (packages[i].getName().equals(Constants.OSGI_FRAMEWORK_PACKAGE)) { FrameworkProperties.setProperty(Constants.FRAMEWORK_VERSION, packages[i].getVersion().toString()); break; } FrameworkProperties.setProperty(Constants.OSGI_IMPL_VERSION_KEY, systemBundle.getVersion().toString()); }
private Boolean processPluginUpgrading() { final Version version = getDefault().getBundle().getVersion(); final IPreferenceStore preferenceStore = getDefault().getPreferenceStore(); final String preferenceName = "lastVersionActivated"; final String lastVersionActivated = preferenceStore.getString(preferenceName); final boolean upgraded = "".equals(lastVersionActivated) || (version.compareTo(new Version(lastVersionActivated)) > 0); preferenceStore.setValue(preferenceName, version.toString()); return upgraded; }