You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Daniel F. Savarese" <df...@savarese.org> on 2004/06/15 05:15:11 UTC

Re: [vfs][all][poll]regular expression library or jdk1.4 as minim um requirement

In message <F3...@kossuth.synygy.net>, "Inger,
 Matthew" writes:
>Why not take the road that ANT takes:
>
>1. Create an interface to do your regular expression functions
>2. Implement one for JDK 1.4, and one for Jakarta-Oro (and potentially
>   others like Jakarta-Regexp)
>3. Using reflection instantiate the appropriate implementation class
>   ie (this is typed now, and may not compile without tweeking)

All of this already exists on the jakarta-oro head branch.  I implemented
the J2SE 1.4 wrapper in the past couple of hours because I haven't been
very successful as using that as a lure to get more committers involved in
jakarta-oro.  I don't know to persuade people with an itch to scratch it.
In any case, I'll restate that jakarta-oro is not a regular expression
engine, but a set of generic interfaces to implement engines (along with
some implementations).  Using jakarta-oro, all vfs has to do is something
like this to choose an engine:

PatternMatchingEngineFactory factory = new PatternMatchingEngineFactory();
PatternMatchingEngine engine;
PatternCompiler compiler;
PatternMatcher matcher;
String engineKey;

if(factory.containsKey(PatternMatchingEngineFactory.JAVA_KEY))
  engineKey = PatternMatchingEngineFactory.JAVA_KEY;
else
  engineKey = PatternMatchingEngineFactory.PERL5_KEY;

engine   = factory.get(engineKey);
compiler = engine.createCompiler();
matcher  = engine.createCompiler();

Interested parties can implement a wrapper for jakarta-regexp using
the java wrapper in org.apache.oro.text.java as a guide and I'm sure
the PMC will grant committership in an instant to any commons committer.

daniel



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org