You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@depot.apache.org by mm...@apache.org on 2004/07/12 19:47:22 UTC

svn commit: rev 22849 - in incubator/depot/trunk/update: . src/java/org/apache/depot/update src/java/org/apache/depot/update/artifact src/java/org/apache/depot/update/artifact/compare src/java/org/apache/depot/update/download src/java/org/apache/depot/update/monitor src/java/org/apache/depot/update/repository src/test/org/apache/depot/update/repository

Author: mmay
Date: Mon Jul 12 12:47:21 2004
New Revision: 22849

Modified:
   incubator/depot/trunk/update/build-ant-get.xml
   incubator/depot/trunk/update/build.xml
   incubator/depot/trunk/update/src/java/org/apache/depot/update/Artifact.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/Repository.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/RepositoryManifest.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/artifact/ArtifactGroup.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/artifact/compare/ArtifactGroupNameComparator.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/download/DownloadManager.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/monitor/StatisticsMonitor.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/AbstractHierarchicalRepository.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/MockRepository.java
   incubator/depot/trunk/update/src/test/org/apache/depot/update/repository/RepositoryTests.java
Log:
Refactored some variables and added some javadocs

Modified: incubator/depot/trunk/update/build-ant-get.xml
==============================================================================
--- incubator/depot/trunk/update/build-ant-get.xml	(original)
+++ incubator/depot/trunk/update/build-ant-get.xml	Mon Jul 12 12:47:21 2004
@@ -11,9 +11,12 @@
 		<include name="commons-httpclient/jars/commons-httpclient-2.0.jar" />
 		<include name="commons-codec/jars/commons-codec-1.2.jar" />
 		<include name="regexp/jars/regexp-null.jar" />
+		<include name="junit/jars/junit-3.8.jar" />		
+		<include name="ant/jars/ant-1.6.1.jar" />		
 	</fileset>
 	<target name="get-all"
-	        depends="get-log4j,get-commons-vfs,get-commons-logging,get-commons-httpclient,get-commons-codec,get-regexp" />
+	        depends="get-log4j,get-commons-vfs,get-commons-logging,get-commons-httpclient,get-commons-codec,
+	        get-regexp,get-junit,get-ant,get-xmlunit" />
 	<target name="get-log4j">
 		<mkdir dir="${repository.dir}/log4j/jars/" />
 		<get verbose="true"
@@ -56,4 +59,25 @@
 		     dest="${repository.dir}/regexp/jars/regexp-null.jar"
 		     src="http://www.ibiblio.org/maven/regexp/jars/regexp-1.3.jar" />
 	</target>
+	<target name="get-junit">
+		<mkdir dir="${repository.dir}/junit/jars/" />
+		<get verbose="true"
+		     usetimestamp="true"
+		     dest="${repository.dir}/junit/jars/junit-3.8.jar"
+		     src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.jar" />
+	</target>	
+	<target name="get-ant">
+		<mkdir dir="${repository.dir}/ant/jars/" />
+		<get verbose="true"
+		     usetimestamp="true"
+		     dest="${repository.dir}/ant/jars/ant-1.6.1.jar"
+		     src="http://www.ibiblio.org/maven/ant/jars/ant-1.6.1.jar" />
+	</target>	
+	<target name="get-xmlunit">
+		<mkdir dir="${repository.dir}/xmlunit/jars/" />
+		<get verbose="true"
+		     usetimestamp="true"
+		     dest="${repository.dir}/xmlunit/jars/xmlunit-1.0.jar"
+		     src="http://www.ibiblio.org/maven/xmlunit/jars/xmlunit-1.0.jar" />
+	</target>	
 </project>

Modified: incubator/depot/trunk/update/build.xml
==============================================================================
--- incubator/depot/trunk/update/build.xml	(original)
+++ incubator/depot/trunk/update/build.xml	Mon Jul 12 12:47:21 2004
@@ -87,9 +87,7 @@
 	<target name="compile"
 	        depends="-init-path,version-stamp,java.antlet.compile"
 	        description="Compile java source files." />
-	<target name="-init-path" depends="get-all">
-
-	</target>
+	<target name="-init-path" depends="get-all"/>
 
 	<target name="gump" depends="compile,dist-jar" />
 	<target name="test" depends="junit.test" />

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/Artifact.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/Artifact.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/Artifact.java	Mon Jul 12 12:47:21 2004
@@ -132,7 +132,7 @@
 	public String toString() {
 		StringBuffer buffer = new StringBuffer();
 
-		if (!m_group.getGroup().equals(m_identifier.getId())) {
+		if (!m_group.getName().equals(m_identifier.getId())) {
 			buffer.append("{");
 			buffer.append(m_group.toString());
 			buffer.append("}: ");

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/Repository.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/Repository.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/Repository.java	Mon Jul 12 12:47:21 2004
@@ -29,7 +29,8 @@
 import org.apache.depot.update.util.select.ISelector;
 
 /**
- * @author anou_mana
+ * The main interface for the implementation of a Repository
+ * 
  */
 public interface Repository extends IReferenceable {
 	public static class Identifier extends GenericIdentifier {
@@ -138,4 +139,4 @@
 	ArtifactInstance publishArtifact(ArtifactUpdaterContext context, ArtifactInstance resource)
 		throws Exception;
 
-}
+}
\ No newline at end of file

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/RepositoryManifest.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/RepositoryManifest.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/RepositoryManifest.java	Mon Jul 12 12:47:21 2004
@@ -28,7 +28,7 @@
 import org.apache.depot.version.Version;
 
 /**
- * @author arb_jack
+ * 
  */
 public class RepositoryManifest implements Dumpable {
 	private List m_types = null;
@@ -37,18 +37,18 @@
 	private List m_instances = null;
 
 	/**
-	 * an empty manifest
-	 *
+	 * Constructor
+	 * Builds an empty RepositoryManifest
 	 */
 	public RepositoryManifest() {
 		classInit();
 	}
 
 	/**
+	 * Constructor
+	 * Extract manifest from a list of instances of Artifacts  
 	 * 
-	 * Extract manifest from a list of resources
-	 * 
-	 * @param resources
+	 * @param instances
 	 */
 	public RepositoryManifest(List instances) {
 		classInit();
@@ -57,8 +57,13 @@
 	}
 
 	/**
-	 * Handrolled...
+	 * Constructor
+	 * Builds a RepositoryManifest based on the input parameters
 	 *
+	 * @param types
+	 * @param ids
+	 * @param versions
+	 * @param instances of Artifacts
 	 */
 	public RepositoryManifest(List types, List ids, List versions, List instances) {
 		classInit();
@@ -70,8 +75,10 @@
 	}
 
 	/**
-	 * A clone...
+	 * Constructor
+	 * Building a clone of the other class
 	 *
+	 * @param other another RepositoryManifest which is cloned
 	 */
 	public RepositoryManifest(RepositoryManifest other) {
 		classInit();
@@ -82,8 +89,7 @@
 	}
 
 	/**
-	 * 
-	 *
+	 * Initialize this class
 	 */
 	private void classInit() {
 		m_types = new ArrayList();
@@ -92,6 +98,11 @@
 		m_instances = new ArrayList();
 	}
 
+	/**
+	 * Import information from a list of instances
+	 * 
+	 * @param instances
+	 */
 	public void importInformation(List instances) {
 
 		for (Iterator i = instances.iterator(); i.hasNext();) {

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/artifact/ArtifactGroup.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/artifact/ArtifactGroup.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/artifact/ArtifactGroup.java	Mon Jul 12 12:47:21 2004
@@ -18,11 +18,17 @@
  * @author <a href="http://incubator.apache.org/depot">The Apache Incubator Depot Project</a>
  */
 public class ArtifactGroup {
-	public String m_group = null;
+	public String m_name = null;
 	
-	public ArtifactGroup(String group) {
-		if(group == null)throw new NullPointerException("group must be set");
-		m_group = group;
+	/**
+	 * Constructor
+	 * Builds an artifactGroup with the specified name
+	 * 
+	 * @param name name of the ArtifactGroup
+	 */
+	public ArtifactGroup(String name) {
+		if(name == null)throw new NullPointerException("name of the group must be set");
+		m_name = name;
 	}	
 	
 	/*
@@ -31,34 +37,52 @@
 	* @see java.lang.Object#equals(java.lang.Object)
 	*/
 	public boolean equals(Object otherGroup) {
-		return m_group.equals(((ArtifactGroup) otherGroup).m_group);
+		return m_name.equals(((ArtifactGroup) otherGroup).getName());
 	}
+	
 	/*
 	 * (non-Javadoc)
 	 * 
 	 * @see java.lang.Object#hashCode()
 	 */
 	public int hashCode() {
-		return m_group.hashCode();
+		return m_name.hashCode();
 	}
+	
 	/*
 	 * (non-Javadoc)
 	 * 
 	 * @see java.lang.Object#toString()
 	 */
 	public String toString() {
-		return m_group;
+		return m_name;
 	}
+	
 	/**
-	 * @return
+	 * Gets the groupidentifier of this group
+	 * 
+	 * @return groupidentifier
 	 */
-	public String getGroup() {
-		return m_group;
+	public String getName() {
+		return m_name;
 	}
+	
+	/**
+	 * returns a group for test purposes
+	 * 
+	 * @return a Test artifactGroup
+	 */
 	public static ArtifactGroup getTestGroup() {
 		return getTestGroup("test");
 	}
+	
+	/**
+	 * returns a group for test purposes with the given identifier/name
+	 * 
+	 * @param name The identifier of the testgroup
+	 * @return a Test artifactGroup
+	 */	
 	public static ArtifactGroup getTestGroup(String name) {
 		return new ArtifactGroup(name);
 	}
-}
+}
\ No newline at end of file

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/artifact/compare/ArtifactGroupNameComparator.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/artifact/compare/ArtifactGroupNameComparator.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/artifact/compare/ArtifactGroupNameComparator.java	Mon Jul 12 12:47:21 2004
@@ -46,8 +46,8 @@
 		final ArtifactGroup resourceGroup1,
 		final ArtifactGroup resourceGroup2) {
 		int comparison =
-			resourceGroup1.getGroup().compareToIgnoreCase(
-				resourceGroup2.getGroup());
+			resourceGroup1.getName().compareToIgnoreCase(
+				resourceGroup2.getName());
 		return comparison;
 	}
 }

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/download/DownloadManager.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/download/DownloadManager.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/download/DownloadManager.java	Mon Jul 12 12:47:21 2004
@@ -27,7 +27,9 @@
 import org.apache.depot.update.repository.RepositoryException;
 
 /**
- * @author arb_jack
+ * This class represents, like the name suggests, a Download Manager.
+ * 
+ * @author <a href="http://incubator.apache.org/depot">The Apache Incubator Depot Project</a>
  */
 public class DownloadManager {
 
@@ -45,6 +47,16 @@
 	}
 
 
+	/**
+	 * downloadTo - downloads the ArtifactInstances to the specified (local) 
+	 * repository
+	 * 
+	 * Question: can this be used to upload to a remote repository??
+	 * 
+	 * @param instances list of artifactInstances
+	 * @param targetRepository repository to which the artifacts are downloaded
+	 * @throws UpdateException
+	 */
 	public void downloadTo(List instances, Repository targetRepository)
 		throws UpdateException {
 
@@ -60,10 +72,10 @@
 
 		for (Iterator i = instances.iterator(); i.hasNext();) {
 			ArtifactInstance resource = (ArtifactInstance) i.next();
+			
 			try {
 				target.publishArtifact(resource);
-			}
-			catch (Exception e) {
+			} catch (Exception e) {
 				//
 				// (1) log (2) stash in result set error table
 				//

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/monitor/StatisticsMonitor.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/monitor/StatisticsMonitor.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/monitor/StatisticsMonitor.java	Mon Jul 12 12:47:21 2004
@@ -91,7 +91,7 @@
 
 			m_artifacts.add(artifact);
 
-			String groupName = artifact.getArtifact().getGroup().getGroup();
+			String groupName = artifact.getArtifact().getGroup().getName();
 			String artifactName = artifact.getIdentifier().getId();
 
 			if (!groupName.equals(artifactName)) {

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/AbstractHierarchicalRepository.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/AbstractHierarchicalRepository.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/AbstractHierarchicalRepository.java	Mon Jul 12 12:47:21 2004
@@ -164,6 +164,9 @@
 		return results;
 	}
 
+	/**
+	 * @deprecated uses a buggy method
+	 */
 	public RepositoryManifest getManifest(
 		ArtifactUpdaterContext context,
 		ArtifactGroup group,
@@ -179,7 +182,7 @@
 			? new VirtualResourceLocator(
 				new VirtualResourceLocator(
 					getRepositoryRoot(),
-					group.getGroup()),
+					group.getName()),
 				"jars/")
 			: getRepositoryRoot();
 	}

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/MockRepository.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/MockRepository.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/MockRepository.java	Mon Jul 12 12:47:21 2004
@@ -60,7 +60,7 @@
 
 		folderForGroup(group);
 
-		List resourceList = ArtifactInstance.getTestArtifactList(group.getGroup(), 10);
+		List resourceList = ArtifactInstance.getTestArtifactList(group.getName(), 10);
 
 		results = SelectionHelper.select(resourceList, selector);
 

Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/repository/RepositoryTests.java
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/repository/RepositoryTests.java	(original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/repository/RepositoryTests.java	Mon Jul 12 12:47:21 2004
@@ -33,6 +33,7 @@
 
 	private RepositoryWrapper m_repo1 = null;
 	private RepositoryWrapper m_repo2 = null;
+//	private MockRepository mock_repo = null;
 
 	//	static {
 	//		Logger.testInit();
@@ -52,6 +53,8 @@
 
 		m_repo2 = new RepositoryWrapper(MockRepository.getMockRepository(),
 				ArtifactUpdaterContext.getTestContext());
+		
+//		mock_repo = new MockRepository("Test");
 	}
 
 	public void testListGroups1() throws Exception {
@@ -78,6 +81,10 @@
 		assertNotNull("List Artifacts", list2);
 		assertFalse("List Artifacts not Empty", list2.isEmpty());
 
+//		List list3 = mock_repo.listArtifacts(ArtifactUpdaterContext.getTestContext(), testGroup, AllSelector.getInstance());
+//		assertNotNull("List Artifacts", list2);
+//		assertFalse("List Artifacts not Empty", list2.isEmpty());		
+		
 		//		DebugUtils.dump("Test Artifacts", list1);
 		//		DebugUtils.dump("Mock Artifacts", list2);
 	}