You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Joel Schuster <jo...@Navsys.com> on 2009/08/26 22:32:25 UTC

ServiceProperty vs Property

Could someone please either explain or point me to documentation that explains the difference b/t a @ServiceProperty and a @Property?

In particular what difference it makes in the FileInstaller's *.cfg files?

________________________________

Joel Schuster
Senior Software Engineer
NAVSYS Corporation
14960 Woodcarver Road, Colorado Springs, CO 80921
719-481-4877



Re: ServiceProperty vs Property

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

So, as already said:
@ServiceProperty are published with the service registration (if and  
only if their value is not null). It manages property updates: if the  
field value changes, the service registration is updated with the new  
value. (Service Property annotations target fields only). As they are  
published, they are used during the filter matching of a service lookup
@Property are component instance properties. They are not published  
with the service registration. This annotation targets fields and  
method (setter method)

So now what about the configuration admin. Both can be set by using  
the configuration admin (and so with .cfg file of File Install [http://ipojo-dark-side.blogspot.com/2009/04/ipojo-and-file-install-configuring.html 
]) if it's a factory configuration. In fact, factory configurations  
are interpreted by iPOJO as component instance creation (or  
reconfiguration if the configuration is just updated).

iPOJO also supports 'propagation'. When enabled, every unknown  
component (so not a @Property) properties received during the creation  
or a reconfiguration are propagated to the service registration. The  
iPOJO - DOSGi tutorial [http://felix.apache.org/site/apache-felix-ipojo-dosgi.html 
] uses this feature to configure an instance in order to publish it  
remotely. It adds the osgi.remote.* properties. As those properties  
are unknown, and as the propagation is enabled, these properties will  
be published with the service registration.

Regards,

Clement

On 27.08.2009, at 00:14, Marcel Offermans wrote:

>
> On Aug 26, 2009, at 23:26 , Joel Schuster wrote:
>
>> So the ConfigAdmin can actually be used to dynamically set either,
>
> ConfigAdmin will only get the config to the component, you have to  
> propagate these properties to the service properties in your  
> component manually. That being said, for example the dependency  
> manager has a feature that automates that process (and probably  
> others have too). So yes, you could summarize that like you do.
>
>> but only the Service Property is used for lookups (filters) and such?
>
> Absolutely.
>
> Greetings, Marcel
>
>
> ---------------------------------------------------------------------
> 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: ServiceProperty vs Property

Posted by Marcel Offermans <ma...@luminis.nl>.
On Aug 26, 2009, at 23:26 , Joel Schuster wrote:

> So the ConfigAdmin can actually be used to dynamically set either,

ConfigAdmin will only get the config to the component, you have to  
propagate these properties to the service properties in your component  
manually. That being said, for example the dependency manager has a  
feature that automates that process (and probably others have too). So  
yes, you could summarize that like you do.

> but only the Service Property is used for lookups (filters) and such?

Absolutely.

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: ServiceProperty vs Property

Posted by Joel Schuster <jo...@Navsys.com>.
So the ConfigAdmin can actually be used to dynamically set either, but only the Service Property is used for lookups (filters) and such?

- Joel

> -----Original Message-----
> From: Marcel Offermans [mailto:marcel.offermans@luminis.nl]
> Sent: Wednesday, August 26, 2009 3:16 PM
> To: users@felix.apache.org
> Subject: Re: ServiceProperty vs Property
> 
> On Aug 26, 2009, at 23:07 , Joel Schuster wrote:
> 
> > Maybe... Actually, that's why I ask the question. What's the
> > difference then b/t properties of configuration objects and
> > properties with which services are registered that sounds very
> > similar to me.
> >
> > Or, more to the point, in what cases would I use one over the other?
> 
> ConfigAdmin is used to centrally/exernally provide configuration for
> your components.
> 
> Registering properties on services is done so you can query the
> service registry based on them.
> 
> Sometimes the two are used together to first externally configure a
> component and then pass on this configuration to interested parties as
> part of the service properties.
> 
> An example. Let's assume you have a component that is a servlet, and
> you want to be able to configure the endpoint for that servlet
> externally. You'd use ConfigAdmin to do that. Let's also assume that
> the OSGi HttpService supports the whiteboard pattern (by default it
> doesn't but that doesn't matter). By registering your servlet service
> with an endpoint property, HttpService could pick that up and register
> the servlet at the correct endpoint.
> 
> Greetings, Marcel
> 
> 
> ---------------------------------------------------------------------
> 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: ServiceProperty vs Property

Posted by Marcel Offermans <ma...@luminis.nl>.
On Aug 26, 2009, at 23:07 , Joel Schuster wrote:

> Maybe... Actually, that's why I ask the question. What's the  
> difference then b/t properties of configuration objects and  
> properties with which services are registered that sounds very  
> similar to me.
>
> Or, more to the point, in what cases would I use one over the other?

ConfigAdmin is used to centrally/exernally provide configuration for  
your components.

Registering properties on services is done so you can query the  
service registry based on them.

Sometimes the two are used together to first externally configure a  
component and then pass on this configuration to interested parties as  
part of the service properties.

An example. Let's assume you have a component that is a servlet, and  
you want to be able to configure the endpoint for that servlet  
externally. You'd use ConfigAdmin to do that. Let's also assume that  
the OSGi HttpService supports the whiteboard pattern (by default it  
doesn't but that doesn't matter). By registering your servlet service  
with an endpoint property, HttpService could pick that up and register  
the servlet at the correct endpoint.

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: ServiceProperty vs Property

Posted by Joel Schuster <jo...@Navsys.com>.
Maybe... Actually, that's why I ask the question. What's the difference then b/t properties of configuration objects and properties with which services are registered that sounds very similar to me.

Or, more to the point, in what cases would I use one over the other?

- Joel

-----Original Message-----
From: Felix Meschberger [mailto:fmeschbe@gmail.com] 
Sent: Wednesday, August 26, 2009 2:41 PM
To: users@felix.apache.org
Subject: Re: ServiceProperty vs Property

Hi Joel,

Joel Schuster schrieb:
> Could someone please either explain or point me to documentation that explains the difference b/t a @ServiceProperty and a @Property?

I assume you refer to the properties of configuration objects provided
by the Configuration Admin service and the properties with which
services are registered.


> In particular what difference it makes in the FileInstaller's *.cfg files?

The FileInstaller .cfg files define properties which are provided as
part of configurations provided to ManagedService and
ManagedServiceFactory services.

HTH

Regards
Felix
> 
> ________________________________
> 
> Joel Schuster
> Senior Software Engineer
> NAVSYS Corporation
> 14960 Woodcarver Road, Colorado Springs, CO 80921
> 719-481-4877
> 
> 
> 

---------------------------------------------------------------------
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: ServiceProperty vs Property

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Joel,

Joel Schuster schrieb:
> Could someone please either explain or point me to documentation that explains the difference b/t a @ServiceProperty and a @Property?

I assume you refer to the properties of configuration objects provided
by the Configuration Admin service and the properties with which
services are registered.


> In particular what difference it makes in the FileInstaller's *.cfg files?

The FileInstaller .cfg files define properties which are provided as
part of configurations provided to ManagedService and
ManagedServiceFactory services.

HTH

Regards
Felix
> 
> ________________________________
> 
> Joel Schuster
> Senior Software Engineer
> NAVSYS Corporation
> 14960 Woodcarver Road, Colorado Springs, CO 80921
> 719-481-4877
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org