You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by lu...@apache.org on 2004/08/15 14:57:17 UTC
cvs commit: jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs Copy.java Move.java
luetzkendorf 2004/08/15 05:57:17
Modified: webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs
Tag: SLIDE_2_1_RELEASE_BRANCH Copy.java Move.java
Log:
support for relative destination uris added
Revision Changes Path
No revision
No revision
1.2.2.1 +19 -6 jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java
Index: Copy.java
===================================================================
RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- Copy.java 28 Jul 2004 09:31:47 -0000 1.2
+++ Copy.java 15 Aug 2004 12:57:17 -0000 1.2.2.1
@@ -22,6 +22,9 @@
import java.io.IOException;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.URIException;
+
import org.apache.tools.ant.BuildException;
import org.apache.webdav.ant.Utils;
import org.apache.webdav.lib.methods.DepthSupport;
@@ -34,8 +37,9 @@
public class Copy extends WebdavMatchingTask {
private String destination;
- private int depth;
- private boolean overwrite;
+ private int depth = DepthSupport.DEPTH_INFINITY;
+ private boolean overwrite = false;
+ private HttpURL destinationURL;
/*
* @see org.apache.tools.ant.Task#execute()
@@ -43,11 +47,12 @@
public void execute() throws BuildException {
validate();
try {
+ // TODO assure that the colletion to which we copy does exist
log("Copying " + getUrl(), ifVerbose());
Utils.copyResource(
getHttpClient(),
getUrl(),
- this.destination,
+ this.destinationURL.getURI(),
this.depth,
this.overwrite
);
@@ -82,6 +87,14 @@
super.validate();
if (destination == null) {
throw new BuildException("Missing required attribute destination");
+ }
+
+ try {
+ this.destinationURL = Utils.createHttpURL(getUrl(), this.destination);
+ this.destinationURL.setPath(removeDoubleSlashes(
+ this.destinationURL.getPath()));
+ } catch (URIException e) {
+ throw new BuildException("Invalid destination uri!", e);
}
}
1.3.2.1 +16 -4 jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Move.java
Index: Move.java
===================================================================
RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Move.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- Move.java 28 Jul 2004 09:31:47 -0000 1.3
+++ Move.java 15 Aug 2004 12:57:17 -0000 1.3.2.1
@@ -22,6 +22,9 @@
import java.io.IOException;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.URIException;
+
import org.apache.tools.ant.BuildException;
import org.apache.webdav.ant.Utils;
@@ -34,6 +37,7 @@
private String destination;
private boolean overwrite;
+ private HttpURL destinationURL;
/*
* @see org.apache.tools.ant.Task#execute()
@@ -45,7 +49,7 @@
Utils.moveResource(
getHttpClient(),
getUrl(),
- this.destination,
+ this.destinationURL.getURI(),
this.overwrite
);
}
@@ -66,6 +70,14 @@
super.validate();
if (destination == null) {
throw new BuildException("Missing required attribute destination");
+ }
+
+ try {
+ this.destinationURL = Utils.createHttpURL(getUrl(), this.destination);
+ this.destinationURL.setPath(removeDoubleSlashes(
+ this.destinationURL.getPath()));
+ } catch (URIException e) {
+ throw new BuildException("Invalid destination uri!", e);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org