You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/05 12:02:43 UTC

svn commit: r544459 [14/36] - in /incubator/ivy/core/trunk: src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/ src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver...

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/DefaultNonMatchingVersionReporter.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/DefaultNonMatchingVersionReporter.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/DefaultNonMatchingVersionReporter.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/DefaultNonMatchingVersionReporter.java Tue Jun  5 05:02:27 2007
@@ -24,25 +24,26 @@
 import org.apache.ivy.util.Message;
 
 /**
- * A default implementation of the reporter used in the sort.  The reporting is isolated here to make
- * it easier to test, and to have a place where adding different type of reporting (silent, warning, exceptions) 
+ * A default implementation of the reporter used in the sort. The reporting is isolated here to make
+ * it easier to test, and to have a place where adding different type of reporting (silent, warning,
+ * exceptions)
  */
 public class DefaultNonMatchingVersionReporter implements NonMatchingVersionReporter {
 
-	public void reportNonMatchingVersion(DependencyDescriptor descriptor, ModuleDescriptor md) {
-    	ModuleRevisionId dependencyRevisionId = descriptor.getDependencyRevisionId();
-    	ModuleRevisionId parentRevisionId = descriptor.getParentRevisionId();
-    	if (parentRevisionId==null) {
-    		//There are some rare case where DependencyDescriptor have no parent.  
-    		//This is should not be used in the SortEngine, but if it is, we show a decent trace.
-    		Message.warn("Non matching revision detected.  Dependency " + dependencyRevisionId +
-        			" doesn't match " + md);
-    	} else {
-    		ModuleId parentModuleId = parentRevisionId.getModuleId(); 
-    		Message.warn("Non matching revision detected.  " + parentModuleId + " depends on " 
-    				+ dependencyRevisionId + ", doesn't match " + md);
-    	}
+    public void reportNonMatchingVersion(DependencyDescriptor descriptor, ModuleDescriptor md) {
+        ModuleRevisionId dependencyRevisionId = descriptor.getDependencyRevisionId();
+        ModuleRevisionId parentRevisionId = descriptor.getParentRevisionId();
+        if (parentRevisionId == null) {
+            // There are some rare case where DependencyDescriptor have no parent.
+            // This is should not be used in the SortEngine, but if it is, we show a decent trace.
+            Message.warn("Non matching revision detected.  Dependency " + dependencyRevisionId
+                    + " doesn't match " + md);
+        } else {
+            ModuleId parentModuleId = parentRevisionId.getModuleId();
+            Message.warn("Non matching revision detected.  " + parentModuleId + " depends on "
+                    + dependencyRevisionId + ", doesn't match " + md);
+        }
 
-	}
+    }
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/ModuleDescriptorSorter.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/ModuleDescriptorSorter.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/ModuleDescriptorSorter.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/ModuleDescriptorSorter.java Tue Jun  5 05:02:27 2007
@@ -28,65 +28,73 @@
 import org.apache.ivy.plugins.version.VersionMatcher;
 import org.apache.ivy.util.Message;
 
-
 /**
  * Inner helper class for sorting ModuleDescriptors.<br>
- * ModuleDescriptorSorter use CollectionOfModulesToSort to find the dependencies of the modules, and use ModuleInSort
- * to store some temporary values attached to the modules to sort.
+ * ModuleDescriptorSorter use CollectionOfModulesToSort to find the dependencies of the modules, and
+ * use ModuleInSort to store some temporary values attached to the modules to sort.
+ * 
  * @see ModuleInSort
  * @see CollectionOfModulesToSort
  */
 public class ModuleDescriptorSorter {
-        
+
     private final CollectionOfModulesToSort moduleDescriptors;
+
     private final List sorted = new LinkedList();
-	private final CircularDependencyStrategy circularDepStrategy;
-      
-    
-    public ModuleDescriptorSorter(Collection modulesDescriptorsToSort,VersionMatcher matcher, NonMatchingVersionReporter nonMatchingVersionReporter, CircularDependencyStrategy circularDepStrategy) {
-    	this.circularDepStrategy = circularDepStrategy;
-		moduleDescriptors = new CollectionOfModulesToSort(modulesDescriptorsToSort, matcher , nonMatchingVersionReporter);
+
+    private final CircularDependencyStrategy circularDepStrategy;
+
+    public ModuleDescriptorSorter(Collection modulesDescriptorsToSort, VersionMatcher matcher,
+            NonMatchingVersionReporter nonMatchingVersionReporter,
+            CircularDependencyStrategy circularDepStrategy) {
+        this.circularDepStrategy = circularDepStrategy;
+        moduleDescriptors = new CollectionOfModulesToSort(modulesDescriptorsToSort, matcher,
+                nonMatchingVersionReporter);
     }
-    
+
     /**
      * Iterates over all modules calling sortModuleDescriptorsHelp.
+     * 
      * @return sorted module
      * @throws CircularDependencyException
      */
     public List sortModuleDescriptors() throws CircularDependencyException {
-    	Message.debug("Nbr of module to sort : " + moduleDescriptors.size());
-    	Iterator _moduleDescriptorsIterator = moduleDescriptors.iterator();
+        Message.debug("Nbr of module to sort : " + moduleDescriptors.size());
+        Iterator _moduleDescriptorsIterator = moduleDescriptors.iterator();
         while (_moduleDescriptorsIterator.hasNext()) {
-            ModuleInSort next = (ModuleInSort)_moduleDescriptorsIterator.next();
-			sortModuleDescriptorsHelp(next, next);
+            ModuleInSort next = (ModuleInSort) _moduleDescriptorsIterator.next();
+            sortModuleDescriptorsHelp(next, next);
         }
         return sorted;
     }
 
     /**
-     * If current module has already been added to list, returns,
-     * Otherwise invokes sortModuleDescriptorsHelp for all dependencies
-     * contained within set of moduleDescriptors.  Then finally adds self
-     * to list of sorted.<br/>
-     * When a loop is detected by a recursive call, the moduleDescriptors are not added
-     * immediately added to the sorted list.  They are added as loop dependencies of the root, and will be
-     * added to the sorted list only when the root itself will be added. 
-     * @param current Current module to add to sorted list.
+     * If current module has already been added to list, returns, Otherwise invokes
+     * sortModuleDescriptorsHelp for all dependencies contained within set of moduleDescriptors.
+     * Then finally adds self to list of sorted.<br/> When a loop is detected by a recursive call,
+     * the moduleDescriptors are not added immediately added to the sorted list. They are added as
+     * loop dependencies of the root, and will be added to the sorted list only when the root itself
+     * will be added.
+     * 
+     * @param current
+     *            Current module to add to sorted list.
      * @throws CircularDependencyException
      */
-    private void sortModuleDescriptorsHelp(ModuleInSort current, ModuleInSort caller) throws CircularDependencyException {
-        //if already sorted return
+    private void sortModuleDescriptorsHelp(ModuleInSort current, ModuleInSort caller)
+            throws CircularDependencyException {
+        // if already sorted return
         if (current.isSorted()) {
             return;
         }
-		if (current.checkLoop(caller , circularDepStrategy)) {
-			return;
-		}
-        DependencyDescriptor [] descriptors = current.getDependencies();
-        Message.debug("Sort dependencies of : " + current.toString() + " / Number of dependencies = " + descriptors.length);
+        if (current.checkLoop(caller, circularDepStrategy)) {
+            return;
+        }
+        DependencyDescriptor[] descriptors = current.getDependencies();
+        Message.debug("Sort dependencies of : " + current.toString()
+                + " / Number of dependencies = " + descriptors.length);
         current.setCaller(caller);
         for (int i = 0; i < descriptors.length; i++) {
-        	ModuleInSort child = moduleDescriptors.getModuleDescriptorDependency(descriptors[i]);
+            ModuleInSort child = moduleDescriptors.getModuleDescriptorDependency(descriptors[i]);
             if (child != null) {
                 sortModuleDescriptorsHelp(child, current);
             }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/ModuleInSort.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/ModuleInSort.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/ModuleInSort.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/ModuleInSort.java Tue Jun  5 05:02:27 2007
@@ -30,135 +30,145 @@
 import org.apache.ivy.plugins.version.VersionMatcher;
 import org.apache.ivy.util.Message;
 
-/** 
- * Decorates a ModuleDescriptor with some attributes used during the sort.  Thus every instance of a ModuleInSort can be used in 
- * only one ModuleDescriptorSorter at a time.<br>
+/**
+ * Decorates a ModuleDescriptor with some attributes used during the sort. Thus every instance of a
+ * ModuleInSort can be used in only one ModuleDescriptorSorter at a time.<br>
  * The added fields are : <br>
  * <ul>
  * <li><code>isSorted</code> : is true iff this module has already been added to the sorted list.</li>
- * <li><code>loopElements</code> : When the module is the root of a loop (=the first element of a loop met during the sort), 
- * 		<code>loopElements</code> contains all ModuleInSort of the loop (excluding the root itself.</li>
- * <li><code>isLoopIntermediateElement</code> : When a loop is detected, all modules included in the loop 
- * 		(except the root) have <code>isLoopIntermediateElement</code> set to true.</li>
- * <li><code>caller</code> : During the sort, we traverse recursively the graph.  When doing that, caller point to the parent element. 
+ * <li><code>loopElements</code> : When the module is the root of a loop (=the first element of a
+ * loop met during the sort), <code>loopElements</code> contains all ModuleInSort of the loop
+ * (excluding the root itself.</li>
+ * <li><code>isLoopIntermediateElement</code> : When a loop is detected, all modules included in
+ * the loop (except the root) have <code>isLoopIntermediateElement</code> set to true.</li>
+ * <li><code>caller</code> : During the sort, we traverse recursively the graph. When doing that,
+ * caller point to the parent element.
  */
 class ModuleInSort {
-	
-	private final ModuleDescriptor module;
-	private boolean isSorted = false; 
-	private List loopElements = new LinkedList();
-	private boolean isLoopIntermediateElement = false; 
-	private ModuleInSort caller;
-	
-	public ModuleInSort(ModuleDescriptor moduleToSort) {
-		module = moduleToSort;
-	}
-	
-	public boolean isInLoop() {
-		return isLoopIntermediateElement;
-	}
-
-	public boolean isSorted() {
-		if (isSorted) {
-			Message.debug("Module descriptor already sorted : " + module.getModuleRevisionId().toString());
-			return true;
-		} else {
-			return false;
-		}
-	}
-	
-	public void setCaller(ModuleInSort caller) {
-		this.caller = caller;
-	}
-
-	public void endOfCall() {
-		caller = null;
-	}
-
-	/** 
-	 * Check if a adding this element as a dependency of caller will introduce a circular dependency.
-	 * If it is, all the elements of the loop are flaged as 'loopIntermediateElement', and the loopElements of this module
-	 * (which is the root of the loop) is updated.  The depStrategy is invoked on order to report a correct circular loop message. 
-	 * @param futurCaller
-	 * @param depStrategy
-	 * @return true if a loop is detected.
-	 */
-	public boolean checkLoop(ModuleInSort futurCaller, CircularDependencyStrategy depStrategy) {
-		if (caller!=null) {        	
-	        LinkedList elemOfLoop = new LinkedList();
-	        elemOfLoop.add(this.module.getModuleRevisionId());
-			for(ModuleInSort stackElem = futurCaller ; stackElem!=this ; stackElem=stackElem.caller) {
-				elemOfLoop.add(stackElem.module.getModuleRevisionId());
-				stackElem.isLoopIntermediateElement = true;
-				loopElements.add(stackElem);
-			}
-			elemOfLoop.add(this.module.getModuleRevisionId());
-			ModuleRevisionId[] mrids = (ModuleRevisionId[]) elemOfLoop.toArray(new ModuleRevisionId[elemOfLoop.size()]);
-			depStrategy.handleCircularDependency(mrids);
-	        return true;
-	    } else {
-	    	return false;
-	    }
-	}
-
-	/**
-	 * Add this module to the sorted list except if this module is an intermediary element of a loop.
-	 * If this module is the 'root' of a loop, then all elements of that loops are added before.
-	 * @param sorted The list of sorted elements on which this module will be added
-	 */
-	public void addToSortedListIfRequired(List sorted) {
-		if (!isLoopIntermediateElement) {
-			addToSortList(sorted);
-	    }
-	}
-
-
-	/** 
-	 * Add this module to the sorted list.  
-	 * If current is the 'root' of a loop, then all elements of that loops are added before.
-	 */
-	private void addToSortList(List sortedList) {
-		for (Iterator it = loopElements.iterator(); it.hasNext();) {
-			ModuleInSort moduleInLoop = (ModuleInSort) it.next();
-			moduleInLoop.addToSortList(sortedList);
-		}
-		if (!this.isSorted()) {
-			sortedList.add(module);
-			this.isSorted = true;
-		}
-	}
-
-	
-	public String toString() {
-		return module.getModuleRevisionId().toString();
-	}
-
-	public DependencyDescriptor[] getDependencies() {
-		return module.getDependencies();
-	}
-
-	
-	
-	/** Log a warning saying that a loop is detected */
-	public static void logLoopWarning(List loopElement) {
-		Message.warn("circular dependency detected during sort: "+CircularDependencyHelper.formatMessageFromDescriptors(loopElement));
-	}
-
-
-	/**
-	 * Return true if this module match the DependencyDescriptor with the given versionMatcher.
-	 * If this module has no version defined, then true is always returned.  
-	 */
-	public boolean match(DependencyDescriptor descriptor, VersionMatcher versionMatcher) {
-		ModuleDescriptor md = module;
-		return md.getResolvedModuleRevisionId().getRevision() == null || 
-				md.getResolvedModuleRevisionId().getRevision().equals(Ivy.getWorkingRevision()) ||
-				versionMatcher.accept(descriptor.getDependencyRevisionId(), md);
-		//Checking md.getResolvedModuleRevisionId().getRevision().equals(Ivy.getWorkingRevision() allow to consider any local non resolved ivy.xml
-		//as a valid module.
-	}
-	
-	public ModuleDescriptor getSortedModuleDescriptor() {
-		return module;
-	}
+
+    private final ModuleDescriptor module;
+
+    private boolean isSorted = false;
+
+    private List loopElements = new LinkedList();
+
+    private boolean isLoopIntermediateElement = false;
+
+    private ModuleInSort caller;
+
+    public ModuleInSort(ModuleDescriptor moduleToSort) {
+        module = moduleToSort;
+    }
+
+    public boolean isInLoop() {
+        return isLoopIntermediateElement;
+    }
+
+    public boolean isSorted() {
+        if (isSorted) {
+            Message.debug("Module descriptor already sorted : "
+                    + module.getModuleRevisionId().toString());
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public void setCaller(ModuleInSort caller) {
+        this.caller = caller;
+    }
+
+    public void endOfCall() {
+        caller = null;
+    }
+
+    /**
+     * Check if a adding this element as a dependency of caller will introduce a circular
+     * dependency. If it is, all the elements of the loop are flaged as 'loopIntermediateElement',
+     * and the loopElements of this module (which is the root of the loop) is updated. The
+     * depStrategy is invoked on order to report a correct circular loop message.
+     * 
+     * @param futurCaller
+     * @param depStrategy
+     * @return true if a loop is detected.
+     */
+    public boolean checkLoop(ModuleInSort futurCaller, CircularDependencyStrategy depStrategy) {
+        if (caller != null) {
+            LinkedList elemOfLoop = new LinkedList();
+            elemOfLoop.add(this.module.getModuleRevisionId());
+            for (ModuleInSort stackElem = futurCaller; stackElem != this; stackElem = stackElem.caller) {
+                elemOfLoop.add(stackElem.module.getModuleRevisionId());
+                stackElem.isLoopIntermediateElement = true;
+                loopElements.add(stackElem);
+            }
+            elemOfLoop.add(this.module.getModuleRevisionId());
+            ModuleRevisionId[] mrids = (ModuleRevisionId[]) elemOfLoop
+                    .toArray(new ModuleRevisionId[elemOfLoop.size()]);
+            depStrategy.handleCircularDependency(mrids);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Add this module to the sorted list except if this module is an intermediary element of a
+     * loop. If this module is the 'root' of a loop, then all elements of that loops are added
+     * before.
+     * 
+     * @param sorted
+     *            The list of sorted elements on which this module will be added
+     */
+    public void addToSortedListIfRequired(List sorted) {
+        if (!isLoopIntermediateElement) {
+            addToSortList(sorted);
+        }
+    }
+
+    /**
+     * Add this module to the sorted list. If current is the 'root' of a loop, then all elements of
+     * that loops are added before.
+     */
+    private void addToSortList(List sortedList) {
+        for (Iterator it = loopElements.iterator(); it.hasNext();) {
+            ModuleInSort moduleInLoop = (ModuleInSort) it.next();
+            moduleInLoop.addToSortList(sortedList);
+        }
+        if (!this.isSorted()) {
+            sortedList.add(module);
+            this.isSorted = true;
+        }
+    }
+
+    public String toString() {
+        return module.getModuleRevisionId().toString();
+    }
+
+    public DependencyDescriptor[] getDependencies() {
+        return module.getDependencies();
+    }
+
+    /** Log a warning saying that a loop is detected */
+    public static void logLoopWarning(List loopElement) {
+        Message.warn("circular dependency detected during sort: "
+                + CircularDependencyHelper.formatMessageFromDescriptors(loopElement));
+    }
+
+    /**
+     * Return true if this module match the DependencyDescriptor with the given versionMatcher. If
+     * this module has no version defined, then true is always returned.
+     */
+    public boolean match(DependencyDescriptor descriptor, VersionMatcher versionMatcher) {
+        ModuleDescriptor md = module;
+        return md.getResolvedModuleRevisionId().getRevision() == null
+                || md.getResolvedModuleRevisionId().getRevision().equals(Ivy.getWorkingRevision())
+                || versionMatcher.accept(descriptor.getDependencyRevisionId(), md);
+        // Checking md.getResolvedModuleRevisionId().getRevision().equals(Ivy.getWorkingRevision()
+        // allow to consider any local non resolved ivy.xml
+        // as a valid module.
+    }
+
+    public ModuleDescriptor getSortedModuleDescriptor() {
+        return module;
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/NonMatchingVersionReporter.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/NonMatchingVersionReporter.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/NonMatchingVersionReporter.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/NonMatchingVersionReporter.java Tue Jun  5 05:02:27 2007
@@ -22,12 +22,15 @@
 
 public interface NonMatchingVersionReporter {
 
-    /** 
-     * Report to the user that ivy has detected that a module to sort has a dependency
-	 * on an other module to sort, but the revisions doesn't match.
-	 * @param descriptor The non matching dependency descriptor.
-	 * @param md The module to sort having the corect moduleID but a non matching revision
-	 */ 
-	public void reportNonMatchingVersion(DependencyDescriptor descriptor, ModuleDescriptor md);
-	
+    /**
+     * Report to the user that ivy has detected that a module to sort has a dependency on an other
+     * module to sort, but the revisions doesn't match.
+     * 
+     * @param descriptor
+     *            The non matching dependency descriptor.
+     * @param md
+     *            The module to sort having the corect moduleID but a non matching revision
+     */
+    public void reportNonMatchingVersion(DependencyDescriptor descriptor, ModuleDescriptor md);
+
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/SortEngine.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/SortEngine.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/SortEngine.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/SortEngine.java Tue Jun  5 05:02:27 2007
@@ -30,28 +30,28 @@
 import org.apache.ivy.plugins.circular.CircularDependencyException;
 
 public class SortEngine {
-	private IvySettings settings;
-	
-    public SortEngine(IvySettings settings) {
-		this.settings = settings;
-	}
+    private IvySettings settings;
 
+    public SortEngine(IvySettings settings) {
+        this.settings = settings;
+    }
 
-	public List sortNodes(Collection nodes) {
-        /* here we want to use the sort algorithm which work on module descriptors :
-         * so we first put dependencies on a map from descriptors to dependency, then we 
-         * sort the keySet (i.e. a collection of descriptors), then we replace
-         * in the sorted list each descriptor by the corresponding dependency
+    public List sortNodes(Collection nodes) {
+        /*
+         * here we want to use the sort algorithm which work on module descriptors : so we first put
+         * dependencies on a map from descriptors to dependency, then we sort the keySet (i.e. a
+         * collection of descriptors), then we replace in the sorted list each descriptor by the
+         * corresponding dependency
          */
-        
+
         Map dependenciesMap = new LinkedHashMap();
         List nulls = new ArrayList();
         for (Iterator iter = nodes.iterator(); iter.hasNext();) {
-            IvyNode node = (IvyNode)iter.next();
+            IvyNode node = (IvyNode) iter.next();
             if (node.getDescriptor() == null) {
                 nulls.add(node);
             } else {
-                List n = (List)dependenciesMap.get(node.getDescriptor());
+                List n = (List) dependenciesMap.get(node.getDescriptor());
                 if (n == null) {
                     n = new ArrayList();
                     dependenciesMap.put(node.getDescriptor(), n);
@@ -60,34 +60,40 @@
             }
         }
         List list = sortModuleDescriptors(dependenciesMap.keySet());
-        List ret = new ArrayList((int)(list.size()*1.3+nulls.size())); //attempt to adjust the size to avoid too much list resizing
-        for (int i=0; i<list.size(); i++) {
-            ModuleDescriptor md = (ModuleDescriptor)list.get(i);
-            List n = (List)dependenciesMap.get(md);
-            ret.addAll(n);            
+        List ret = new ArrayList((int) (list.size() * 1.3 + nulls.size())); // attempt to adjust the
+        // size to avoid too
+        // much list resizing
+        for (int i = 0; i < list.size(); i++) {
+            ModuleDescriptor md = (ModuleDescriptor) list.get(i);
+            List n = (List) dependenciesMap.get(md);
+            ret.addAll(n);
         }
         ret.addAll(0, nulls);
         return ret;
     }
 
-
     /**
-     * Sorts the given ModuleDescriptors from the less dependent to the more dependent.
-     * This sort ensures that a ModuleDescriptor is always found in the list before all 
-     * ModuleDescriptors depending directly on it.
-     * @param moduleDescriptors a Collection of ModuleDescriptor to sort
+     * Sorts the given ModuleDescriptors from the less dependent to the more dependent. This sort
+     * ensures that a ModuleDescriptor is always found in the list before all ModuleDescriptors
+     * depending directly on it.
+     * 
+     * @param moduleDescriptors
+     *            a Collection of ModuleDescriptor to sort
      * @return a List of sorted ModuleDescriptors
-     * @throws CircularDependencyException if a circular dependency exists
+     * @throws CircularDependencyException
+     *             if a circular dependency exists
      */
-    public List sortModuleDescriptors(Collection moduleDescriptors) throws CircularDependencyException {
-		return sortModuleDescriptors(moduleDescriptors , new DefaultNonMatchingVersionReporter());   
+    public List sortModuleDescriptors(Collection moduleDescriptors)
+            throws CircularDependencyException {
+        return sortModuleDescriptors(moduleDescriptors, new DefaultNonMatchingVersionReporter());
     }
 
-
-	public List sortModuleDescriptors(Collection moduleDescriptors, NonMatchingVersionReporter nonMatchingVersionReporter) {
-		ModuleDescriptorSorter sorter = new ModuleDescriptorSorter(moduleDescriptors, 
-        		settings.getVersionMatcher(), nonMatchingVersionReporter , settings.getCircularDependencyStrategy());
-		return sorter.sortModuleDescriptors();
-	}
+    public List sortModuleDescriptors(Collection moduleDescriptors,
+            NonMatchingVersionReporter nonMatchingVersionReporter) {
+        ModuleDescriptorSorter sorter = new ModuleDescriptorSorter(moduleDescriptors, settings
+                .getVersionMatcher(), nonMatchingVersionReporter, settings
+                .getCircularDependencyStrategy());
+        return sorter.sortModuleDescriptors();
+    }
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/AbstractCircularDependencyStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/AbstractCircularDependencyStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/AbstractCircularDependencyStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/AbstractCircularDependencyStrategy.java Tue Jun  5 05:02:27 2007
@@ -18,17 +18,17 @@
 package org.apache.ivy.plugins.circular;
 
 public abstract class AbstractCircularDependencyStrategy implements CircularDependencyStrategy {
-	private String _name;
+    private String _name;
 
-	protected AbstractCircularDependencyStrategy(String name) {
-		_name = name;	
-	}
-	
-	public String getName() {
-		return _name;
-	}
-	
-	public String toString() {
-		return getName();
-	}
+    protected AbstractCircularDependencyStrategy(String name) {
+        _name = name;
+    }
+
+    public String getName() {
+        return _name;
+    }
+
+    public String toString() {
+        return getName();
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyException.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyException.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyException.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyException.java Tue Jun  5 05:02:27 2007
@@ -19,28 +19,25 @@
 
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 
-
 /**
  * Unchecked exception thrown when a circular dependency exists between projects.
- *
  */
 
 public class CircularDependencyException extends RuntimeException {
 
     private ModuleRevisionId[] _mrids;
 
-	/**
-     * 
-     * @param descriptors module descriptors in order of circular dependency
+    /**
+     * @param descriptors
+     *            module descriptors in order of circular dependency
      */
     public CircularDependencyException(final ModuleRevisionId[] mrids) {
         super(CircularDependencyHelper.formatMessage(mrids));
         _mrids = mrids;
     }
-    
+
     public ModuleRevisionId[] getPath() {
-    	return _mrids;
+        return _mrids;
     }
-    
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java Tue Jun  5 05:02:27 2007
@@ -27,7 +27,9 @@
 
     /**
      * Returns a string representation of this circular dependency graph
-     * @param descriptors in order of circular dependency
+     * 
+     * @param descriptors
+     *            in order of circular dependency
      * @return
      */
     public static String formatMessage(final ModuleRevisionId[] mrids) {
@@ -41,30 +43,30 @@
     }
 
     public static String formatMessage(final ModuleDescriptor[] descriptors) {
-    	return formatMessage(toMrids(descriptors));
+        return formatMessage(toMrids(descriptors));
     }
-    
+
     /**
-    * @param loopElements a List<ModuleDescriptor>
-	*/
+     * @param loopElements
+     *            a List<ModuleDescriptor>
+     */
     public static String formatMessageFromDescriptors(List loopElements) {
-    	ModuleRevisionId[] mrids = new ModuleRevisionId[loopElements.size()];
-		int pos = 0;
-		for (Iterator it = loopElements.iterator(); it.hasNext();) {
-			ModuleDescriptor descriptor = (ModuleDescriptor) it.next();
-			mrids[pos] = descriptor.getModuleRevisionId();
-			pos++;
-		}
-		return formatMessage(mrids);
-	}
+        ModuleRevisionId[] mrids = new ModuleRevisionId[loopElements.size()];
+        int pos = 0;
+        for (Iterator it = loopElements.iterator(); it.hasNext();) {
+            ModuleDescriptor descriptor = (ModuleDescriptor) it.next();
+            mrids[pos] = descriptor.getModuleRevisionId();
+            pos++;
+        }
+        return formatMessage(mrids);
+    }
 
-	public static ModuleRevisionId[] toMrids(ModuleDescriptor[] descriptors) {
-		ModuleRevisionId[] mrids = new ModuleRevisionId[descriptors.length];
-		for (int i = 0; i < descriptors.length; i++) {
-			mrids[i] = descriptors[i].getModuleRevisionId();
-		}
-		return mrids;
-	}
-	
+    public static ModuleRevisionId[] toMrids(ModuleDescriptor[] descriptors) {
+        ModuleRevisionId[] mrids = new ModuleRevisionId[descriptors.length];
+        for (int i = 0; i < descriptors.length; i++) {
+            mrids[i] = descriptors[i].getModuleRevisionId();
+        }
+        return mrids;
+    }
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyStrategy.java Tue Jun  5 05:02:27 2007
@@ -20,8 +20,8 @@
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 
 public interface CircularDependencyStrategy {
-	String getName();
+    String getName();
 
-	void handleCircularDependency(ModuleRevisionId[] mrids);
+    void handleCircularDependency(ModuleRevisionId[] mrids);
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/ErrorCircularDependencyStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/ErrorCircularDependencyStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/ErrorCircularDependencyStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/ErrorCircularDependencyStrategy.java Tue Jun  5 05:02:27 2007
@@ -20,19 +20,18 @@
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 
 public class ErrorCircularDependencyStrategy extends AbstractCircularDependencyStrategy {
-	
-	private static final CircularDependencyStrategy INSTANCE = new ErrorCircularDependencyStrategy();
 
+    private static final CircularDependencyStrategy INSTANCE = new ErrorCircularDependencyStrategy();
 
-	public static CircularDependencyStrategy getInstance() {
-		return INSTANCE;
-	}
-	
-	private ErrorCircularDependencyStrategy() {
-		super("error");
-	}
-	
-	public void handleCircularDependency(ModuleRevisionId[] mrids) {
-		throw new CircularDependencyException(mrids);
-	}
+    public static CircularDependencyStrategy getInstance() {
+        return INSTANCE;
+    }
+
+    private ErrorCircularDependencyStrategy() {
+        super("error");
+    }
+
+    public void handleCircularDependency(ModuleRevisionId[] mrids) {
+        throw new CircularDependencyException(mrids);
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/IgnoreCircularDependencyStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/IgnoreCircularDependencyStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/IgnoreCircularDependencyStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/IgnoreCircularDependencyStrategy.java Tue Jun  5 05:02:27 2007
@@ -21,19 +21,19 @@
 import org.apache.ivy.util.Message;
 
 public class IgnoreCircularDependencyStrategy extends AbstractCircularDependencyStrategy {
-	
-	private static final CircularDependencyStrategy INSTANCE = new IgnoreCircularDependencyStrategy();
 
+    private static final CircularDependencyStrategy INSTANCE = new IgnoreCircularDependencyStrategy();
 
-	public static CircularDependencyStrategy getInstance() {
-		return INSTANCE;
-	}
-	
-	private IgnoreCircularDependencyStrategy() {
-		super("ignore");
-	}
-	
-	public void handleCircularDependency(ModuleRevisionId[] mrids) {
-		Message.verbose("circular dependency found: "+ CircularDependencyHelper.formatMessage(mrids));
-	}
+    public static CircularDependencyStrategy getInstance() {
+        return INSTANCE;
+    }
+
+    private IgnoreCircularDependencyStrategy() {
+        super("ignore");
+    }
+
+    public void handleCircularDependency(ModuleRevisionId[] mrids) {
+        Message.verbose("circular dependency found: "
+                + CircularDependencyHelper.formatMessage(mrids));
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/WarnCircularDependencyStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/WarnCircularDependencyStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/WarnCircularDependencyStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/WarnCircularDependencyStrategy.java Tue Jun  5 05:02:27 2007
@@ -21,19 +21,18 @@
 import org.apache.ivy.util.Message;
 
 public class WarnCircularDependencyStrategy extends AbstractCircularDependencyStrategy {
-	
-	private static final CircularDependencyStrategy INSTANCE = new WarnCircularDependencyStrategy();
 
+    private static final CircularDependencyStrategy INSTANCE = new WarnCircularDependencyStrategy();
 
-	public static CircularDependencyStrategy getInstance() {
-		return INSTANCE;
-	}
-	
-	private WarnCircularDependencyStrategy() {
-		super("warn");
-	}
-	
-	public void handleCircularDependency(ModuleRevisionId[] mrids) {
-		Message.warn("circular dependency found: "+ CircularDependencyHelper.formatMessage(mrids));
-	}
+    public static CircularDependencyStrategy getInstance() {
+        return INSTANCE;
+    }
+
+    private WarnCircularDependencyStrategy() {
+        super("warn");
+    }
+
+    public void handleCircularDependency(ModuleRevisionId[] mrids) {
+        Message.warn("circular dependency found: " + CircularDependencyHelper.formatMessage(mrids));
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/AbstractConflictManager.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/AbstractConflictManager.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/AbstractConflictManager.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/AbstractConflictManager.java Tue Jun  5 05:02:27 2007
@@ -22,11 +22,12 @@
 
 public abstract class AbstractConflictManager implements ConflictManager, IvySettingsAware {
     private String _name;
+
     private IvySettings _settings;
 
     public IvySettings getSettings() {
         return _settings;
-    }    
+    }
 
     public void setSettings(IvySettings ivy) {
         _settings = ivy;
@@ -34,12 +35,12 @@
 
     public String getName() {
         return _name;
-    }    
+    }
 
     public void setName(String name) {
         _name = name;
     }
-    
+
     public String toString() {
         return _name;
     }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/ConflictManager.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/ConflictManager.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/ConflictManager.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/ConflictManager.java Tue Jun  5 05:02:27 2007
@@ -23,20 +23,21 @@
 
 public interface ConflictManager {
     /**
-     * Resolves the eventual conflicts found in the given collection of IvyNode.
-     * This method return a Collection of IvyNode which have not been evicted.
-     * The given conflicts Collection contains at least one IvyNode.
+     * Resolves the eventual conflicts found in the given collection of IvyNode. This method return
+     * a Collection of IvyNode which have not been evicted. The given conflicts Collection contains
+     * at least one IvyNode. This method can be called with IvyNodes which are not yet loaded. If
+     * this conflict manager is not able to resolve conflicts with the current data found in the
+     * IvyNodes and need them to be fully loaded, it will return null to indicate that no conflict
+     * resolution has been done.
      * 
-     * This method can be called with IvyNodes which are not yet loaded.
-     * If this conflict manager is not able to resolve conflicts with the current
-     * data found in the IvyNodes and need them to be fully loaded, it will 
-     * return null to indicate that no conflict resolution has been done.
-     * 
-     * @param parent the ivy node parent for which the conflict is to be resolved
-     * @param conflicts the collection of IvyNode to check for conflicts
-     * @return a Collection of IvyNode which have not been evicted, or null if
-     *         conflict management resolution is not possible yet
+     * @param parent
+     *            the ivy node parent for which the conflict is to be resolved
+     * @param conflicts
+     *            the collection of IvyNode to check for conflicts
+     * @return a Collection of IvyNode which have not been evicted, or null if conflict management
+     *         resolution is not possible yet
      */
     Collection resolveConflicts(IvyNode parent, Collection conflicts);
+
     String getName();
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/FixedConflictManager.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/FixedConflictManager.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/FixedConflictManager.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/FixedConflictManager.java Tue Jun  5 05:02:27 2007
@@ -24,17 +24,18 @@
 
 import org.apache.ivy.core.resolve.IvyNode;
 
-
 public class FixedConflictManager extends AbstractConflictManager {
     private Collection _revs;
+
     public FixedConflictManager(String[] revs) {
         _revs = Arrays.asList(revs);
-        setName("fixed"+_revs);
+        setName("fixed" + _revs);
     }
+
     public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
         Collection resolved = new ArrayList(conflicts.size());
         for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
-            IvyNode node = (IvyNode)iter.next();
+            IvyNode node = (IvyNode) iter.next();
             String revision = node.getResolvedId().getRevision();
             if (_revs.contains(revision)) {
                 resolved.add(node);
@@ -46,5 +47,5 @@
     public Collection getRevs() {
         return _revs;
     }
-    
+
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestConflictManager.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestConflictManager.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestConflictManager.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestConflictManager.java Tue Jun  5 05:02:27 2007
@@ -29,13 +29,11 @@
 import org.apache.ivy.plugins.latest.LatestStrategy;
 import org.apache.ivy.util.Message;
 
-
 public class LatestConflictManager extends AbstractConflictManager {
     public static class NoConflictResolvedYetException extends RuntimeException {
-	}
-
+    }
 
-	private static class IvyNodeArtifactInfo implements ArtifactInfo {
+    private static class IvyNodeArtifactInfo implements ArtifactInfo {
         private final IvyNode _node;
 
         private IvyNodeArtifactInfo(IvyNode dep) {
@@ -43,29 +41,28 @@
         }
 
         public long getLastModified() {
-        	long lastModified = _node.getLastModified();
-        	if (lastModified == 0) {
-        		// if the last modified timestamp is unknown, we can't resolve
-        		// the conflicts now, and trigger an exception which will be catched
-        		// in the main resolveConflicts method
-        		throw new NoConflictResolvedYetException();
-        	} else {
-        		return lastModified;
-        	}
+            long lastModified = _node.getLastModified();
+            if (lastModified == 0) {
+                // if the last modified timestamp is unknown, we can't resolve
+                // the conflicts now, and trigger an exception which will be catched
+                // in the main resolveConflicts method
+                throw new NoConflictResolvedYetException();
+            } else {
+                return lastModified;
+            }
         }
 
         public String getRevision() {
             return _node.getResolvedId().getRevision();
         }
-        
+
         public IvyNode getNode() {
             return _node;
         }
     }
 
-
-
     private LatestStrategy _strategy;
+
     private String _strategyName;
 
     public LatestConflictManager() {
@@ -85,34 +82,34 @@
             return conflicts;
         }
         for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
-            IvyNode node = (IvyNode)iter.next();
+            IvyNode node = (IvyNode) iter.next();
             DependencyDescriptor dd = node.getDependencyDescriptor(parent);
-            if (dd != null && dd.isForce() 
-            		&& parent.getResolvedId().equals(dd.getParentRevisionId())) {
+            if (dd != null && dd.isForce()
+                    && parent.getResolvedId().equals(dd.getParentRevisionId())) {
                 return Collections.singleton(node);
             }
         }
         try {
-	        ArtifactInfo latest = getStrategy().findLatest(toArtifactInfo(conflicts), null);
-	        if (latest != null) {
-	            return Collections.singleton(((IvyNodeArtifactInfo)latest).getNode());
-	        } else {
-	            return conflicts;
-	        }
+            ArtifactInfo latest = getStrategy().findLatest(toArtifactInfo(conflicts), null);
+            if (latest != null) {
+                return Collections.singleton(((IvyNodeArtifactInfo) latest).getNode());
+            } else {
+                return conflicts;
+            }
         } catch (NoConflictResolvedYetException ex) {
-        	// we have not enough informations in the nodes to resolve conflict
-        	// according to the resolveConflicts contract, we must return null
-        	return null;
+            // we have not enough informations in the nodes to resolve conflict
+            // according to the resolveConflicts contract, we must return null
+            return null;
         }
     }
 
     private ArtifactInfo[] toArtifactInfo(Collection conflicts) {
         List artifacts = new ArrayList(conflicts.size());
         for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
-            IvyNode node = (IvyNode)iter.next();
+            IvyNode node = (IvyNode) iter.next();
             artifacts.add(new IvyNodeArtifactInfo(node));
         }
-        return (ArtifactInfo[])artifacts.toArray(new ArtifactInfo[artifacts.size()]);
+        return (ArtifactInfo[]) artifacts.toArray(new ArtifactInfo[artifacts.size()]);
     }
 
     public LatestStrategy getStrategy() {
@@ -120,7 +117,7 @@
             if (_strategyName != null) {
                 _strategy = getSettings().getLatestStrategy(_strategyName);
                 if (_strategy == null) {
-                    Message.error("unknown latest strategy: "+_strategyName);
+                    Message.error("unknown latest strategy: " + _strategyName);
                     _strategy = getSettings().getDefaultLatestStrategy();
                 }
             } else {
@@ -129,22 +126,21 @@
         }
         return _strategy;
     }
-    
 
     /**
      * To conform to configurator API
+     * 
      * @param latestStrategy
      */
     public void setLatest(String strategyName) {
         _strategyName = strategyName;
     }
-    
+
     public void setStrategy(LatestStrategy strategy) {
         _strategy = strategy;
     }
-    
 
     public String toString() {
-        return _strategy != null?String.valueOf(_strategy):_strategyName;
+        return _strategy != null ? String.valueOf(_strategy) : _strategyName;
     }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/NoConflictManager.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/NoConflictManager.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/NoConflictManager.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/NoConflictManager.java Tue Jun  5 05:02:27 2007
@@ -21,11 +21,11 @@
 
 import org.apache.ivy.core.resolve.IvyNode;
 
-
 public class NoConflictManager extends AbstractConflictManager {
     public NoConflictManager() {
         setName("all");
     }
+
     public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
         return conflicts;
     }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/RegexpConflictManager.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/RegexpConflictManager.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/RegexpConflictManager.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/RegexpConflictManager.java Tue Jun  5 05:02:27 2007
@@ -27,11 +27,9 @@
 import org.apache.ivy.core.resolve.IvyNode;
 import org.apache.ivy.util.Message;
 
-
 /**
- * A ConflictManager that can be used to resolve conflicts based on regular
- * expressions of the revision of the module. The conflict manager is added like
- * this:
+ * A ConflictManager that can be used to resolve conflicts based on regular expressions of the
+ * revision of the module. The conflict manager is added like this:
  * 
  * <pre>
  *    &lt;!-- Match all revisions, but ignore the last dot(.) and the character after it.
@@ -41,88 +39,83 @@
  *    &lt;/conflict-managers&gt;
  * </pre>
  * 
- * The regular expression must contain a capturing group. The group will be used
- * to resolve the conflicts by an String.equals() test. If ignoreNonMatching is
- * false non matching modules will result in an exception. If it is true they
- * will be compaired by their full revision.
- * 
- *
+ * The regular expression must contain a capturing group. The group will be used to resolve the
+ * conflicts by an String.equals() test. If ignoreNonMatching is false non matching modules will
+ * result in an exception. If it is true they will be compaired by their full revision.
  */
 public class RegexpConflictManager extends AbstractConflictManager {
-	private Pattern pattern = Pattern.compile("(.*)");
+    private Pattern pattern = Pattern.compile("(.*)");
 
-	private boolean mIgnoreNonMatching;
+    private boolean mIgnoreNonMatching;
 
-	public RegexpConflictManager() {
-	}
+    public RegexpConflictManager() {
+    }
 
-	public void setRegexp(String regexp) {
-		pattern = Pattern.compile(regexp);
-		Matcher matcher = pattern.matcher("abcdef");
-		if (matcher.groupCount() != 1) {
-			String message = "Pattern does not contain ONE (capturing group): '"
-					+ pattern + "'";
-			Message.error(message);
-			throw new IllegalArgumentException(message);
-		}
-	}
-
-	public void setIgnoreNonMatching(boolean ignoreNonMatching) {
-		mIgnoreNonMatching = ignoreNonMatching;
-	}
-
-	public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
-		IvyNode lastNode = null;
-		for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
-			IvyNode node = (IvyNode) iter.next();
-
-			if (lastNode != null && !matchEquals(node, lastNode)) {
-				String msg = lastNode + ":" + getMatch(lastNode)
-						+ " (needed by " + Arrays.asList(lastNode.getAllCallers())
-						+ ") conflicts with " + node + ":" + getMatch(node)
-						+ " (needed by " + Arrays.asList(node.getAllCallers()) + ")";
-				Message.error(msg);
-				Message.sumupProblems();
-				throw new StrictConflictException(msg);
-			}
-			if (lastNode == null || nodeIsGreater(node, lastNode)) {
-				lastNode = node;
-			}
-		}
-
-		return Collections.singleton(lastNode);
-	}
-
-	private boolean nodeIsGreater(IvyNode node, IvyNode lastNode) {
-		return getMatch(node).compareTo(getMatch(lastNode)) > 0;
-	}
-
-	private boolean matchEquals(IvyNode lastNode, IvyNode node) {
-		return getMatch(lastNode).equals(getMatch(node));
-	}
-
-	private String getMatch(IvyNode node) {
-		String revision = node.getId().getRevision();
-		Matcher matcher = pattern.matcher(revision);
-		if (matcher.matches()) {
-			String match = matcher.group(1);
-			if (match != null) {
-				return match;
-			}
-			warnOrThrow("First group of pattern: '" + pattern
-					+ "' does not match: " + revision + " " + node);
-		} else {
-			warnOrThrow("Pattern: '" + pattern + "' does not match: "
-					+ revision + " " + node);
-		}
-		return revision;
-	}
-
-	private void warnOrThrow(String message) {
-		if (mIgnoreNonMatching) {
-			Message.warn(message);
-		} else {
-			throw new StrictConflictException(message);
-		}
-	}
+    public void setRegexp(String regexp) {
+        pattern = Pattern.compile(regexp);
+        Matcher matcher = pattern.matcher("abcdef");
+        if (matcher.groupCount() != 1) {
+            String message = "Pattern does not contain ONE (capturing group): '" + pattern + "'";
+            Message.error(message);
+            throw new IllegalArgumentException(message);
+        }
+    }
+
+    public void setIgnoreNonMatching(boolean ignoreNonMatching) {
+        mIgnoreNonMatching = ignoreNonMatching;
+    }
+
+    public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
+        IvyNode lastNode = null;
+        for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
+            IvyNode node = (IvyNode) iter.next();
+
+            if (lastNode != null && !matchEquals(node, lastNode)) {
+                String msg = lastNode + ":" + getMatch(lastNode) + " (needed by "
+                        + Arrays.asList(lastNode.getAllCallers()) + ") conflicts with " + node
+                        + ":" + getMatch(node) + " (needed by "
+                        + Arrays.asList(node.getAllCallers()) + ")";
+                Message.error(msg);
+                Message.sumupProblems();
+                throw new StrictConflictException(msg);
+            }
+            if (lastNode == null || nodeIsGreater(node, lastNode)) {
+                lastNode = node;
+            }
+        }
+
+        return Collections.singleton(lastNode);
+    }
+
+    private boolean nodeIsGreater(IvyNode node, IvyNode lastNode) {
+        return getMatch(node).compareTo(getMatch(lastNode)) > 0;
+    }
+
+    private boolean matchEquals(IvyNode lastNode, IvyNode node) {
+        return getMatch(lastNode).equals(getMatch(node));
+    }
+
+    private String getMatch(IvyNode node) {
+        String revision = node.getId().getRevision();
+        Matcher matcher = pattern.matcher(revision);
+        if (matcher.matches()) {
+            String match = matcher.group(1);
+            if (match != null) {
+                return match;
+            }
+            warnOrThrow("First group of pattern: '" + pattern + "' does not match: " + revision
+                    + " " + node);
+        } else {
+            warnOrThrow("Pattern: '" + pattern + "' does not match: " + revision + " " + node);
+        }
+        return revision;
+    }
+
+    private void warnOrThrow(String message) {
+        if (mIgnoreNonMatching) {
+            Message.warn(message);
+        } else {
+            throw new StrictConflictException(message);
+        }
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/StrictConflictManager.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/StrictConflictManager.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/StrictConflictManager.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/StrictConflictManager.java Tue Jun  5 05:02:27 2007
@@ -25,23 +25,20 @@
 import org.apache.ivy.core.resolve.IvyNode;
 import org.apache.ivy.util.Message;
 
-
-
-public class StrictConflictManager extends AbstractConflictManager
-{
+public class StrictConflictManager extends AbstractConflictManager {
 
     public StrictConflictManager() {
     }
 
-
-    public Collection resolveConflicts(IvyNode parent, Collection conflicts)
-    {
+    public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
         IvyNode lastNode = null;
         for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
-            IvyNode node = (IvyNode)iter.next();
+            IvyNode node = (IvyNode) iter.next();
 
             if (lastNode != null && !lastNode.equals(node)) {
-                String msg = lastNode + " (needed by " + Arrays.asList(lastNode.getAllCallers()) + ") conflicts with " + node + " (needed by " + Arrays.asList(node.getAllCallers()) + ")";
+                String msg = lastNode + " (needed by " + Arrays.asList(lastNode.getAllCallers())
+                        + ") conflicts with " + node + " (needed by "
+                        + Arrays.asList(node.getAllCallers()) + ")";
                 Message.error(msg);
                 Message.sumupProblems();
                 throw new StrictConflictException(msg);

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/AbstractLatestStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/AbstractLatestStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/AbstractLatestStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/AbstractLatestStrategy.java Tue Jun  5 05:02:27 2007
@@ -24,14 +24,14 @@
 import org.apache.ivy.Ivy;
 import org.apache.ivy.plugins.IvyAware;
 
-
 public abstract class AbstractLatestStrategy implements LatestStrategy, IvyAware {
     private String _name;
+
     private Ivy _ivy;
 
     public Ivy getIvy() {
         return _ivy;
-    }    
+    }
 
     public void setIvy(Ivy ivy) {
         _ivy = ivy;
@@ -40,26 +40,26 @@
     public String getName() {
         return _name;
     }
-    
+
     public void setName(String name) {
         _name = name;
     }
-    
+
     public String toString() {
         return _name;
     }
-    
+
     public ArtifactInfo findLatest(ArtifactInfo[] infos, Date date) {
-    	List l = sort(infos);
-    	
-    	// the latest revision comes last, use a ListIterator to iterate the
-    	// sorted list in the reverse direction.
-    	for (ListIterator iter = l.listIterator(l.size()); iter.hasPrevious();) {
-			ArtifactInfo info = (ArtifactInfo) iter.previous();
-			if (date == null || info.getLastModified() < date.getTime()) {
-				return info;
-			}
-		}
-    	return null;
+        List l = sort(infos);
+
+        // the latest revision comes last, use a ListIterator to iterate the
+        // sorted list in the reverse direction.
+        for (ListIterator iter = l.listIterator(l.size()); iter.hasPrevious();) {
+            ArtifactInfo info = (ArtifactInfo) iter.previous();
+            if (date == null || info.getLastModified() < date.getTime()) {
+                return info;
+            }
+        }
+        return null;
     }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/ArtifactInfo.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/ArtifactInfo.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/ArtifactInfo.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/ArtifactInfo.java Tue Jun  5 05:02:27 2007
@@ -19,5 +19,6 @@
 
 public interface ArtifactInfo {
     String getRevision();
+
     long getLastModified();
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/ComparatorLatestStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/ComparatorLatestStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/ComparatorLatestStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/ComparatorLatestStrategy.java Tue Jun  5 05:02:27 2007
@@ -23,31 +23,29 @@
 import java.util.Comparator;
 import java.util.List;
 
-
-
 public class ComparatorLatestStrategy extends AbstractLatestStrategy {
 
-	private Comparator _comparator;
+    private Comparator _comparator;
 
-	public ComparatorLatestStrategy() {
-	}
+    public ComparatorLatestStrategy() {
+    }
 
-	public ComparatorLatestStrategy(Comparator comparator) {
-		_comparator = comparator;
-	}
+    public ComparatorLatestStrategy(Comparator comparator) {
+        _comparator = comparator;
+    }
 
     public List sort(ArtifactInfo[] infos) {
-    	List ret = new ArrayList(Arrays.asList(infos));
-    	Collections.sort(ret, _comparator);
-    	return ret;
+        List ret = new ArrayList(Arrays.asList(infos));
+        Collections.sort(ret, _comparator);
+        return ret;
     }
 
-	public Comparator getComparator() {
-		return _comparator;
-	}
-
-	public void setComparator(Comparator comparator) {
-		_comparator = comparator;
-	}
+    public Comparator getComparator() {
+        return _comparator;
+    }
+
+    public void setComparator(Comparator comparator) {
+        _comparator = comparator;
+    }
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestLexicographicStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestLexicographicStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestLexicographicStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestLexicographicStrategy.java Tue Jun  5 05:02:27 2007
@@ -19,22 +19,17 @@
 
 import java.util.Comparator;
 
-
-
-
 public class LatestLexicographicStrategy extends ComparatorLatestStrategy {
     /**
-     * Compares two revisions.
-     * Revisions are compared lexicographically unless
-     * a 'latest' revision is found. If the latest revision found
-     * is an absolute latest (latest. like), then it is assumed to be the greater.
-     * If a partial latest is found, then it is assumed to be greater
-     * than any matching fixed revision. 
-     */ 
+     * Compares two revisions. Revisions are compared lexicographically unless a 'latest' revision
+     * is found. If the latest revision found is an absolute latest (latest. like), then it is
+     * assumed to be the greater. If a partial latest is found, then it is assumed to be greater
+     * than any matching fixed revision.
+     */
     private static Comparator COMPARATOR = new Comparator() {
         public int compare(Object o1, Object o2) {
-            String rev1 = ((ArtifactInfo)o1).getRevision();
-            String rev2 = ((ArtifactInfo)o2).getRevision();
+            String rev1 = ((ArtifactInfo) o1).getRevision();
+            String rev2 = ((ArtifactInfo) o2).getRevision();
             if (rev1.startsWith("latest")) {
                 return 1;
             }
@@ -49,12 +44,12 @@
             }
             return rev1.compareTo(rev2);
         }
-    
+
     };
-    
+
     public LatestLexicographicStrategy() {
-    	super(COMPARATOR);
+        super(COMPARATOR);
         setName("latest-lexico");
     }
-    
+
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java Tue Jun  5 05:02:27 2007
@@ -25,32 +25,35 @@
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.plugins.version.VersionMatcher;
 
-
-
-
 public class LatestRevisionStrategy extends ComparatorLatestStrategy {
     public static class SpecialMeaning {
         private String _name;
+
         private Integer _value;
+
         public String getName() {
             return _name;
         }
+
         public void setName(String name) {
             _name = name;
         }
+
         public Integer getValue() {
             return _value;
         }
+
         public void setValue(Integer value) {
             _value = value;
         }
+
         public void validate() {
             if (_name == null) {
                 throw new IllegalStateException("a special meaning should have a name");
             }
             if (_value == null) {
                 throw new IllegalStateException("a special meaning should have a value");
-            }            
+            }
         }
     }
 
@@ -63,25 +66,24 @@
     }
 
     /**
-     * Compares two ModuleRevisionId by their revision.
-     * Revisions are compared using an algorithm inspired by PHP
-     * version_compare one. 
-     */ 
+     * Compares two ModuleRevisionId by their revision. Revisions are compared using an algorithm
+     * inspired by PHP version_compare one.
+     */
     public final Comparator STATIC_COMPARATOR = new Comparator() {
-    	public int compare(Object o1, Object o2) {
-            String rev1 = ((ModuleRevisionId)o1).getRevision();
-            String rev2 = ((ModuleRevisionId)o2).getRevision();
-            
+        public int compare(Object o1, Object o2) {
+            String rev1 = ((ModuleRevisionId) o1).getRevision();
+            String rev2 = ((ModuleRevisionId) o2).getRevision();
+
             rev1 = rev1.replaceAll("([a-zA-Z])(\\d)", "$1.$2");
             rev1 = rev1.replaceAll("(\\d)([a-zA-Z])", "$1.$2");
             rev2 = rev2.replaceAll("([a-zA-Z])(\\d)", "$1.$2");
             rev2 = rev2.replaceAll("(\\d)([a-zA-Z])", "$1.$2");
-            
+
             String[] parts1 = rev1.split("[\\._\\-\\+]");
             String[] parts2 = rev2.split("[\\._\\-\\+]");
-            
+
             int i = 0;
-            for (; i < parts1.length && i <parts2.length; i++) {
+            for (; i < parts1.length && i < parts2.length; i++) {
                 if (parts1[i].equals(parts2[i])) {
                     continue;
                 }
@@ -98,10 +100,10 @@
                 }
                 // both are strings, we compare them taking into account special meaning
                 Map specialMeanings = getSpecialMeanings();
-                Integer sm1 = (Integer)specialMeanings.get(parts1[i].toLowerCase());
-                Integer sm2 = (Integer)specialMeanings.get(parts2[i].toLowerCase());
+                Integer sm1 = (Integer) specialMeanings.get(parts1[i].toLowerCase());
+                Integer sm2 = (Integer) specialMeanings.get(parts2[i].toLowerCase());
                 if (sm1 != null) {
-                    sm2 = sm2==null?new Integer(0):sm2;
+                    sm2 = sm2 == null ? new Integer(0) : sm2;
                     return sm1.compareTo(sm2);
                 }
                 if (sm2 != null) {
@@ -110,65 +112,63 @@
                 return parts1[i].compareTo(parts2[i]);
             }
             if (i < parts1.length) {
-                return isNumber(parts1[i])?1:-1;
+                return isNumber(parts1[i]) ? 1 : -1;
             }
             if (i < parts2.length) {
-                return isNumber(parts2[i])?-1:1;
+                return isNumber(parts2[i]) ? -1 : 1;
             }
             return 0;
-    	}
+        }
 
         private boolean isNumber(String str) {
             return str.matches("\\d+");
         }
     };
 
-    
     /**
-     * Compares two ArtifactInfo by their revision.
-     * Revisions are compared using an algorithm inspired by PHP
-     * version_compare one, unless a dynamic revision is given,
-     * in which case the version matcher is used to perform the comparison. 
-     */ 
+     * Compares two ArtifactInfo by their revision. Revisions are compared using an algorithm
+     * inspired by PHP version_compare one, unless a dynamic revision is given, in which case the
+     * version matcher is used to perform the comparison.
+     */
     public Comparator COMPARATOR = new Comparator() {
 
         public int compare(Object o1, Object o2) {
-            String rev1 = ((ArtifactInfo)o1).getRevision();
-            String rev2 = ((ArtifactInfo)o2).getRevision();
+            String rev1 = ((ArtifactInfo) o1).getRevision();
+            String rev2 = ((ArtifactInfo) o2).getRevision();
 
-            /* The revisions can still be not resolved, so we use the current 
-             * version matcher to know if one revision is dynamic, and in this 
-             * case if it should be considered greater or lower than the other one.
-             * 
-             * Note that if the version matcher compare method returns 0, it's because
-             * it's not possible to know which revision is greater. In this case we 
-             * consider the dynamic one to be greater, because most of the time
-             * it will then be actually resolved and a real comparison will occur.
-             */  
+            /*
+             * The revisions can still be not resolved, so we use the current version matcher to
+             * know if one revision is dynamic, and in this case if it should be considered greater
+             * or lower than the other one. Note that if the version matcher compare method returns
+             * 0, it's because it's not possible to know which revision is greater. In this case we
+             * consider the dynamic one to be greater, because most of the time it will then be
+             * actually resolved and a real comparison will occur.
+             */
             VersionMatcher vmatcher = IvyContext.getContext().getSettings().getVersionMatcher();
             ModuleRevisionId mrid1 = ModuleRevisionId.newInstance("", "", rev1);
             ModuleRevisionId mrid2 = ModuleRevisionId.newInstance("", "", rev2);
             if (vmatcher.isDynamic(mrid1)) {
-            	int c = vmatcher.compare(mrid1, mrid2, STATIC_COMPARATOR);
-				return c >= 0? 1 : -1;
+                int c = vmatcher.compare(mrid1, mrid2, STATIC_COMPARATOR);
+                return c >= 0 ? 1 : -1;
             } else if (vmatcher.isDynamic(mrid2)) {
-            	int c = vmatcher.compare(mrid2, mrid1, STATIC_COMPARATOR);
-				return c >= 0? -1 : 1;
+                int c = vmatcher.compare(mrid2, mrid1, STATIC_COMPARATOR);
+                return c >= 0 ? -1 : 1;
             }
-            
+
             return STATIC_COMPARATOR.compare(mrid1, mrid2);
         }
-    
+
     };
-    
+
     private Map _specialMeanings = null;
+
     private boolean _usedefaultspecialmeanings = true;
-    
+
     public LatestRevisionStrategy() {
-    	setComparator(COMPARATOR);
+        setComparator(COMPARATOR);
         setName("latest-revision");
     }
-    
+
     public void addConfiguredSpecialMeaning(SpecialMeaning meaning) {
         meaning.validate();
         getSpecialMeanings().put(meaning.getName().toLowerCase(), meaning.getValue());

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestStrategy.java Tue Jun  5 05:02:27 2007
@@ -20,27 +20,26 @@
 import java.util.Date;
 import java.util.List;
 
-
-
 public interface LatestStrategy {
     /**
-     * Finds the latest artifact among the given artifacts info.
-     * The definition of 'latest' depends on the strategy itself.
-     * Given artifacts info are all good candidate. If the given date is not
-     * null, then found artifact should not be later than this date. 
+     * Finds the latest artifact among the given artifacts info. The definition of 'latest' depends
+     * on the strategy itself. Given artifacts info are all good candidate. If the given date is not
+     * null, then found artifact should not be later than this date.
      * 
      * @param infos
      * @param date
      * @return the latest artifact among the given ones.
      */
     ArtifactInfo findLatest(ArtifactInfo[] infos, Date date);
+
     /**
-     * Sorts the given artifacts info from the oldest one to the latest one.
-     * The definition of 'latest' depends on the strategy itself.
-     * Given artifacts info are all good candidate. 
+     * Sorts the given artifacts info from the oldest one to the latest one. The definition of
+     * 'latest' depends on the strategy itself. Given artifacts info are all good candidate.
+     * 
      * @param infos
      * @return
      */
     List sort(ArtifactInfo[] infos);
+
     String getName();
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestTimeStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestTimeStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestTimeStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestTimeStrategy.java Tue Jun  5 05:02:27 2007
@@ -19,20 +19,18 @@
 
 import java.util.Comparator;
 
-
-
-
 public class LatestTimeStrategy extends ComparatorLatestStrategy {
     private static Comparator COMPARATOR = new Comparator() {
         public int compare(Object o1, Object o2) {
-            long d1 = ((ArtifactInfo)o1).getLastModified();
-            long d2 = ((ArtifactInfo)o2).getLastModified();
+            long d1 = ((ArtifactInfo) o1).getLastModified();
+            long d2 = ((ArtifactInfo) o2).getLastModified();
             return new Long(d1).compareTo(new Long(d2));
         }
-    
+
     };
+
     public LatestTimeStrategy() {
-    	super(COMPARATOR);
+        super(COMPARATOR);
         setName("latest-time");
     }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcher.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcher.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcher.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcher.java Tue Jun  5 05:02:27 2007
@@ -26,14 +26,15 @@
 
     /**
      * Create a new instance of a pattern matcher
-     *
-     * @param name the name of the pattern matcher. Never null.
+     * 
+     * @param name
+     *            the name of the pattern matcher. Never null.
      */
-    public AbstractPatternMatcher(/*@NotNull*/ String name) {
+    public AbstractPatternMatcher(/* @NotNull */String name) {
         this.name = name;
     }
 
-    public /*@NotNull*/ Matcher getMatcher(/*@NotNull*/String expression) {
+    public/* @NotNull */Matcher getMatcher(/* @NotNull */String expression) {
         if (expression == null) {
             throw new NullPointerException();
         }
@@ -43,20 +44,20 @@
         return newMatcher(expression);
     }
 
-    public /*@NotNull*/ String getName() {
+    public/* @NotNull */String getName() {
         return name;
     }
 
     /**
      * Returns an instance of the implementation specific matcher.
-     *
-     * @param expression the string to be matched.
+     * 
+     * @param expression
+     *            the string to be matched.
      * @return the instance of the related matcher. Never null.
      */
-    protected abstract /*@NotNull*/ Matcher newMatcher(/*@NotNull*/ String expression);
+    protected abstract/* @NotNull */Matcher newMatcher(/* @NotNull */String expression);
 
     public String toString() {
         return getName();
     }
 }
-

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/AnyMatcher.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/AnyMatcher.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/AnyMatcher.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/AnyMatcher.java Tue Jun  5 05:02:27 2007
@@ -20,7 +20,7 @@
 /**
  * A matcher that will match everything.
  */
-public /*@Immutable*/ class AnyMatcher implements Matcher {
+public/* @Immutable */class AnyMatcher implements Matcher {
     public final static Matcher INSTANCE = new AnyMatcher();
 
     public AnyMatcher() {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/ExactOrRegexpPatternMatcher.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/ExactOrRegexpPatternMatcher.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/ExactOrRegexpPatternMatcher.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/ExactOrRegexpPatternMatcher.java Tue Jun  5 05:02:27 2007
@@ -17,17 +17,16 @@
  */
 package org.apache.ivy.plugins.matcher;
 
-
 /**
- * A pattern matcher that tries to match exactly the input with the expression, or match it as a pattern.
- * <p/>
- * The evaluation for matching is perform first by checking if expression and input are equals (via equals method)
- * else it attempts to do it by trying to match the input using the expression as a regexp.
- *
+ * A pattern matcher that tries to match exactly the input with the expression, or match it as a
+ * pattern. <p/> The evaluation for matching is perform first by checking if expression and input
+ * are equals (via equals method) else it attempts to do it by trying to match the input using the
+ * expression as a regexp.
+ * 
  * @see ExactPatternMatcher
  * @see RegexpPatternMatcher
  */
-public /*@Immutable*/ final class ExactOrRegexpPatternMatcher extends AbstractPatternMatcher {
+public/* @Immutable */final class ExactOrRegexpPatternMatcher extends AbstractPatternMatcher {
 
     public static final ExactOrRegexpPatternMatcher INSTANCE = new ExactOrRegexpPatternMatcher();
 
@@ -41,6 +40,7 @@
 
     private static final class ExactOrRegexpMatcher implements Matcher {
         private Matcher _exact;
+
         private Matcher _regexp;
 
         public ExactOrRegexpMatcher(String expression) {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/ExactPatternMatcher.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/ExactPatternMatcher.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/ExactPatternMatcher.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/ExactPatternMatcher.java Tue Jun  5 05:02:27 2007
@@ -18,12 +18,11 @@
 package org.apache.ivy.plugins.matcher;
 
 /**
- * Implementation of an exact matcher.
- * <p/>
- * The matching will be performed against an expression being a string. It will only
- * matches if both strings are equal (per equals()) rule or if both strings are null.
+ * Implementation of an exact matcher. <p/> The matching will be performed against an expression
+ * being a string. It will only matches if both strings are equal (per equals()) rule or if both
+ * strings are null.
  */
-public /*@Immutable*/ final class ExactPatternMatcher extends AbstractPatternMatcher {
+public/* @Immutable */final class ExactPatternMatcher extends AbstractPatternMatcher {
 
     public static final ExactPatternMatcher INSTANCE = new ExactPatternMatcher();
 
@@ -35,7 +34,7 @@
         return new ExactMatcher(expression);
     }
 
-    private static /*@Immutable*/ class ExactMatcher implements Matcher {
+    private static/* @Immutable */class ExactMatcher implements Matcher {
         protected String _expression;
 
         public ExactMatcher(String expression) {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java Tue Jun  5 05:02:27 2007
@@ -24,28 +24,26 @@
 import org.apache.oro.text.regex.Pattern;
 import org.apache.oro.text.regex.Perl5Matcher;
 
-
-
 /**
  * A pattern matcher matching input using unix-like glob matcher expressions. Meta characters are:
  * <ul>
- * <li> * -  Matches zero or more characters</li>
+ * <li> * - Matches zero or more characters</li>
  * <li> ? - Matches exactly one character.</li>
  * </ul>
- * <p/>
- * <b> Note that this matcher is available only with <a href="http://jakarta.apache.org/oro"Apache Jakarta Oro 2.0.8</a>
- * in your classpath.</b>
- *
- * @see <a href="http://jakarta.apache.org/oro/api/org/apache/oro/text/GlobCompiler.html">GlobCompiler</a>
+ * <p/> <b> Note that this matcher is available only with <a
+ * href="http://jakarta.apache.org/oro"Apache Jakarta Oro 2.0.8</a> in your classpath.</b>
+ * 
+ * @see <a
+ *      href="http://jakarta.apache.org/oro/api/org/apache/oro/text/GlobCompiler.html">GlobCompiler</a>
  */
-public /*@Immutable*/ final class GlobPatternMatcher extends AbstractPatternMatcher {
+public/* @Immutable */final class GlobPatternMatcher extends AbstractPatternMatcher {
 
     public static final GlobPatternMatcher INSTANCE = new GlobPatternMatcher();
 
     /*
-    NOTE: GlobCompiler does ~100K compilation/s
-    - If necessary look into using ThreadLocal for GlobCompiler/Perl5Matcher to cut on useless object creation
-    - If expression are reused over and over a LRU cache could make sense
+     * NOTE: GlobCompiler does ~100K compilation/s - If necessary look into using ThreadLocal for
+     * GlobCompiler/Perl5Matcher to cut on useless object creation - If expression are reused over
+     * and over a LRU cache could make sense
      */
 
     public GlobPatternMatcher() {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/Matcher.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/Matcher.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/Matcher.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/Matcher.java Tue Jun  5 05:02:27 2007
@@ -24,24 +24,21 @@
 
     /**
      * Check whether a given string is matched by this matcher.
-     *
-     * @param input the string to be matched. Cannot be null.
+     * 
+     * @param input
+     *            the string to be matched. Cannot be null.
      * @return true if the input string is matched, false otherwise.
      */
-    public boolean matches(/*@NotNull*/ String input);
+    public boolean matches(/* @NotNull */String input);
 
     /**
-     * Return if the matcher will match *only* if the expression equals the input.
-     * <i>
-     * WARN:
-     * This is used only as a performance trick, to avoid scanning for things
-     * when you already know exactly what you want. In the install task where
-     * it used it avoid scanning the repository to list all modules to find
-     * that only one matches, and that it has the name requested.
-     * </i>
-     *
-     * @return true if the matcher only matches when the expression is
-     *         equals to the input, false otherwise.
+     * Return if the matcher will match *only* if the expression equals the input. <i> WARN: This is
+     * used only as a performance trick, to avoid scanning for things when you already know exactly
+     * what you want. In the install task where it used it avoid scanning the repository to list all
+     * modules to find that only one matches, and that it has the name requested. </i>
+     * 
+     * @return true if the matcher only matches when the expression is equals to the input, false
+     *         otherwise.
      */
     public boolean isExact();
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/MatcherHelper.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/MatcherHelper.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/MatcherHelper.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/MatcherHelper.java Tue Jun  5 05:02:27 2007
@@ -46,20 +46,17 @@
         return matches(m, exp.getModuleId(), aid.getModuleId())
                 && matches(m, exp.getName(), aid.getName())
                 && matches(m, exp.getExt(), aid.getExt())
-                && matches(m, exp.getType(), aid.getType())
-                ;
+                && matches(m, exp.getType(), aid.getType());
     }
 
     public static boolean isExact(PatternMatcher m, ModuleRevisionId exp) {
-        return isExact(m, exp.getOrganisation())
-                && isExact(m, exp.getName())
+        return isExact(m, exp.getOrganisation()) && isExact(m, exp.getName())
                 && isExact(m, exp.getRevision());
     }
 
     // unused
     public static boolean isExact(PatternMatcher m, ModuleId exp) {
-        return isExact(m, exp.getOrganisation())
-                && isExact(m, exp.getName());
+        return isExact(m, exp.getOrganisation()) && isExact(m, exp.getName());
     }
 
     public static boolean isExact(PatternMatcher m, String exp) {