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/20 20:40:15 UTC
svn commit: rev 23091 - in incubator/depot/trunk/update: bin src/java/org/apache/depot/update src/java/org/apache/depot/update/impl src/java/org/apache/depot/update/query src/java/org/apache/depot/update/repository src/java/org/apache/depot/update/repository/compare src/java/org/apache/depot/update/repository/select src/java/org/apache/depot/update/tool src/java/org/apache/depot/update/util/select src/test/org/apache/depot/update/query src/test/org/apache/depot/update/util/xml
Author: ajack
Date: Tue Jul 20 13:40:14 2004
New Revision: 23091
Removed:
incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/compare/
incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/select/AbstractRepositorySelector.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/select/ActiveRepositorySelector.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/select/AttributeBasedRepositorySelector.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/select/LocalRepositorySelector.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/select/RemoteRepositorySelector.java
Modified:
incubator/depot/trunk/update/bin/update.py
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/impl/RepositorySetWrapper.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/query/ArtifactQuery.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/query/QueryEngine.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/AbstractRepository.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/RepositorySet.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/tool/DownloaderTool.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/util/select/AllSelector.java
incubator/depot/trunk/update/src/test/org/apache/depot/update/query/QueryTests.java
incubator/depot/trunk/update/src/test/org/apache/depot/update/util/xml/XMLParserTests.java
Log:
Subclipse still doesn't work...
Modified: incubator/depot/trunk/update/bin/update.py
==============================================================================
--- incubator/depot/trunk/update/bin/update.py (original)
+++ incubator/depot/trunk/update/bin/update.py Tue Jul 20 13:40:14 2004
@@ -18,12 +18,7 @@
"""
- This is the commandline entrypoint into Python Gump as a
- build system (as opposed to a cronned CI tool).
-
- It works similarly to "cvs", as it needs to be given the action
- to do, and it needs to be run in the correct directory
- (workspace or project).
+ This is the commandline entry point into Depot Updater
"""
@@ -54,13 +49,17 @@
depotJars=os.path.abspath(os.path.join(depotHome,'jars'))
print depotJars
+ # Build the CLASSPATH
if os.path.exists(depotJars):
for jar in os.listdir(depotJars):
if jar.endWith('.jar'):
cp.append(os.path.abspath(jar))
# New CLASSPATH
- env['CLASSPATH'] = os.pathsep.join(cp)
+ classpath = os.pathsep.join(cp)
+ env['CLASSPATH'] = classpath
+ print classpath
+
#
# Actually run the Java command
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 Tue Jul 20 13:40:14 2004
@@ -91,6 +91,7 @@
*/
public ArtifactUpdater() {
m_identifier = new ArtifactUpdater.Identifier(UpdateConstants.DEFAULT);
+ initClass();
artifactConfigInit();
}
@@ -111,6 +112,7 @@
public ArtifactUpdater(ArtifactUpdater.Identifier id)
throws UpdateException {
m_identifier = id;
+ initClass();
artifactConfigInit();
}
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 Tue Jul 20 13:40:14 2004
@@ -127,6 +127,13 @@
return m_identifier;
}
+ /**
+ * @return Returns the options.
+ */
+ public ArtifactUpdaterOptions getOptions() {
+ return m_options;
+ }
+
public static ArtifactUpdaterContext getResourceUpdaterContext(
ArtifactUpdaterContext.Identifier identifier,
boolean createIfRequired)
@@ -153,4 +160,6 @@
return context;
}
+
+
}
Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/impl/RepositorySetWrapper.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/impl/RepositorySetWrapper.java (original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/impl/RepositorySetWrapper.java Tue Jul 20 13:40:14 2004
@@ -16,22 +16,24 @@
package org.apache.depot.update.impl;
+import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.depot.common.log.Logger;
+import org.apache.depot.common.util.debug.DebugUtils;
+import org.apache.depot.common.util.debug.Dumpable;
import org.apache.depot.update.Repository;
import org.apache.depot.update.UpdateException;
import org.apache.depot.update.artifact.ArtifactGroup;
-import org.apache.depot.update.repository.DefaultRepository;
import org.apache.depot.update.repository.RepositorySet;
import org.apache.depot.update.util.select.AllSelector;
/**
* @author anou_mana
*/
-public class RepositorySetWrapper {
+public class RepositorySetWrapper implements Dumpable {
private ArtifactUpdaterContext m_context = null;
@@ -64,12 +66,14 @@
m_repositoryWrappers.add(
new RepositoryWrapper((Repository) i.next(), m_context));
}
+ if (m_repositoryWrappers.isEmpty())
+ Logger.getLogger().debug("No wrappers constructed");
}
// :TODO: Work in progress ...
// Do we make it 'high level' (1 list of unique groups returned)
// or low level?
-
+ /*
public List listGroups() {
List allGroups = null;
@@ -100,6 +104,18 @@
return allGroups;
}
+ */
+
+ /**
+ * Is this empty (or does it contain repositories)?
+ *
+ * @return true = empty
+ */
+ public boolean isEmpty() {
+ return m_repositorySet.isEmpty();
+ }
+
+
/**
* @return
*/
@@ -112,5 +128,15 @@
*/
public List getRepositoryWrappers() {
return m_repositoryWrappers;
+ }
+
+ public void dump(PrintWriter out, int depth, boolean verbose) {
+ //String indent = DebugUtils.getIndent(depth);
+
+ DebugUtils.dump(out, depth + 1, "Context: ", verbose, m_context);
+
+ DebugUtils.printSeparator(out, depth + 1);
+ DebugUtils.dump(out, depth + 1, "Repositories: ", verbose,
+ m_repositorySet);
}
}
Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/query/ArtifactQuery.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/query/ArtifactQuery.java (original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/query/ArtifactQuery.java Tue Jul 20 13:40:14 2004
@@ -25,32 +25,34 @@
import org.apache.depot.common.util.debug.Dumpable;
import org.apache.depot.update.artifact.ArtifactGroup;
import org.apache.depot.update.repository.RepositorySet;
+import org.apache.depot.update.util.select.AllSelector;
import org.apache.depot.update.util.select.ISelector;
/**
* @author arb_jack
* @author anou_mana
*
- * A ResourceQuery is (primarily) an internal class derived from
- * simpler user ResourceRequest objects.
+ * A ResourceQuery is (primarily) an internal class derived from simpler user
+ * ResourceRequest objects.
*
* A ResourceQuery is effectively an SQL statement like this:
*
* <pre>
*
- * SELECT * FROM {REPOSITORIES:group}
- * WHERE ((name='junit' AND version>=1.0))
- * GROUP BY name, version
- * ORDER BY name, version, type
- *
+ *
+ * SELECT * FROM {REPOSITORIES:group}
+ * WHERE ((name='junit' AND version>=1.0))
+ * GROUP BY name, version
+ * ORDER BY name, version, type
+ *
+ *
* </pre>
*
- * The REPOSITORIES are a list of repositories, imaging them as tables.
- * The "group" is which group on those repositories (if it exists).
- * The * means resources, imagine resources as rows in the tables
- * The GROUP BY is a bit of a stretch (it groups results this way)
- * The ORDER BY is self explanatory.
- *
+ * The REPOSITORIES are a list of repositories, imaging them as tables. The
+ * "group" is which group on those repositories (if it exists). The * means
+ * resources, imagine resources as rows in the tables The GROUP BY is a bit of a
+ * stretch (it groups results this way) The ORDER BY is self explanatory.
+ *
*/
public class ArtifactQuery implements Dumpable {
@@ -59,21 +61,17 @@
// Repository
// :TODO: Hmm, ought repositories be on query at all?
private RepositorySet m_repositorySet = null;
-
+
private ISelector m_where = null;
private Comparator m_orderBy = null;
private Comparator m_groupBy = null;
//
// :TODO: Nice if we could make queries referenceable
- // to allow re-use (especially for the more generic)
+ // to allow re-use (especially for the more generic)
//
- public ArtifactQuery(
- ArtifactGroup group,
- RepositorySet repositories,
- ISelector where,
- Comparator groupBy,
- Comparator orderBy) {
+ public ArtifactQuery(ArtifactGroup group, RepositorySet repositories,
+ ISelector where, Comparator groupBy, Comparator orderBy) {
m_groups = new ArrayList();
m_groups.add(group);
@@ -83,11 +81,8 @@
m_orderBy = orderBy;
}
- public ArtifactQuery(
- ArtifactGroup group,
- ISelector where,
- Comparator groupBy,
- Comparator orderBy) {
+ public ArtifactQuery(ArtifactGroup group, ISelector where,
+ Comparator groupBy, Comparator orderBy) {
m_groups = new ArrayList();
m_groups.add(group);
@@ -103,7 +98,7 @@
//
// :TODO: Nice if we could make queries referenceable
- // to allow re-use (especially for the more generic)
+ // to allow re-use (especially for the more generic)
//
public ArtifactQuery(ArtifactQuery other) {
m_groups = other.m_groups;
@@ -115,7 +110,7 @@
}
//
- // Same query, different repositories
+ // Same query, different repositories
//
public ArtifactQuery(ArtifactQuery other, RepositorySet repositories) {
this(other);
@@ -198,19 +193,21 @@
DebugUtils.dump(out, depth + 1, "Resource Groups: ", verbose, m_groups);
DebugUtils.printSeparator(out, depth + 1);
- DebugUtils.dump(
- out,
- depth + 1,
- "Repositories: ",
- verbose,
- m_repositorySet);
+ DebugUtils.dump(out, depth + 1, "Repositories: ", verbose,
+ m_repositorySet);
+ if (null != m_where) {
DebugUtils.printSeparator(out, depth + 1);
DebugUtils.dump(out, depth + 1, "Where: ", verbose, m_where);
- DebugUtils.printSeparator(out, depth + 1);
- DebugUtils.dump(out, depth + 1, "Group By: ", verbose, m_groupBy);
- DebugUtils.printSeparator(out, depth + 1);
- DebugUtils.dump(out, depth + 1, "Order By: ", verbose, m_orderBy);
+ }
+ if (null != m_groupBy) {
+ DebugUtils.printSeparator(out, depth + 1);
+ DebugUtils.dump(out, depth + 1, "Group By: ", verbose, m_groupBy);
+ }
+ if (null != m_orderBy) {
+ DebugUtils.printSeparator(out, depth + 1);
+ DebugUtils.dump(out, depth + 1, "Order By: ", verbose, m_orderBy);
+ }
}
public String toString() {
@@ -219,8 +216,7 @@
buffer.append("SELECT * FROM ");
if (null != m_repositorySet) {
buffer.append(m_repositorySet.getIdentifier());
- }
- else {
+ } else {
buffer.append("Default Repositories");
}
@@ -241,4 +237,4 @@
return buffer.toString();
}
-}
+}
\ No newline at end of file
Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/query/QueryEngine.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/query/QueryEngine.java (original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/query/QueryEngine.java Tue Jul 20 13:40:14 2004
@@ -47,23 +47,18 @@
*
* @param wrappers
* @param query
- * @return
- * @throws UpdateException
+ * @return @throws
+ * UpdateException
*/
- public ArtifactResult queryRepositories(
- RepositorySetWrapper wrappers,
- ArtifactQuery query)
- throws UpdateException {
+ public ArtifactResult queryRepositories(RepositorySetWrapper wrappers,
+ ArtifactQuery query) throws UpdateException {
// Extract query components
List resourceGroups = query.getGroups();
- //
// Trawl the repositories to gather resources
- //
- return queryArtifacts(
- gatherArtifacts(wrappers, resourceGroups, query),
- query);
+ return queryArtifacts(gatherArtifacts(wrappers, resourceGroups, query),
+ query);
}
/**
@@ -74,10 +69,10 @@
* @return
*/
public ArtifactResult queryArtifacts(List resources, ArtifactQuery query) {
- // if (Logger.getLog().isDebug()) {
- // DebugUtils.printSeparator();
- // DebugUtils.dump(query);
- // }
+ if (Logger.getLogger().isDebug()) {
+ DebugUtils.printSeparator();
+ DebugUtils.dump(query);
+ }
// A result object, and the results (unpackaged) list
ArtifactResult result = new ArtifactResult();
@@ -85,44 +80,40 @@
// Package the results..
if (resources.isEmpty())
Logger.getLogger().warn(
- Messages.getString(MessageConstants.NO_RESOURCES_FOUND));
+ Messages.getString(MessageConstants.NO_RESOURCES_FOUND));
else {
Logger.getLogger().info(
- Messages.getString(MessageConstants.RESOURCES_FOUND));
+ Messages.getString(MessageConstants.RESOURCES_FOUND));
Comparator groupBy = query.getGroupBy();
Comparator orderBy = query.getOrderBy();
- // if (Logger.getLog().isDebug()) {
- // DebugUtils.printSeparator();
- // DebugUtils.dump("All Results", results);
- // }
+ if (Logger.getLogger().isDebug()) {
+ DebugUtils.printSeparator();
+ DebugUtils.dump("All Results", result);
+ }
+
+ // Perform the group by...
groupBy(result, resources, groupBy);
- // if (Logger.getLog().isDebug()) {
- // DebugUtils.printSeparator();
- // DebugUtils.dump("Grouped Results", result);
- // }
+ if (Logger.getLogger().isDebug()) {
+ DebugUtils.printSeparator();
+ DebugUtils.dump("Grouped Results", result);
+ }
// Order the various groups
if (null == orderBy)
- orderBy =
- StandardArtifactComparisons
- .getNameTypeVersionComparatorSequence();
+ orderBy = StandardArtifactComparisons.getNameTypeVersionComparatorSequence();
orderBy(result, orderBy);
if (Logger.getLogger().isDebug()) {
DebugUtils.printSeparator();
DebugUtils.dump("Final (Grouped/Ordered) Results", result);
- for (Iterator i =
- ArtifactResultHelper.getArtifactList(result).iterator();
- i.hasNext();
- ) {
+ for (Iterator i = ArtifactResultHelper.getArtifactList(result).iterator(); i.hasNext();) {
Monitor.getMonitor().notify(
- new ArtifactEvent(
- ArtifactEvent.RESULT,
- (ArtifactInstance) i.next()));
+ new ArtifactEvent(ArtifactEvent.RESULT,
+ (ArtifactInstance) i.next()));
}
}
@@ -131,57 +122,59 @@
return result;
}
- private List gatherArtifacts(
- RepositorySetWrapper wrappers,
- List resourceGroups,
- ArtifactQuery query) {
+ /**
+ * Gather all the artifacts for these groups from these
+ * repositories, and return (for filtering/grouping/ordering).
+ *
+ * @param wrappers
+ * @param resourceGroups
+ * @param query
+ * @return
+ */
+ private List gatherArtifacts(RepositorySetWrapper wrappers,
+ List resourceGroups, ArtifactQuery query) {
List results = new ArrayList();
ISelector whereClause = query.getWhere();
if (null == whereClause)
whereClause = AllSelector.getInstance();
-
+
//:TODO: Total Hack, just to allow something...
// Rework w/ correct configurable components
-
- for (Iterator i = wrappers.getRepositoryWrappers().iterator();
- i.hasNext();
- ) {
+ int searched = 0;
+ for (Iterator i = wrappers.getRepositoryWrappers().iterator(); i.hasNext();) {
RepositoryWrapper repo = (RepositoryWrapper) i.next();
try {
Logger.getLogger().debug(
- Messages.getString(
- MessageConstants.SEARCH_REPOSITORY,
- repo));
-
+ Messages.getString(MessageConstants.SEARCH_REPOSITORY,
+ repo));
+ searched += 1;
+
+ // Look for all groups in lists
+ int gsearched = 0;
for (Iterator ii = resourceGroups.iterator(); ii.hasNext();) {
ArtifactGroup resourceGroup = (ArtifactGroup) ii.next();
Logger.getLogger().debug(
- Messages.getString(
- MessageConstants.RESOURCE_GROUP,
- resourceGroup));
+ Messages.getString(MessageConstants.RESOURCE_GROUP,
+ resourceGroup));
+ gsearched += 1;
// Look...
- List resources =
- repo.listInstances(resourceGroup, whereClause);
+ List resources = repo.listInstances(resourceGroup,
+ whereClause);
if (resources.isEmpty()) {
Logger.getLogger().info(
- Messages.getString(
- MessageConstants.NO_RESOURCES_FOUND_IN,
- query,
- repo,
- resourceGroup));
- }
- else {
+ Messages.getString(
+ MessageConstants.NO_RESOURCES_FOUND_IN,
+ query, repo, resourceGroup));
+ } else {
Logger.getLogger().info(
- Messages.getString(
- MessageConstants.RESOURCES_FOUND_IN,
- query,
- repo,
- resourceGroup));
+ Messages.getString(
+ MessageConstants.RESOURCES_FOUND_IN,
+ query, repo, resourceGroup));
//
// Do the query
@@ -189,30 +182,33 @@
results.addAll(resources);
}
}
- }
- catch (Exception e) {
- String message =
- Messages.getString(MessageConstants.LIST_FAILED);
+
+ if (0 == gsearched )
+ Logger.getLogger().warn("No groups searched");
+
+ } catch (Exception e) {
+ String message = Messages.getString(MessageConstants.LIST_FAILED);
Logger.getLogger().warn(message, e);
// :TODO: results.getNotes().warning(message, e);
}
}
+
+ if (0 == searched )
+ Logger.getLogger().warn("No repositories searched");
return results;
}
//
//
- // Group into lists by comparator equality adn order the same,
+ // Group into lists by comparator equality adn order the same,
// each group lists be same comparator.
//
//
- private void groupBy(
- ArtifactResult result,
- List allResults,
- Comparator groupBy) {
+ private void groupBy(ArtifactResult result, List allResults,
+ Comparator groupBy) {
if (null != groupBy) {
@@ -228,9 +224,8 @@
ArtifactInstance resource = (ArtifactInstance) i.next();
// Do we have a new group?
- if ((null == currentList)
- || (null == currentResource)
- || (groupBy.compare(resource, currentResource) != 0)) {
+ if ((null == currentList) || (null == currentResource)
+ || (groupBy.compare(resource, currentResource) != 0)) {
currentList = new ArrayList();
// Add group to results
@@ -243,8 +238,7 @@
// For comparing group changes..
currentResource = resource;
}
- }
- else {
+ } else {
// A single list (one group)...
result.add(allResults);
}
@@ -261,4 +255,4 @@
}
}
-}
+}
\ No newline at end of file
Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/AbstractRepository.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/AbstractRepository.java (original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/AbstractRepository.java Tue Jul 20 13:40:14 2004
@@ -46,7 +46,7 @@
* @author anou_mana
*/
public abstract class AbstractRepository
- implements Repository, ISelectable, Dumpable {
+ implements Repository, Dumpable {
private RepositoryCapabilitySet m_capabilities = null;
private RepositoryAttributeMap m_attributes = null;
Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/RepositorySet.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/RepositorySet.java (original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/RepositorySet.java Tue Jul 20 13:40:14 2004
@@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import org.apache.depot.common.log.Logger;
import org.apache.depot.update.Repository;
@@ -33,8 +34,7 @@
public class RepositorySet implements IReferenceable {
public static class Identifier extends GenericIdentifier {
- public final static String REPO_SET_URI =
- "http://apache.org/repository/set";
+ public final static String REPO_SET_URI = "http://apache.org/repository/set";
public final static String REPO_SET_PREFIX = "repoSet";
public Identifier(String id) {
@@ -45,7 +45,7 @@
public static final String REPOSITORYSET_CLASSNAME = RepositorySet.class.getName();
private RepositorySet.Identifier m_identifier = null;
- private ArrayList m_repositories = new ArrayList();
+ private List m_repositories = new ArrayList();
/**
*
@@ -105,7 +105,7 @@
/**
* @return
*/
- public ArrayList getRepositories() {
+ public List getRepositories() {
return m_repositories;
}
@@ -117,6 +117,15 @@
}
/**
+ * Is this empty (or does it contain repositories)?
+ *
+ * @return true = empty
+ */
+ public boolean isEmpty() {
+ return m_repositories.isEmpty();
+ }
+
+ /**
* @param list
*/
public void setRepositories(ArrayList list) {
@@ -152,12 +161,11 @@
return buff.toString();
}
- public static RepositorySet getDefaultRepositorySet(
- )
- {
- return RepositorySet.getRepositorySet(
- new RepositorySet.Identifier(UpdateConstants.DEFAULT), true);
+ public static RepositorySet getDefaultRepositorySet() {
+ return RepositorySet.getRepositorySet(new RepositorySet.Identifier(
+ UpdateConstants.DEFAULT), true);
}
+
public static RepositorySet getRepositorySet(
RepositorySet.Identifier identifier, final boolean createIfRequired) {
@@ -181,4 +189,4 @@
return set;
}
-}
+}
\ No newline at end of file
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 Tue Jul 20 13:40:14 2004
@@ -28,8 +28,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 +61,28 @@
// 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));
+ } else {
+ updater.setRepositorySet(RepositorySet.getRepositorySet("gump",
+ false));
}
// Assigned the target (to copy into)
updater.setTargetRepository(getTargetRepository(targetDir));
-
+
// The group to go get
ArtifactGroup group = new ArtifactGroup(groupName);
// Update...
updater.getArtifacts(group);
-
+
// Cleanup (to remove duplicates)
updater.cleanTarget(group);
}
@@ -93,4 +90,4 @@
public static void main(String[] args) {
(new DownloaderTool()).run(args);
}
-}
+}
\ No newline at end of file
Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/util/select/AllSelector.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/util/select/AllSelector.java (original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/util/select/AllSelector.java Tue Jul 20 13:40:14 2004
@@ -16,7 +16,6 @@
package org.apache.depot.update.util.select;
-import org.apache.depot.common.util.SystemUtils;
/**
* @author arb_jack
@@ -36,5 +35,5 @@
return AllSelector.INSTANCE;
}
- public String toString() { return SystemUtils.getShortName(getClass()); }
+ public String toString() { return Boolean.TRUE.toString(); }
}
Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/query/QueryTests.java
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/query/QueryTests.java (original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/query/QueryTests.java Tue Jul 20 13:40:14 2004
@@ -18,6 +18,7 @@
import junit.framework.TestCase;
+import org.apache.depot.common.log.Logger;
import org.apache.depot.common.util.debug.DebugUtils;
import org.apache.depot.update.UpdateException;
import org.apache.depot.update.artifact.ArtifactGroup;
@@ -51,19 +52,22 @@
public void setUp() throws Exception {
m_context = ArtifactUpdaterContext.getTestContext();
+ Logger.testInit();
+
m_engine = new QueryEngine();
- m_repoSet =
- new RepositorySetWrapper(
+ m_repoSet = new RepositorySetWrapper(
RepositorySet.getRepositorySet(UpdateConstants.MOCK, true),
m_context);
+
+ assertTrue("We have some repositories", !m_repoSet.isEmpty());
}
public void testQuery1() throws UpdateException {
ArtifactQuery query = new ArtifactQuery(new ArtifactGroup("test"));
perform(query);
}
-
+
public void testQuery2() throws UpdateException {
ArtifactQuery query =
new ArtifactQuery(
@@ -141,7 +145,6 @@
return result;
}
-
private ArtifactResult performAndCount(
ArtifactQuery query,
int groups,
@@ -163,8 +166,13 @@
}
private ArtifactResult perform(ArtifactQuery query) throws UpdateException {
+
+ DebugUtils.dump(m_repoSet);
+
ArtifactResult result = m_engine.queryRepositories(m_repoSet, query);
+ Logger.getLogger().debug("Query : " + query.toString());
+
DebugUtils.dump(query);
DebugUtils.dump(result);
Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/util/xml/XMLParserTests.java
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/util/xml/XMLParserTests.java (original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/util/xml/XMLParserTests.java Tue Jul 20 13:40:14 2004
@@ -34,9 +34,7 @@
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
- super.setUp();
-
- Logger.testInit();
+ super.setUp();
}
public void testXMLParse() throws Exception {