cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Get.java

2004-11-18 Thread stevel
stevel  2004/11/18 08:00:18

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/repository
Repository.java Library.java MavenRepository.java
HttpRepository.java RepositoryRef.java
GetLibraries.java
   src/etc/testcases/taskdefs/optional getlibraries.xml
   src/testcases/org/apache/tools/ant/taskdefs/optional/repository
GetLibrariesTest.java
   src/main/org/apache/tools/ant/taskdefs Get.java
  Added:   src/main/org/apache/tools/ant/taskdefs/repository
EnabledLibraryElement.java
ScheduledUpdatePolicy.java
EnabledLibraryElementList.java
AbsentFilesPolicy.java TimestampPolicy.java
BaseLibraryPolicy.java LibraryPolicy.java
ForceUpdatePolicy.java NoUpdatePolicy.java
AssertDownloaded.java
  Log:
  Updated getlibraries code, plus new classes. After this
  checkin I'm about to move and rename some of the existing stuff.
  
  Revision  ChangesPath
  1.3   +9 -2  
ant/src/main/org/apache/tools/ant/taskdefs/optional/repository/Repository.java
  
  Index: Repository.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/repository/Repository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Repository.java   2 Nov 2004 23:37:21 -   1.2
  +++ Repository.java   18 Nov 2004 16:00:17 -  1.3
  @@ -99,11 +99,18 @@
   /**
* fetch a library from the repository
*
  - * @param library
  + * @param library library to fetch
*
  + * @param useTimestamp flag to indicate the timestamp of the lib should 
be used
* @return
*/
  -public abstract boolean fetch(Library library) throws IOException;
  +public abstract boolean fetch(Library library, boolean useTimestamp) 
throws IOException;
   
   
  +/**
  + * this is a string that uniquely describes the repository
  + * and can be used for equality tests iacross/i instances. 
  + * @return
  + */
  +public abstract String getRepositoryURI();
   }
  
  
  
  1.3   +126 -52   
ant/src/main/org/apache/tools/ant/taskdefs/optional/repository/Library.java
  
  Index: Library.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/repository/Library.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Library.java  30 Oct 2004 21:03:44 -  1.2
  +++ Library.java  18 Nov 2004 16:00:17 -  1.3
  @@ -18,8 +18,9 @@
   package org.apache.tools.ant.taskdefs.optional.repository;
   
   import org.apache.tools.ant.BuildException;
  -import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.taskdefs.repository.EnabledLibraryElement;
   import org.apache.tools.ant.types.Path;
  +import org.apache.tools.ant.util.FileUtils;
   
   import java.io.File;
   
  @@ -28,7 +29,30 @@
*
* @since Ant1.7
*/
  -public class Library {
  +public class Library implements EnabledLibraryElement {
  +
  +/**
  + * enabled flag
  + */
  +private boolean enabled = true;
  +
  +/**
  + * turn policy on/off
  + *
  + * @param enabled
  + */
  +public void setEnabled(boolean enabled) {
  +this.enabled = enabled;
  +}
  +
  +/**
  + * are we enabled
  + *
  + * @return true if [EMAIL PROTECTED] #enabled} is set
  + */
  +public boolean getEnabled() {
  +return enabled;
  +}
   
   //project ant
   private String project;
  @@ -52,14 +76,12 @@
   private File libraryFile;
   
   /**
  - * if clause
  + * we fetch every library by default; note the enabled/disabled
  + * flag has precedence, and this flag is not visible in the XML
*/
  -private String ifClause;
  +private boolean toFetch=true;
   
  -/**
  - * unless clause
  - */
  -private String unlessClause;
  +private boolean fetched=false;
   
   public static final String ERROR_NO_ARCHIVE = No archive defined;
   public static final String ERROR_NO_PROJECT = No project defined;
  @@ -70,6 +92,7 @@
* suffix
*/
   private String suffix = jar;
  +public static final String ERROR_FILE_IS_A_DIR = Library file is a 
directory:;
   
   
   /**
  @@ -155,38 +178,6 @@
   }
   
   /**
  - * a property that must be set for the library to be considered a 
dependency
  - * @return
  - */
  -public String getIf() {
  -return ifClause;
  -}
  -
  -/**
  - * a property that must be set for the library to be considered a 
dependency
  

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Get.java

2004-11-02 Thread stevel
stevel  2004/11/02 15:37:21

  Modified:.build.xml
   src/main/org/apache/tools/ant/taskdefs/optional/repository
Repository.java HttpRepository.java
MavenRepository.java GetLibraries.java
RepositoryRef.java
   src/testcases/org/apache/tools/ant/taskdefs/optional/repository
GetLibrariesTest.java
   src/etc/testcases/taskdefs/optional getlibraries.xml
   src/main/org/apache/tools/ant/taskdefs Get.java
  Log:
  1. Updated repository work; now has the following from Russel Gold's contrib
   -uses get to get
   -sets a classpath after
  2. some changes to Get to make this work. They also lay the way to adding 
progress indicators to guis, if that is felt useful in IDEs (it may be, once 
downloads become more common)
  3. starting on security. This will need to work with checksum to get done. 
Currently the md5 can be fetched if asked for, and if so it must exist.
  
  Revision  ChangesPath
  1.440 +0 -1  ant/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/ant/build.xml,v
  retrieving revision 1.439
  retrieving revision 1.440
  diff -u -r1.439 -r1.440
  --- build.xml 29 Oct 2004 08:54:32 -  1.439
  +++ build.xml 2 Nov 2004 23:37:20 -   1.440
  @@ -329,7 +329,6 @@
 /selector
   
 selector id=needs.apache-httpclient
  -filename name=${optional.package}/repository/**/*/
 /selector
   
   
  
  
  
  1.2   +1 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/repository/Repository.java
  
  Index: Repository.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/repository/Repository.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Repository.java   25 Oct 2004 23:13:38 -  1.1
  +++ Repository.java   2 Nov 2004 23:37:21 -   1.2
  @@ -53,7 +53,7 @@
   if (getRefid() == null) {
   return this;
   } else {
  -Repository repository = (Repository) 
getCheckedRef(this.getClass(),
  +Repository repository = (Repository) 
getCheckedRef(Repository.class, 
   Repository);
   return repository;
   }
  
  
  
  1.3   +44 -145   
ant/src/main/org/apache/tools/ant/taskdefs/optional/repository/HttpRepository.java
  
  Index: HttpRepository.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/repository/HttpRepository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpRepository.java   30 Oct 2004 21:03:44 -  1.2
  +++ HttpRepository.java   2 Nov 2004 23:37:21 -   1.3
  @@ -16,25 +16,15 @@
*/
   package org.apache.tools.ant.taskdefs.optional.repository;
   
  -import org.apache.commons.httpclient.Credentials;
  -import org.apache.commons.httpclient.DefaultMethodRetryHandler;
  -import org.apache.commons.httpclient.HttpClient;
  -import org.apache.commons.httpclient.HttpMethod;
  -import org.apache.commons.httpclient.HttpStatus;
  -import org.apache.commons.httpclient.UsernamePasswordCredentials;
  -import org.apache.commons.httpclient.cookie.CookiePolicy;
  -import org.apache.commons.httpclient.methods.GetMethod;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.util.FileUtils;
  +import org.apache.tools.ant.taskdefs.Get;
   
   import java.io.File;
  -import java.io.FileOutputStream;
   import java.io.IOException;
  -import java.io.InputStream;
   import java.net.MalformedURLException;
   import java.net.URL;
  -import java.util.Date;
   
   /**
* This is a base class for repositories that are built on URLs. Although you
  @@ -59,21 +49,10 @@
*/
   private String password;
   
  -
   /**
* auth realm; can be null
*/
  -private String realm;
  -
  -/**
  - * this is our http client
  - */
  -private HttpClient client;
  -
  -/**
  - * number of times to retry fetches
  - */
  -private int retries = 1;
  +//private String realm;
   
   /**
* no repository URL
  @@ -88,7 +67,6 @@
   /**
* retry logic
*/
  -private DefaultMethodRetryHandler retryhandler;
   public static final String ERROR_REENTRANT_USE = Repository is already 
in use;
   private static final String IF_MODIFIED_SINCE = If-Modified-Since;
   private static final int BLOCKSIZE = 8192;
  @@ -136,10 +114,12 @@
   public void setPassword(String password) {
   this.password = password;
   }
  +/*
   
   public String getRealm() {
   return realm;
   }
  +*/
 

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Get.java

2003-05-14 Thread bodewig
bodewig 2003/05/14 06:37:21

  Modified:src/main/org/apache/tools/ant/taskdefs Get.java
  Log:
  Provide more feedback while geting in verbose mode
  
  Revision  ChangesPath
  1.33  +5 -0  ant/src/main/org/apache/tools/ant/taskdefs/Get.java
  
  Index: Get.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Get.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Get.java  10 Feb 2003 14:13:34 -  1.32
  +++ Get.java  14 May 2003 13:37:21 -  1.33
  @@ -218,11 +218,16 @@
   try {
   byte[] buffer = new byte[100 * 1024];
   int length;
  +int dots = 0;
   
   while ((length = is.read(buffer)) = 0) {
   fos.write(buffer, 0, length);
   if (verbose) {
   System.out.print(.);
  +if (dots++  50) {
  +System.out.flush();
  +dots = 0;
  +}
   }
   }
   if (verbose) {