You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by chutch <g....@gmail.com> on 2014/08/05 11:58:31 UTC
How to create configuration for Managed Service Factory with Karaf
features?
I'm trying to create a simple configuration for Amdatu's MongoDB
<http://www.amdatu.org/components/mongodb.html> component. When I create a
file named *org.amdatu.mongo-kairos.cfg* with following line inside
*dbName=kairos* and put it into the deploy folder - everything works OK.
However, when I'm trying to use config tag in features.xml nothing happens.
Part of my feature file, which uses configuration tag:
<http://karaf.apache.org/manual/latest-2.3.x/users-guide/provisioning.html#Configurations>
<feature name="persistency" version="0.0.1-SNAPSHOT" description="MongoDB
Persistency">
//(...)
<config name="org.amdatu.mongo-kairos">
dbName=kairos
</config>
</feature>
The above is a copy/paste from my stackoverflow question, I didn't know
about the list. So if someone is interested in getting points, please go
ahead. :-)
--
View this message in context: http://karaf.922171.n3.nabble.com/How-to-create-configuration-for-Managed-Service-Factory-with-Karaf-features-tp4034592.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: How to create configuration for Managed Service Factory with
Karaf features?
Posted by chutch <g....@gmail.com>.
Thanks for the answer! I'm using Karaf 3.0.1
I do have some thoughts after switching to config files. I've created config
folder next to the pom.xml and added following part into the build section:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>persistency-config</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>${project.groupId}</groupId>
<artifactId>persistency-config</artifactId>
<version>${project.version}</version>
<packaging>cfg</packaging>
<file>config/org.amdatu.mongo-kairos.cfg</file>
</configuration>
</execution>
</executions>
</plugin>
And following entry in my features.xml
<configfile finalname="/etc/org.amdatu.mongo-kairos.cfg">
mvn:groupId/persistency-config/version/cfg
</configfile>
I think that this is great, because it allows to keep several configurations
for different environments. (staging/prod) And, moreover - it keeps
different versions of configs along with versions of your app is it
develops!
This also made me to version the feature.xml as a separate maven project.
(with the usage of the very same maven plugin)
--
View this message in context: http://karaf.922171.n3.nabble.com/How-to-create-configuration-for-Managed-Service-Factory-with-Karaf-features-tp4034592p4034606.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: How to create configuration for Managed Service Factory with
Karaf features?
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,
It's an issue already identify (and fixed).
What's the Karaf version ?
Anyway, as a workaround, you can use <configfile/> instead of <config/>.
Regards
JB
On 08/05/2014 11:58 AM, chutch wrote:
> I'm trying to create a simple configuration for Amdatu's MongoDB
> <http://www.amdatu.org/components/mongodb.html> component. When I create a
> file named *org.amdatu.mongo-kairos.cfg* with following line inside
> *dbName=kairos* and put it into the deploy folder - everything works OK.
> However, when I'm trying to use config tag in features.xml nothing happens.
>
> Part of my feature file, which uses configuration tag:
> <http://karaf.apache.org/manual/latest-2.3.x/users-guide/provisioning.html#Configurations>
>
> <feature name="persistency" version="0.0.1-SNAPSHOT" description="MongoDB
> Persistency">
> //(...)
> <config name="org.amdatu.mongo-kairos">
> dbName=kairos
> </config>
> </feature>
>
> The above is a copy/paste from my stackoverflow question, I didn't know
> about the list. So if someone is interested in getting points, please go
> ahead. :-)
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/How-to-create-configuration-for-Managed-Service-Factory-with-Karaf-features-tp4034592.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com