You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by manisv <s....@gmail.com> on 2016/09/01 09:44:08 UTC

Managed Service Factory Configuration file deployment

Hi,
I would like to know how to deploy configuration (.cfg) files for a
managedservicefactory into /etc folder of Karaf instance automatically. My
understanding is every config file has to be under etc. 

Below are the steps I've done so far.
1. Have created a managedservicefactory class A  having properties p1, p2 in
a bundle B1.
2. Have created another bundle B2 & created a .cfg file under config folder
(config/<PID>-<InstanceId>.cfg). 
3. Have created a feature xml with below definition in bundle B2
<feature name="feature1"><configfile
finalname=&quot;/etc/&lt;PID>-<InstanceId>.cfg>
    mvn:<groupId>/<artifactId>/<version>/cfg
</configfile></feature>
4. Have added below maven install plugin in pom.xml in bundle B2.
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-install-plugin</artifactId>
				<executions>
					<execution>
						<id>magizhchi-arch-configuration</id>
						<phase>install</phase>
						<goals>
							<goal>install-file</goal>
						</goals>
						<configuration>
							<groupId>${project.groupId}</groupId>
							<artifactId>${project.artifactId}</artifactId>
							<version>${project.version}</version>
							<packaging>cfg</packaging>
			<file>config/<PID>-<InstanceId>.cfg</file>
						</configuration>
					</execution>
				</executions>
			</plugin>
Having above implementaitons, the cfg file is not deployed into etc folder &
hence, I don't see any configuration against those managedservicefactory in
OSGi console. Am stuck here. Is there anything I've missed or is there any
other alternate way for my requirement of deploying cfg files into Karaf
instance?

Thanks
Mani



--
View this message in context: http://karaf.922171.n3.nabble.com/Managed-Service-Factory-Configuration-file-deployment-tp4047806.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Managed Service Factory Configuration file deployment

Posted by manisv <s....@gmail.com>.
Thanks JB. It works fine now, Config files are now getting deployed
automatically into etc folder after feature deployment. I made changes as
done in the below artifact.
Regards,
Mani



--
View this message in context: http://karaf.922171.n3.nabble.com/Managed-Service-Factory-Configuration-file-deployment-tp4047806p4047810.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Managed Service Factory Configuration file deployment

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

do you see the *-*.cfg file in the etc folder after feature deployement ?

It works this way in decanter. For instance the JMX collector uses a 
ManagedServiceFactory. The cfg files are provided via a feature (or by 
hand):

<configfile 
finalname="/etc/org.apache.karaf.decanter.collector.jmx-local.cfg">mvn:org.apache.karaf.decanter.collector/org.apache.karaf.decanter.collector.jmx/1.2.0/cfg/local</configfile>

Regards
JB

On 09/01/2016 11:44 AM, manisv wrote:
> Hi,
> I would like to know how to deploy configuration (.cfg) files for a
> managedservicefactory into /etc folder of Karaf instance automatically. My
> understanding is every config file has to be under etc.
>
> Below are the steps I've done so far.
> 1. Have created a managedservicefactory class A  having properties p1, p2 in
> a bundle B1.
> 2. Have created another bundle B2 & created a .cfg file under config folder
> (config/<PID>-<InstanceId>.cfg).
> 3. Have created a feature xml with below definition in bundle B2
> <feature name="feature1"><configfile
> finalname=&quot;/etc/&lt;PID>-<InstanceId>.cfg>
>     mvn:<groupId>/<artifactId>/<version>/cfg
> </configfile></feature>
> 4. Have added below maven install plugin in pom.xml in bundle B2.
> <plugin>
> 				<groupId>org.apache.maven.plugins</groupId>
> 				<artifactId>maven-install-plugin</artifactId>
> 				<executions>
> 					<execution>
> 						<id>magizhchi-arch-configuration</id>
> 						<phase>install</phase>
> 						<goals>
> 							<goal>install-file</goal>
> 						</goals>
> 						<configuration>
> 							<groupId>${project.groupId}</groupId>
> 							<artifactId>${project.artifactId}</artifactId>
> 							<version>${project.version}</version>
> 							<packaging>cfg</packaging>
> 			<file>config/<PID>-<InstanceId>.cfg</file>
> 						</configuration>
> 					</execution>
> 				</executions>
> 			</plugin>
> Having above implementaitons, the cfg file is not deployed into etc folder &
> hence, I don't see any configuration against those managedservicefactory in
> OSGi console. Am stuck here. Is there anything I've missed or is there any
> other alternate way for my requirement of deploying cfg files into Karaf
> instance?
>
> Thanks
> Mani
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Managed-Service-Factory-Configuration-file-deployment-tp4047806.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