fr.paris5.shaman.legend.ant
Class WebdavPut
java.lang.Object
|
+--org.apache.tools.ant.ProjectComponent
|
+--org.apache.tools.ant.Task
|
+--org.apache.tools.ant.taskdefs.MatchingTask
|
+--fr.paris5.shaman.legend.ant.WebdavPut
- public class WebdavPut
- extends org.apache.tools.ant.taskdefs.MatchingTask
Puts a bunch of files on to a WebDAV-compliant web server.
To use this task, first you must define it in your Ant build file:
<taskdef name="davput" classname="fr.paris5.shaman.legend.ant.WebdavPut"/>
Next, specify a specific target, such as:
<target name="upload" depends="init">
<davput
url="http://localhost/dav/"
userid="hpotter"
password="muggle"
createremotedirs="yes"
>
<fileset dir=".">
<include name="*.html"/>
</fileset>
</davput>
</target>
This task is based on org.apache.webdav.ant.taskdefs.Put provided
with Jakarta-Slide 1.0.16, and originally written by
B.C. Holmes. The original
implementation does not allow creating new collections (directories).
The current implementation is not optimized, and has not been extensively
tested.
- Version:
- $Id: WebdavPut.java,v 1.1 2002/07/04 13:36:23 caillette Exp $
- Author:
- Laurent Caillette
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
fileset, useDefaultExcludes |
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Method Summary |
(package private) static void |
()
|
void |
addFileset(org.apache.tools.ant.types.FileSet set)
Adds a set of files (nested fileset attribute). |
protected java.lang.String |
concatenate(java.lang.String first,
java.lang.String second,
java.lang.String separator)
|
protected void |
createRemoteDirIfNotExists(java.lang.String remoteBaseDir,
java.lang.String filePath)
Stupid implementation. |
void |
execute()
Does the work. |
protected java.net.URL |
fileToURL(java.io.File file)
The purpose of this method is to convert a File instance into a
"file:" URL. |
boolean |
getCreateremotedirs()
|
boolean |
getLock()
Should we try to lock the remote resource as we upload it? |
java.lang.String |
getPassword()
Get a password to access the resources |
private static java.util.Enumeration |
getResourceTypePropertyTags()
|
java.lang.String |
getUrl()
|
java.lang.String |
getUserid()
Get a userid to access the resources |
void |
setCreateremotedirs(boolean create)
|
void |
setLock(boolean lock)
|
void |
setPassword(java.lang.String password)
Set a password to access the resources |
void |
setUrl(java.lang.String url)
Set the base URL. |
void |
setUserid(java.lang.String userid)
Set a userid to access the resources |
protected void |
uploadFiles(java.lang.String urlFile,
org.apache.tools.ant.FileScanner scanner)
|
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, setDefaultexcludes, setExcludes, setExcludesfile, setIncludes, setIncludesfile, XsetIgnore, XsetItems |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
toURL
private java.lang.String toURL
userid
private java.lang.String userid
password
private java.lang.String password
lock
private boolean lock
filesets
private java.util.Vector filesets
- The sets of files that will be sent to the web server.
client
protected org.apache.commons.httpclient.HttpClient client
createRemoteDirs
private boolean createRemoteDirs
RESOURCETYPEPROPERTY_TAGLIST
private static final java.util.Vector RESOURCETYPEPROPERTY_TAGLIST
WebdavPut
public WebdavPut()
addFileset
public void addFileset(org.apache.tools.ant.types.FileSet set)
- Adds a set of files (nested fileset attribute).
getLock
public boolean getLock()
- Should we try to lock the remote resource as we upload it?
- Parameters:
userid
- - HTTP userid
setLock
public void setLock(boolean lock)
getUserid
public java.lang.String getUserid()
- Get a userid to access the resources
setUserid
public void setUserid(java.lang.String userid)
- Set a userid to access the resources
- Parameters:
userid
- - HTTP userid
getPassword
public java.lang.String getPassword()
- Get a password to access the resources
setPassword
public void setPassword(java.lang.String password)
- Set a password to access the resources
- Parameters:
password
- - HTTP password
getUrl
public java.lang.String getUrl()
setUrl
public void setUrl(java.lang.String url)
- Set the base URL.
- Parameters:
base
- URL for the request.
getCreateremotedirs
public boolean getCreateremotedirs()
setCreateremotedirs
public void setCreateremotedirs(boolean create)
execute
public void execute()
throws org.apache.tools.ant.BuildException
- Does the work.
- Overrides:
execute
in class org.apache.tools.ant.Task
- Throws:
org.apache.tools.ant.BuildException
- Thrown in unrecoverable error.
static void ()
getResourceTypePropertyTags
private static java.util.Enumeration getResourceTypePropertyTags()
createRemoteDirIfNotExists
protected void createRemoteDirIfNotExists(java.lang.String remoteBaseDir,
java.lang.String filePath)
- Stupid implementation. Performs a check each time, no caching.
- Parameters:
filePath
-
uploadFiles
protected void uploadFiles(java.lang.String urlFile,
org.apache.tools.ant.FileScanner scanner)
throws org.apache.commons.httpclient.HttpException,
java.io.IOException
concatenate
protected java.lang.String concatenate(java.lang.String first,
java.lang.String second,
java.lang.String separator)
fileToURL
protected java.net.URL fileToURL(java.io.File file)
throws java.net.MalformedURLException
- The purpose of this method is to convert a File instance into a
"file:" URL. Basically, it does what the
File.toURL()
does, but unfortunately, that method requires JDK1.2.
Copyright © 2002 Laurent Caillette and l'Université René Descartes, Paris 5. All rights reserved.