Am Mittwoch, den 31.10.2007, 14:46 +0100 schrieb Bertrand Delacretaz: > On 10/31/07, Felix Meschberger <[EMAIL PROTECTED]> wrote: > > > >... 3) Keep our existing interfaces an use the jar service provider > > >mechanism > > > Jackrabbit uses that for query syntax plugins, a plugin jar needs a > > > text file like this one: > > > > The mechanism is good and is in fact as Thomas points out used > > throughout Sun's own implementations. But it has one serious drawback: > > The implementation is based on an internal class and thus not part of > > the Java API.... > > You mean javax.imageio.spi.ServiceRegistry (which is what Jackrabbit > uses) might not be available on non-Sun VMs, due to the "javax" > prefix?
No, this class is available on all Java runtimes compliant to Java API spec 1.4 and above. But using this is of course misusing a class :-) Though it perfectly works. > > And you mention that BSF has its own implementation, I found this one: > > https://svn.apache.org/repos/asf/jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineManager.java > > but that uses sun.misc.Service, which is probably what you mean by an > internal class. This is the internal class, I was referring to. I would, contrary to Jackrabbit, opt for implementing a very simple implementation of the sun.misc.Service class to implement the plugin mechanism. By simple I mean: Just find the files using the class loader resource enumeration, read those files, taking each line as a fully qualified ScriptEngine class name (unless the line's first character is "#" or the line is empty). This is really just a very short method of around 10 lines of code. Regards Felix
