Hi Ian,

> On 09 Sep 2016, at 18:04, Ian Boston <[email protected]> wrote:
> 
> Hi,
> Is it possible write a CommitHook as an OSGI Component/Service and for Oak
> to pick it up ?
> The Component starts and gets registered as a service, but Oak doesn't
> appear to pick it up.

The standard RepositoryManager[1] (responsible for setting-up the repo) allows 
to register EditorProvider, IndexEditorProvider and IndexProvider via OSGi. If 
you use a Sling-based setup, then the repository is created by 
OakSlingRepositoryManager[2] and it’s only possible to register index-related 
services.

> If its not possible to add a CommitHook in this way, what is the best way
> of doing it from outside the oak-core bundle ?

I’m afraid they can’t be added dynamically, so you need to modify the 
*RepositoryManager class and add an appropriate .with() invocation.

Regards,
Tomek

[1] 
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManager.java
[2] 
https://github.com/apache/sling/blob/trunk/bundles/jcr/oak-server/src/main/java/org/apache/sling/jcr/oak/server/internal/OakSlingRepositoryManager.java

-- 
Tomek Rękawek | Adobe Research | www.adobe.com
[email protected]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to