krysalis-update/src/java/org/krysalis/depot/update/ant/cache CachedArtifactSetExportTask.java,1.1,1.2 CachedArtifactFileSet.java,1.1,1.2 RepositoryElement.java,1.1,1.2 ArtifactElement.java,1.1,1.2 CachedArtifactSet.java,1.2,1.3

Nick Chalko <[email protected]> Wed, 08 Dec 2004 09:12:02 +0000
Newsgroups gmane.comp.krysalis.cvs
Message-ID <[email protected]>
Update of /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ant/cache
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26470/src/java/org/krysalis/depot/update/ant/cache

Modified Files:
	CachedArtifactSetExportTask.java CachedArtifactFileSet.java 
	RepositoryElement.java ArtifactElement.java 
	CachedArtifactSet.java 
Log Message:
format

Index: CachedArtifactSet.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ant/cache/CachedArtifactSet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CachedArtifactSet.java	8 Dec 2004 09:09:46 -0000	1.2
--- CachedArtifactSet.java	8 Dec 2004 09:11:55 -0000	1.3
***************
*** 70,74 ****
  
  	/**
! 	 *  
  	 */
  	public CachedArtifactSet(Project project) {
--- 70,74 ----
  
  	/**
! 	 * 
  	 */
  	public CachedArtifactSet(Project project) {

Index: ArtifactElement.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ant/cache/ArtifactElement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactElement.java	8 Dec 2004 09:07:08 -0000	1.1
--- ArtifactElement.java	8 Dec 2004 09:11:55 -0000	1.2
***************
*** 17,20 ****
--- 17,21 ----
   */
  package org.krysalis.depot.update.ant.cache;
+ 
  import java.io.File;
  
***************
*** 48,51 ****
--- 49,53 ----
  import org.krysalis.version.VersionException;
  import org.krysalis.version.impl.apache.ApacheVersion;
+ 
  /**
   * @version $Revision$
***************
*** 53,61 ****
--- 55,69 ----
  public class ArtifactElement extends DataType {
  	private String group;
+ 
  	private String name;
+ 
  	private String version;
+ 
  	private String repository;
+ 
  	private String ext;
+ 
  	private ArtifactInstance bestRemoteArtifact;
+ 
  	private final Project project;
  
***************
*** 128,134 ****
  	ArtifactInstance initArtifact() {
  		ArtifactInstance r = new ArtifactInstance(
! 					new Artifact(getArtifactGroup(), name, getArtifactType(), getVersionObject()
! 						), 
! 						new ArtifactLocator(getFileName(),
  						ext, getLocation()));
  		return r;
--- 136,141 ----
  	ArtifactInstance initArtifact() {
  		ArtifactInstance r = new ArtifactInstance(
! 				new Artifact(getArtifactGroup(), name, getArtifactType(),
! 						getVersionObject()), new ArtifactLocator(getFileName(),
  						ext, getLocation()));
  		return r;
***************
*** 203,207 ****
  	 */
  	public Repository getIRepository() {
! 		RepositoryElement repositoryElement = (RepositoryElement) project.getReference(getRepository());
  		return new DefaultRepository(repositoryElement.getId(),
  				new VirtualResourceLocator(repositoryElement.getUrl()));
--- 210,215 ----
  	 */
  	public Repository getIRepository() {
! 		RepositoryElement repositoryElement = (RepositoryElement) project
! 				.getReference(getRepository());
  		return new DefaultRepository(repositoryElement.getId(),
  				new VirtualResourceLocator(repositoryElement.getUrl()));
***************
*** 209,213 ****
  
  	/**
! 	 *  
  	 */
  	public ArtifactElement(Project project) {
--- 217,221 ----
  
  	/**
! 	 * 
  	 */
  	public ArtifactElement(Project project) {
***************
*** 221,225 ****
  		set.addSelector(new TypeSelector(getArtifactType()));
  		if (null != version) {
! 			set.addSelector(new VersionSelector( new ApacheVersion(version)));
  		}
  		return (ISelector) set;
--- 229,233 ----
  		set.addSelector(new TypeSelector(getArtifactType()));
  		if (null != version) {
! 			set.addSelector(new VersionSelector(new ApacheVersion(version)));
  		}
  		return (ISelector) set;
***************
*** 234,238 ****
  		}
  		if (bestRemoteArtifact != null) {
! 			return bestRemoteArtifact.getLocator().getLocation().toExternalForm();
  		} else {
  			return null;
--- 242,247 ----
  		}
  		if (bestRemoteArtifact != null) {
! 			return bestRemoteArtifact.getLocator().getLocation()
! 					.toExternalForm();
  		} else {
  			return null;
***************
*** 275,279 ****
  	}
  
! 	ArtifactResult query(Repository repo) { //TODO
  		// experiment
  		getProject().log("Looking for " + this, Project.MSG_DEBUG);
--- 284,288 ----
  	}
  
! 	ArtifactResult query(Repository repo) { // TODO
  		// experiment
  		getProject().log("Looking for " + this, Project.MSG_DEBUG);
***************
*** 282,291 ****
  			ArtifactQuery query = new ArtifactQuery(getArtifactGroup(),
  					getArtifactSelector(), null, VersionComparator.REVERSE);
! 			//TODO need to be a better way to sort by.
  			ArtifactUpdaterContext context = new ArtifactUpdaterContext();
  			context.setProtocolManager(new DefaultProtocolOperationsManager(
  					context));
! 			RepositorySet repositorySet = RepositorySet.getRepositorySet(
! 					repo.getIdentifier().getId(), true);
  			repositorySet.addRepository(repo);
  			RepositorySetWrapper rw = new RepositorySetWrapper(repositorySet,
--- 291,300 ----
  			ArtifactQuery query = new ArtifactQuery(getArtifactGroup(),
  					getArtifactSelector(), null, VersionComparator.REVERSE);
! 			// TODO need to be a better way to sort by.
  			ArtifactUpdaterContext context = new ArtifactUpdaterContext();
  			context.setProtocolManager(new DefaultProtocolOperationsManager(
  					context));
! 			RepositorySet repositorySet = RepositorySet.getRepositorySet(repo
! 					.getIdentifier().getId(), true);
  			repositorySet.addRepository(repo);
  			RepositorySetWrapper rw = new RepositorySetWrapper(repositorySet,

Index: CachedArtifactFileSet.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ant/cache/CachedArtifactFileSet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CachedArtifactFileSet.java	8 Dec 2004 09:07:08 -0000	1.1
--- CachedArtifactFileSet.java	8 Dec 2004 09:11:55 -0000	1.2
***************
*** 17,20 ****
--- 17,21 ----
   */
  package org.krysalis.depot.update.ant.cache;
+ 
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.DirectoryScanner;
***************
*** 22,35 ****
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.types.FileSet;
  /**
!  *  
   */
  final class CachedArtifactFileSet extends FileSet {
  	private final CachedArtifactSet updateSet;
  	private boolean initialized = false;
  	private FileScanner scanner;
  	CachedArtifactFileSet(CachedArtifactSet updateSet) {
  		this.updateSet = updateSet;
  	}
  	private synchronized void initialize() {
  		if (!initialized) {
--- 23,41 ----
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.types.FileSet;
+ 
  /**
!  * 
   */
  final class CachedArtifactFileSet extends FileSet {
  	private final CachedArtifactSet updateSet;
+ 
  	private boolean initialized = false;
+ 
  	private FileScanner scanner;
+ 
  	CachedArtifactFileSet(CachedArtifactSet updateSet) {
  		this.updateSet = updateSet;
  	}
+ 
  	private synchronized void initialize() {
  		if (!initialized) {
***************
*** 42,50 ****
  				throw e;
  			} catch (Exception e) {
! 				throw new BuildException("error initializing " + getDataTypeName(), e);
  			}
  		}
  		initialized = true;
  	}
  	/*
  	 * (non-Javadoc)
--- 48,58 ----
  				throw e;
  			} catch (Exception e) {
! 				throw new BuildException("error initializing "
! 						+ getDataTypeName(), e);
  			}
  		}
  		initialized = true;
  	}
+ 
  	/*
  	 * (non-Javadoc)
***************
*** 56,61 ****
  		return super.getDirectoryScanner(p);
  	}
  	/**
! 	 *  
  	 */
  	private void initIfNeeded() {
--- 64,70 ----
  		return super.getDirectoryScanner(p);
  	}
+ 
  	/**
! 	 * 
  	 */
  	private void initIfNeeded() {

Index: RepositoryElement.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ant/cache/RepositoryElement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RepositoryElement.java	8 Dec 2004 09:07:08 -0000	1.1
--- RepositoryElement.java	8 Dec 2004 09:11:55 -0000	1.2
***************
*** 21,34 ****
  import org.apache.tools.ant.types.DataType;
  
-  
  /**
   * Describes a Repository for use in other Depot Ant tasks.
!  *  @version $Revision$
   */
  public class RepositoryElement extends DataType {
- 	
  
  	private URL url;
  	private boolean remote;
  	private String id;
  
--- 21,35 ----
  import org.apache.tools.ant.types.DataType;
  
  /**
   * Describes a Repository for use in other Depot Ant tasks.
!  * 
!  * @version $Revision$
   */
  public class RepositoryElement extends DataType {
  
  	private URL url;
+ 
  	private boolean remote;
+ 
  	private String id;
  
***************
*** 38,49 ****
  	public boolean isRemote() {
  		return remote;
! 		
  	}
  	/**
! 	 * @param remote The remote to set.
  	 */
  	public void setRemote(boolean remote) {
  		this.remote = remote;
  	}
  	/**
  	 * @return Returns the url.
--- 39,53 ----
  	public boolean isRemote() {
  		return remote;
! 
  	}
+ 
  	/**
! 	 * @param remote
! 	 *            The remote to set.
  	 */
  	public void setRemote(boolean remote) {
  		this.remote = remote;
  	}
+ 
  	/**
  	 * @return Returns the url.
***************
*** 52,61 ****
  		return url;
  	}
  	/**
! 	 * @param url The url to set.
  	 */
  	public void setUrl(URL url) {
  		this.url = url;
  	}
  	/**
  	 * @return Returns the id.
--- 56,68 ----
  		return url;
  	}
+ 
  	/**
! 	 * @param url
! 	 *            The url to set.
  	 */
  	public void setUrl(URL url) {
  		this.url = url;
  	}
+ 
  	/**
  	 * @return Returns the id.
***************
*** 64,72 ****
  		return id;
  	}
  	/**
! 	 * @param id The id to set.
  	 */
  	public void setId(String id) {
! 		this.id = id;		
  	}
  }
--- 71,81 ----
  		return id;
  	}
+ 
  	/**
! 	 * @param id
! 	 *            The id to set.
  	 */
  	public void setId(String id) {
! 		this.id = id;
  	}
  }

Index: CachedArtifactSetExportTask.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ant/cache/CachedArtifactSetExportTask.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CachedArtifactSetExportTask.java	8 Dec 2004 09:07:08 -0000	1.1
--- CachedArtifactSetExportTask.java	8 Dec 2004 09:11:55 -0000	1.2
***************
*** 17,20 ****
--- 17,21 ----
   */
  package org.krysalis.depot.update.ant.cache;
+ 
  import java.io.File;
  import java.io.FileWriter;
***************
*** 26,29 ****
--- 27,31 ----
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.Task;
+ 
  /**
   * Export a cached resource set to xml file. <code>
***************
*** 38,42 ****
--- 40,46 ----
  public class CachedArtifactSetExportTask extends Task {
  	private String refid;
+ 
  	private File toFile;
+ 
  	/**
  	 * The refid of the cachedset to export.
***************
*** 47,50 ****
--- 51,55 ----
  		return refid;
  	}
+ 
  	/**
  	 * SEt the refid of the cachedset to export
***************
*** 56,59 ****
--- 61,65 ----
  		this.refid = refid;
  	}
+ 
  	/**
  	 * The file to export the Cached set to
***************
*** 64,67 ****
--- 70,74 ----
  		return toFile;
  	}
+ 
  	/**
  	 * The file to export the Cached set to
***************
*** 73,76 ****
--- 80,84 ----
  		this.toFile = toFile;
  	}
+ 
  	/*
  	 * (non-Javadoc)
***************
*** 97,108 ****
  						+ nameValue("name", resource.getName()));
  				out.println("              "
! 						+ nameValue("group", resource.getGroup() == null
! 								? resource.getName()
! 								: resource.getGroup()));
! 				org.krysalis.version.Version version = resource.getDownloadedVersion();
  				if (version == null) {
  					version = org.krysalis.version.Version.UNKNOWN;
  				}
! 			
  				out.println("              "
  						+ nameValue("version", version.toString()));
--- 105,117 ----
  						+ nameValue("name", resource.getName()));
  				out.println("              "
! 						+ nameValue("group",
! 								resource.getGroup() == null ? resource
! 										.getName() : resource.getGroup()));
! 				org.krysalis.version.Version version = resource
! 						.getDownloadedVersion();
  				if (version == null) {
  					version = org.krysalis.version.Version.UNKNOWN;
  				}
! 
  				out.println("              "
  						+ nameValue("version", version.toString()));
***************
*** 120,123 ****
--- 129,133 ----
  		}
  	}
+ 
  	private String nameValue(final String name, final String value) {
  		String togther = name + "=\"" + value + "\"";



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/