@Override public Version getSpecVersion() { return SingleVersion.valueOf("2.1"); }
public static Version getRuntimeAPIVersion() { String version = Bootstrap.class.getPackage().getImplementationVersion(); if (version != null) { return SingleVersion.valueOf(version); } return EmptyVersion.getInstance(); }
public static Version getRuntimeAPIVersion() { String version = Bootstrap.class.getPackage().getImplementationVersion(); if (version != null) { return SingleVersion.valueOf(version); } return EmptyVersion.getInstance(); }
private SingleVersion getCurrentCoreRulesetsVersion() { Path windupRulesDir = getRulesetsDir(); Path coreRulesPomPath = windupRulesDir.resolve(RULESET_CORE_DIRECTORY + "/META-INF/maven/org.jboss.windup.rules/windup-rulesets/pom.xml"); File pomXml = coreRulesPomPath.toFile(); if (!pomXml.exists()) return null; MavenModelResource pom = (MavenModelResource) factory.create(pomXml); return SingleVersion.valueOf(pom.getCurrentModel().getVersion()); }
/** * Create an {@link AddonId} from the given name, version, and API version. */ public static AddonId from(String name, String version, String apiVersion) { Assert.notNull(name, "Name cannot be null."); if (name.trim().isEmpty()) throw new IllegalArgumentException("Name cannot be empty."); Assert.notNull(version, "Version cannot be null."); if (version.trim().isEmpty()) throw new IllegalArgumentException("Version cannot be empty."); AddonId id = new AddonId(); id.name = name; id.version = SingleVersion.valueOf(version); if (apiVersion == null || apiVersion.trim().isEmpty()) id.apiVersion = EmptyVersion.getInstance(); else id.apiVersion = SingleVersion.valueOf(apiVersion); return id; }
private SingleVersion getCurrentCoreRulesetsVersion() { Path windupRulesDir = getRulesetsDir(); Path coreRulesPomPath = windupRulesDir.resolve(RULESET_CORE_DIRECTORY + "/META-INF/maven/org.jboss.windup.rules/windup-rulesets/pom.xml"); File pomXml = coreRulesPomPath.toFile(); if (!pomXml.exists()) return null; MavenModelResource pom = (MavenModelResource) factory.create(pomXml); return SingleVersion.valueOf(pom.getCurrentModel().getVersion()); }
/** * Returns the Implementation version for the given {@link Class} * * @param type the {@link Class} with the corresponding package * @return {@link Version} representation from the {@link Package#getImplementationVersion()} returned from * {@link Class#getPackage()} */ public static Version getImplementationVersionFor(Class<?> type) { Assert.notNull(type, "Type must not be null."); final Version result; Package pkg = type.getPackage(); if (pkg == null) { result = EmptyVersion.getInstance(); } else { String version = pkg.getImplementationVersion(); if (Strings.isNullOrEmpty(version)) { result = EmptyVersion.getInstance(); } else { result = SingleVersion.valueOf(version); } } return result; }
/** * Returns the Specification version for the given {@link Class} * * @param type the {@link Class} with the corresponding package * @return {@link Version} representation from the {@link Package#getSpecificationVersion()} returned from * {@link Class#getPackage()} */ public static Version getSpecificationVersionFor(Class<?> type) { Assert.notNull(type, "Type must not be null."); final Version result; Package pkg = type.getPackage(); if (pkg == null) { result = EmptyVersion.getInstance(); } else { String version = pkg.getSpecificationVersion(); if (Strings.isNullOrEmpty(version)) { result = EmptyVersion.getInstance(); } else { result = SingleVersion.valueOf(version); } } return result; }
@Override public boolean accept(Dependency dependency) { Version version = SingleVersion.valueOf(dependency.getCoordinate().getVersion()); return version.compareTo(runtimeVersion) > 0 && version.getMajorVersion() == runtimeVersion.getMajorVersion() && "Final".equals(version.getQualifier()); } }));
&& Versions.isApiCompatible(runtimeAPIVersion, SingleVersion.valueOf(apiVersion)))
&& Versions.isApiCompatible(runtimeAPIVersion, SingleVersion.valueOf(apiVersion)))
&& Versions.isApiCompatible(runtimeAPIVersion, SingleVersion.valueOf(apiVersion)))
&& Versions.isApiCompatible(runtimeAPIVersion, SingleVersion.valueOf(apiVersion)))
&& Versions.isApiCompatible(specificationVersion, SingleVersion.valueOf(apiVersion)))
@Override public Result execute(UIExecutionContext context) throws Exception { if (!context.getPrompt().promptBoolean( "Are you sure you want to continue? This command will delete current directories: addons, bin, lib, rules/migration-core")) { return Results.fail("Updating distribution was aborted."); } // Find the latest version. Coordinate latestDist = this.updater.getLatestReleaseOf("org.jboss.windup", "windup-distribution"); Version latestVersion = SingleVersion.valueOf(latestDist.getVersion()); Version installedVersion = currentAddon.getId().getVersion(); if (latestVersion.compareTo(installedVersion) <= 0) { return Results.fail(Util.WINDUP_BRAND_NAME_ACRONYM+" CLI is already in the most updated version."); } distUpdater.replaceWindupDirectoryWithDistribution(latestDist); return Results.success("Sucessfully updated "+Util.WINDUP_BRAND_NAME_ACRONYM+" CLI to version " + latestDist.getVersion() + ". Please restart RHAMT CLI."); }