org.apache.tools.ant.taskdefs
Class Get

java.lang.Object
  |
  +--org.apache.tools.ant.Task
        |
        +--org.apache.tools.ant.taskdefs.Get

public class Get
extends Task

Get a particular file from a URL source. Options include verbose reporting, timestamp based fetches and controlling actions on failures. NB: access through a firewall only works if the whole Java runtime is correctly configured.

Author:
costin@dnt.ro

Fields inherited from class org.apache.tools.ant.Task
description, location, project, target, taskName, taskType, wrapper
 
Constructor Summary
Get()
           
 
Method Summary
 void execute()
          Does the work.
 void setDest(java.io.File dest)
          Where to copy the source file.
 void setIgnoreErrors(boolean v)
          Don't stop if get fails if set to "true".
 void setSrc(java.net.URL u)
          Set the URL.
 void setUseTimestamp(boolean v)
          Use timestamps, if set to "true".
 void setVerbose(boolean v)
          Be verbose, if set to "true".
protected  boolean touchFile(java.io.File file, long timemillis)
          set the timestamp of a named file to a specified time.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Get

public Get()
Method Detail

execute

public void execute()
             throws BuildException
Does the work.
Overrides:
execute in class Task
Throws:
BuildException - Thrown in unrecoverable error.

touchFile

protected boolean touchFile(java.io.File file,
                            long timemillis)
                     throws BuildException
set the timestamp of a named file to a specified time.
Parameters:
filename -  
time - in milliseconds since the start of the era
Returns:
true if it succeeded. False means that this is a java1.1 system and that file times can not be set
Throws:
BuildException - Thrown in unrecoverable error. Likely this comes from file access failures.

setSrc

public void setSrc(java.net.URL u)
Set the URL.
Parameters:
u - URL for the file.

setDest

public void setDest(java.io.File dest)
Where to copy the source file.
Parameters:
dest - Path to file.

setVerbose

public void setVerbose(boolean v)
Be verbose, if set to "true".
Parameters:
v - if "true" then be verbose

setIgnoreErrors

public void setIgnoreErrors(boolean v)
Don't stop if get fails if set to "true".
Parameters:
v - if "true" then don't report download errors up to ant

setUseTimestamp

public void setUseTimestamp(boolean v)
Use timestamps, if set to "true".

In this situation, the if-modified-since header is set so that the file is only fetched if it is newer than the local file (or there is no local file) This flag is only valid on HTTP connections, it is ignored in other cases. When the flag is set, the local copy of the downloaded file will also have its timestamp set to the remote file time.
Note that remote files of date 1/1/1970 (GMT) are treated as 'no timestamp', and web servers often serve files with a timestamp in the future by replacing their timestamp with that of the current time. Also, inter-computer clock differences can cause no end of grief.

Parameters:
v - "true" to enable file time fetching


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.