Hi,

Juan José Vázquez Delgado schrieb:
> Thanks.
> 
> 
>> Basically, you access the properties from the ComponentContext you get
>> in the activate method by calling the ComponentContext.getProperties()
>> method. This returns you all the properties, which you have set
>> "programmatically", i.e. the default values, as well as the configured
>> values, where the configured values overwrite the default
>> (programmatically set values).
>>
> 
> I know, but what happens for instance if you want the property being
> initialized from the result of a method accesing to bundle context?. Is that
> possible?.

You can do that in the activator method since the BundleContext is also
available from the ComponentContext:


    protected void activate(ComponentContext context) {
        BundleContext ctx = context.getBundleContext();
        Object prop = getFromBundleContext(ctx);
        if (prop == null) {
           prop = getFromConfiguration(context.getProperties());
        }
    }

But you have to do that yourself.

Regards
Felix

Reply via email to