4.7.3. Example of an Executable Bundle

The following is an example of an executable bundle. In this case, the bundle contains the sample application from the tutorial in Chapter 2, Tutorial

helloserver/
   2.0/
      bundle/
         actions/
            hello.sh
            install.sh
            start.sh
            status.sh
            stop.sh
         config/
            helloserver.properties
            logging.properties
         info
      shared/
         lib/
            serverhello-2.0.jar
            shared-utils-0.9.0.jar

The directory 'shared' contains the java libraries need to run this application. Since these are not platform-specific, they are inside a 'lib' directory within 'shared'. The bundle hooks inside this bundle rely on built-in BundleWorks functions to handle start, stop, and status commands. There is also a custom hook named 'hello'.

As an example, the contents of the start.sh script are shown here.

#!/bin/sh

. $BUNDLEWORKS_INCLUDE/java_service_funcs.sh

java_service_start "org.bundleworks.tutorial.HelloServer" \
   "-Djava.util.logging.config.file=$WORK_DIR/config/logging.properties" \
   "$@"

Note that executable bundles can also contain 'load' and 'unload' hooks, although this example bundle doesn't.