karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lindsay Smith <lin...@coretech.co.nz>
Subject Starting embedded Karaf from Java - reliance on System properties
Date Mon, 12 Sep 2011 02:38:17 GMT
I'm investigating launching Karaf from within Java and I have some questions about setting
Karaf's configuration properties.

I think Karaf shows a whole lot of promise as the foundation for OSGi products, I'd love to
be able to use it and I'm looking forward to the 3.0 release as it appears to have a bunch
of stuff I think makes it very useful.  The embedded scenario is very important to me as well,
hence the questions.   We currently use Equinox directly with their servlet bridge.

When using the startup script, a bunch of system properties are set when launching the Java
process.     When launching Karaf from Java, the only example I've seen is the web container
example that I think is in the source.  It sets a bunch of system properties via Java before
calling the launcher class.

Is Karaf dependent on system properties to configure itself?  Is there any other way to give
Karaf the config information it needs?

I see that there is a system.properties file in the /etc folder - does Karaf simply use this
file - after modifying the values from matching system properties that are present?

While system properties are fine when you have are launching the Java process yourself, it's
not appropriate to set them or read them in an embedded situation, as you don't always have
control over how that process was launched, or what other classes are reading or setting system
properties within the same process.    In an embedded situation if you set system properties
in code then you've limited yourself to a single Karaf instance being launched from that process.

As an ideal solution, lauching Karaf from Java would pass in a map of configuration values.
 We could then write wrappers that, for example, pull configuration values from the servlet
context, or from an external properties file that contains the initial values.

Thanks for any feedback


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message