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

svn commit: rev 23154 - in incubator/depot/trunk/update/src/java/org/apache/depot/update: . impl tool

Author: ajack
Date: Thu Jul 22 08:31:48 2004
New Revision: 23154

Modified:
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ArtifactUpdater.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/impl/ArtifactUpdaterContext.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/tool/DownloaderTool.java
Log:
Some hand merging.


Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ArtifactUpdater.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ArtifactUpdater.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ArtifactUpdater.java	Thu Jul 22 08:31:48 2004
@@ -48,7 +48,7 @@
  * 
  * @see DefaultArtifactUpdater, StandardResourceUpdater
  * 
- * @author <a href="http://incubator.apache.org/depot">The Apache Incubator Depot Project</a>
+ * @author arb_jack
  */
 public class ArtifactUpdater implements IReferenceable {
 	
@@ -124,6 +124,7 @@
 		m_queryEngine = new QueryEngine();
 
 		// Protocol operations..
+		if (!getContext().hasProtocolManager() )
 		getContext().setProtocolManager(
 			new DefaultProtocolOperationsManager(getContext()));
 		
@@ -337,25 +338,19 @@
 
 
 	/**
-	 * Set the Repository to which the artifact should be published 
-	 * 
-	 * @param repository the target Repository
+	 * @param repository
 	 */
 	public void setTargetRepository(Repository repository) {
 		m_targetRepository = repository;
 	}
 	/**
-	 * Gets the Repository to which the artifact should be published 
-	 * 
-	 * @return Repository the target Repository
+	 * @return
 	 */
 	public Repository getTargetRepository() {
 		return m_targetRepository;
 	}
 
 	/**
-	 * 
-	 * 
 	 * @return Returns the repositorySet.
 	 */
 	public RepositorySet getRepositorySet() {

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/impl/ArtifactUpdaterContext.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/impl/ArtifactUpdaterContext.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/impl/ArtifactUpdaterContext.java	Thu Jul 22 08:31:48 2004
@@ -21,7 +21,6 @@
 import org.apache.depot.common.util.SystemUtils;
 import org.apache.depot.update.ArtifactUpdaterOptions;
 import org.apache.depot.update.UpdateException;
-import org.apache.depot.update.config.UpdaterConfig;
 import org.apache.depot.update.protocols.DefaultProtocolOperationsManager;
 import org.apache.depot.update.protocols.ProtocolOperationsManager;
 import org.apache.depot.update.util.UpdateConstants;
@@ -47,13 +46,6 @@
 		}
 	}
 	
-	static {
-		// Configure from the shared XML file...
-		//:TODO: *Maybe* move later, or allow user to pass filename
-		// in order to override
-		UpdaterConfig.configure();
-	}
-
 	private ArtifactUpdaterContext.Identifier m_identifier = null;
 
 	private ProtocolOperationsManager m_protocolManager = null;
@@ -112,6 +104,16 @@
 	 */
 	public void setProtocolManager(ProtocolOperationsManager manager) {
 		m_protocolManager = manager;
+	}
+	
+	/**
+	 * Does this content already have a protocol manager?
+	 * 
+	 * @return true = yes
+	 */
+	public boolean hasProtocolManager()
+	{
+		return (null != m_protocolManager);
 	}
 
 	/**

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/tool/DownloaderTool.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/tool/DownloaderTool.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/tool/DownloaderTool.java	Thu Jul 22 08:31:48 2004
@@ -14,11 +14,13 @@
  *  limitations under the License.
  */
 package org.apache.depot.update.tool;
+import org.apache.depot.common.log.Logger;
 import org.apache.depot.common.util.cli.CommandLine;
 import org.apache.depot.common.util.cli.Option;
 import org.apache.depot.update.ArtifactUpdater;
 import org.apache.depot.update.Repository;
 import org.apache.depot.update.artifact.ArtifactGroup;
+import org.apache.depot.update.config.UpdaterConfig;
 import org.apache.depot.update.repository.DefaultRepository;
 import org.apache.depot.update.repository.RepositorySet;
 /**
@@ -28,8 +30,9 @@
 	private static Option l_targetOption = null;
 	private static Option l_groupOption = null;
 	private static Option l_configOption = null;
-	static {l_repoOption = new Option("r", "repo", true, "Repository");
-	
+	static {
+		l_repoOption = new Option("r", "repo", true, "Repository");
+
 		l_configOption = new Option("c", "config", true,
 				"The configuration file");
 		l_groupOption = new Option("g", "group", true, "The group to go get");
@@ -60,32 +63,37 @@
 		// Optional configuration
 		String configName = cmdline.getOptionValue(l_configOption);
 		// Optional repository URL
-		String repoUrl=cmdline.getOptionValue(l_repoOption);
-		
+		String repoUrl = cmdline.getOptionValue(l_repoOption);
+
 		ArtifactUpdater updater = new ArtifactUpdater();
-		
-		if (null != repoUrl)
-		{
+
+		if (null != repoUrl) {
 			RepositorySet repoSet = new RepositorySet("gump");
-			repoSet.addRepository(new DefaultRepository("gump",repoUrl));
+			repoSet.addRepository(new DefaultRepository("gump", repoUrl));
 			updater.setRepositorySet(repoSet);
-		}
-		else
-		{
-			updater.setRepositorySet(
-						RepositorySet.getRepositorySet("gump",
-									false));
+			
+			Logger.getLogger().info("Repository @ " + repoUrl);
+		} else {
+			updater.setRepositorySet(RepositorySet.getRepositorySet("gump",
+					false));
 		}
 
+		if ( null != configName )
+			UpdaterConfig.configure(configName);
+		
+		Logger.getLogger().info("Target Repository @ " + targetDir);
+		
 		// Assigned the target (to copy into)
 		updater.setTargetRepository(getTargetRepository(targetDir));
-		
+
 		// The group to go get
 		ArtifactGroup group = new ArtifactGroup(groupName);
 
+		Logger.getLogger().info("Artifact Group : " + groupName);
+		
 		// Update...
 		updater.getArtifacts(group);
-		
+
 		// Cleanup (to remove duplicates)
 		updater.cleanTarget(group);
 	}
@@ -93,4 +101,4 @@
 	public static void main(String[] args) {
 		(new DownloaderTool()).run(args);
 	}
-}
+}
\ No newline at end of file