felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paulo Renato de Athaydes <renatoathay...@hotmail.com>
Subject RE: [iPOJO] Modifying a metadata.xml property directly in the JAR
Date Wed, 20 Aug 2014 08:39:26 GMT
Guys, this is beyond awesome.
I've been using Guice and Spring DM at work and I just can't believe how superior IPojo is!
And people are sucking for Guice for some reason.
Keep up the good work on IPojo! By the way, has anyone been able to  test the Gradle plugin
I've created for IPojo? I've tested it myself with a few test projects and it seems to work
great, but it would be great to know if there's anything missing from it (or something broken).
It's on JCenter if anyone wants to try it (work on version 1.1 is about to start)... Documentation
on GitHub: https://github.com/renatoathaydes/osgi-run/tree/master/ipojo-plugin
Renato

> Date: Wed, 20 Aug 2014 10:27:06 +0200
> From: remi.druilhe@cea.fr
> To: users@felix.apache.org
> Subject: Re: [iPOJO] Modifying a metadata.xml property directly in the JAR
> 
> Thanks for the answers.
> 
> After you told me how to solve my problem, I found an old article of you describing how
to use the configuration admin service with cfg files :
> http://ipojo-dark-side.blogspot.fr/2009/04/ipojo-and-file-install-configuring.html
> 
> So I installed config-admin and file-install bundles (felix bundles) but it did not work
at first. In fact, I had to rename my component from tcp-handler to tcphandler (with no -
in the name) and create the cfg file as you said.
> 
> Now everything work :-)
> 
> Regards.
> 
> Le 19/08/2014 15:49, Clement Escoffier a écrit :
> > Hi,
> >
> > Yes, changing the metadata.xml file won’t work as it is not read at runtime. What
you can do is to externalized the instance declaration in a ‘cfg’ file (if your runtime
support this format). cfg files are generally use to push configurations to the configuration
admin.
> >
> > In your case it would be something like : tcp-handler-instance.cfg, with the following
content:
> > serverIP=……
> > serverPort=8080
> >
> > Changing the cfg file reconfigure the instance.
> >
> > Regards,
> >
> > Clement
> >
> > On 19 août 2014 at 14:53:32, Paulo Renato de Athaydes (renatoathaydes@hotmail.com)
wrote:
> >
> > I believe the metadata.xml file is not actually used after you compile... have a
look at the jar's manifest instead, IPojo saves all the information it needs in the manifest
after compilation, so if you change it there it should work.
> > However, it seems to me you need to find a better way to configure this kind of
thing... Maybe others can help here?
> > Renato
> >
> >> Date: Tue, 19 Aug 2014 10:15:47 +0200
> >> From:remi.druilhe@cea.fr   
> >> To:users@felix.apache.org   
> >> Subject: [iPOJO] Modifying a metadata.xml property directly in the JAR
> >>   
> >> Hello,
> >>   
> >> I just created a TCP client to communicate with a server using iPOJO.
> >> For now, I used the property fields into the component "instance" to
> >> configure the IP address of my server. Something like that :
> >>   
> >> <instance component="tcp-handler">
> >> <property name="serverIp" value="xxx.xxx.xxx.xxx"/>
> >> <property name="serverPort" value="yyyy"/>
> >> </instance>
> >>   
> >> My purpose is to easily modify this configuration when I move my server
> >> on another device without asking the user to set the IP address
> >> everytime the client is started. And i'd like not to use a config file
> >> because I assume that the metadata.xml is already some kind of a config
> >> file.
> >>   
> >> So, I though that using "instance" enables me to modify the metadata.xml
> >> file into the JAR file and update this JAR with the new value. In fact,
> >> Ubuntu asks if I want to update the archive after modifying a file and I
> >> say yes. I can see the change when I reopen the archive.
> >>   
> >> However, it seems that when my client is launched in Felix, it always
> >> uses the old IP address despite changes I made in the JAR file.
> >>   
> >> What's wrong with my way of configuring my component ? Is it possible to
> >> modify a file into a JAR file ? Is the value of my property is
> >> definitively set into the component "instance" in the metadata.xml (like
> >> a static field) ?
> >>   
> >> Thanks,
> >>   
> >> Regards.
> >>   
> >> --
> >> Rémi Druilhe
> >>   
> 
> -- 
> Rémi Druilhe
> Ingénieur de recherche
> DACLE/LIALP
> Institut Carnot
> Laboratoire d’électronique et de technologie de l’information
> Commissariat à l’énergie atomique et aux énergies alternatives
> MINATEC Campus | 17 rue des Martyrs | 38054 Grenoble Cedex 9
> T. +33 (0)4 38 78 06 45 | F. +33 (0)4 38 78 90 73
> www.leti.fr
> 
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message