diff --git a/core-feature-pack/galleon-common/src/main/resources/configs/standalone/model.xml b/core-feature-pack/galleon-common/src/main/resources/configs/standalone/model.xml index 974b956f3c4..0be78f79039 100644 --- a/core-feature-pack/galleon-common/src/main/resources/configs/standalone/model.xml +++ b/core-feature-pack/galleon-common/src/main/resources/configs/standalone/model.xml @@ -15,6 +15,7 @@ + diff --git a/core-feature-pack/galleon-common/src/main/resources/packages/banner/content/bin/banner.txt b/core-feature-pack/galleon-common/src/main/resources/packages/banner/content/bin/banner.txt new file mode 100644 index 00000000000..a7037324dba --- /dev/null +++ b/core-feature-pack/galleon-common/src/main/resources/packages/banner/content/bin/banner.txt @@ -0,0 +1,6 @@ + _ ___ __ __________ ______ +| | / (_) /___/ / ____/ /_ __ / ____/___ ________ +| | /| / / / / __ / /_ / / / / / / / / __ \/ ___/ _ \ +| |/ |/ / / / /_/ / __/ / / /_/ / / /___/ /_/ / / / __/ +|__/|__/_/_/\__,_/_/ /_/\__, / \____/\____/_/ \___/ + /____/ diff --git a/core-feature-pack/galleon-common/src/main/resources/packages/banner/package.xml b/core-feature-pack/galleon-common/src/main/resources/packages/banner/package.xml new file mode 100644 index 00000000000..4e23d5a90ab --- /dev/null +++ b/core-feature-pack/galleon-common/src/main/resources/packages/banner/package.xml @@ -0,0 +1,4 @@ + + + + diff --git a/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/content/modules/system/layers/base/org/jboss/as/product/wildfly-core/module.xml b/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/content/modules/system/layers/base/org/jboss/as/product/wildfly-core/module.xml index a24ced5bb39..46b02e52e42 100644 --- a/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/content/modules/system/layers/base/org/jboss/as/product/wildfly-core/module.xml +++ b/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/content/modules/system/layers/base/org/jboss/as/product/wildfly-core/module.xml @@ -16,4 +16,4 @@ - + \ No newline at end of file diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java index c7aa92a746d..55cf88ed816 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java @@ -479,6 +479,7 @@ public HostControllerEnvironment(Map hostSystemProperties, boole this.hostControllerUUID = uuid; this.backupDomainFiles = backupDomainFiles; this.useCachedDc = useCachedDc; + ProductConfig.getBannerFile(productConfig, homeDir.getAbsolutePath()); this.productConfig = productConfig; // Note the java.security.manager property shouldn't be set, but we'll check to ensure the security manager should be enabled this.securityManagerEnabled = securityManagerEnabled || isJavaSecurityManagerConfigured(hostSystemProperties); diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerService.java b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerService.java index 493d20b02a9..80ecc07745e 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerService.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerService.java @@ -103,7 +103,8 @@ public void start(StartContext context) throws StartException { // processState.setStarting(); final ProductConfig config = environment.getProductConfig(); final String prettyVersion = config.getPrettyVersionString(); - ServerLogger.AS_ROOT_LOGGER.serverStarting(prettyVersion); + final String banner = environment.getStability() == org.jboss.as.version.Stability.EXPERIMENTAL ? config.getBanner() : ""; + ServerLogger.AS_ROOT_LOGGER.serverStarting(prettyVersion, banner); if (System.getSecurityManager() != null) { ServerLogger.AS_ROOT_LOGGER.securityManagerEnabled(); } diff --git a/server/src/main/java/org/jboss/as/server/ApplicationServerService.java b/server/src/main/java/org/jboss/as/server/ApplicationServerService.java index a67f628e8a9..663897bf8d6 100644 --- a/server/src/main/java/org/jboss/as/server/ApplicationServerService.java +++ b/server/src/main/java/org/jboss/as/server/ApplicationServerService.java @@ -82,7 +82,8 @@ public synchronized void start(final StartContext context) throws StartException final ServerEnvironment serverEnvironment = configuration.getServerEnvironment(); final ProductConfig config = serverEnvironment.getProductConfig(); final String prettyVersion = config.getPrettyVersionString(); - ServerLogger.AS_ROOT_LOGGER.serverStarting(prettyVersion); + final String banner = serverEnvironment.getStability() == org.jboss.as.version.Stability.EXPERIMENTAL ? config.getBanner() : ""; + ServerLogger.AS_ROOT_LOGGER.serverStarting(prettyVersion, banner); if (System.getSecurityManager() != null) { ServerLogger.AS_ROOT_LOGGER.securityManagerEnabled(); } diff --git a/server/src/main/java/org/jboss/as/server/ServerEnvironment.java b/server/src/main/java/org/jboss/as/server/ServerEnvironment.java index 40019885b5e..364a6183759 100644 --- a/server/src/main/java/org/jboss/as/server/ServerEnvironment.java +++ b/server/src/main/java/org/jboss/as/server/ServerEnvironment.java @@ -549,6 +549,7 @@ public ServerEnvironment(final String hostControllerName, final Properties props throw ServerLogger.ROOT_LOGGER.couldNotObtainServerUuidFile(ex, filePath); } this.serverUUID = uuid; + ProductConfig.getBannerFile(productConfig, homeDir.getAbsolutePath()); this.productConfig = productConfig; // Keep a copy of the original properties diff --git a/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java b/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java index 087649a87c9..5d56a10127c 100644 --- a/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java +++ b/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java @@ -317,10 +317,11 @@ public interface ServerLogger extends BasicLogger { * Logs an informational message indicating the server is starting. * * @param prettyVersion the server version. + * @param banner the server ACII banner. */ @LogMessage(level = INFO) - @Message(id = 49, value = "%s starting") - void serverStarting(String prettyVersion); + @Message(id = 49, value = "%s starting%s") + void serverStarting(String prettyVersion, String banner); /** * Logs an informational message indicating the server is stopped. diff --git a/testsuite/domain/pom.xml b/testsuite/domain/pom.xml index 236a1c5c34c..47bea6f26d7 100644 --- a/testsuite/domain/pom.xml +++ b/testsuite/domain/pom.xml @@ -131,6 +131,7 @@ product.conf + banner diff --git a/testsuite/manualmode/pom.xml b/testsuite/manualmode/pom.xml index f8568d76461..4784158bb3b 100644 --- a/testsuite/manualmode/pom.xml +++ b/testsuite/manualmode/pom.xml @@ -218,6 +218,7 @@ ${project.version} product.conf + banner @@ -442,6 +443,7 @@ product.conf + banner @@ -543,6 +545,7 @@ product.conf + banner diff --git a/testsuite/rbac/pom.xml b/testsuite/rbac/pom.xml index bba7ab19f9b..b4ba8631d66 100644 --- a/testsuite/rbac/pom.xml +++ b/testsuite/rbac/pom.xml @@ -101,6 +101,7 @@ + banner product.conf @@ -332,6 +333,7 @@ org.jboss.as.patching.cli + banner product.conf @@ -456,6 +458,7 @@ org.jboss.as.patching.cli + banner product.conf diff --git a/testsuite/standalone/pom.xml b/testsuite/standalone/pom.xml index ddc404a9db3..340071f28bc 100644 --- a/testsuite/standalone/pom.xml +++ b/testsuite/standalone/pom.xml @@ -224,6 +224,7 @@ + banner product.conf @@ -307,6 +308,7 @@ org.jboss.as.patching.cli + banner product.conf @@ -407,6 +409,7 @@ org.jboss.as.patching.cli + banner product.conf diff --git a/version/src/main/java/org/jboss/as/version/ProductConfig.java b/version/src/main/java/org/jboss/as/version/ProductConfig.java index ec491412644..b927156b7d7 100644 --- a/version/src/main/java/org/jboss/as/version/ProductConfig.java +++ b/version/src/main/java/org/jboss/as/version/ProductConfig.java @@ -12,6 +12,7 @@ import java.io.Serializable; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.security.AccessController; import java.security.PrivilegedAction; @@ -34,19 +35,20 @@ public class ProductConfig implements Serializable { private final String name; private final String version; + private String banner; private final String consoleSlot; private final Stability defaultStability; private final Set stabilities; private boolean isProduct; public static ProductConfig fromFilesystemSlot(ModuleLoader loader, String home, Map providedProperties) { - return new ProductConfig(loader, getProductConfProperties(home), providedProperties); + return new ProductConfig(loader, home, getProductConfProperties(home), providedProperties); } public static ProductConfig fromKnownSlot(String slot, ModuleLoader loader, Map providedProperties) { - return new ProductConfig(loader, new ProductConfProps(slot), providedProperties); + return new ProductConfig(loader, null, new ProductConfProps(slot), providedProperties); } - private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Map providedProperties) { + private ProductConfig(ModuleLoader loader, String home, ProductConfProps productConfProps, Map providedProperties) { String productName = null; String projectName = null; String productVersion = null; @@ -81,6 +83,7 @@ private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Ma minStability = Stability.fromString(minStabilityValue); } } + getBannerFile(this, home); } setSystemProperties(productConfProps.miscProperties, providedProperties); @@ -97,6 +100,19 @@ private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Ma this.stabilities = EnumSet.range(maxStability, minStability); } + public static void getBannerFile(ProductConfig config, String home) { + if (home != null) { + Path bannerPath = Paths.get(home, "bin", "banner.txt"); + if (bannerPath != null && Files.exists(bannerPath)) { + try { + config.banner = System.lineSeparator() + Files.readString(bannerPath); + } catch (Exception e) { + // Don't care + } + } + } + } + private static String getProductConf(String home) { final String defaultVal = home + File.separator + "bin" + File.separator + "product.conf"; PrivilegedAction action = new PrivilegedAction() { @@ -133,6 +149,7 @@ public ProductConfig(final String productName, final String productVersion, fina this.consoleSlot = consoleSlot; this.defaultStability = Stability.DEFAULT; this.stabilities = EnumSet.of(this.defaultStability); + this.banner = null; } public String getProductName() { @@ -167,6 +184,14 @@ public Set getStabilitySet() { return this.stabilities; } + /** + * The product ASCII banner defined in $JBOSS_HOME\bin\banner.txt using \n as line ending. + * @return the ASCII banner. + */ + public String getBanner() { + return banner; + } + public String getPrettyVersionString() { if (name != null) { return String.format("%s %s (WildFly Core %s)", name, version, Version.AS_VERSION);