Hi,

I'm thinking of creating a generic launcher, using a text file
definition to load and start jars, allowing a Sling launcher to take
over and load and start bundles once a main class is started.

Here's a rough idea - I haven't looked at Karaf closely yet, there's
probably some overlap, but my idea is to create a generic Java
launcher, having nothing to do with OSGi, that in turn launches an
OSGi-aware main class.

The launcher is a runnable jar, or a war file.

It uses a text file named launch.txt to define what to launch, example below.

# START launch.txt example
properties:
sling.home = ./sling
org.apache.commons.launcher.protocols.maven.repository.1 =
http://repo1.maven.org/maven2
org.apache.commons.launcher.protocols.maven.repository.2 =
http://people.apache.org/repo/m2-incubating-repository

protocols:
# by default only the http and file protocol are provided to
# load jar files, more can be added by loading protocol jars

# The maven protocol, for example, grabs jar files from
# repositories  defined by the *.maven.repository properties
# found above.
jar http://some.repository/launcher-maven-protocol-1.4.2.jar
md5=1231231239812cd21231987

bootstrap:
# load a number of jars that are required to start the main class
jar maven:org.apache.felix:org.osgi.compendium:jar:1.2.0
md5=1231231239812cd212315645
jar maven:org.apache.felix:org.osgi.core:jar:1.2.0
sha1=1231231239812cd21231123213
jar maven:org.apache.felix:org.osgi.foundation:jar:1.2.0
sha1=1231231239812cd2123112313
jar maven:org.apache.sling:org.apache.sling.launchpad.launcher:2.0.2-incubator
md5=1231231239812cd2123112313

# now start the main class, from the org.apache.sling.launchpad.launcher jar
main-class org.apache.sling.launchpad.launcher.Main -m launcher

# The launcher stops processing here, and provides this file to the
main class as its
# standard input. The above launcher.Main processes the lines that follow the
# above main-class statement

# Load and start a few bundles, some with specific start levels
bundle http://some.obr/some-bundle sha1=1231390890823121312
bundle maven:some.group:some.artifact:1.0 startlevel=2 md5=123213213984329843

# END launch.txt example

Creating a launcher that will "never" change doesn't seem too hard,
and then defining a Sling launchpad instance boils down to the
launch.txt file.

Using a text file to define bundles makes it easy for people to
exchange configurations, as the text file fully defines the
application assembly, based on the bundles URLs and digests.

WDYT?

-Bertrand

Reply via email to