Hi,

On 18.02.11 22:03, "Carlos Quiroz" <[email protected]> wrote:

>Hi
>
>Thanks a lot for the explanation, it makes some sense now but still if I
>keep the code as:
>
>@Component
>public class ActiveMQBrokerComponent {
>
>and my config as 
>edu.gemini.jms.activemq.broker.ActiveMQBrokerComponent.cfg

For configuration targeting ManagedServiceFactory (so creating an
instance) the file name should be:
edu.gemini.jms.activemq.broker.ActiveMQBrokerComponent-instance_name.cfg

So the -instance_name is important as it's how file install detect what
kind of configuration it is.

Regards,

Clement

>
>the component is not created
>
>Carlos
>
>On Feb 18, 2011, at 4:25 PM, Clement Escoffier wrote:
>
>> 
>> 
>> On 18.02.11 19:48, "Carlos Quiroz" <[email protected]> wrote:
>> 
>>> Hi
>>> 
>>> Thanks for the answer, I tried option 1 and 3 and though it says that
>>>the
>>> configuration is picked up and a configuration update is scheduled my
>>> component is never created
>>> 
>>> However in a variation of option 3 if I keep the @Instantiate it works.
>>> 
>>> It seems fileinstall won't create a component by default?
>>> 
>>> My class looks like this now:
>>> @Component(managedservice = "ActiveMQBrokerComponent")
>>> @Instantiate
>>> public class ActiveMQBrokerComponent {
>> 
>> Yes, in the third approach the @Instantiate must still be here.
>> 
>> In fact File Install creates the instance only for ManagedServiceFactory
>> not for ManagedService. So, if a configuration is targeting a managed
>> service factory, it creates an instance (or reconfigure the instance
>> previously created from this configuration). If the configuration is
>> targeting a managed service, then an already existing instance has to
>> expose this managed service. If it's the case, this instance is
>> (re-)configured.
>> 
>> The managedservice exposes a ManagedService, so an instance must be
>> declared (either using @Instantiate, or XML, or any other ways creating
>> instances). In addition, by default, iPOJO exposes a
>>ManagedServiceFactory
>> for each (public) @Component allowing to create / dispose instances from
>> this @Component type.
>> 
>> Regards,
>> 
>> Clement
>> 
>> 
>>> 
>>> Carlos
>>> 
>>> On Feb 18, 2011, at 3:04 PM, Clement Escoffier wrote:
>>> 
>>>> Hi,
>>>> 
>>>> The 'managedservice' attribute cannot be the component class name as
>>>> it's
>>>> already used as a ManagedServiceFactory. So, you've several choice:
>>>> - remove the @Instantiate and the managed service attribute: iPOJO
>>>>will
>>>> registers the managed service factory and file install will push your
>>>> configuration (which creates an iPOJO instance)
>>>> - set publicFactory=false in the @Component : so the
>>>> ManagedServiceFactory
>>>> won't be published by iPOJO, and so only the ManagedService will be
>>>> published (using the
>>>> pid:edu.gemini.jms.activemq.broker.ActiveMQBrokerComponent)
>>>> - Change the managedservice attribute to be something different and
>>>> rename
>>>> your cfg file
>>>> 
>>>> Regards,
>>>> 
>>>> Clement
>>>> 
>>>> 
>>>> 
>>>> On 18.02.11 14:29, "Carlos Quiroz" <[email protected]> wrote:
>>>> 
>>>>> Hi
>>>>> 
>>>>> I'm trying to use file install to configure my iPojo components which
>>>>> are
>>>>> normally singletons but I'm stuck in that my objects get configured
>>>>> twice
>>>>> once by iPojo and once by fileinstall.
>>>>> My objects are annotated like this:
>>>>> 
>>>>> @Component(managedservice =
>>>>> "edu.gemini.jms.activemq.broker.ActiveMQBrokerComponent")
>>>>> @Instantiate
>>>>> public class ActiveMQBrokerComponent {
>>>>>  @Property(name = "brokerUrl", value = "INVALID", mandatory = true)
>>>>>  private String url;
>>>>> ...
>>>>> 
>>>>> And I have a configuration file called
>>>>> edu.gemini.jms.activemq.broker.ActiveMQBrokerComponent.cfg with the
>>>>> properties like brokerUrl
>>>>> 
>>>>> It seems first ipojo creates the object and updates them with the
>>>>> default
>>>>> config and then fileinstall does it again with the correct ones from
>>>>> the
>>>>> file.
>>>>> 
>>>>> What I'd like is that the object is created and updated only once
>>>>>when
>>>>> the configuration is available via fileinstall.
>>>>> 
>>>>> It seems I can do that with FileInstall if I remove the @Instantiate
>>>>> and
>>>>> use a configuration file like
>>>>> edu.gemini.jms.activemq.broker.ActiveMQBrokerComponent-<PID>.cfg
>>>>> 
>>>>> Is that the way this should be done, or is there a better way to
>>>>> achieve
>>>>> creating and configuring a single ipojo component
>>>>> 
>>>>> Regards
>>>>> Carlos
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to