Wednesday, August 4, 2010

Re-Branding Karaf Shell Console

Various people have requested that we post some sort of demo or guide to re-branding Apache Karaf shell console, so in this post I'm going to do just that.
The process for branding the shell console is relatively simple, all that is required is a branding jar which contains the new branding in a properties file and some edits to the Karaf etc/custom.properties file.

To start we will create a new directory 'branding' and in that folder create a simple pom file that will build our branding jar. The important entry is to export 'org.apache.karaf.branding' in our jar.
We will then create a source directory structure to contain our new branding. The branding itself is kept in a 'branding.properties' file. This is a text file which contains some mark ups for text appearance. The basic layout would be 'src/main/resources/org/apache/karaf/branding/branding.properties'.

After completing the above two steps your branding project should have the following layout:

branding/
branding/pom.xml
branding/src/main/resources/org/apache/karaf/branding/branding.properties

To build the branding jar type 'mvn install'.

To deploy the new branding copy the branding jar inside of the target folder to $KARAF_HOME/lib.

Finally to enable Karaf to use this new branding jar you'll have to edit $KARAF_HOMR/etc/custom.properties to include the following entry:

org.osgi.framework.system.packages.extra = \
org.apache.karaf.branding; \
com.sun.org.apache.xalan.internal.xsltc.trax; \
com.sun.org.apache.xerces.internal.dom; \
com.sun.org.apache.xerces.internal.jaxp; \
com.sun.org.apache.xerces.internal.xni


The demo described above has been included in trunk and should appear in the next release of Karaf.

No comments: