-
1. Re: Creating/Installing Custom Feature with config properties
ffang Jan 24, 2013 9:03 PM (in response to constv)Hi,
Yeah, you can specify configuration with your feature descriptor, here is an example
<feature name="http" description="Implementation of the OSGi HTTP service" version="2.3.0" resolver="(obr)"> <config name="org.ops4j.pax.web"> org.osgi.service.http.port=8181 javax.servlet.context.tempdir=... org.ops4j.pax.web.config.file=... </config> <feature version="[7.0,8.0)">jetty</feature> <bundle start-level="30">mvn:org.ops4j.pax.web/pax-web-api/1.1.3</bundle> <bundle start-level="30">mvn:org.ops4j.pax.web/pax-web-spi/1.1.3</bundle> <bundle start-level="30">mvn:org.ops4j.pax.web/pax-web-runtime/1.1.3</bundle> <bundle start-level="30">mvn:org.ops4j.pax.web/pax-web-jetty/1.1.3</bundle> </feature>
Freeman
-
2. Re: Creating/Installing Custom Feature with config properties
constv Jan 25, 2013 8:39 AM (in response to ffang)Freeman, thank you. This example shows how to specify actual properties and have them placed in a .cfg file. That's great. The legacy application I have ported to OSGi uses a number of other .properties and XML files that should remain externalized. All those files are distributed in a single /conf folder, and I need that folder to be deployed, for example, as a subdirectory under <karaf-home>/etc (or anywhere else.) I understand that the only way to do that would be by dropping that subdirectory manually to the desired location. Correct?
-
3. Re: Creating/Installing Custom Feature with config properties
ffang Jan 27, 2013 8:10 PM (in response to constv)Hi,
You can do something like
<feature name="..." description="..." version="..." resolver="(obr)"> <configfile finalname="/etc/whatever">mvn:your_configuration_file</configfile> ... </feature>
Freeman
-
4. Re: Creating/Installing Custom Feature with config properties
constv Jan 28, 2013 9:57 AM (in response to ffang)Thank you!
-
5. Re: Creating/Installing Custom Feature with config properties
constv Feb 15, 2013 3:54 PM (in response to ffang)Hi Freeman,
I have realized that installing this "config" feature does not replace the .cfg file if the file already exists in the /etc directory. If I remove the file first and then install the feature, the file is picked up in the Maven repository and installed. Otherwise the old/outdated file remains intact. Is there a way to enforce Karaf to replace the file each time "feature:install" is executed for the "configfile" feature?
Thanks,
Constantine
-
6. Re: Creating/Installing Custom Feature with config properties
constv Feb 15, 2013 3:55 PM (in response to constv)Added a follow-up question, see above...
-
7. Re: Creating/Installing Custom Feature with config properties
ffang Feb 18, 2013 2:28 AM (in response to constv)Hi,
Yes, you can add
override="true" attribute
for configfile tag
Freeman
-
8. Re: Creating/Installing Custom Feature with config properties
constv Feb 19, 2013 11:11 AM (in response to ffang)Thank you! Is there a complete reference guide available somewhere where things like that are documented?
The most painful thing about OSGi and Karaf to me has been the lack of consistent and consolidated documentation. Some topics are well documented, but many useful details are either missing or very hard to find.
-
9. Re: Creating/Installing Custom Feature with config properties
davsclaus Feb 21, 2013 8:47 AM (in response to constv)Yes I agree. Both the Karaf and Aries team should focus IMHO on improving and documenting. And have some more examples, FAQ, etc.
And do not tell users to read the entire OSGi spec as thats massive.
There is also this new OSGi book but albeit a bit short on 60+ pages
http://www.packtpub.com/open-services-gateway-initiative-starter/book
And Fuse ESB Enterprise has some OSGi docs at
http://fusesource.com/products/fuse-esb-enterprise/#documentation