0

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

Community
  • 1
  • 1
lsc
  • 681
  • 3
  • 8
  • 26
  • 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 Jun 06 '16 at 18:38
  • 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 Jun 07 '16 at 21:45

2 Answers2

0

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.

Alexandre Cartapanis
  • 1,513
  • 3
  • 15
  • 19
0

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.

Community
  • 1
  • 1
vorburger
  • 3,439
  • 32
  • 38