[
https://issues.apache.org/jira/browse/SLING-6578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15890012#comment-15890012
]
Felix Meschberger edited comment on SLING-6578 at 3/1/17 11:37 AM:
-------------------------------------------------------------------
bq. service.pid is not reliable - with a DS component you only have a
service.pid if the component is configurable through an OSGi configuration and
such a configuration exists.
This is not entirely correct, fortunately. You can very well add a service.pid
property to the component properties e.g. through the @Property annotation.
This is actually stipulated by the quote on merging service.pid property values
in my previous comment.
Using a separate property will just bloat the property space for referring to
services. You will end with this function using this tada.id property and that
function using that hurray.id property, etc.
Why not just service.pid ?
Using the PropertyUtil, you can easily just convert the property to a String[]
and ignore the fact that service.pid may be String, String[] or even
Collection<String>.
was (Author: fmeschbe):
bq. service.pid is not reliable - with a DS component you only have a
service.pid if the component is configurable through an OSGi configuration and
such a configuration exists.
This is not entirely correct, fortunately. You can very well add a service.pid
property to the component properties e.g. through the @Property annotation.
This is actually stipulated by the quote on merging service.pid property values
in my previous comment.
> Use "service.pid" property instead of class name to reference validators
> ------------------------------------------------------------------------
>
> Key: SLING-6578
> URL: https://issues.apache.org/jira/browse/SLING-6578
> Project: Sling
> Issue Type: Improvement
> Reporter: Konrad Windszus
> Assignee: Konrad Windszus
>
> Leveraging the component's "service.pid" property value instead of its
> classname is more stable (even if implementation changes, the PID might stay
> the same) and also allows for configuration factories to refer to a specific
> validator configuration. The fallback should be the property "component.name"
> as "service.pid" is not always necessarily set. Basically the validator
> should be referable via each of those value, i.e. one of the "service.pid"s
> or the "component.name".
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)