[pylucene-dev] Introducing PyLucene without gcj

Andi Vajda vajda at osafoundation.org
Fri Sep 21 13:54:40 PDT 2007


With the GPL'ing of Java and Lucene's pending move to using Java 1.5,
I decided to give PyLucene without gcj a try.

One of the best features of gcj is its C++ interface. Its ability to expose 
Java classes as C++ to C++ programs makes it very easy to invoke Java from 
C++. This feature is unique and sorely missed when moving off of gcj.

The Java Native Invocation Interface makes it possible to invoke Java classes 
from C++ but is rather crufty and very verbose to use by hand.

I started by implementing a C++ code generator that generates C++ wrapper 
classes that hide all the JNI invocation cruft from the C++ programmer.
These wrapper classes in effect offer a very similar C++ interface to what is 
offered by gcj's CNI.

While I was implementing this it became apparent that the C++ wrappers for 
giving access to Java classes from Python could be generated at the same 
time.

Eventually, I ended up writing a new C++ code generator, that I called jcc, 
that is able to generate C++ wrappers for accessing Java classes from Python 
and C++.

This code generator is now used to generate a new flavor of PyLucene, called 
PyLucene with JCC. JCC has no built-in knowledge about Lucene and could be 
used to generate wrappers for any Java library that uses similar coding styles 
and techniques than the ones used by the Java Lucene developers.

JCC could become a project of its own. At the moment, it is part of the 
PyLucene with JCC source tree.

The PyLucene source tree got split into two forks, a gcj fork containing the 
original PyLucene and a new jcc fork containing the new sources, consisting 
mainly of unit tests, samples and the sources to jcc since _all_ of PyLucene, 
except for extension code, is now generated by jcc.

The new README files in:

     - http://svn.osafoundation.org/pylucene/trunk/README
     - http://svn.osafoundation.org/pylucene/trunk/jcc/README
     - http://svn.osafoundation.org/pylucene/trunk/jcc/jcc/README

should hopefully be interesting reading.

JCC is very new. All PyLucene with JCC unit tests and samples run well.
Some are slower, some are faster than PyLucene with GCJ. So far, I've only 
built and tested it on Intel Mac OS X 10.4.10 with Apple's JD=K 1.5 but 
support for other platforms such as other Unix flavors should be trivial.
Support for Windows is in the works...

Questions, comments, feedback, feature ideas are very welcome !

Andi..


More information about the pylucene-dev mailing list