You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Carlos Quiroz <cq...@gemini.edu> on 2011/02/18 14:29:02 UTC
iPojo and FileInstall component configuration
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: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Automating Creating a factory configuration
Posted by Justin Edelson <ju...@justinedelson.com>.
Shay-
maven-sling-plugin does something along these lines. Look at the
configure() and addConfiguration() methods in
http://svn.apache.org/repos/asf/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
Justin
On Sat, Feb 19, 2011 at 11:50 AM, Shay Thompson <st...@adobe.com> wrote:
>
> One of the steps in setting up our product is to Create a new factory configuration by going to the Configuration tab in the Felix Web Console, clicking the 'Create new factory configuration' button and clicking Save to create a new configuration with the default values. I was wondering if anyone knew of a way to automate this process using an api, maven, curl, whatever?
>
> Thanks,
> Shay
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Automating Creating a factory configuration
Posted by Shay Thompson <st...@adobe.com>.
One of the steps in setting up our product is to Create a new factory configuration by going to the Configuration tab in the Felix Web Console, clicking the 'Create new factory configuration' button and clicking Save to create a new configuration with the default values. I was wondering if anyone knew of a way to automate this process using an api, maven, curl, whatever?
Thanks,
Shay
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: iPojo and FileInstall component configuration
Posted by Clement Escoffier <cl...@gmail.com>.
Hi,
On 18.02.11 22:03, "Carlos Quiroz" <cq...@gemini.edu> 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" <cq...@gemini.edu> 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" <cq...@gemini.edu> 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: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: iPojo and FileInstall component configuration
Posted by Carlos Quiroz <cq...@gemini.edu>.
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
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" <cq...@gemini.edu> 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" <cq...@gemini.edu> 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: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: iPojo and FileInstall component configuration
Posted by Clement Escoffier <cl...@gmail.com>.
On 18.02.11 19:48, "Carlos Quiroz" <cq...@gemini.edu> 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" <cq...@gemini.edu> 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: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: iPojo and FileInstall component configuration
Posted by Carlos Quiroz <cq...@gemini.edu>.
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 {
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" <cq...@gemini.edu> 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: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: iPojo and FileInstall component configuration
Posted by Clement Escoffier <cl...@gmail.com>.
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" <cq...@gemini.edu> 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: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org