jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chetan Mehrotra <chetan.mehro...@gmail.com>
Subject Re: Improving Jackrabbit integration within OSGi and other managed environment
Date Thu, 06 Sep 2012 10:38:30 GMT
> This looks very interesting to me and should rather be targeted at dev@
> instead of user@. I suggest you repost this there. Also I'd create a JCR

Done. Send it to dev. Would continue discussion there

Chetan Mehrotra

On Thu, Sep 6, 2012 at 3:20 PM, Michael Dürig <mduerig@apache.org> wrote:
> Hi Chetan,
> This looks very interesting to me and should rather be targeted at dev@
> instead of user@. I suggest you repost this there. Also I'd create a JCR
> issue for the Jackrabbit part of your work and attach a patch. This way you
> probably reach a broader audience.
> AFAIU your changes I'd be in favour of applying something along these lines
> to the code. The solution seems simple enough to not break anything but OTOH
> is a very useful step for making repository configuration a bit more
> flexible.
> Michael
> On 6.9.12 6:36, Chetan Mehrotra wrote:
>> While using jackrabbit in managed environment like Sling, Spring etc
>> its easy for other components to access the Repository service.
>> However its tricky to use managed components of those env within
>> Jackrabbit as it creates the instances on its own. To simplify such
>> integration it would be helpful if JR exposes a factory service which
>> is used to create the various beans from the JR configuration.
>> To achieve that I have done a small poc which introduces a BeanFactory
>> service and uses that within BeanConfig to create the class instances.
>> The relevant changes are available at Git fork [1] and changes done
>> can be seen at [2]. To demonstrate the use of such a feature I took
>> the usecase of externalizing the AuthorizableAction [3] in Sling env.
>> So it should be possible to use an OSGi service which implements the
>> AuthorizableAction within JR. An implementation of that is available
>> at [4].
>> Usage
>> ======
>> Any JR component which needs to be provided via external service would
>> need to have a factoryType attribute set. The class would be set to
>> the interface name of the service
>> <AuthorizableAction
>> class="org.apache.jackrabbit.core.security.user.action.AuthorizableAction"
>> factoryType="osgi"/>
>> Then in Sling side we provide an OsgiBeanFactory which is passed to JR
>> through ConfigurationParser. This factory would internally lookup the
>> service and provide it to JR. It can also ensure that Repository
>> service is restarted if the service is not available or through proxy
>> it can handle the dynamic nature of OSGi.
>> An improved implementation can make use of BeanConfigVisitor interface
>> to determine the services which are required from OSGi and can ensure
>> that it only starts the repository after all the required services are
>> present. It can use the Felix Dependency manager [5] to achieve that.
>> Further in static env like Spring the implementation of BeanFactory
>> would be much simpler as it does not have to worry about services
>> going away at runtime.
>> Would such a feature be useful to be part of JR Core. Thoughts?
>> Chetan Mehrotra
>> [1] https://github.com/chetanmeh/jackrabbit/tree/osgi-factory
>> [2] https://github.com/chetanmeh/jackrabbit/compare/osgi-factory
>> [3]
>> http://jackrabbit.apache.org/api/2.4/org/apache/jackrabbit/core/security/user/action/AuthorizableAction.html
>> [4] https://github.com/chetanmeh/sling/compare/osgi-factory
>> [5]
>> https://felix.apache.org/site/apache-felix-dependency-manager-getting-started.html

View raw message