lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <>
Subject [jira] Commented: (LUCENE-2915) make CoreCodecProvider convenience class so apps can easily pick per-field codecs
Date Thu, 10 Feb 2011 15:04:57 GMT


Uwe Schindler commented on LUCENE-2915:

Hi Mike,

I would prefer to remove the hardcoded core providers from source code. In Java is a standard
mechanism (so called Service Provider framework) that can be used to find out all codecs that
ship with all given JAR files in classpath. This makes it easy to add custom codecs, you just
add the JAR file to class path and it is available.

If you like I could code the lookup code (unfortunately its only "standardized" in Java 6,
but its available in a different public class since Java 1.2. It is mainly used by:
- XML, XSLT (all of javax.xml)
- image formats (png, gif,..)

In general it works very simple:
The JAR file contains a MANIFEST that lists all classes that implement a codec under a key
that is the class name of the abstract base class. A simple example is: if you plug xercesImpl.jar
into your classpath, it's manifest contains a javax.xml.dom.DocumentBuilder=someClass. Based
on this information DocumentuilderFactory returns a suitable implementation of a DOM parser.
The same would be for Lucene, the MANIFEST of lucene-core.jar would contain a simplar list
of classes (all are returned to the provider!). If you then add the JAR file of contrib-misc
to it, also the AppendingOnlyCoded would also be available.

Implementation is quite simple: you can ask the service provider API for the above key (in
our case a oal.index.Codec-like one) and the codec provier returns an Iterator of implementation
classes. Those would get registered on Startup of DefaultCodecProvider.

> make CoreCodecProvider convenience class so apps can easily pick per-field codecs
> ---------------------------------------------------------------------------------
>                 Key: LUCENE-2915
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 4.0
>         Attachments: LUCENE-2915.patch
> We already have DefaultCodecProvider, which simply registers all core codecs and uses
Standard for all fields, but it's package private.
> We should make this public, and name it CoreCodecProvider.

This message is automatically generated by JIRA.
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message