Chapter 23. Branding JBoss Fuse Console

When you start JBoss Fuse, you are welcomed by a default message on JBoss Fuse console. You can customize the JBoss Fuse console with your own brand. You can define your own welcome message to be displayed when you start the console and also the prompt displayed to the users. There are two ways to customize:
  • Adding a branding.properties file to Fuse install dir/etc directory

    Procedure 23.1. Adding a branding.properties file to Fuse install dir/etc directory

    1. Create a branding.properties file with your message. A sample file is given below:
      {
      }
      welcome = \
      \u001B[31m      _ ____                  ______\u001B[0m\n\
      \u001B[31m     | |  _ \\                |  ____|             \u001B[0m\n\
      \u001B[31m     | | |_) | ___  ___ ___  | |__ _   _ ___  ___\u001B[0m\n\
      \u001B[31m _   | |  _ < / _ \\/ __/ __| |  __| | | / __|/ _ \\\u001B[0m\n\
      \u001B[31m| |__| | |_) | (_) \\__ \\__ \\ | |  | |_| \\__ \\  __/\u001B[0m\n\
      \u001B[31m \\____/|____/ \\___/|___/___/ |_|   \\__,_|___/\\___|\u001B[0m\n\
      \n\
      \u001B[1m  JBoss Fuse\u001B[0m (6.2.0.redhat-133)\n\
      \n\
      Open a browser to http://localhost:8181 to access the management console\n\
      \n\
      Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown JBoss Fuse.\n
      prompt = \u001B[31mJBossFuse\u001B[0m:\u001B[34m${USER}\u001B[0m\u001B[1m@\u001B[0m\u001B[36m${APPLICATION}\u001B[0m>\u0020
      {
      }
    2. Copy the branding.properties file to Fuse install dir/etc directory.
    3. Navigate to Fuse install dir/bin directory. Open the terminal and enter the command ./fuse to start the JBoss Fuse server. You will see your branded message on the JBoss Fuse console.
  • Creating a branding bundle
    At the startup, JBoss Fuse is looking for a bundle which exports the org.apache.karaf.branding package, containing a branding.properties file. This branding bundle contains a file which stores your customized brand.
    You can create a simple branding bundle using Maven. Copy your branding.properties file to the maven project resources directory, for example, src/main/resources/org/apache/karaf/branding/ directory. Then using your project's pom.xml file you can generate the branding bundle as per the steps given below:

    Procedure 23.2. Creating a branding bundle

    1. Create branding.properties file as shown above. Copy this file to project resources directory, for example, src/main/resources/org/apache/karaf/branding/branding.properties directory.
    2. A sample pom.xml file can be as follows:
      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      
          <modelVersion>4.0.0</modelVersion>
      
          <groupId>branding.console</groupId>
          <artifactId>my.brand</artifactId>
          <version>1.0-SNAPSHOT</version>
          <packaging>bundle</packaging>
          <name>My Brand</name>
      
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.apache.felix</groupId>
                      <artifactId>maven-bundle-plugin</artifactId>
                      <version>2.4.0</version>
                      <extensions>true</extensions>
                      <configuration>
                          <instructions>
                              <Bundle-SymbolicName>manual</bundle-SymbolicName>
                              <Import-Package>*</Import-Package>
                              <Private-Package>!*</Private-Package>
                              <Export-Package>
                                  org.apache.karaf.branding
                              </Export-Package>
                              <Spring-Context>*;public-context:=false</Spring-Context>
                          </instructions>
                      </configuration>
                  </plugin>
              </plugins>
          </build>
       </project>
    3. Open a terminal and navigate to directory where you have saved the pom.xml file. Run mvn clean install command to create a branding bundle.
    4. Copy generated branded bundle from the project's /target directory to Fuse install dir/lib directory.
    5. In order for JBoss Fuse to use this branding bundle instead of default one, add the following line to Fuse install dir/etc/custom.properties file:
      org.osgi.framework.system.packages.extra = \ org.apache.karaf.branding
    6. Save your changes. Navigate to Fuse install dir/bindirectory and run ./fuse to start JBoss Fuse server. You can see your branded console after the startup.