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

Felix Meschberger commented on OAK-2273:
----------------------------------------

I had a quick chat with [~chetanm] on this topic.

Considering:

* oak-lucene provides its own Codec implementation for Lucene
* Lucene loads the Codecs using Java Service Loader (and never unloads)
* thus a separate Lucene bundle would not see the oak-lucene Codec since the 
Lucene bundle Service Loader does not know about OSGi
* thus Lucene better be embedded in oak-lucene such that the Lucene Service 
Loader sees the oak-lucene codec and code loading is bound to the livecycle of 
oak-lucene
* another bundle in the framework could export Lucene as well but oak-lucene 
must use its own version and not wire to that other bundle

I suggest to

* export the org.apache.lucene packages with just the version number of the 
lucene library; e.g.
{noformat}
Export-Package:
    org.apache.lucene.*; version=4.7.1
{noformat}
* not import org.apache.lucene packages. This guarantess that oak-lucene itself 
always only uses the embedded lucene packages; e.g.
{noformat}
Import-Package:
    !org.apache.lucene.*,
    *
{noformat}

The worst thing that could happen in this scenario is that an importer of a 
lucene package and providing an Analyzer is not wired to oak-lucene and thus 
oak-lucene cannot use that Analyzer service

> Export Lucene packages 
> -----------------------
>
>                 Key: OAK-2273
>                 URL: https://issues.apache.org/jira/browse/OAK-2273
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>          Components: oak-lucene
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>             Fix For: 1.2
>
>
> As discussed in [1] for enabling custom analyzers in Oak we intend make use 
> of OSGi ServiceRegistry. This would require other bundles to create custom 
> analyzer instance and register it with SR from where oak-lucene would look 
> them up
> Further export would make use of Mandatory Attributes so as to prevent Oak 
> usage of Lucene affecting other bundles in the OSGi runtime. The Lucene 
> packages would be exported like
> {noformat}
> Export-Package: org.apache.lucene;provider="oak";mandatory=:provider
> {noformat}
> And any bundle which wish to make use of Lucene related packages
> {noformat}
> Import-Package : org.apache.lucene;provider="oak"
> {noformat}
> [1] 
> http://markmail.org/thread/xsmg3tjjbkhtyhpk#query:+page:1+mid:jmip66k43l2qxc6a+state:results
> [2] http://www.osgi.org/download/r4v41/r4.core.pdf (Sec 3.6.6 pg 45)



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

Reply via email to