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..cfcb7faa871 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 @@ -4,8 +4,7 @@ ~ Copyright The WildFly Authors ~ SPDX-License-Identifier: Apache-2.0 --> - - + @@ -16,4 +15,4 @@ - + \ No newline at end of file diff --git a/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/pm/wildfly/resources/modules/system/layers/base/org/jboss/as/product/wildfly-core/dir/META-INF/MANIFEST.MF b/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/pm/wildfly/resources/modules/system/layers/base/org/jboss/as/product/wildfly-core/dir/META-INF/MANIFEST.MF index 14b9473f806..9a019d156cb 100644 --- a/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/pm/wildfly/resources/modules/system/layers/base/org/jboss/as/product/wildfly-core/dir/META-INF/MANIFEST.MF +++ b/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/pm/wildfly/resources/modules/system/layers/base/org/jboss/as/product/wildfly-core/dir/META-INF/MANIFEST.MF @@ -1,2 +1,9 @@ JBoss-Project-Release-Name: ${product.release.name} JBoss-Product-Release-Version: ${project.version} +JBoss-Project-Banner: \n + _ ___ __ __________ ______ \n + | | / (_) /___/ / ____/ /_ __ / ____/___ ________ \n + | | /| / / / / __ / /_ / / / / / / / / __ \/ ___/ _ \\n + | |/ |/ / / / /_/ / __/ / / /_/ / / /___/ /_/ / / / __/\n + |__/|__/_/_/\__,_/_/ /_/\__, / \____/\____/_/ \___/ \n + /____/ \n 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/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 3e6dd767136..73e91532b2e 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 bfb3e0c5871..30975cc83e8 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 260ac14397d..c7d3c26341f 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 1050c227cc1..dd5a73c174c 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..7e6e2355b9c 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,21 +35,23 @@ public class ProductConfig implements Serializable { private final String name; private final String version; + private final 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 projectBanner = ""; String productVersion = null; String consoleSlot = null; Stability defaultStability = Stability.COMMUNITY; @@ -81,10 +84,18 @@ private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Ma minStability = Stability.fromString(minStabilityValue); } } + Path bannerPath = getBannerFile(home); + if (bannerPath != null && Files.exists(bannerPath)) { + try { + projectBanner = System.lineSeparator() + Files.readString(bannerPath); + } catch (Exception e) { + // Don't care + } + } } - setSystemProperties(productConfProps.miscProperties, providedProperties); } catch (Exception e) { + e.printStackTrace(); // Don't care } finally { safeClose(manifestStream); @@ -95,6 +106,14 @@ private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Ma this.consoleSlot = consoleSlot; this.defaultStability = defaultStability; this.stabilities = EnumSet.range(maxStability, minStability); + this.banner = projectBanner; + } + + private static Path getBannerFile(String home) { + if (home != null) { + return Paths.get(home, "bin", "banner.txt"); + } + return null; } private static String getProductConf(String home) { @@ -133,6 +152,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 +187,14 @@ public Set getStabilitySet() { return this.stabilities; } + /** + * The product ASCII banner defined in MANIFEST.MF 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);