As Chameleon promotes conventions, it promotes a common directory structure:

  • bin contains the launcher and its dependencies
  • core contains the key OSGi bundles
  • runtime contains so-called technical services and external libraries. It can also contains cfg files representing OSGi config admin’s configurations. By default, this directory is watched at runtime, reflecting changes in the OSGi runtime.
  • application contains the application’s bundles and configurations. By default, this directory is watched at runtime, reflecting changes in the OSGi runtime.
  • conf contains logging and the platform configuration

By default log files are created in the logs directory.

The bin directory

The bin directory contains the core launcher and its dependency.

The core directory

The core directory contains core bundles. Once launched, these bundles are never updated, they are the foundation of your application. Updating them requires a restart of the application. These bundles starts before any other bundles.

You can add fundamental static bundles is this directory. By default, Apache Felix iPOJO, Ow2 Shelbie and Apache Felix Configuration Admin are deployed.

The runtime directory

The runtime directory contains bundles and configuration files. By default, this bundle is not watched, but bundles can be updated manually.

Traditionally these bundles provide technical services used by your application. For instance, it would be the place of the event admin or custom deployers.

You can enable the watching on this directory. In this case, change in the directory will be reflected within the OSGi framework.

The application directory

The application directory contains the bundles and configuration files from your application. By default, this directory is watched. So changes are reflected.

The ‘libs’ directory

The libs directory contains jars that are not bundles. Chameleon scans these jars and exposes every included packages within the OSGi runtime. So, Chameleon applications can relies on packages included in jars that are not bundles.

The conf directory

the conf directory contains all the required configurations:

  • OSGi framework configuration
  • System properties
  • Log backend configuration

Chameleon provides a facade for JUL (Java Utils Logging). JUG log messages are automatically redirected to the Chameleon log system (and backed to Logback).

Hook

You can register a hook to be notified of the initialization, configuration and shutting down of a Chameleon instance. Hooks are declared using SPI.

A hook implements the org.ow2.chameleon.core.hook.Hook interface (or extends org.ow2.chameleon.core.hook.DefaultHook). The hook is declared in a file named: META-INF/services/org.ow2.chameleon.core.hook.Hook and containing the name of your Hook implementation:

org.ow2.chameleon.core.hook.MyHook

The jar containing the Hook must be available in the Java ClassPath.

The hook is notified:

  • when the Chameleon is initialized. Nothing important was done before this point.
  • once the Chameleon is configured (but not yet started). You can retrieve and modify the configuraiton in this callback
  • when the Chameleon instance is stopped

Back to top

Version: 1.10.8-SNAPSHOT. Last Published: 2015-05-04.