Author: imario
Date: Wed Aug 10 12:36:15 2005
New Revision: 231298
URL: http://svn.apache.org/viewcvs?rev=231298&view=rev
Log:
PR: 34942 and maybe 35958
need to support nested tasks in ant.
upgrade to ant 1.6.2
Thanks to Jacob Kjome
Modified:
jakarta/commons/proper/vfs/trunk/project.xml
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/tasks/VfsTask.java
jakarta/commons/proper/vfs/trunk/xdocs/download.xml
Modified: jakarta/commons/proper/vfs/trunk/project.xml
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/project.xml?rev=231298&r1=231297&r2=231298&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/project.xml (original)
+++ jakarta/commons/proper/vfs/trunk/project.xml Wed Aug 10 12:36:15 2005
@@ -94,7 +94,7 @@
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
- <version>1.5</version>
+ <version>1.6.2</version>
</dependency>
<dependency>
@@ -177,7 +177,7 @@
<exclude>**/test/Abstract*TestCase.java</exclude>
</excludes>
</unitTest>
-
+
<!-- J A R R E S O U R C E S -->
<!-- Resources that are packaged up inside the JAR file -->
<resources>
@@ -202,9 +202,9 @@
<!--<report>maven-changelog-plugin</report>-->
<report>maven-changes-plugin</report>
<!-- <report>maven-checkstyle-plugin</report> -->
-<!--
- <report>maven-clover-plugin</report>
--->
+ <!--
+ <report>maven-clover-plugin</report>
+ -->
<!--
<report>maven-developer-activity-plugin</report>
<report>maven-file-activity-plugin</report>
Modified:
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/tasks/VfsTask.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/tasks/VfsTask.java?rev=231298&r1=231297&r2=231298&view=diff
==============================================================================
---
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/tasks/VfsTask.java
(original)
+++
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/tasks/VfsTask.java
Wed Aug 10 12:36:15 2005
@@ -18,11 +18,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemException;
-import org.apache.commons.vfs.VFS;
import org.apache.commons.vfs.impl.StandardFileSystemManager;
import org.apache.tools.ant.BuildEvent;
-import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.SubBuildListener;
import org.apache.tools.ant.Task;
/**
@@ -36,22 +35,7 @@
public class VfsTask
extends Task
{
- // private static StandardFileSystemManager manager;
-
- /**
- * Hold the reference to VFS and a refcounter.
- *
- * For every "target" which is called within the current target the
refcount is incremented.
- * When the target ends this refcount is decremented.
- * If 0 is reached VFS will shutdown.
- */
- private static class VfsRef
- {
- StandardFileSystemManager manager;
-
- // start with refcount 1 as we are in an ant "target"
- volatile int refcount = 1;
- }
+ private static StandardFileSystemManager manager;
/**
* Resolves a URI to a file, relative to the project's base directory.
@@ -61,61 +45,50 @@
protected FileObject resolveFile(final String uri)
throws FileSystemException
{
- VfsRef vfsRef = (VfsRef)
getProject().getReference(VFS.class.getName());
- if (vfsRef == null)
+ if (manager == null)
{
- vfsRef = new VfsRef();
+ manager = new StandardFileSystemManager();
+ manager.setLogger(new AntLogger());
+ manager.init();
+ getProject().addBuildListener(new CloseListener());
}
+ return manager.resolveFile(getProject().getBaseDir(), uri);
+ }
- synchronized(vfsRef)
+ /**
+ * Close the manager
+ */
+ protected void closeManager()
+ {
+ if (manager != null)
{
- if (vfsRef.manager == null)
- {
- vfsRef.manager = new StandardFileSystemManager();
- vfsRef.manager.setLogger(new AntLogger());
- vfsRef.manager.init();
- getProject().addBuildListener(new CloseListener());
-
- getProject().addReference(VFS.class.getName(), vfsRef);
- }
+ manager.close();
+ manager = null;
}
-
- return vfsRef.manager.resolveFile(getProject().getBaseDir(), uri);
}
/**
* Closes the VFS manager when the project finishes.
*/
private class CloseListener
- implements BuildListener
+ implements SubBuildListener
{
- public void subBuildStarted(BuildEvent event)
+ public void subBuildStarted(BuildEvent buildEvent)
{
- // event.getProject().log("subbuild started", Project.MSG_ERR);
}
- public void subBuildFinished(BuildEvent event)
+ public void subBuildFinished(BuildEvent buildEvent)
{
- // event.getProject().log("subbuild finished", Project.MSG_ERR);
+ closeManager();
}
public void buildFinished(BuildEvent event)
{
- // event.getProject().log("build finished", Project.MSG_ERR);
-
- /*
- VfsRef vfsRef = (VfsRef)
getProject().getReference(VFS.class.getName());
- if (vfsRef != null)
- {
- vfsRef.manager.close();
- vfsRef = null;
- }
- */
+ closeManager();
}
public void buildStarted(BuildEvent event)
{
- // event.getProject().log("build started", Project.MSG_ERR);
}
public void messageLogged(BuildEvent event)
@@ -124,53 +97,18 @@
public void targetFinished(BuildEvent event)
{
- // event.getProject().log("target finished", Project.MSG_ERR);
-
- VfsRef vfsRef = (VfsRef)
getProject().getReference(VFS.class.getName());
- if (vfsRef != null)
- {
- synchronized(vfsRef)
- {
- if (vfsRef.manager != null)
- {
- vfsRef.refcount--;
- if (vfsRef.refcount < 1)
- {
- vfsRef.manager.close();
- vfsRef.manager = null;
- }
- }
-
- getProject().removeBuildListener(CloseListener.this);
- }
- }
}
public void targetStarted(BuildEvent event)
{
- // event.getProject().log("target started", Project.MSG_ERR);
-
- VfsRef vfsRef = (VfsRef)
getProject().getReference(VFS.class.getName());
- if (vfsRef != null)
- {
- synchronized(vfsRef)
- {
- if (vfsRef.manager != null)
- {
- vfsRef.refcount++;
- }
- }
- }
}
public void taskFinished(BuildEvent event)
{
- // event.getProject().log("task finished", Project.MSG_ERR);
}
public void taskStarted(BuildEvent event)
{
- // event.getProject().log("task started", Project.MSG_ERR);
}
}
Modified: jakarta/commons/proper/vfs/trunk/xdocs/download.xml
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/xdocs/download.xml?rev=231298&r1=231297&r2=231298&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/xdocs/download.xml (original)
+++ jakarta/commons/proper/vfs/trunk/xdocs/download.xml Wed Aug 10 12:36:15 2005
@@ -9,7 +9,8 @@
<section name="Download">
<p>
Nightly builds of Commons VFS can be found
- <a
href="http://cvs.apache.org/builds/jakarta-commons/nightly/commons-vfs/">here</a>.
+ <a
href="http://cvs.apache.org/builds/jakarta-commons/nightly/commons-vfs/">here</a>
+ .
</p>
<p>
You will also need to download the jars used by Commons VFS.
@@ -39,20 +40,23 @@
<tr>
<td>
Jakarta
- <a
href="http://jakarta.apache.org/commons/net/">Commons Net</a> Version 1.2.1 or
later.
+ <a
href="http://jakarta.apache.org/commons/net/">Commons Net</a>
+ Version 1.2.1 or later.
</td>
<td rowspan="2">FTP</td>
</tr>
<tr>
<td>
Jakarta
- <a href="http://jakarta.apache.org/oro/">ORO</a>
Version 2.0.8
+ <a href="http://jakarta.apache.org/oro/">ORO</a>
+ Version 2.0.8
</td>
</tr>
<tr>
<td>
Jakarta
- <a
href="http://jakarta.apache.org/commons/httpclient/">Commons Httpclient</a>.
+ <a
href="http://jakarta.apache.org/commons/httpclient/">Commons Httpclient</a>
+ .
Version 2.0 or later.
</td>
<td>
@@ -64,8 +68,10 @@
<tr>
<td>
jdom.org
- <a href="http://www.jdom.org">JDom</a>.
- Version 1.0.<br />
+ <a href="http://www.jdom.org">JDom</a>
+ .
+ Version 1.0.
+ <br/>
Only needed if you use webdav 2.2+
</td>
<td>
@@ -75,28 +81,38 @@
<tr>
<td>
Jakarta
- <a href="http://jakarta.apache.org/slide/">Slide</a>
Version 2.2pre1 (20050629.002841)<br />
- You only need this bleeding edge version if you would
like to use the RandomAccessContent with webdav
+ <a href="http://jakarta.apache.org/slide/">Slide</a>
+ Version 2.2pre1 (20050629.002841)
+ <br/>
+ You only need this bleeding edge version if you would
like to use the RandomAccessContent with
+ webdav
</td>
<td>WebDAV</td>
</tr>
<tr>
<td>
- <a href="http://jcifs.samba.org/">jCIFS</a> Version
0.8.3 or later.
+ <a href="http://jcifs.samba.org/">jCIFS</a>
+ Version 0.8.3 or later.
</td>
<td>CIFS</td>
</tr>
<tr>
<td>
- <a href="http://www.jcraft.com/jsch/">JSch</a> Version
0.1.14 or later.
+ <a href="http://www.jcraft.com/jsch/">JSch</a>
+ Version 0.1.14 or later.
</td>
<td>SFTP</td>
</tr>
<tr>
<td>
- <a
href="http://jakarta.apache.org/commons/sandbox/compress/">Commons Compress</a>
Nightly build 20040530<br />
- There are no other nightlies than the one I created
for maven, so please download it from the link below until this changes:<br/>
- <a
href="http://www.ibiblio.org/maven/commons-compress/jars/commons-compress-20040530.jar">http://www.ibiblio.org/maven/commons-compress/jars/commons-compress-20040530.jar</a>
+ <a
href="http://jakarta.apache.org/commons/sandbox/compress/">Commons Compress</a>
+ Nightly build 20040530
+ <br/>
+ There are no other nightlies than the one I created
for maven, so please download it from the
+ link below until this changes:
+ <br/>
+ <a
href="http://www.ibiblio.org/maven/commons-compress/jars/commons-compress-20040530.jar">
+
http://www.ibiblio.org/maven/commons-compress/jars/commons-compress-20040530.jar</a>
</td>
<td>tar, bz2</td>
</tr>
@@ -108,13 +124,19 @@
</p>
<ul>
<li>
- Check the source out of SVN using:<br/>
- HEAD: <code>svn co
http://svn.apache.org/repos/asf/jakarta/commons/proper/vfs/trunk vfs</code><br/>
- For a certain version please look at <a
href="http://svn.apache.org/repos/asf/jakarta/commons/proper/vfs/tags">http://svn.apache.org/repos/asf/jakarta/commons/proper/vfs/tags</a>
+ Check the source out of SVN using:
+ <br/>
+ HEAD:
+ <code>svn co
http://svn.apache.org/repos/asf/jakarta/commons/proper/vfs/trunk vfs</code>
+ <br/>
+ For a certain version please look at
+ <a
href="http://svn.apache.org/repos/asf/jakarta/commons/proper/vfs/tags">
+
http://svn.apache.org/repos/asf/jakarta/commons/proper/vfs/tags</a>
</li>
<li>
Download a nightly source snapshot from
- <a
href="http://cvs.apache.org/builds/jakarta-commons/nightly/commons-vfs/">here</a>.
+ <a
href="http://cvs.apache.org/builds/jakarta-commons/nightly/commons-vfs/">here</a>
+ .
</li>
</ul>
<p>
@@ -123,22 +145,27 @@
<ul>
<li>
Use
- <a href="http://ant.apache.org">Ant</a> 1.5 or later.
+ <a href="http://ant.apache.org">Ant</a>
+ 1.6.2 or later.
Use the
- <code>build.xml</code> file in the root source
- directory. The default target downloads the dependencies
+ <code>build.xml</code>
+ file in the root source
+ directory. The default target downloads the dependencies
used to build Commons VFS, and then builds the jar file
into the
- <code>target</code> directory.
+ <code>target</code>
+ directory.
</li>
<li>
Use
<a href="http://maven.apache.org">Maven</a>
beta 9 or later. Use the
- <code>jar</code> goal to download
- the dependencies, and build the VFS jar. Maven builds the
+ <code>jar</code>
+ goal to download
+ the dependencies, and build the VFS jar. Maven builds the
jar file into the
- <code>target</code> directory.
+ <code>target</code>
+ directory.
</li>
</ul>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]