You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Norbert Somlai <ns...@gmail.com> on 2010/06/02 13:58:06 UTC
Is configuring service properties the Spring DM way possible with
Declarative Services
Hi,
I know how to use FileInstall or the Web Console to reconfigure a component.
What I could not find is a way to declaratively configure a component
instance in component.xml, so I could keep the reference and the
configuration at the same place. Something like
<reference interface="com.acme.IInterface" bind="setInterface"
unbind="unsetInterface" policy="dynamic" cardinality="1..1" >
<property name="param1" value="value1"/>
...
</reference>
and the ComponentContext on activation would contain this property so the
new instance could initialize itself with it.
Is there a way to achieve something like this with DS or DS+CM?
Thanks, Norbert
--
View this message in context: http://old.nabble.com/Is-configuring-service-properties-the-Spring-DM-way-possible-with-Declarative-Services-tp28753396p28753396.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Is configuring service properties the Spring DM way possible
with Declarative Services
Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 6/2/10 9:55, Norbert Somlai wrote:
> I would like to configure a component instance from the _referring_
> component, not just provide default properties for a component. Where can I
> specify the properties in the referrers component.xml? The DTD does not seem
> to allow a<property> element in a<reference> element.
>
Ah, sorry, I understand now. Yeah, I don't think that is possibly. The
basis is there with component factories, but I think this would require
a spec change or be an impl-specific feature.
-> richard
> Norbert
>
>
> Richard S. Hall wrote:
>
>> On 6/2/10 7:58, Norbert Somlai wrote:
>>
>>> Hi,
>>>
>>> I know how to use FileInstall or the Web Console to reconfigure a
>>> component.
>>> What I could not find is a way to declaratively configure a component
>>> instance in component.xml, so I could keep the reference and the
>>> configuration at the same place. Something like
>>>
>>> <reference interface="com.acme.IInterface" bind="setInterface"
>>> unbind="unsetInterface" policy="dynamic" cardinality="1..1">
>>>
>>> <property name="param1" value="value1"/>
>>> ...
>>> </reference>
>>>
>>> and the ComponentContext on activation would contain this property so the
>>> new instance could initialize itself with it.
>>>
>>> Is there a way to achieve something like this with DS or DS+CM?
>>>
>>>
>> I thought that _was_ the point of the<property> tag in DS...
>>
>> -> richard
>>
>>
>>> Thanks, Norbert
>>>
>>>
>> ---------------------------------------------------------------------
>> 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: Is configuring service properties the Spring DM way possible
with Declarative Services
Posted by Norbert Somlai <ns...@gmail.com>.
I would like to configure a component instance from the _referring_
component, not just provide default properties for a component. Where can I
specify the properties in the referrers component.xml? The DTD does not seem
to allow a <property> element in a <reference> element.
Norbert
Richard S. Hall wrote:
>
> On 6/2/10 7:58, Norbert Somlai wrote:
>> Hi,
>>
>> I know how to use FileInstall or the Web Console to reconfigure a
>> component.
>> What I could not find is a way to declaratively configure a component
>> instance in component.xml, so I could keep the reference and the
>> configuration at the same place. Something like
>>
>> <reference interface="com.acme.IInterface" bind="setInterface"
>> unbind="unsetInterface" policy="dynamic" cardinality="1..1">
>>
>> <property name="param1" value="value1"/>
>> ...
>> </reference>
>>
>> and the ComponentContext on activation would contain this property so the
>> new instance could initialize itself with it.
>>
>> Is there a way to achieve something like this with DS or DS+CM?
>>
>
> I thought that _was_ the point of the <property> tag in DS...
>
> -> richard
>
>> Thanks, Norbert
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
>
--
View this message in context: http://old.nabble.com/Is-configuring-service-properties-the-Spring-DM-way-possible-with-Declarative-Services-tp28753396p28754873.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Is configuring service properties the Spring DM way possible
with Declarative Services
Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 6/2/10 7:58, Norbert Somlai wrote:
> Hi,
>
> I know how to use FileInstall or the Web Console to reconfigure a component.
> What I could not find is a way to declaratively configure a component
> instance in component.xml, so I could keep the reference and the
> configuration at the same place. Something like
>
> <reference interface="com.acme.IInterface" bind="setInterface"
> unbind="unsetInterface" policy="dynamic" cardinality="1..1">
>
> <property name="param1" value="value1"/>
> ...
> </reference>
>
> and the ComponentContext on activation would contain this property so the
> new instance could initialize itself with it.
>
> Is there a way to achieve something like this with DS or DS+CM?
>
I thought that _was_ the point of the <property> tag in DS...
-> richard
> Thanks, Norbert
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Is configuring service properties the Spring DM way possible
with Declarative Services
Posted by Norbert Somlai <ns...@gmail.com>.
That's correct. I would like to implement a generic service, for example a
database connection handler and instantiate preconfigured instances of it
without programming. Using my previous pseudocode example:
component.xml of bundle 1:
<reference interface="com.acme.IDatabase" bind="setDB" unbind="unsetDB"
policy="dynamic" cardinality="1..1" >
<property name="databaseurl" value="jdbc:mysql://database1..."/>
</reference>
component.xml of bundle 2:
<reference interface="com.acme.IDatabase" bind="setDB" unbind="unsetDB"
policy="dynamic" cardinality="1..1" >
<property name="databaseurl" value="jdbc:mssql://database2..."/>
</reference>
But now I understand from Richard's response that this is not possible.
Richard S. Hall wrote:
>
>
> On 6/2/10 12:22, Felix Meschberger wrote:
>> Hi,
>>
>> On 02.06.2010 13:58, Norbert Somlai wrote:
>>
>>> Hi,
>>>
>>> I know how to use FileInstall or the Web Console to reconfigure a
>>> component.
>>> What I could not find is a way to declaratively configure a component
>>> instance in component.xml, so I could keep the reference and the
>>> configuration at the same place. Something like
>>>
>>> <reference interface="com.acme.IInterface" bind="setInterface"
>>> unbind="unsetInterface" policy="dynamic" cardinality="1..1">
>>>
>>> <property name="param1" value="value1"/>
>>> ...
>>> </reference>
>>>
>>> and the ComponentContext on activation would contain this property so
>>> the
>>> new instance could initialize itself with it.
>>>
>>> Is there a way to achieve something like this with DS or DS+CM?
>>>
>> I think there is a misconception here:
>>
>> The reference element is used to declare that the component uses a
>> service from the service registry. The attributes define further
>> requirements, e.g. the target property can be used to select the actual
>> services.
>>
>> The property element is used to configure the component itself.
>>
>> The configuration of the referenced service, which I assume is what you
>> are referring to, is not the task of the component. That service must
>> care for its configuration itself.
>>
>
> I understood it that he wanted to be injected with configured instances,
> like if you used the specified properties to create a configured
> instance from a component factory and then injected his component with
> those specifically configured instances.
>
> -> richard
>
>> Regards
>> Felix
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
--
View this message in context: http://old.nabble.com/Is-configuring-service-properties-the-Spring-DM-way-possible-with-Declarative-Services-tp28753396p28757815.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Is configuring service properties the Spring DM way possible
with Declarative Services
Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 6/2/10 12:22, Felix Meschberger wrote:
> Hi,
>
> On 02.06.2010 13:58, Norbert Somlai wrote:
>
>> Hi,
>>
>> I know how to use FileInstall or the Web Console to reconfigure a component.
>> What I could not find is a way to declaratively configure a component
>> instance in component.xml, so I could keep the reference and the
>> configuration at the same place. Something like
>>
>> <reference interface="com.acme.IInterface" bind="setInterface"
>> unbind="unsetInterface" policy="dynamic" cardinality="1..1">
>>
>> <property name="param1" value="value1"/>
>> ...
>> </reference>
>>
>> and the ComponentContext on activation would contain this property so the
>> new instance could initialize itself with it.
>>
>> Is there a way to achieve something like this with DS or DS+CM?
>>
> I think there is a misconception here:
>
> The reference element is used to declare that the component uses a
> service from the service registry. The attributes define further
> requirements, e.g. the target property can be used to select the actual
> services.
>
> The property element is used to configure the component itself.
>
> The configuration of the referenced service, which I assume is what you
> are referring to, is not the task of the component. That service must
> care for its configuration itself.
>
I understood it that he wanted to be injected with configured instances,
like if you used the specified properties to create a configured
instance from a component factory and then injected his component with
those specifically configured instances.
-> richard
> Regards
> Felix
>
> ---------------------------------------------------------------------
> 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: Is configuring service properties the Spring DM way possible
with Declarative Services
Posted by Justin Edelson <ju...@gmail.com>.
On 6/2/10 12:22 PM, Felix Meschberger wrote:
> Hi,
>
> On 02.06.2010 13:58, Norbert Somlai wrote:
>>
>> Hi,
>>
>> I know how to use FileInstall or the Web Console to reconfigure a component.
>> What I could not find is a way to declaratively configure a component
>> instance in component.xml, so I could keep the reference and the
>> configuration at the same place. Something like
>>
>> <reference interface="com.acme.IInterface" bind="setInterface"
>> unbind="unsetInterface" policy="dynamic" cardinality="1..1" >
>>
>> <property name="param1" value="value1"/>
>> ...
>> </reference>
>>
>> and the ComponentContext on activation would contain this property so the
>> new instance could initialize itself with it.
>>
>> Is there a way to achieve something like this with DS or DS+CM?
>
> I think there is a misconception here:
>
> The reference element is used to declare that the component uses a
> service from the service registry. The attributes define further
> requirements, e.g. the target property can be used to select the actual
> services.
>
> The property element is used to configure the component itself.
>
> The configuration of the referenced service, which I assume is what you
> are referring to, is not the task of the component. That service must
> care for its configuration itself.
...and this is exactly the same as Spring DM.
>
> Regards
> Felix
>
> ---------------------------------------------------------------------
> 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: Is configuring service properties the Spring DM way possible
with Declarative Services
Posted by Felix Meschberger <fm...@gmail.com>.
Hi,
On 02.06.2010 13:58, Norbert Somlai wrote:
>
> Hi,
>
> I know how to use FileInstall or the Web Console to reconfigure a component.
> What I could not find is a way to declaratively configure a component
> instance in component.xml, so I could keep the reference and the
> configuration at the same place. Something like
>
> <reference interface="com.acme.IInterface" bind="setInterface"
> unbind="unsetInterface" policy="dynamic" cardinality="1..1" >
>
> <property name="param1" value="value1"/>
> ...
> </reference>
>
> and the ComponentContext on activation would contain this property so the
> new instance could initialize itself with it.
>
> Is there a way to achieve something like this with DS or DS+CM?
I think there is a misconception here:
The reference element is used to declare that the component uses a
service from the service registry. The attributes define further
requirements, e.g. the target property can be used to select the actual
services.
The property element is used to configure the component itself.
The configuration of the referenced service, which I assume is what you
are referring to, is not the task of the component. That service must
care for its configuration itself.
Regards
Felix
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Is configuring service properties the Spring DM way possible
with Declarative Services
Posted by Justin Edelson <ju...@gmail.com>.
On 6/2/10 7:58 AM, Norbert Somlai wrote:
>
> Hi,
>
> I know how to use FileInstall or the Web Console to reconfigure a component.
> What I could not find is a way to declaratively configure a component
> instance in component.xml, so I could keep the reference and the
> configuration at the same place. Something like
>
> <reference interface="com.acme.IInterface" bind="setInterface"
> unbind="unsetInterface" policy="dynamic" cardinality="1..1" >
>
> <property name="param1" value="value1"/>
> ...
> </reference>
>
> and the ComponentContext on activation would contain this property so the
> new instance could initialize itself with it.
>
> Is there a way to achieve something like this with DS or DS+CM?
>
> Thanks, Norbert
Did you mean to nest the <property> element within the <reference>
element like that? That's not valid. <property> elements need to go at
the same level as the <reference> element (i.e. directly within the
<component> element).
Justin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org