I have bundle A which is started on osgi framework. How can I add/create resources (for example images or xml files) in this bundle at runtime - I mean bundle is installed and active? Is this possible? If yes, then how? I use apache felix.
Asked
Active
Viewed 266 times
0
-
Without reinstalling the bundle with the new content, I do not think it is possible. – Balazs Zsoldos Jul 20 '16 at 18:06
-
@Balazs Zsoldos Do you mean the first step is to modify original bundle.jar and after that reinstall the bundle - to update in osgi cache? – Pavel_K Jul 20 '16 at 18:09
-
Yes, I was thinking about that. Are you sure you can only use these XML files as classpath resources? Can't you use them from a temp folder or another store? It would be useful to know more about your use-case? – Balazs Zsoldos Jul 20 '16 at 18:20
-
1There's probably a better way to achieve what you want to do. How are the resources being loaded? Please give some background of the high-level goals. – Neil Bartlett Jul 20 '16 at 23:57
-
@Balazs Zsoldos Of course there is always possibility to store these resources in another place, not in bundle. But I am looking for solution how to create them in bundle at runtime. – Pavel_K Jul 21 '16 at 04:18
-
1This is impossible because a bundle is 'logically' read only in an OSGi environment, you cannot change its content. This was explicitly done so multiple frameworks could share the same JAR. It also sounds as a bizarre thing to do, could you elaborate, as Neil asked, what you need this function for? – Peter Kriens Jul 21 '16 at 07:50
-
you may use "Apache Felix Shell" to build an interactive bundle to consume dynamic files at run time. here with examples http://felix.apache.org/documentation/subprojects/apache-felix-shell.html – Hisham Khalil Jul 22 '16 at 10:41
-
@Hishamkh I think you have misunderstood the question. – Neil Bartlett Jul 22 '16 at 20:39