0
votes

I am using Apache Felix in embedded manner as explained in http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-launching-and-embedding.html

As per the discussion in Apache Felix File Install jar from deploy folder

1) Started felix

2) Installed/started felix.fileinstall bundle on it

3) Set the System proper to hotdiploy dir i.e

System.setProperty("felix.fileinstall.dir", "file:C:/myrproject/hotdeploy");

I can see bundles in the dir are registered. But is there away that I can get notification when this dir change (adding or deleting new bundles)? So in that case I can check for non started bundles and start them. That will help to work hot deployment feature realtime.

Thanks

2
Java 7 has API for watching directories, but you will have the problem that your code might be called before the code of fileinstall.Balazs Zsoldos
FileInstall already automatically starts the bundles it finds in the load directory -- assuming you have the felix.fileinstall.bundles.new.start property set to true (which is the default). So what is the problem you're solving exactly?Neil Bartlett

2 Answers

0
votes

You can install org.apache.felix.eventadmin bundle, and then watch event topic org/osgi/framework/BundleEvent/STARTED. Have a look at felix eventadmin.

Note that the felix web console is a good tool to watch events, at least for debugging purpose.

0
votes

Given that your question includes "a way that I can get notification when this dir change (adding or deleting new bundles", you're probably looking for the Apache Felix File Install bundle; see also this other question.