[ 
https://issues.apache.org/jira/browse/OAK-3201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francesco Mari updated OAK-3201:
--------------------------------
    Attachment: OAK-3201-02.patch

To better illustrate my previous comment, I attached [^OAK-3201-02.patch] with 
three classes to be used as an example.

{{DefaultSecurityProvider}} is an implementation of {{SecurityProvider}} that 
is completely unaware of OSGi. The {{DefaultSecurityProviderBuilder}} is just 
an helper class to help users in building new instances of 
{{DefaultSecurityProvider}}. The {{DefaultSecurityProviderBuilder}} is unaware 
of OSGi, too. These classes can be surely used outside of an OSGi framework.

{{DefaultSecurityProviderRegistration}} takes care of gathering the 
dependencies of a {{DefaultSecurityProvider}} from the OSGi environment, 
creating a new instance of {{DefaultSecurityProvider}} using the 
{{DefaultSecurityProviderBuilder}}, and registering the newly created instance 
into the OSGi framework as a new service. Being this a default implementation, 
we give the possibility to users to deactivate it by using a flag exposed as 
OSGi configuration.

I didn't go further with my example, but the same pattern can be applied to 
implementations of {{AuthorizationConfiguration}}, 
{{AuthenticationConfiguration}}, and so on.

> Use static references in SecurityProviderImpl for composite services
> --------------------------------------------------------------------
>
>                 Key: OAK-3201
>                 URL: https://issues.apache.org/jira/browse/OAK-3201
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: Francesco Mari
>            Assignee: Francesco Mari
>         Attachments: OAK-3201-01.patch, OAK-3201-02.patch
>
>
> {{SecurityProviderImpl}} has dynamic references to many other services, like 
> {{RestrictionProvider}}, that represent the configuration of this component.
> Being these services dynamic, the OSGi runtime has no clear dependency 
> relationship between the {{SecurityProviderImpl}} and the required services. 
> Thus, it may happen that an instance of {{SecurityProviderImpl}} is published 
> before the services it requires are started, creating a window where the 
> {{SecurityProviderimpl}} is operating differently from the way it's 
> configured.
> I suggest to turn the dynamic references in {{SecurityProviderImpl}} to 
> static ones to improve the consistency of the implementation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to