javadictionaryconfigurationcomponentsipojo

How to get an iPOJO component instance configuration?


I have an iPOJO Component Instance that I create like this:

  Dictionary dic = new Hashtable();
  dic.put("target-name", finalHelloInstanceName);
  ComponentInstance x= factory.createComponentInstance(dic);

Inside my component that I am instantiating above, how can I get the Dictionary "dic" values?

Could it be something like?

@Validate
    public void start() throws Exception {

        Dictionary dic= ?????

}

or is it:

@Updated
public void updated(Dictionary conf) {

    dic= conf;


}

Solution

  • I did some experiments, and I found that, when I add the following method to my bundle:

    @Updated
    public void updated(Dictionary conf) {
    
        dic= conf;
    
    
    }
    

    this method will be invoked automatically once the component is instantiated, receiving my instance configuration. I also noticed that this method is invoked before the start() method of the bundle. Nice stuff!