ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r351741 - in /ant/core/trunk: docs/manual/CoreTypes/resources.html src/etc/testcases/types/resources/build.xml src/main/org/apache/tools/ant/types/resources/URLResource.java src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java
Date Fri, 02 Dec 2005 14:50:06 GMT
Author: mbenson
Date: Fri Dec  2 06:50:00 2005
New Revision: 351741

URL: http://svn.apache.org/viewcvs?rev=351741&view=rev
Log:
remove java resource support from URL resource in favor of JavaResource.

Modified:
    ant/core/trunk/docs/manual/CoreTypes/resources.html
    ant/core/trunk/src/etc/testcases/types/resources/build.xml
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/URLResource.java
    ant/core/trunk/src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java

Modified: ant/core/trunk/docs/manual/CoreTypes/resources.html
URL: http://svn.apache.org/viewcvs/ant/core/trunk/docs/manual/CoreTypes/resources.html?rev=351741&r1=351740&r2=351741&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTypes/resources.html (original)
+++ ant/core/trunk/docs/manual/CoreTypes/resources.html Fri Dec  2 06:50:00 2005
@@ -229,21 +229,7 @@
     <td valign="top">file</td>
     <td valign="top">The file to expose as a file: url</td>
   </tr>
-  <tr>
-    <td valign="top">javaresource</td>
-    <td valign="top">The Java resource to expose as a jar: url</td>
-  </tr>
-  <tr>
-    <td valign="top">classpath</td>
-    <td valign="top">The classpath to use when establishing the URL
-      for a Java resource</td>
-    <td align="center" valign="top">No</td>
-  </tr>
 </table>
-<p>The classpath along which to search for a Java resource
-  can also be specified by means of one or more nested
-  <code><a href="../using.html#path">classpath</a></code> elements.
-</p>
 
 <h4><a name="string">string</a></h4>
 

Modified: ant/core/trunk/src/etc/testcases/types/resources/build.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/etc/testcases/types/resources/build.xml?rev=351741&r1=351740&r2=351741&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/types/resources/build.xml (original)
+++ ant/core/trunk/src/etc/testcases/types/resources/build.xml Fri Dec  2 06:50:00 2005
@@ -346,24 +346,8 @@
     </fail>
   </target>
 
-  <target name="testresourceurl" depends="createjar">
-    <!-- test ref while we're at it -->
-    <url id="resourceurl"
-         javaresource="foo/c/z" classpath="${jar}" />
-    <fail>
-      <condition>
-        <resourcecount count="0">
-          <restrict>
-            <url refid="resourceurl" />
-            <rsel:exists />
-          </restrict>
-        </resourcecount>
-      </condition>
-    </fail>
-  </target>
-
   <target name="url"
-depends="testfileurl,testfileurlref,testhttpurl1,testhttpurl2,testjarurl,testresourceurl"
/>
+depends="testfileurl,testfileurlref,testhttpurl1,testhttpurl2,testjarurl" />
 
   <target name="testfile" depends="init">
     <echo file="${file}">This is a test.</echo>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/URLResource.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/URLResource.java?rev=351741&r1=351740&r2=351741&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/URLResource.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/URLResource.java Fri Dec
 2 06:50:00 2005
@@ -43,9 +43,7 @@
         = Resource.getMagicNumber("null URL".getBytes());
 
     private URL url;
-    private String javaResource;
     private URLConnection conn;
-    private Path classpath;
 
     /**
      * Default constructor.
@@ -100,37 +98,6 @@
     }
 
     /**
-     * Set the resource name with which to expose a Java resource.
-     * @param s the Java resource name.
-     * @see java.lang.ClassLoader#getResource(String)
-     */
-    public synchronized void setJavaResource(String s) {
-        checkAttributesAllowed();
-        javaResource = s;
-    }
-
-    /**
-     * Set the classpath for this URLResource.
-     * @param p the Path against which to resolve Java resources.
-     */
-    public synchronized void setClasspath(Path p) {
-        checkAttributesAllowed();
-        addConfiguredClasspath(p);
-    }
-
-    /**
-     * Create a nested classpath element.
-     * @return a Path object.
-     */
-    public synchronized void addConfiguredClasspath(Path p) {
-        checkChildrenAllowed();
-        if (classpath == null) {
-            classpath = new Path(getProject());
-        }
-        classpath.add(p);
-    }
-
-    /**
      * Get the URL used by this URLResource.
      * @return a URL object.
      */
@@ -138,25 +105,6 @@
         if (isReference()) {
             return ((URLResource) getCheckedRef()).getURL();
         }
-        if (url == null && javaResource != null) {
-            ClassLoader cl = null;
-            AntClassLoader acl = null;
-            if (classpath != null) {
-                acl = getProject().createClassLoader(classpath);
-                cl = acl;
-            } else {
-                cl = getClass().getClassLoader();
-                if (cl == null) {
-                    cl = ClassLoader.getSystemClassLoader();
-                }
-            }
-            if (cl != null) {
-                setURL(cl.getResource(javaResource));
-                if (acl != null) {
-                    acl.cleanup();
-                }
-            }
-        }
         return url;
      }
 
@@ -166,7 +114,7 @@
      */
     public synchronized void setRefid(Reference r) {
         //not using the accessor in this case to avoid side effects
-        if (url != null || javaResource != null) {
+        if (url != null) {
             throw tooManyAttributes();
         }
         super.setRefid(r);
@@ -370,4 +318,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java?rev=351741&r1=351740&r2=351741&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/types/ResourceCollectionsTest.java Fri
Dec  2 06:50:00 2005
@@ -117,10 +117,6 @@
         executeTarget("testresourcesref");
     }
 
-    public void testresourceurl() {
-        executeTarget("testresourceurl");
-    }
-
     public void teststring1() {
         executeTarget("teststring1");
     }



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


Mime
View raw message