You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Christian Schneider (JIRA)" <ji...@apache.org> on 2018/04/23 13:15:00 UTC

[jira] [Commented] (SLING-7612) Use Declarative Services to register optional components

    [ https://issues.apache.org/jira/browse/SLING-7612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16448124#comment-16448124 ] 

Christian Schneider commented on SLING-7612:
--------------------------------------------

After the changes the code is simpler and it uses the same approach to initialise all classes.

Before the change one class was initialised using DS, one using Activator and one using programmatic registration inside the other DS component. If there was a really good reason for the old code then of course lets keep it unchanged. If it was simply to handle the optional case then I think it is much more straightforward to use only one approach.

I think it is also not the best style to handle an optional by loading a class and handling the exception. DS abstracts this away for us.

When looking into the dynamics then I think there should be no real difference. DS will process the components during activation. As far as I know the only real difference would be if a DS component needs a mandatory reference that is not yet there. In our case though there is no such reference so I would expect the components to start up in the same way as with an Activator.

Anyway because of the one DS component that was already present DS was involved anyway. So we do not introduce a new technology into the bundle.

> Use Declarative Services to register optional components
> --------------------------------------------------------
>
>                 Key: SLING-7612
>                 URL: https://issues.apache.org/jira/browse/SLING-7612
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons
>    Affects Versions: Commons Mime 2.1.10
>            Reporter: Christian Schneider
>            Priority: Major
>             Fix For: Commons Mime 2.1.12
>
>
> Currently the TikaMimeTypeProvider as well as the MimeTypeWebConsolePlugin are registered programmatically. I guess this is done make sure they work with the optional package dependencies.
> I recently learned that DS is very good to handle this case. So I propose to do both with simple DS component annotations. I will provide a PR.
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)