cvs commit: ant/src/main/org/apache/tools/ant/util ClasspathUtils.java

2005-05-20 Thread mbenson
mbenson 2005/05/20 15:51:37

  Modified:src/main/org/apache/tools/ant/util ClasspathUtils.java
  Log:
  Javadoc
  
  Revision  ChangesPath
  1.15  +16 -16
ant/src/main/org/apache/tools/ant/util/ClasspathUtils.java
  
  Index: ClasspathUtils.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/util/ClasspathUtils.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ClasspathUtils.java   21 Jan 2005 14:51:50 -  1.14
  +++ ClasspathUtils.java   20 May 2005 22:51:37 -  1.15
  @@ -26,8 +26,8 @@
   /**
* Offers some helper methods on the Path structure in ant.
*
  - * pBasic idea behind this utility class is to use it from inside the
  - * different ant objects (and user defined objects) that need classLoading
  + * pThe basic idea behind this utility class is to use it from inside the
  + * different Ant objects (and user defined objects) that need classLoading
* for their operation.
* Normally those would have a setClasspathRef() {for the @classpathref}
* and/or a createClasspath() {for the nested lt;classpathgt;}
  @@ -91,12 +91,12 @@
* String, boolean)}.
*
* pDelegates to the other one after extracting the referenced
  - * Path from the Project This checks also that the passed
  + * Path from the Project. This checks also that the passed
* Reference is pointing to a Path all right./p
  - * @param p current ant project
  + * @param p current Ant project
* @param ref Reference to Path structure
* @param reverseLoader if set to true this new loader will take
  - * precedence over it's parent (which is contra the regular
  + * precedence over its parent (which is contra the regular
* classloader behaviour)
* @return The class loader
*/
  @@ -121,7 +121,7 @@
*
* pAssumes the logical 'false' for the reverseLoader./p
*
  - * @param p current ant project
  + * @param p current Ant project
* @param path the path
* @param loaderId the loader id string
* @return The class loader
  @@ -143,7 +143,7 @@
* @param path the path
* @param loaderId the loader id string
* @param reverseLoader if set to true this new loader will take
  - * precedence over it's parent (which is contra the regular
  + * precedence over its parent (which is contra the regular
* classloader behaviour)
* @return The class loader
*/
  @@ -158,14 +158,14 @@
* defined in the path argument.
*
* pBased on the setting of the magic property
  - * 'ant.reuse.loader' this will try to reuse the perviously
  + * 'ant.reuse.loader' this will try to reuse the previously
* created loader with that id, and of course store it there upon
* creation./p
* @param p Ant Project where the handled components are 
living in.
* @param path  Path object to be used as classpath for this 
classloader
* @param loaderId  identification for this Loader,
* @param reverseLoader if set to true this new loader will take
  - *  precedence over it's parent (which is contra the 
regular
  + *  precedence over its parent (which is contra the 
regular
*  classloader behaviour)
* @param reuseLoader   if true reuse the loader if it is found
* @return  ClassLoader that uses the Path as its classpath.
  @@ -198,17 +198,17 @@
   }
   
   /**
  - * Gets a fresh, different, not used before classloader that uses the
  - * passed path as it's classpath.
  + * Gets a fresh, different, previously unused classloader that uses the
  + * passed path as its classpath.
*
* pThis method completely ignores the ant.reuse.loader magic
* property and should be used with caution./p
* @param p Ant Project where the handled components are 
living in.
* @param path  the classpath for this loader
* @param reverseLoader if set to true this new loader will take
  - *  precedence over it's parent (which is contra the 
regular
  + *  precedence over its parent (which is contra the 
regular
*  classloader behaviour)
  - * @return The fresh, different, not used before class loader.
  + * @return The fresh, different, previously unused class loader.
*/
   public static ClassLoader getUniqueClassLoaderForPath(
   Project p,
  @@ -227,7 +227,7 @@
* Creates a fresh object instance of the specified classname.
*
* p This uses the userDefinedLoader to load the specified class,
  - * and then makes an instance using the 

cvs commit: ant/src/main/org/apache/tools/ant/util ClasspathUtils.java

2005-01-21 Thread peterreilly
peterreilly2005/01/21 06:51:50

  Modified:src/main/org/apache/tools/ant/util ClasspathUtils.java
  Log:
  checkstyle
  
  Revision  ChangesPath
  1.14  +41 -26
ant/src/main/org/apache/tools/ant/util/ClasspathUtils.java
  
  Index: ClasspathUtils.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/util/ClasspathUtils.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ClasspathUtils.java   10 Dec 2004 15:18:57 -  1.13
  +++ ClasspathUtils.java   21 Jan 2005 14:51:50 -  1.14
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2003-2004 The Apache Software Foundation
  + * Copyright  2003-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  @@ -76,8 +76,8 @@
*
* pAssumes the logical 'false' for the reverseLoader./p
*
  - * @param p
  - * @param ref
  + * @param p the project
  + * @param ref the reference
* @return The class loader
*/
   public static ClassLoader getClassLoaderForPath(
  @@ -121,8 +121,9 @@
*
* pAssumes the logical 'false' for the reverseLoader./p
*
  - * @param path
  - * @param loaderId
  + * @param p current ant project
  + * @param path the path
  + * @param loaderId the loader id string
* @return The class loader
*/
   public static ClassLoader getClassLoaderForPath(
  @@ -138,8 +139,12 @@
* pSets value for 'reuseLoader' to true if the magic property
* has been set./p
*
  - * @param path
  - * @param loaderId
  + * @param p the project
  + * @param path the path
  + * @param loaderId the loader id string
  + * @param reverseLoader if set to true this new loader will take
  + * precedence over it's parent (which is contra the regular
  + * classloader behaviour)
* @return The class loader
*/
   public static ClassLoader getClassLoaderForPath(
  @@ -156,12 +161,13 @@
* 'ant.reuse.loader' this will try to reuse the perviously
* created loader with that id, and of course store it there upon
* creation./p
  + * @param p Ant Project where the handled components are 
living in.
* @param path  Path object to be used as classpath for this 
classloader
* @param loaderId  identification for this Loader,
* @param reverseLoader if set to true this new loader will take
*  precedence over it's parent (which is contra the 
regular
*  classloader behaviour)
  - * @param p Ant Project where the handled components are 
living in.
  + * @param reuseLoader   if true reuse the loader if it is found
* @return  ClassLoader that uses the Path as its classpath.
*/
   public static ClassLoader getClassLoaderForPath(
  @@ -197,8 +203,11 @@
*
* pThis method completely ignores the ant.reuse.loader magic
* property and should be used with caution./p
  - * @param path the classpath for this loader
  - * @param reverseLoader
  + * @param p Ant Project where the handled components are 
living in.
  + * @param path  the classpath for this loader
  + * @param reverseLoader if set to true this new loader will take
  + *  precedence over it's parent (which is contra the 
regular
  + *  classloader behaviour)
* @return The fresh, different, not used before class loader.
*/
   public static ClassLoader getUniqueClassLoaderForPath(
  @@ -303,7 +312,7 @@
   
   /**
* Constructs Delegate
  - * @param component
  + * @param component the ProjectComponent this delegate is for.
*/
   Delegate(ProjectComponent component) {
   this.component = component;
  @@ -312,9 +321,9 @@
   /**
* This method is a Delegate method handling the @classpath 
attribute.
*
  - * pThis attribute can set a path to add to the classpath/p
  + * pThis attribute can set a path to add to the classpath./p
*
  - * @param classpath
  + * @param classpath the path to use for the classpath.
*/
   public void setClasspath(Path classpath) {
   if (this.classpath == null) {
  @@ -328,9 +337,9 @@
* Delegate method handling the lt;classpathgt; tag.
*
* pThis nested path-like structure can set a path to add to the
  - * classpath/p
  + * classpath./p
*
  - * @return the created path
  + * @return the created path.
*/
 

cvs commit: ant/src/main/org/apache/tools/ant/util ClasspathUtils.java

2005-01-21 Thread peterreilly
peterreilly2005/01/21 06:57:19

  Modified:src/main/org/apache/tools/ant/util Tag: ANT_16_BRANCH
ClasspathUtils.java
  Log:
  sync
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.8.2.6   +41 -26
ant/src/main/org/apache/tools/ant/util/ClasspathUtils.java
  
  Index: ClasspathUtils.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/util/ClasspathUtils.java,v
  retrieving revision 1.8.2.5
  retrieving revision 1.8.2.6
  diff -u -r1.8.2.5 -r1.8.2.6
  --- ClasspathUtils.java   10 Dec 2004 15:20:11 -  1.8.2.5
  +++ ClasspathUtils.java   21 Jan 2005 14:57:19 -  1.8.2.6
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2003-2004 The Apache Software Foundation
  + * Copyright  2003-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  @@ -76,8 +76,8 @@
*
* pAssumes the logical 'false' for the reverseLoader./p
*
  - * @param p
  - * @param ref
  + * @param p the project
  + * @param ref the reference
* @return The class loader
*/
   public static ClassLoader getClassLoaderForPath(
  @@ -121,8 +121,9 @@
*
* pAssumes the logical 'false' for the reverseLoader./p
*
  - * @param path
  - * @param loaderId
  + * @param p current ant project
  + * @param path the path
  + * @param loaderId the loader id string
* @return The class loader
*/
   public static ClassLoader getClassLoaderForPath(
  @@ -138,8 +139,12 @@
* pSets value for 'reuseLoader' to true if the magic property
* has been set./p
*
  - * @param path
  - * @param loaderId
  + * @param p the project
  + * @param path the path
  + * @param loaderId the loader id string
  + * @param reverseLoader if set to true this new loader will take
  + * precedence over it's parent (which is contra the regular
  + * classloader behaviour)
* @return The class loader
*/
   public static ClassLoader getClassLoaderForPath(
  @@ -156,12 +161,13 @@
* 'ant.reuse.loader' this will try to reuse the perviously
* created loader with that id, and of course store it there upon
* creation./p
  + * @param p Ant Project where the handled components are 
living in.
* @param path  Path object to be used as classpath for this 
classloader
* @param loaderId  identification for this Loader,
* @param reverseLoader if set to true this new loader will take
*  precedence over it's parent (which is contra the 
regular
*  classloader behaviour)
  - * @param p Ant Project where the handled components are 
living in.
  + * @param reuseLoader   if true reuse the loader if it is found
* @return  ClassLoader that uses the Path as its classpath.
*/
   public static ClassLoader getClassLoaderForPath(
  @@ -197,8 +203,11 @@
*
* pThis method completely ignores the ant.reuse.loader magic
* property and should be used with caution./p
  - * @param path the classpath for this loader
  - * @param reverseLoader
  + * @param p Ant Project where the handled components are 
living in.
  + * @param path  the classpath for this loader
  + * @param reverseLoader if set to true this new loader will take
  + *  precedence over it's parent (which is contra the 
regular
  + *  classloader behaviour)
* @return The fresh, different, not used before class loader.
*/
   public static ClassLoader getUniqueClassLoaderForPath(
  @@ -303,7 +312,7 @@
   
   /**
* Constructs Delegate
  - * @param component
  + * @param component the ProjectComponent this delegate is for.
*/
   Delegate(ProjectComponent component) {
   this.component = component;
  @@ -312,9 +321,9 @@
   /**
* This method is a Delegate method handling the @classpath 
attribute.
*
  - * pThis attribute can set a path to add to the classpath/p
  + * pThis attribute can set a path to add to the classpath./p
*
  - * @param classpath
  + * @param classpath the path to use for the classpath.
*/
   public void setClasspath(Path classpath) {
   if (this.classpath == null) {
  @@ -328,9 +337,9 @@
* Delegate method handling the lt;classpathgt; tag.
*
* pThis nested path-like structure can set a path to add to the
  - * classpath/p
  + * 

cvs commit: ant/src/main/org/apache/tools/ant/util ClasspathUtils.java

2003-07-07 Thread bodewig
bodewig 2003/07/07 06:57:29

  Modified:src/main/org/apache/tools/ant/util ClasspathUtils.java
  Log:
  Some whitespace changes
  
  Revision  ChangesPath
  1.3   +74 -71
ant/src/main/org/apache/tools/ant/util/ClasspathUtils.java
  
  Index: ClasspathUtils.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/util/ClasspathUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClasspathUtils.java   23 Apr 2003 15:03:06 -  1.2
  +++ ClasspathUtils.java   7 Jul 2003 13:57:28 -   1.3
  @@ -63,37 +63,37 @@
   /**
* Offers some helper methods on the Path structure in ant.
*
  - * pBasic idea behind this utility class is to use it from inside the 
  - * different ant objects (and user defined objects) that need classLoading 
  + * pBasic idea behind this utility class is to use it from inside the
  + * different ant objects (and user defined objects) that need classLoading
* for their operation.
  - * Normally those would have a setClasspathRef() {for the @classpathref} 
  + * Normally those would have a setClasspathRef() {for the @classpathref}
* and/or a createClasspath() {for the nested lt;classpathgt;}
  - * Typically one would have in your Ant Task or DataType/p 
  + * Typically one would have in your Ant Task or DataType/p
*
* precode
* ClasspathUtils.Delegate cpDelegate;
  - * 
  + *
* public void init(){
* this.cpDelegate = ClasspathUtils.getDelegate(this);
* super.init();
* }
  - * 
  + *
* public void setClasspathRef(Reference r) {
* this.cpDelegate.setClasspathRef(r);
* }
  - * 
  + *
* public Path createClasspath() {
* return this.cpDelegate.createClasspath();
* }
  - * 
  + *
* public void setClassname(String fqcn) {
* this.cpDelegate.setClassname(fqcn);
* }
* /code/pre
  - * 
  - * pAt execution time, when you actually need the classloading 
  + *
  + * pAt execution time, when you actually need the classloading
* you can just:/p
  - * 
  + *
* precode
* Object o = this.cpDelegate.newInstance();
* /code/pre
  @@ -102,15 +102,18 @@
*/
   public class ClasspathUtils {
   private static final String LOADER_ID_PREFIX = ant.loader.;
  +/**
  + * Name of the magic property that controls classloader reuse in Ant 1.4.
  + */
   public static final String REUSE_LOADER_REF = ant.reuse.loader;
   
  -/** 
  +/**
* Convenience overloaded version of [EMAIL PROTECTED]
* #getClassLoaderForPath(Project, Reference, boolean)}.
*
* pAssumes the logical 'false' for the reverseLoader./p
  - *  
  - * @param path 
  + *
  + * @param path
* @param pathId
* @return
*/
  @@ -120,7 +123,7 @@
   return getClassLoaderForPath(p, ref, false);
   }
   
  -/** 
  +/**
* Convenience overloaded version of [EMAIL PROTECTED] 
#geClassLoader(Project, Path,
* String, boolean)}.
*
  @@ -136,7 +139,7 @@
*/
   public static ClassLoader getClassLoaderForPath(
   Project p, Reference ref, boolean reverseLoader) {
  -
  +
   String pathId = ref.getRefId();
   Object path = p.getReference(pathId);
   if (!(path instanceof Path)) {
  @@ -149,13 +152,13 @@
   return getClassLoaderForPath(p, (Path) path, loaderId, 
reverseLoader);
   }
   
  -/** 
  +/**
* Convenience overloaded version of [EMAIL PROTECTED]
* #getClassLoaderForPath(Project, Path, String, boolean)}.
*
* pAssumes the logical 'false' for the reverseLoader./p
  - *  
  - * @param path 
  + *
  + * @param path
* @param loaderId
* @return
*/
  @@ -165,14 +168,14 @@
   return getClassLoaderForPath(p, path, loaderId, false);
   }
   
  -/** 
  +/**
* Convenience overloaded version of [EMAIL PROTECTED]
* #getClassLoaderForPath(Project, Path, String, boolean, boolean)}.
*
* pSets value for 'reuseLoader' to true if the magic property
* has been set./p
  - *  
  - * @param path 
  + *
  + * @param path
* @param loaderId
* @return
*/
  @@ -191,12 +194,12 @@
* created loader with that id, and of course store it there upon
* creation./p
* @param path Path object to be used as classpath for this classloader
  - * @param loaderID identification for this Loader, 
  + * @param loaderID identification for this Loader,
* @param reverseLoader if set to true this new loader will take
* precedence over it's parent (which is contra the regular
  - * @param p Ant Project where the handled components are living in. 
  + * @param p Ant Project where the handled components are living 

cvs commit: ant/src/main/org/apache/tools/ant/util ClasspathUtils.java

2003-04-23 Thread bodewig
bodewig 2003/04/23 08:03:06

  Modified:src/etc/testcases/core/loaderref loaderref.xml
   src/main/org/apache/tools/ant/taskdefs Definer.java
   src/main/org/apache/tools/ant/util ClasspathUtils.java
  Log:
  Make Definer use the new ClasspathUtils, make ClasspathUtils even more
  reuse-friendly.
  
  PR: 19213
  Submitted by: Marc Portier mpo at apache dot org
  
  Revision  ChangesPath
  1.2   +1 -0  ant/src/etc/testcases/core/loaderref/loaderref.xml
  
  Index: loaderref.xml
  ===
  RCS file: /home/cvs/ant/src/etc/testcases/core/loaderref/loaderref.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- loaderref.xml 6 Jan 2003 13:58:31 -   1.1
  +++ loaderref.xml 23 Apr 2003 15:03:06 -  1.2
  @@ -22,6 +22,7 @@
   
 target name=testbadref depends=compile 
   taskdef loaderref=loaderref-test
  + name=test1
classname=Test1
classpath=${classes.dir}/
 /target
  
  
  
  1.29  +23 -93ant/src/main/org/apache/tools/ant/taskdefs/Definer.java
  
  Index: Definer.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Definer.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Definer.java  7 Mar 2003 11:23:01 -   1.28
  +++ Definer.java  23 Apr 2003 15:03:06 -  1.29
  @@ -66,6 +66,7 @@
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.Path;
   import org.apache.tools.ant.types.Reference;
  +import org.apache.tools.ant.util.ClasspathUtils;
   
   /**
* Base class for Taskdef and Typedef - does all the classpath
  @@ -79,21 +80,16 @@
   public abstract class Definer extends Task {
   private String name;
   private String value;
  -private Path classpath;
   private File file;
   private String resource;
  -private boolean reverseLoader = false;
  -private String loaderId = null;
  -private String classpathId = null;
  -
  -private static final String REUSE_LOADER_REF = ant.reuse.loader;
  +private ClasspathUtils.Delegate cpDelegate;
   
   /**
* @deprecated stop using this attribute
* @ant.attribute ignore=true
*/
   public void setReverseLoader(boolean reverseLoader) {
  -this.reverseLoader = reverseLoader;
  +this.cpDelegate.setReverseLoader(reverseLoader);
   log(The reverseloader attribute is DEPRECATED. It will be removed,
   Project.MSG_WARN);
   }
  @@ -103,7 +99,7 @@
   }
   
   public Path getClasspath() {
  -return classpath;
  +return cpDelegate.getClasspath();
   }
   
   public File getFile() {
  @@ -115,15 +111,15 @@
   }
   
   public boolean isReverseLoader() {
  -return reverseLoader;
  +return cpDelegate.isReverseLoader();
   }
   
   public String getLoaderId() {
  -return loaderId;
  +return cpDelegate.getClassLoadId();
   }
   
   public String getClasspathId() {
  -return classpathId;
  +return cpDelegate.getClassLoadId();
   }
   
   /**
  @@ -132,21 +128,14 @@
* @param classpath an Ant Path object containing the classpath.
*/
   public void setClasspath(Path classpath) {
  -if (this.classpath == null) {
  -this.classpath = classpath;
  -} else {
  -this.classpath.append(classpath);
  -}
  +this.cpDelegate.setClasspath(classpath);
   }
   
   /**
* Create the classpath to be used when searching for component being 
defined
*/
   public Path createClasspath() {
  -if (this.classpath == null) {
  -this.classpath = new Path(getProject());
  -}
  -return this.classpath.createPath();
  +return this.cpDelegate.createClasspath();
   }
   
   /**
  @@ -154,8 +143,7 @@
* To actually share the same loader, set loaderref as well
*/
   public void setClasspathRef(Reference r) {
  -classpathId=r.getRefId();
  -createClasspath().setRefid(r);
  +this.cpDelegate.setClasspathref(r);
   }
   
   /**
  @@ -170,7 +158,7 @@
* @since Ant 1.5
*/
   public void setLoaderRef(Reference r) {
  -loaderId = r.getRefId();
  +this.cpDelegate.setLoaderRef(r);
   }
   
   
  @@ -272,81 +260,12 @@
* create a classloader for this definition
*/
   private ClassLoader createLoader() {
  -// magic property
  -if (getProject().getProperty(REUSE_LOADER_REF) != null) {
  -// Generate the 'reuse' name automatically from the reference.
  -// This allows taskdefs that work on both ant1.4 and ant1.5.
  -// 

cvs commit: ant/src/main/org/apache/tools/ant/util ClasspathUtils.java

2003-04-14 Thread bodewig
bodewig 2003/04/14 00:06:55

  Added:   src/main/org/apache/tools/ant/util ClasspathUtils.java
  Log:
  Utility class to centralize all classloader and instante from custom
  classloader related actions.
  
  PR: 18906
  Submitted by: Marc Portier mpo at apache dot org
  
  Revision  ChangesPath
  1.1  
ant/src/main/org/apache/tools/ant/util/ClasspathUtils.java
  
  Index: ClasspathUtils.java
  ===
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *any, must include the following acknowlegement:
   *   This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/).
   *Alternately, this acknowlegement may appear in the software itself,
   *if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names Ant and Apache Software
   *Foundation must not be used to endorse or promote products derived
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called Apache
   *nor may Apache appear in their names without prior written
   *permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * http://www.apache.org/.
   */
  package org.apache.tools.ant.util;
  
  import org.apache.tools.ant.AntClassLoader;
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.types.Path;
  import org.apache.tools.ant.types.Reference;
  
  /**
   * Offers some helper methods on the Path structure in ant.
   *
   * pBasic idea behind this utility class is to use it from inside the 
   * different ant objects (and user defined objects) that need dclassLoading 
   * for their operation.
   * Normally those would have a setClasspathRef() {for the @@classpathref} 
   * and/or a createClasspath() {for the nested lt;classpathgt;}
   * Typically one would have/p 
   *
   * precode
   * public void setClasspathRef(Reference r) {
   * this.classpathId = r.getRefId();
   * createClasspath().setRefid(r);
   * }
   * 
   * public Path createClasspath() {
   * if (this.classpath == null) {
   * this.classpath = new Path(getProject());
   * }
   * return this.classpath.createPath();
   * }
   * 
   * public void setClassname(String fqcn) {
   * this.classname = fqcn;
   * }
   * /code/pre
   * 
   * pwhen you actually need the classloading you can just:/p
   * 
   * precode
   * ClassLoader cl = ClasspathUtils.getClassLoaderForPath(this.classpath, 
this.classpathId);
   * Object o = ClasspathUtils.newInstance(this.classname, cl);
   * /code/pre
   *
   * @since Ant 1.6
   */
  public class ClasspathUtils {
  private static final String LOADER_ID_PREFIX = ant.loader.;
  public static final String REUSE_LOADER_REF = ant.reuse.loader;
  
  /** 
   * Convenience overloaded version of [EMAIL PROTECTED]
   * #getClassLoaderForPath(Project, Reference, boolean)}.
   *
   * pAssumes the logical 'false' for the reverseLoader./p
   *  
   * @param path