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 
([email protected]) 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: [email protected]  
> To: [email protected]  
> 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  
>  

Reply via email to