diff --git a/cli/cli-client/src/main/java/org/infinispan/cli/CLI.java b/cli/cli-client/src/main/java/org/infinispan/cli/CLI.java index ad1c93378e6f..996044dec7f5 100644 --- a/cli/cli-client/src/main/java/org/infinispan/cli/CLI.java +++ b/cli/cli-client/src/main/java/org/infinispan/cli/CLI.java @@ -284,7 +284,7 @@ private void help(PrintStream out) { } private void version(PrintStream out) { - out.printf("%s CLI %s\n", Version.getBrandName(), Version.getVersion()); + out.printf("%s CLI %s\n", Version.getBrandName(), Version.getBrandVersion()); out.printf("Copyright (C) Red Hat Inc. and/or its affiliates and other contributors\n"); out.printf("License Apache License, v. 2.0. http://www.apache.org/licenses/LICENSE-2.0\n"); } diff --git a/commons/all/src/main/java/org/infinispan/commons/util/Version.java b/commons/all/src/main/java/org/infinispan/commons/util/Version.java index 3688bd0b2720..2afe74ba08c2 100644 --- a/commons/all/src/main/java/org/infinispan/commons/util/Version.java +++ b/commons/all/src/main/java/org/infinispan/commons/util/Version.java @@ -25,13 +25,15 @@ public class Version { private static final Version INSTANCE = new Version(); public static final String INFINISPAN_VERSION = "infinispan.version"; public static final String INFINISPAN_BRAND_NAME = "infinispan.brand.name"; + public static final String INFINISPAN_BRAND_VERSION = "infinispan.brand.version"; public static final String INFINISPAN_CODENAME = "infinispan.codename"; public static final String INFINISPAN_CORE_SCHEMA_VERSION = "infinispan.core.schema.version"; public static final String INFINISPAN_MODULE_SLOT_PREFIX = "infinispan.module.slot.prefix"; public static final String INFINISPAN_MODULE_SLOT_VERSION = "infinispan.module.slot.version"; private final String version; - private final String brandname; + private final String brandName; + private final String brandVersion; private final String codename; private final String schemaVersion; private final byte[] versionId; @@ -56,7 +58,8 @@ private Version(InputStream is) { // Ignore errors, we'll use fallbacks } version = properties.getProperty(INFINISPAN_VERSION, "0.0.0-SNAPSHOT"); - brandname = properties.getProperty(INFINISPAN_BRAND_NAME, "Infinispan"); + brandName = properties.getProperty(INFINISPAN_BRAND_NAME, "Infinispan"); + brandVersion = properties.getProperty(INFINISPAN_BRAND_VERSION, version); codename = properties.getProperty(INFINISPAN_CODENAME, "N/A"); schemaVersion = properties.getProperty(INFINISPAN_CORE_SCHEMA_VERSION, "0.0"); String parts[] = getParts(version); @@ -83,7 +86,7 @@ public String version() { } public String brandName() { - return brandname; + return brandName; } /* @@ -94,7 +97,11 @@ public static String getVersion() { } public static String getBrandName() { - return INSTANCE.brandname; + return INSTANCE.brandName; + } + + public static String getBrandVersion() { + return INSTANCE.brandVersion; } public static String getCodename() { @@ -181,9 +188,9 @@ public static void main(String[] args) { * Prints full version information to the standard output. */ public static void printFullVersionInformation() { - System.out.println(INSTANCE.brandname); + System.out.println(INSTANCE.brandName); System.out.println(); - System.out.printf("Version: \t%s%n", INSTANCE.version); + System.out.printf("Version: \t%s%n", INSTANCE.brandVersion); System.out.printf("Codename: \t%s%n", INSTANCE.codename); System.out.println(); } @@ -192,7 +199,7 @@ public static void printFullVersionInformation() { * Returns version information as a string. */ public static String printVersion() { - return INSTANCE.brandname + " '" + INSTANCE.codename + "' " + INSTANCE.version; + return INSTANCE.brandName + " '" + INSTANCE.codename + "' " + INSTANCE.brandVersion; } private static byte[] readVersionBytes(String major, String minor, String micro, String modifier) { diff --git a/commons/all/src/main/resources/META-INF/infinispan-version.properties b/commons/all/src/main/resources/META-INF/infinispan-version.properties index c61d7fcd7ee5..2ed55f8c666c 100644 --- a/commons/all/src/main/resources/META-INF/infinispan-version.properties +++ b/commons/all/src/main/resources/META-INF/infinispan-version.properties @@ -2,6 +2,7 @@ infinispan.version=${project.version} infinispan.core.schema.version=${infinispan.core.schema.version} infinispan.codename=${infinispan.codename} infinispan.brand.name=${infinispan.brand.name} +infinispan.brand.version=${infinispan.brand.version} infinispan.module.slot.prefix=${infinispan.module.slot.prefix} infinispan.module.slot.version=${infinispan.base.version} infinispan.build.commitid=${buildNumber} diff --git a/server/runtime/src/main/java/org/infinispan/server/Server.java b/server/runtime/src/main/java/org/infinispan/server/Server.java index cadbc1a51175..a527d88dba99 100644 --- a/server/runtime/src/main/java/org/infinispan/server/Server.java +++ b/server/runtime/src/main/java/org/infinispan/server/Server.java @@ -364,7 +364,7 @@ public synchronized CompletableFuture run() { ); // Change status this.status = ComponentStatus.RUNNING; - log.serverStarted(Version.getBrandName(), Version.getVersion(), timeService.timeDuration(startTime, TimeUnit.MILLISECONDS)); + log.serverStarted(Version.getBrandName(), Version.getBrandVersion(), timeService.timeDuration(startTime, TimeUnit.MILLISECONDS)); } catch (Exception e) { r.completeExceptionally(e); } diff --git a/server/runtime/src/main/java/org/infinispan/server/security/UserTool.java b/server/runtime/src/main/java/org/infinispan/server/security/UserTool.java index 36359bacb809..34b866d5c23c 100644 --- a/server/runtime/src/main/java/org/infinispan/server/security/UserTool.java +++ b/server/runtime/src/main/java/org/infinispan/server/security/UserTool.java @@ -267,7 +267,7 @@ public void help(PrintStream out) { @Override public void version(PrintStream out) { - out.printf("%s User Tool %s (%s)\n", Version.getBrandName(), Version.getVersion(), Version.getCodename()); + out.printf("%s User Tool %s\n", Version.getBrandName(), Version.getBrandVersion()); out.println("Copyright (C) Red Hat Inc. and/or its affiliates and other contributors"); out.println("License Apache License, v. 2.0. http://www.apache.org/licenses/LICENSE-2.0"); } diff --git a/tools/src/main/java/org/infinispan/tools/store/migrator/StoreMigrator.java b/tools/src/main/java/org/infinispan/tools/store/migrator/StoreMigrator.java index 5f6715588f7e..e5829f64a5ed 100644 --- a/tools/src/main/java/org/infinispan/tools/store/migrator/StoreMigrator.java +++ b/tools/src/main/java/org/infinispan/tools/store/migrator/StoreMigrator.java @@ -4,6 +4,7 @@ import static org.infinispan.tools.store.migrator.Element.SIZE; import java.io.FileReader; +import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -18,6 +19,7 @@ import org.infinispan.AdvancedCache; import org.infinispan.commons.io.ByteBufferImpl; import org.infinispan.commons.marshall.AdvancedExternalizer; +import org.infinispan.commons.util.Version; import org.infinispan.container.entries.ImmortalCacheEntry; import org.infinispan.container.entries.ImmortalCacheValue; import org.infinispan.container.entries.InternalCacheEntry; @@ -91,7 +93,7 @@ public void run() throws Exception { void run(boolean output) throws Exception { String batchSizeProp = properties.getProperty(BATCH + "." + SIZE); - int batchLimit = batchSizeProp != null ? new Integer(batchSizeProp) : DEFAULT_BATCH_SIZE; + int batchLimit = batchSizeProp != null ? Integer.parseInt(batchSizeProp) : DEFAULT_BATCH_SIZE; try (EmbeddedCacheManager manager = TargetStoreFactory.getCacheManager(properties); StoreIterator sourceReader = StoreIteratorFactory.get(properties)) { @@ -127,7 +129,8 @@ void run(boolean output) throws Exception { public static void main(String[] args) throws Exception { if (args.length != 1) { - System.err.println("Usage: StoreMigrator migrator.properties"); + version(System.out); + System.out.println("Usage: StoreMigrator migrator.properties"); System.exit(1); } Properties properties = new Properties(); @@ -135,6 +138,12 @@ public static void main(String[] args) throws Exception { new StoreMigrator(properties).run(true); } + private static void version(PrintStream out) { + out.printf("%s Store Migrator %s\n", Version.getBrandName(), Version.getBrandVersion()); + out.println("Copyright (C) Red Hat Inc. and/or its affiliates and other contributors"); + out.println("License Apache License, v. 2.0. http://www.apache.org/licenses/LICENSE-2.0"); + } + private boolean warnAndIgnoreInternalClasses(Object o, Set extClass, boolean output) { Class clazz = o.getClass(); boolean isBlackListed = !extClass.contains(clazz) && !clazz.isPrimitive() && INTERNAL_BLACKLIST.stream().anyMatch(c -> c.isAssignableFrom(clazz));