felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Stoecker <jstoecker...@gmail.com>
Subject Closing felix when bundle/service is finished
Date Tue, 21 Jun 2011 22:31:19 GMT

I have a "statistics" bundle that provides the service of reading a
file, doing some calculations, and writing a new file. Ideally, I
would like to write a small command-line program inside an executable
JAR (not a bundle) that would be used as follows:

java -jar analyzer.jar file1 file2 file3 ...

The host program in analyzer.jar would then launch an embedded
framework, auto-deploy the statistics bundle, and use the service
interface of that bundle. I read on the felix website that there are
two options for this type of situation: having the service interfaces
inside the host program (not something I want to do, as these bundles
should not depend on this host program) or to use reflection. I am not
sure how to use reflection for this purpose.

As an alternative, I figured I could write a second bundle that reads
a series of files from a fixed location and uses the statistics
bundle, as both would be inside the OSGi container. I can put these
bundles into the bundle directory of the stand-alone felix framework
and this works; however, I don't want felix to keep running after all
the files are processed.

What is the cleanest and easiest way to accomplish the task of
providing input (file names) to a service and having it shutdown when


To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org

View raw message