felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <XavierMillie...@Eaton.com>
Subject RE: Ipojo property
Date Tue, 16 Jul 2013 07:19:39 GMT
Hi,

I have a short question, about this feature, why the method: public void updated(Dictionary
conf) is called twice, when the bundle starts ??

Best regards



-----------------------------

-----------------------------

-----Message d'origine-----
De : guillaume.ow2@gmail.com [mailto:guillaume.ow2@gmail.com] De la part de Guillaume Sauthier
(OW2)
Envoyé : lundi 15 juillet 2013 13:44
À : users@felix.apache.org
Objet : Re: Ipojo property

This is not a simple property file, it's a file for configAdmin service.
ConfigAdmin takes properties as input and try to apply them on a factory or an instance of
component.
So, you have to tell config admin which component you're targetting with your configuration
file.

Using fileinstall (the thing that read your .cfg file), the target ID is specified reading
the file name:
http://felix.apache.org/site/apache-felix-file-install.html#ApacheFelixFileInstall-Configurations

So, your file is named mypackage.MyComponent.cfg As per the doc, it targets a component instance
named 'myPackage.MyComponent'.
But you don't provide any name to your instance.

To sum up:
1. Rename your file to 'MyComponent-default.cfg' (since 'MyComponent' is the @Component.name
you set) 2. Remove the @Instantiate (ConfigAdmin WILL instantiate a new component instance
for you)

--Guillaume


2013/7/15 <XavierMillieret@eaton.com>

> Hi All,
>
> I would like to know, if it's possible with IPOJO to retrieve any 
> property from a property file, because after reading any documentation 
> about this, normally, yes, but this code does not work !! some help  please ?
>
> package mypackage
>
> @Component(name = "MyComponent ", immediate = true, propagation = 
> true) @Instantiate @Provides public class MyComponent {
>
>     private static Logger logger =
> LoggerFactory.getLogger(MessageBusTransport.class);
>     @Property(name = "myProperty")
>     public void myProperty (String myProperty) {
>         this. myProperty = myProperty;
>     }
>
>     /**
>      * Try to connect with a AMQP MOM.
>      *
>      * @throws MessageBusException
>      */
>     @Validate
>     public void starting(){
>         logger.debug(MessageBusTransport.class.getSimpleName() + " :
> starting...");
>
>         System.out.println(myProperty); }
>
> .....
>
> With Karaf I put my property file under /etc, and the name, is:
> mypackage.MyComponent.cfg
>
> In the file
> myProperty=myValue
>
>
> So ???????
>
> Thanks you for help
>
>
>
> ________________________________
>
> ________________________________
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message