You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Inger, Matthew" <In...@Synygy.com> on 2004/06/14 22:22:14 UTC

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

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)

   private String getRegexpImplClassName() {
      String impClassName = null;

	try {
        Thread.currentThread().getContextClassLoader().loadClass(
            "java.lang.regex");
        implClassName = "org.apache.commons.vfs.regex.JDK14RegexImpl";
      }
      catch ( ClassNotFoundException e) {
      }

      if (impClassName == null) {
    	    try {
           Thread.currentThread().getContextClassLoader().loadClass(
                "org.apache.oro.text.regex.Pattern");
           implClassName = "org.apache.commons.vfs.regex.OroRegexImpl";
          }
          catch ( ClassNotFoundException e) {
          }
      }

      ...

      return implClassName;
   }

   Then, call this method, and if the className returned is not null,
   get the class for the name returned, and call newInstance on it.

This solution requires JDK14 & ORO only to compile, but picks an
implementation
at runtime.  You could even get fancier, and use system properties to
override
the default order specified in the above method, and also to plugin custom
implementations.

Hope this helps.

-----Original Message-----
From: Gary Gregory [mailto:ggregory@seagullsw.com]
Sent: Monday, June 14, 2004 1:22 PM
To: Jakarta Commons Developers List
Subject: RE: [vfs][all][poll]regular expression library or jdk1.4 as
minimum requirement


> [X] Avoid dependency to jdk1.4.
> [X] ... use jakarta-oro

I strongly disagree with making 1.4 the base requirement. 

JDK reqs have been discussed over and over on this list so I will not
reiterate the arguments again but in general I would say lower is
better. 

>From my POV, our product is stuck to running on our /customers/ lowest
common denominator web server which are for the most part Java 1.2 and
1.3 based.

Thank you,
Gary 
> -----Original Message-----
> From: Mario Ivankovits [mailto:imario@apache.org]
> Sent: Monday, June 14, 2004 02:23
> To: Jakarta Commons Developers List
> Subject: [vfs][all][poll]regular expression library or jdk1.4 as
minimum
> requirement
> 
> Hello!
> 
> A contribution of Rami Ojares brings in an "PatternSelector" to handle
> ant-style patterns (/dir/**/file) to select files.
> This class currently uses the jdk1.4 regular expression library.
> 
> Now there are some questions how to handle the regexp thing:
> [ ] Avoid dependency to jdk1.4.
> [ ] ... use jakarta-regexp
> [ ] ... use jakarta-oro
> [ ] ... use the regexp bundled with ant. But then we could not use the
> PatternSelector without the ant.jar and have to move it to the vfs.ant
> package. This powerfull thing might then not be useable for projects
> without it.
> 
> [ ] Dont bother and use jdk1.4 as minimum requirement (and its regexp)
> 
> 
> Here is my vote:
> [X] Dont bother and use jdk1.4 as minimum requirement
> But i dont know which jdk version will be the most used and this is
why
> i started this poll.
> IMHO at least for a sandbox component it should be permitted to use
this
> "bleeding edge ;-)" jdk-version.
> 
> 
> PS: During writing of this poll, i noticed that there already two
> dependencies to the jdk1.4, but those can be easily reverted.
> 
> --
> Mario
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


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

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