incubator-depot-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickcha...@apache.org
Subject svn commit: rev 6878 - incubator/depot/trunk/ruper/src/java/ant/org/apache/ruper/ant/sandbox/chalko
Date Thu, 26 Feb 2004 09:39:54 GMT
Author: nickchalko
Date: Thu Feb 26 01:39:53 2004
New Revision: 6878

Modified:
   incubator/depot/trunk/ruper/src/java/ant/org/apache/ruper/ant/sandbox/chalko/ResourceElement.java
   incubator/depot/trunk/ruper/src/java/ant/org/apache/ruper/ant/sandbox/chalko/RuperSet.java
Log:
More work on actually getting the file.

Modified: incubator/depot/trunk/ruper/src/java/ant/org/apache/ruper/ant/sandbox/chalko/ResourceElement.java
==============================================================================
--- incubator/depot/trunk/ruper/src/java/ant/org/apache/ruper/ant/sandbox/chalko/ResourceElement.java
(original)
+++ incubator/depot/trunk/ruper/src/java/ant/org/apache/ruper/ant/sandbox/chalko/ResourceElement.java
Thu Feb 26 01:39:53 2004
@@ -15,10 +15,16 @@
  * ========================================================================
  */
 package org.apache.ruper.ant.sandbox.chalko;
+import org.apache.ruper.resource.Resource;
+import org.apache.ruper.resource.ResourceGroup;
+import org.apache.ruper.resource.ResourceType;
+import org.apache.ruper.util.net.VirtualResourceLocator;
+import org.apache.version.Version;
 /**
  * @version $Revision: $
  */
 public class ResourceElement {
+	private String group;
 	private String name;
 	private String version;
 	private String repository;
@@ -77,5 +83,61 @@
 	}
 	public String toString() {
 		return name + "-" + version + "." + ext + "@" + repository;
+	}
+	/**
+	 * @return
+	 */
+	Resource initResource() {
+		Resource r = new Resource(getResourceGroup(), name, getVersionObject(),
+				getResourceType(), ext, getFileName(), getLocation());
+		return r;
+	}
+	/**
+	 * @return
+	 */
+	private VirtualResourceLocator getLocation() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * @return
+	 */
+	private String getFileName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * @return
+	 */
+	private ResourceType getResourceType() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * @return
+	 */
+	private Version getVersionObject() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * @return
+	 */
+	private ResourceGroup getResourceGroup() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * @return Returns the group.
+	 */
+	public String getGroup() {
+		return group;
+	}
+	/**
+	 * @param group
+	 *            The group to set.
+	 */
+	public void setGroup(String group) {
+		this.group = group;
 	}
 }

Modified: incubator/depot/trunk/ruper/src/java/ant/org/apache/ruper/ant/sandbox/chalko/RuperSet.java
==============================================================================
--- incubator/depot/trunk/ruper/src/java/ant/org/apache/ruper/ant/sandbox/chalko/RuperSet.java
(original)
+++ incubator/depot/trunk/ruper/src/java/ant/org/apache/ruper/ant/sandbox/chalko/RuperSet.java
Thu Feb 26 01:39:53 2004
@@ -20,8 +20,13 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-
 import org.apache.ruper.ResourceUpdater;
+import org.apache.ruper.RuperException;
+import org.apache.ruper.repository.DefaultRepository;
+import org.apache.ruper.repository.IRepository;
+import org.apache.ruper.resource.Resource;
+import org.apache.ruper.resource.ResourceGroup;
+import org.apache.ruper.util.io.ResolvedFile;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
 import org.apache.tools.ant.FileScanner;
@@ -33,6 +38,7 @@
  * @version $Revision: $
  */
 public class RuperSet extends DataType {
+	public static final String LOCAL_REPOSITORY_ID = "local.repository";
 	public static final String REPOSITORY_DIR_PROPERTY = "repository.dir";
 	private final Project project;
 	private String id;
@@ -72,7 +78,6 @@
 	 * @return
 	 */
 	FileScanner getFileScanner() {
-		
 		final DirectoryScanner scanner = new DirectoryScanner();
 		scanner.setBasedir(getRepoDir());
 		addResources(scanner);
@@ -83,28 +88,33 @@
 	 */
 	private void addResources(DirectoryScanner scanner) {
 		for (Iterator i = resourceList.iterator(); i.hasNext();) {
-		ResourceElement r = (ResourceElement) i.next();
-		add(scanner,r);
-	}
+			ResourceElement r = (ResourceElement) i.next();
+			add(scanner, r);
+		}
 	}
 	/**
 	 * @param scanner
 	 * @param r
 	 */
 	private void add(DirectoryScanner scanner, ResourceElement r) {
-		log("Looking for "+r,Project.MSG_DEBUG);
-		ResourceUpdater ru = new ResourceUpdater(); 
-		
-		
-		
-		
+		log("Looking for " + r, Project.MSG_DEBUG);
+		ResourceUpdater ru = new ResourceUpdater();
+		ru.setTargetRepository(getRepository());
+		Resource resource = r.initResource();
+		try {
+			ru.downloadResource(resource);
+		} catch (RuperException e) {
+			throw new BuildException("Unable to get "+r,e);
+		}
 	}
+
 	/**
-	 * 
-	 */
-	private void findResources() {
-		// TODO Auto-generated method stub
-		
+	 * @return
+	 */
+	private IRepository getRepository() {
+		DefaultRepository repository = new DefaultRepository(
+				LOCAL_REPOSITORY_ID, ResolvedFile.resolve(getRepoDir()));
+		return repository;
 	}
 	/**
 	 * @return

Mime
View raw message