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/01/31 11:00:37 UTC

svn commit: r501796 [5/10] - 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/event/ src/java/org/apache/ivy/core/event/do...

Added: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java?view=auto&rev=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java (added)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java Wed Jan 31 03:00:29 2007
@@ -0,0 +1,1027 @@
+package org.apache.ivy.core.settings;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.core.IvyPatternHelper;
+import org.apache.ivy.core.module.id.ModuleId;
+import org.apache.ivy.core.module.status.StatusManager;
+import org.apache.ivy.plugins.IvyAware;
+import org.apache.ivy.plugins.IvySettingsAware;
+import org.apache.ivy.plugins.circular.CircularDependencyStrategy;
+import org.apache.ivy.plugins.circular.ErrorCircularDependencyStrategy;
+import org.apache.ivy.plugins.circular.IgnoreCircularDependencyStrategy;
+import org.apache.ivy.plugins.circular.WarnCircularDependencyStrategy;
+import org.apache.ivy.plugins.conflict.ConflictManager;
+import org.apache.ivy.plugins.conflict.LatestConflictManager;
+import org.apache.ivy.plugins.conflict.NoConflictManager;
+import org.apache.ivy.plugins.conflict.StrictConflictManager;
+import org.apache.ivy.plugins.latest.LatestLexicographicStrategy;
+import org.apache.ivy.plugins.latest.LatestRevisionStrategy;
+import org.apache.ivy.plugins.latest.LatestStrategy;
+import org.apache.ivy.plugins.latest.LatestTimeStrategy;
+import org.apache.ivy.plugins.matcher.ExactOrRegexpPatternMatcher;
+import org.apache.ivy.plugins.matcher.ExactPatternMatcher;
+import org.apache.ivy.plugins.matcher.GlobPatternMatcher;
+import org.apache.ivy.plugins.matcher.ModuleIdMatcher;
+import org.apache.ivy.plugins.matcher.PatternMatcher;
+import org.apache.ivy.plugins.matcher.RegexpPatternMatcher;
+import org.apache.ivy.plugins.namespace.Namespace;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
+import org.apache.ivy.plugins.report.LogReportOutputter;
+import org.apache.ivy.plugins.report.ReportOutputter;
+import org.apache.ivy.plugins.report.XmlReportOutputter;
+import org.apache.ivy.plugins.resolver.ChainResolver;
+import org.apache.ivy.plugins.resolver.DependencyResolver;
+import org.apache.ivy.plugins.resolver.DualResolver;
+import org.apache.ivy.plugins.trigger.Trigger;
+import org.apache.ivy.plugins.version.ChainVersionMatcher;
+import org.apache.ivy.plugins.version.ExactVersionMatcher;
+import org.apache.ivy.plugins.version.LatestVersionMatcher;
+import org.apache.ivy.plugins.version.SubVersionMatcher;
+import org.apache.ivy.plugins.version.VersionMatcher;
+import org.apache.ivy.plugins.version.VersionRangeMatcher;
+import org.apache.ivy.util.Message;
+import org.apache.ivy.util.url.URLHandlerRegistry;
+
+public class IvySettings {
+    private static final String DEFAULT_CACHE_ARTIFACT_PATTERN = "[organisation]/[module]/[type]s/[artifact]-[revision](.[ext])";
+    private static final String DEFAULT_CACHE_DATA_FILE_PATTERN = "[organisation]/[module]/ivydata-[revision].properties";
+    private static final String DEFAULT_CACHE_IVY_PATTERN = "[organisation]/[module]/ivy-[revision].xml";
+    private static final String DEFAULT_CACHE_RESOLVED_IVY_PATTERN = "resolved-[organisation]-[module]-[revision].xml";
+    private static final String DEFAULT_CACHE_RESOLVED_IVY_PROPERTIES_PATTERN = "resolved-[organisation]-[module]-[revision].properties";
+
+    private Map _typeDefs = new HashMap();
+    private Map _resolversMap = new HashMap();
+    private DependencyResolver _defaultResolver;
+    private DependencyResolver _dictatorResolver = null;
+    
+    private String _defaultResolverName;
+    private File _defaultCache;
+
+	private String _defaultBranch = null;
+
+    private boolean _checkUpToDate = true;
+    private Map _moduleConfigurations = new LinkedHashMap(); // Map (ModuleIdMatcher -> ModuleSettings)
+    
+    private Map _conflictsManager = new HashMap(); // Map (String conflictManagerName -> ConflictManager)
+    private Map _latestStrategies = new HashMap(); // Map (String latestStrategyName -> LatestStrategy)
+    private Map _namespaces = new HashMap(); // Map (String namespaceName -> Namespace)
+    private Map _matchers = new HashMap(); // Map (String matcherName -> Matcher)
+    private Map _reportOutputters = new HashMap(); // Map (String outputterName -> ReportOutputter)
+    private Map _versionMatchers = new HashMap(); // Map (String matcherName -> VersionMatcher)
+    private Map _circularDependencyStrategies = new HashMap(); // Map (String name -> CircularDependencyStrategy)
+    private List _triggers = new ArrayList(); // List (Trigger)
+    
+    private Map _variables = new HashMap();
+
+    private String _cacheIvyPattern = DEFAULT_CACHE_IVY_PATTERN;
+    private String _cacheResolvedIvyPattern = DEFAULT_CACHE_RESOLVED_IVY_PATTERN;
+    private String _cacheResolvedIvyPropertiesPattern = DEFAULT_CACHE_RESOLVED_IVY_PROPERTIES_PATTERN;
+    private String _cacheArtifactPattern = DEFAULT_CACHE_ARTIFACT_PATTERN;
+    private String _cacheDataFilePattern = DEFAULT_CACHE_DATA_FILE_PATTERN;
+
+    private boolean _validate = true;
+
+    private LatestStrategy _defaultLatestStrategy = null;
+    private ConflictManager _defaultConflictManager = null;
+    private CircularDependencyStrategy _circularDependencyStrategy = null;
+    
+    private List _listingIgnore = new ArrayList();
+
+    private boolean _repositoriesConfigured;
+
+    private boolean _useRemoteConfig = false;
+
+    private File _defaultUserDir;
+    
+
+    private List _classpathURLs = new ArrayList();
+
+    private ClassLoader _classloader;
+    
+	private long _interruptTimeout = 2000;
+	private Boolean _debugConflictResolution;
+	private boolean _logNotConvertedExclusionRule;
+	private VersionMatcher _versionMatcher;
+	private StatusManager _statusManager;
+	
+	public IvySettings() {
+        setVariable("ivy.default.conf.dir", getSettingsURL().toExternalForm(), true);
+        
+        String ivyTypeDefs = System.getProperty("ivy.typedef.files");
+        if (ivyTypeDefs != null) {
+            String[] files = ivyTypeDefs.split("\\,");
+            for (int i = 0; i < files.length; i++) {
+                try {
+                    typeDefs(new FileInputStream(new File(files[i].trim())), true);
+                } catch (FileNotFoundException e) {
+                    Message.warn("typedefs file not found: "+files[i].trim());
+                } catch (IOException e) {
+                    Message.warn("problem with typedef file: "+files[i].trim()+": "+e.getMessage());
+                }
+            }
+        } else {
+            try {
+                typeDefs(getSettingsURL("typedef.properties").openStream(), true);
+            } catch (IOException e) {
+                Message.warn("impossible to load default type defs");
+            }
+        }
+        LatestLexicographicStrategy latestLexicographicStrategy = new LatestLexicographicStrategy();
+        LatestRevisionStrategy latestRevisionStrategy = new LatestRevisionStrategy();
+        LatestTimeStrategy latestTimeStrategy = new LatestTimeStrategy();
+
+        addLatestStrategy("latest-revision", latestRevisionStrategy);
+        addLatestStrategy("latest-lexico", latestLexicographicStrategy);
+        addLatestStrategy("latest-time", latestTimeStrategy);
+
+        addConflictManager("latest-revision", new LatestConflictManager("latest-revision", latestRevisionStrategy));
+        addConflictManager("latest-time", new LatestConflictManager("latest-time", latestTimeStrategy));
+        addConflictManager("all", new NoConflictManager());    
+        addConflictManager("strict", new StrictConflictManager());
+        
+        addMatcher(ExactPatternMatcher.INSTANCE);
+        addMatcher(RegexpPatternMatcher.INSTANCE);
+        addMatcher(ExactOrRegexpPatternMatcher.INSTANCE);
+        addMatcher(GlobPatternMatcher.INSTANCE);
+        
+        addReportOutputter(new XmlReportOutputter());
+        addReportOutputter(new LogReportOutputter());
+        
+        configureDefaultCircularDependencyStrategies();
+        
+        _listingIgnore.add(".cvsignore");
+        _listingIgnore.add("CVS");
+        _listingIgnore.add(".svn");
+        
+        addSystemProperties();
+	}
+
+    private void addSystemProperties() {
+        addAllVariables(System.getProperties());
+    }
+
+    /**
+     * Call this method to ask ivy to configure some variables using either a remote or a local properties file
+     */
+    public void configureRepositories(boolean remote) {
+        if (!_repositoriesConfigured) {
+            Properties props = new Properties();
+            boolean configured = false;
+            if (_useRemoteConfig && remote) {
+                try {
+                    URL url = new URL("http://incubator.apache.org/ivy/repository.properties");
+                    Message.verbose("configuring repositories with "+url);
+                    props.load(URLHandlerRegistry.getDefault().openStream(url));
+                    configured = true;
+                } catch (Exception ex) {
+                    Message.verbose("unable to use remote repository configuration: "+ex.getMessage());
+                    props = new Properties();
+                }
+            }
+            if (!configured) {
+            	InputStream repositoryPropsStream = null;
+                try {
+                    repositoryPropsStream = getSettingsURL("repository.properties").openStream();
+					props.load(repositoryPropsStream);
+                } catch (IOException e) {
+                    Message.error("unable to use internal repository configuration: "+e.getMessage());
+                    if (repositoryPropsStream != null) {
+                    	try {repositoryPropsStream.close();} catch(Exception ex) {};
+                    }
+                }
+            }
+            addAllVariables(props, false);
+            _repositoriesConfigured = true;
+        }
+    }
+
+
+    public void typeDefs(InputStream stream) throws IOException {
+    	typeDefs(stream, false);
+    }
+    public void typeDefs(InputStream stream, boolean silentFail) throws IOException {
+        try {
+            Properties p = new Properties();
+            p.load(stream);
+            typeDefs(p, silentFail);
+        } finally {
+            stream.close();
+        }
+    }
+
+    public void typeDefs(Properties p) {
+    	typeDefs(p, false);
+    }
+    public void typeDefs(Properties p, boolean silentFail) {
+        for (Iterator iter = p.keySet().iterator(); iter.hasNext();) {
+            String name = (String) iter.next();
+            typeDef(name, p.getProperty(name), silentFail);
+        }
+    }
+    
+    
+    public void load(File configurationFile) throws ParseException, IOException {
+        Message.info(":: configuring :: file = "+configurationFile);
+        long start = System.currentTimeMillis();
+        setConfigurationVariables(configurationFile);
+        if (getVariable("ivy.default.ivy.user.dir") != null) {
+            setDefaultIvyUserDir(new File(getVariable("ivy.default.ivy.user.dir")));
+        } else {
+            getDefaultIvyUserDir();
+        }
+        getDefaultCache();
+        
+        loadDefaultProperties();
+        try {
+            new XmlSettingsParser(this).parse(configurationFile.toURL());
+        } catch (MalformedURLException e) {
+            IllegalArgumentException iae = new IllegalArgumentException("given file cannot be transformed to url: "+configurationFile);
+            iae.initCause(e);
+            throw iae;
+        }
+        setVariable("ivy.default.ivy.user.dir", getDefaultIvyUserDir().getAbsolutePath(), false);
+        Message.verbose("configuration done ("+(System.currentTimeMillis()-start)+"ms)");
+        dumpConfig();
+    }
+
+    public void load(URL configurationURL) throws ParseException, IOException {
+        Message.info(":: configuring :: url = "+configurationURL);
+        long start = System.currentTimeMillis();
+        setConfigurationVariables(configurationURL);
+        if (getVariable("ivy.default.ivy.user.dir") != null) {
+            setDefaultIvyUserDir(new File(getVariable("ivy.default.ivy.user.dir")));
+        } else {
+            getDefaultIvyUserDir();
+        }
+        getDefaultCache();
+        
+        loadDefaultProperties();
+        new XmlSettingsParser(this).parse(configurationURL);
+        setVariable("ivy.default.ivy.user.dir", getDefaultIvyUserDir().getAbsolutePath(), false);
+        Message.verbose("configuration done ("+(System.currentTimeMillis()-start)+"ms)");
+        dumpConfig();
+    }
+
+    public void loadDefault() throws ParseException, IOException {
+        load(getDefaultConfigurationURL());
+    }
+
+	private void loadDefaultProperties() throws IOException {
+		loadProperties(getDefaultPropertiesURL(), false);
+	}
+
+	public static URL getDefaultPropertiesURL() {
+		return getSettingsURL("ivy.properties");
+	}
+	
+    public static URL getDefaultConfigurationURL() {
+        return getSettingsURL("ivyconf.xml");
+    }
+
+
+	private static URL getSettingsURL() {
+		return XmlSettingsParser.class.getResource("");
+	}
+
+	private static URL getSettingsURL(String file) {
+		return XmlSettingsParser.class.getResource(file);
+	}
+
+    public void setConfigurationVariables(File configurationFile) {
+        try {
+            setVariable("ivy.conf.dir", new File(configurationFile.getAbsolutePath()).getParent());
+            setVariable("ivy.conf.file", configurationFile.getAbsolutePath());
+            setVariable("ivy.conf.url", configurationFile.toURL().toExternalForm());
+        } catch (MalformedURLException e) {
+            IllegalArgumentException iae = new IllegalArgumentException("given file cannot be transformed to url: "+configurationFile);
+            iae.initCause(e);
+            throw iae;
+        }
+    }
+    
+    public void setConfigurationVariables(URL configurationURL) {
+        String confURL = configurationURL.toExternalForm();
+        setVariable("ivy.conf.url", confURL);
+        int slashIndex = confURL.lastIndexOf('/');
+        if (slashIndex != -1) {
+            setVariable("ivy.conf.dir", confURL.substring(0, slashIndex));
+        } else {
+            Message.warn("configuration url does not contain any slash (/): ivy.conf.dir variable not set");
+        }
+    }
+    
+    private void dumpConfig() {
+        Message.verbose("\tdefault cache: "+getDefaultCache());
+        Message.verbose("\tdefault resolver: "+getDefaultResolver());
+        Message.debug("\tdefault latest strategy: "+getDefaultLatestStrategy());
+        Message.debug("\tdefault conflict manager: "+getDefaultConflictManager());
+        Message.debug("\tcircular dependency strategy: "+getCircularDependencyStrategy());
+        Message.debug("\tvalidate: "+doValidate());
+        Message.debug("\tcheck up2date: "+isCheckUpToDate());
+        Message.debug("\tcache ivy pattern: "+getCacheIvyPattern());
+        Message.debug("\tcache artifact pattern: "+getCacheArtifactPattern());
+        
+        if (!_classpathURLs.isEmpty()) {
+            Message.verbose("\t-- "+_classpathURLs.size()+" custom classpath urls:");
+            for (Iterator iter = _classpathURLs.iterator(); iter.hasNext();) {
+                Message.debug("\t\t"+iter.next());
+            }
+        }
+        Message.verbose("\t-- "+_resolversMap.size()+" resolvers:");
+        for (Iterator iter = _resolversMap.values().iterator(); iter.hasNext();) {
+            DependencyResolver resolver = (DependencyResolver)iter.next();
+            resolver.dumpConfig();
+        }
+        if (!_moduleConfigurations.isEmpty()) {
+            Message.debug("\tmodule configurations:");
+            for (Iterator iter = _moduleConfigurations.keySet().iterator(); iter.hasNext();) {
+                ModuleIdMatcher midm = (ModuleIdMatcher)iter.next();
+                ModuleSettings s = (ModuleSettings)_moduleConfigurations.get(midm);
+                Message.debug("\t\t"+midm+" -> "+s);
+            }
+        }
+    }
+
+    public void loadProperties(URL url) throws IOException {
+        loadProperties(url, true);
+    }
+    public void loadProperties(URL url, boolean overwrite) throws IOException {
+        loadProperties(url.openStream(), overwrite);
+    }
+    public void loadProperties(File file) throws IOException {
+        loadProperties(file, true);
+    }
+    
+    public void loadProperties(File file, boolean overwrite) throws IOException {
+        loadProperties(new FileInputStream(file), overwrite);
+    }
+    
+    private void loadProperties(InputStream stream, boolean overwrite) throws IOException {
+    	try {
+	        Properties properties = new Properties();
+	        properties.load(stream);
+	        addAllVariables(properties, overwrite);
+    	} finally {
+    		if (stream != null) {
+    			try {
+    				stream.close();
+    			} catch (IOException e) {}
+    		}
+    	}
+    }
+    
+    public void setVariable(String varName, String value) {
+        setVariable(varName, value, true);
+    }
+    
+    public void setVariable(String varName, String value, boolean overwrite) {
+        if (overwrite || !_variables.containsKey(varName)) {
+            Message.debug("setting '"+varName+"' to '"+value+"'");
+            _variables.put(varName, substitute(value));
+        } else {
+            Message.debug("'"+varName+"' already set: discarding '"+value+"'");
+        }
+    }
+    
+    public void addAllVariables(Map variables) {
+        addAllVariables(variables, true);
+    }
+
+    public void addAllVariables(Map variables, boolean overwrite) {
+        for (Iterator iter = variables.keySet().iterator(); iter.hasNext();) {
+            String key = (String)iter.next();
+            String val = (String)variables.get(key);
+            setVariable(key, val, overwrite);
+        }
+    }
+
+    /**
+     * Substitute variables in the given string by their value found in the current 
+     * set of variables
+     * 
+     * @param str the string in which substitution should be made
+     * @return the string where all current ivy variables have been substituted by their value
+     */
+    public String substitute(String str) {
+        return IvyPatternHelper.substituteVariables(str, getVariables());
+    }
+
+    /**
+     * Returns the variables loaded in configuration file. Those variables
+     * may better be seen as ant properties 
+     * 
+     * @return
+     */
+    public Map getVariables() {
+        return _variables;
+    }
+
+    public Class typeDef(String name, String className) {
+        return typeDef(name, className, false);
+    }
+    
+    public Class typeDef(String name, String className, boolean silentFail) {
+        Class clazz = classForName(className, silentFail);
+        if (clazz != null) {
+        	_typeDefs.put(name, clazz);
+        }
+        return clazz;
+    }
+    
+    private Class classForName(String className, boolean silentFail) {
+        try {
+            return getClassLoader().loadClass(className);
+        } catch (ClassNotFoundException e) {
+        	if (silentFail) {
+        		Message.info("impossible to define new type: class not found: "+className+" in "+_classpathURLs+" nor Ivy classloader");
+        		return null;
+        	} else {
+        		throw new RuntimeException("impossible to define new type: class not found: "+className+" in "+_classpathURLs+" nor Ivy classloader");
+        	}
+        }
+    }
+
+    private ClassLoader getClassLoader() {
+        if (_classloader == null) {
+            if (_classpathURLs.isEmpty()) {
+                _classloader = Ivy.class.getClassLoader();   
+            } else {
+                _classloader = new URLClassLoader(
+                        (URL[])_classpathURLs.toArray(new URL[_classpathURLs.size()]), 
+                        Ivy.class.getClassLoader());
+            }
+        }
+        return _classloader;
+    }
+
+
+    public void addClasspathURL(URL url) {
+        _classpathURLs.add(url);
+        _classloader = null;
+    }
+
+    public Map getTypeDefs() {
+        return _typeDefs;
+    }
+
+    public Class getTypeDef(String name) {
+        return (Class)_typeDefs.get(name);
+    }
+
+    // methods which match ivy conf method signature specs
+    public void addConfigured(DependencyResolver resolver) {
+        addResolver(resolver);
+    }
+    
+    public void addConfigured(ModuleDescriptorParser parser) {
+        ModuleDescriptorParserRegistry.getInstance().addParser(parser);
+    }
+    
+    public void addResolver(DependencyResolver resolver) {
+        if (resolver == null) {
+            throw new NullPointerException("null resolver");
+        }
+        init(resolver);
+        _resolversMap.put(resolver.getName(), resolver);
+        if (resolver instanceof ChainResolver) {
+            List subresolvers = ((ChainResolver)resolver).getResolvers();
+            for (Iterator iter = subresolvers.iterator(); iter.hasNext();) {
+                DependencyResolver dr = (DependencyResolver)iter.next();
+                addResolver(dr);
+            }
+        } else if (resolver instanceof DualResolver) {
+            DependencyResolver ivyResolver = ((DualResolver)resolver).getIvyResolver();
+            if (ivyResolver != null) {
+                addResolver(ivyResolver);
+            }
+            DependencyResolver artifactResolver = ((DualResolver)resolver).getArtifactResolver();
+            if (artifactResolver != null) {
+                addResolver(artifactResolver);
+            }
+        }
+    }
+
+    public void setDefaultCache(File cacheDirectory) {
+        _defaultCache = cacheDirectory;
+    }
+    
+    public void setDefaultResolver(String resolverName) {
+        checkResolverName(resolverName);
+        _defaultResolverName = resolverName;
+    }
+    
+    private void checkResolverName(String resolverName) {
+        if (resolverName != null && !_resolversMap.containsKey(resolverName)) {
+            throw new IllegalArgumentException("no resolver found called "+resolverName+": check your configuration");
+        }
+    }
+
+    /**
+     * regular expressions as explained in Pattern class may be used in ModuleId
+     * organisation and name
+     * 
+     * @param moduleId
+     * @param resolverName
+     * @param branch 
+     */
+    public void addModuleConfiguration(ModuleId mid, PatternMatcher matcher, String resolverName, String branch, String conflictManager) {
+        checkResolverName(resolverName);
+        _moduleConfigurations.put(new ModuleIdMatcher(mid, matcher), new ModuleSettings(resolverName, branch, conflictManager));
+    }
+    
+    public File getDefaultIvyUserDir() {
+        if (_defaultUserDir==null) {
+        	if (getVariable("ivy.home") != null) {
+        		setDefaultIvyUserDir(new File(getVariable("ivy.home")));
+        		Message.verbose("using ivy.default.ivy.user.dir variable for default ivy user dir: "+_defaultUserDir);
+        	} else {
+        		setDefaultIvyUserDir(new File(System.getProperty("user.home"), ".ivy"));
+        		Message.verbose("no default ivy user dir defined: set to "+_defaultUserDir);
+        	}
+        }
+        return _defaultUserDir;
+    }
+    
+    public void setDefaultIvyUserDir(File defaultUserDir) {
+        _defaultUserDir = defaultUserDir;
+        setVariable("ivy.default.ivy.user.dir", _defaultUserDir.getAbsolutePath());
+        setVariable("ivy.home", _defaultUserDir.getAbsolutePath());
+    }    
+
+    public File getDefaultCache() {
+        if (_defaultCache==null) {
+            _defaultCache = new File(getDefaultIvyUserDir(), "cache");
+            Message.verbose("no default cache defined: set to "+_defaultCache);
+        }
+        return _defaultCache;
+    }
+
+    public DependencyResolver getResolver(ModuleId moduleId) {
+        if (_dictatorResolver != null) {
+            return _dictatorResolver;
+        }
+        String resolverName = getResolverName(moduleId);
+        return getResolver(resolverName);
+    }
+
+    public DependencyResolver getResolver(String resolverName) {
+        if (_dictatorResolver != null) {
+            return _dictatorResolver;
+        }
+        DependencyResolver resolver = (DependencyResolver)_resolversMap.get(resolverName);
+        if (resolver == null) {
+            Message.error("unknown resolver "+resolverName);
+        }
+        return resolver;
+    }
+
+    public DependencyResolver getDefaultResolver() {
+        if (_dictatorResolver != null) {
+            return _dictatorResolver;
+        }
+        if (_defaultResolver == null) {
+            _defaultResolver = (DependencyResolver)_resolversMap.get(_defaultResolverName);
+        }
+        return _defaultResolver;
+    }
+
+    public String getResolverName(ModuleId moduleId) {
+        for (Iterator iter = _moduleConfigurations.keySet().iterator(); iter.hasNext();) {
+            ModuleIdMatcher midm = (ModuleIdMatcher)iter.next();
+            if (midm.matches(moduleId)) {
+            	ModuleSettings  ms = (ModuleSettings)_moduleConfigurations.get(midm);
+            	if (ms.getResolverName() != null) {
+            		return ms.getResolverName();
+            	}
+            }
+        }
+        return _defaultResolverName;
+    }
+    
+	public String getDefaultBranch(ModuleId moduleId) {
+        for (Iterator iter = _moduleConfigurations.keySet().iterator(); iter.hasNext();) {
+            ModuleIdMatcher midm = (ModuleIdMatcher)iter.next();
+            if (midm.matches(moduleId)) {
+            	ModuleSettings  ms = (ModuleSettings)_moduleConfigurations.get(midm);
+            	if (ms.getBranch() != null) {
+            		return ms.getBranch();
+            	}
+            }
+        }
+		return getDefaultBranch();
+	}
+
+	public String getDefaultBranch() {
+		return _defaultBranch;
+	}
+	public void setDefaultBranch(String defaultBranch) {
+		_defaultBranch = defaultBranch;
+	}
+
+	public ConflictManager getConflictManager(ModuleId moduleId) {
+        for (Iterator iter = _moduleConfigurations.keySet().iterator(); iter.hasNext();) {
+            ModuleIdMatcher midm = (ModuleIdMatcher)iter.next();
+            if (midm.matches(moduleId)) {
+            	ModuleSettings  ms = (ModuleSettings)_moduleConfigurations.get(midm);
+            	if (ms.getConflictManager() != null) {
+            		ConflictManager cm = getConflictManager(ms.getConflictManager());
+            		if (cm == null) {
+            			throw new IllegalStateException("ivy badly configured: unknown conflict manager "+ms.getConflictManager());
+            		}
+					return cm;
+            	}
+            }
+        }
+		return getDefaultConflictManager();
+	}
+
+    public void addConfigured(ConflictManager cm) {
+        addConflictManager(cm.getName(), cm);
+    }
+    
+    public ConflictManager getConflictManager(String name) {
+        if ("default".equals(name)) {
+            return getDefaultConflictManager();
+        }
+        return (ConflictManager)_conflictsManager.get(name);
+    }
+    public void addConflictManager(String name, ConflictManager cm) {
+        init(cm);
+        _conflictsManager.put(name, cm);
+    }
+    
+    public void addConfigured(LatestStrategy latest) {
+        addLatestStrategy(latest.getName(), latest);
+    }
+    
+    public LatestStrategy getLatestStrategy(String name) {
+        if ("default".equals(name)) {
+            return getDefaultLatestStrategy();
+        }
+        return (LatestStrategy)_latestStrategies.get(name);
+    }
+    public void addLatestStrategy(String name, LatestStrategy latest) {
+        init(latest);
+        _latestStrategies.put(name, latest);
+    }
+    
+    public void addConfigured(Namespace ns) {
+        addNamespace(ns);
+    }
+    
+    public Namespace getNamespace(String name) {
+        if ("system".equals(name)) {
+            return getSystemNamespace();
+        }
+        return (Namespace)_namespaces.get(name);
+    }
+    
+    public Namespace getSystemNamespace() {
+        return Namespace.SYSTEM_NAMESPACE;
+    }
+
+    public void addNamespace(Namespace ns) {
+        init(ns);
+        _namespaces.put(ns.getName(), ns);
+    }
+    
+    public void addConfigured(PatternMatcher m) {
+        addMatcher(m);
+    }
+    
+    public PatternMatcher getMatcher(String name) {
+        return (PatternMatcher)_matchers.get(name);
+    }
+    
+    public void addMatcher(PatternMatcher m) {
+        init(m);
+        _matchers.put(m.getName(), m);
+    }
+    
+    public void addConfigured(ReportOutputter outputter) {
+        addReportOutputter(outputter);
+     }
+     
+     public ReportOutputter getReportOutputter(String name) {
+        return (ReportOutputter) _reportOutputters.get(name);
+     }
+     
+     public void addReportOutputter(ReportOutputter outputter) {
+         init(outputter);
+        _reportOutputters.put(outputter.getName(), outputter);
+     }
+     
+     public ReportOutputter[] getReportOutputters() {
+        return (ReportOutputter[]) _reportOutputters.values().toArray(new ReportOutputter[_reportOutputters.size()]);
+     }
+     
+     public void addConfigured(VersionMatcher vmatcher) {
+         addVersionMatcher(vmatcher);
+      }
+      
+      public VersionMatcher getVersionMatcher(String name) {
+         return (VersionMatcher) _versionMatchers.get(name);
+      }
+      
+      public void addVersionMatcher(VersionMatcher vmatcher) {
+          init(vmatcher);
+         _versionMatchers.put(vmatcher.getName(), vmatcher);
+         
+         if (_versionMatcher == null) {
+        	 _versionMatcher = new ChainVersionMatcher();
+        	 addVersionMatcher(new ExactVersionMatcher());
+         }
+         if (_versionMatcher instanceof ChainVersionMatcher) {
+			ChainVersionMatcher chain = (ChainVersionMatcher) _versionMatcher;
+			chain.add(vmatcher);
+		}
+      }
+      
+      public VersionMatcher[] getVersionMatchers() {
+         return (VersionMatcher[]) _versionMatchers.values().toArray(new VersionMatcher[_versionMatchers.size()]);
+      }
+
+      public VersionMatcher getVersionMatcher() {
+          if (_versionMatcher == null) {
+              configureDefaultVersionMatcher();
+          }
+          return _versionMatcher;
+      }
+
+      public void configureDefaultVersionMatcher() {
+          addVersionMatcher(new LatestVersionMatcher());
+          addVersionMatcher(new SubVersionMatcher());
+          addVersionMatcher(new VersionRangeMatcher());
+      }
+
+
+  	public CircularDependencyStrategy getCircularDependencyStrategy() {
+  		if (_circularDependencyStrategy == null) {
+  			_circularDependencyStrategy = getCircularDependencyStrategy("default");
+  		}
+  		return _circularDependencyStrategy;
+  	}
+
+  	public CircularDependencyStrategy getCircularDependencyStrategy(String name) {
+  		if ("default".equals(name)) {
+  			name = "warn";
+  		}
+		return (CircularDependencyStrategy)_circularDependencyStrategies.get(name);
+	}
+
+	public void setCircularDependencyStrategy(CircularDependencyStrategy strategy) {
+  		_circularDependencyStrategy = strategy;
+  	}
+	
+	public void addConfigured(CircularDependencyStrategy strategy) {
+		addCircularDependencyStrategy(strategy);
+	}
+
+    private void addCircularDependencyStrategy(CircularDependencyStrategy strategy) {
+		_circularDependencyStrategies.put(strategy.getName(), strategy);
+	}
+    
+    private void configureDefaultCircularDependencyStrategies() {
+    	addCircularDependencyStrategy(WarnCircularDependencyStrategy.getInstance());
+    	addCircularDependencyStrategy(ErrorCircularDependencyStrategy.getInstance());
+    	addCircularDependencyStrategy(IgnoreCircularDependencyStrategy.getInstance());
+    }
+
+    public StatusManager getStatusManager() {
+        if (_statusManager == null) {
+            _statusManager = StatusManager.newDefaultInstance();
+        }
+        return _statusManager;
+    }
+    public void setStatusManager(StatusManager statusManager) {
+        _statusManager = statusManager;
+    }
+
+
+    /**
+     * Returns true if the name should be ignored in listing
+     * @param name
+     * @return
+     */
+    public boolean listingIgnore(String name) {
+        return _listingIgnore.contains(name);
+    }
+    
+    /**
+     * Filters the names list by removing all names that should be ignored
+     * as defined by the listing ignore list
+     * @param names
+     */
+    public void filterIgnore(Collection names) {
+        names.removeAll(_listingIgnore);
+    }
+    
+    public boolean isCheckUpToDate() {
+        return _checkUpToDate;
+    }
+    public void setCheckUpToDate(boolean checkUpToDate) {
+        _checkUpToDate = checkUpToDate;
+    }
+
+    public String getCacheArtifactPattern() {
+        return _cacheArtifactPattern;
+    }
+    
+
+    public void setCacheArtifactPattern(String cacheArtifactPattern) {
+        _cacheArtifactPattern = cacheArtifactPattern;
+    }
+    
+
+    public String getCacheIvyPattern() {
+        return _cacheIvyPattern;
+    }
+    
+
+    public void setCacheIvyPattern(String cacheIvyPattern) {
+        _cacheIvyPattern = cacheIvyPattern;
+    }
+    
+
+    public String getCacheDataFilePattern() {
+        return _cacheDataFilePattern;
+    }
+
+
+    public boolean doValidate() {
+        return _validate;
+    }
+
+    public void setValidate(boolean validate) {
+        _validate = validate;
+    }
+
+    public String getVariable(String name) {
+        String val = (String)_variables.get(name);
+        return val==null?val:substitute(val);
+    }
+
+    public ConflictManager getDefaultConflictManager() {
+        if (_defaultConflictManager == null) {
+            _defaultConflictManager = new LatestConflictManager(getDefaultLatestStrategy());
+        }
+        return _defaultConflictManager;
+    }
+    
+
+    public void setDefaultConflictManager(ConflictManager defaultConflictManager) {
+        _defaultConflictManager = defaultConflictManager;
+    }
+    
+
+    public LatestStrategy getDefaultLatestStrategy() {
+        if (_defaultLatestStrategy == null) {
+            _defaultLatestStrategy = new LatestRevisionStrategy();
+        }
+        return _defaultLatestStrategy;
+    }
+    
+
+    public void setDefaultLatestStrategy(LatestStrategy defaultLatestStrategy) {
+        _defaultLatestStrategy = defaultLatestStrategy;
+    }
+    
+    public void addTrigger(Trigger trigger) {
+    	init(trigger);
+    	_triggers.add(trigger);
+    }
+    
+    public List getTriggers() {
+    	return _triggers;
+    }
+
+    public void addConfigured(Trigger trigger) {
+    	addTrigger(trigger);
+    }
+    
+    public boolean isUseRemoteConfig() {
+        return _useRemoteConfig;
+    }
+
+    public void setUseRemoteConfig(boolean useRemoteConfig) {
+        _useRemoteConfig = useRemoteConfig;
+    }
+
+    /** 
+     * WARNING: Replace all current ivy variables by the given Map.
+     * Should be used only when restoring variables.
+     * 
+     *  Thr given Map is not copied, but stored by reference.
+     * @param variables
+     */
+    public void setVariables(Map variables) {
+        if (variables == null) {
+            throw new NullPointerException("variables shouldn't be null");
+        }
+        _variables = variables;
+    }
+    public boolean logModuleWhenFound() {
+        String var = getVariable("ivy.log.module.when.found");
+        return var == null || Boolean.valueOf(var).booleanValue();
+    }
+
+    public boolean logResolvedRevision() {
+        String var = getVariable("ivy.log.resolved.revision");
+        return var == null || Boolean.valueOf(var).booleanValue();
+    }
+
+    public boolean debugConflictResolution() {
+        if (_debugConflictResolution == null) {
+            String var = getVariable("ivy.log.conflict.resolution");
+            _debugConflictResolution =  Boolean.valueOf(var != null && Boolean.valueOf(var).booleanValue());
+        }
+        return _debugConflictResolution.booleanValue();
+    }
+
+    public boolean logNotConvertedExclusionRule() {
+        return _logNotConvertedExclusionRule;
+    }
+    public void setLogNotConvertedExclusionRule(boolean logNotConvertedExclusionRule) {
+        _logNotConvertedExclusionRule = logNotConvertedExclusionRule;
+    }
+
+    private void init(Object obj) {
+		if (obj instanceof IvySettingsAware) {
+            ((IvySettingsAware)obj).setSettings(this);
+        }
+		if (obj instanceof IvyAware) {
+			//TODO
+//            ((IvyAware)obj).setIvy(this);
+        }
+	}
+    
+    
+	private static class ModuleSettings {
+		private String _resolverName;
+		private String _branch;
+		private String _conflictManager;
+		public ModuleSettings(String resolverName, String branch, String conflictManager) {
+			_resolverName = resolverName;
+			_branch = branch;
+			_conflictManager = conflictManager;
+		}
+		public String toString() {
+			return _resolverName != null ? "resolver: "+_resolverName:""
+					+_branch != null ? "branch: "+_branch:"";
+		}
+		public String getBranch() {
+			return _branch;
+		}
+		public String getResolverName() {
+			return _resolverName;
+		}
+		protected String getConflictManager() {
+			return _conflictManager;
+		}
+	}
+
+
+	public String getCacheResolvedIvyPattern() {
+		return _cacheResolvedIvyPattern;
+	}
+
+	public String getCacheResolvedIvyPropertiesPattern() {
+		return _cacheResolvedIvyPropertiesPattern;
+	}
+
+	public long getInterruptTimeout() {
+		return _interruptTimeout;
+	}
+
+	public Collection getResolvers() {
+		return _resolversMap.values();
+	}
+
+	public Collection getResolverNames() {
+		return _resolversMap.keySet();
+	}
+
+	public Collection getMatcherNames() {
+		return _matchers.keySet();
+	}
+
+}

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java Wed Jan 31 03:00:29 2007
@@ -30,7 +30,6 @@
 
 import javax.xml.parsers.SAXParserFactory;
 
-import org.apache.ivy.Ivy;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.status.StatusManager;
 import org.apache.ivy.plugins.circular.CircularDependencyStrategy;
@@ -53,7 +52,7 @@
 	private Configurator _configurator;
     private List _configuratorTags = Arrays.asList(new String[] {"resolvers", "namespaces", "parsers", "latest-strategies", "conflict-managers", "outputters", "version-matchers", "statuses", "circular-dependency-strategies", "triggers"});
 
-    private Ivy _ivy;
+    private IvySettings _ivy;
 
     private String _defaultResolver;
     private String _defaultCM;
@@ -61,7 +60,7 @@
     private String _defaultCircular;
     private String _currentConfiguratorTag;
 
-    public XmlSettingsParser(Ivy ivy) {
+    public XmlSettingsParser(IvySettings ivy) {
         _ivy = ivy;
 	}
 

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=501796&r1=501795&r2=501796
==============================================================================
--- 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 Wed Jan 31 03:00:29 2007
@@ -17,18 +17,14 @@
  */
 package org.apache.ivy.core.sort;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 import java.util.Stack;
 
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.core.resolve.IvyNode;
 import org.apache.ivy.plugins.circular.CircularDependencyException;
 import org.apache.ivy.plugins.circular.CircularDependencyHelper;
 import org.apache.ivy.plugins.version.VersionMatcher;
@@ -42,51 +38,6 @@
  *
  */
 public class ModuleDescriptorSorter {
-    public static List sortNodes(VersionMatcher matcher, 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();
-            if (node.getDescriptor() == null) {
-                nulls.add(node);
-            } else {
-                List n = (List)dependenciesMap.get(node.getDescriptor());
-                if (n == null) {
-                    n = new ArrayList();
-                    dependenciesMap.put(node.getDescriptor(), n);
-                }
-                n.add(node);
-            }
-        }
-        List list = sortModuleDescriptors(matcher, 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);            
-        }
-        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
-     * @return a List of sorted ModuleDescriptors
-     * @throws CircularDependencyException if a circular dependency exists
-     */
-    public static List sortModuleDescriptors(VersionMatcher matcher, Collection moduleDescriptors) throws CircularDependencyException {
-        return new ModuleDescriptorSorter(moduleDescriptors).sortModuleDescriptors(matcher);   
-    }
     
     
     private final Collection moduleDescriptors;

Added: 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=auto&rev=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/SortEngine.java (added)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/sort/SortEngine.java Wed Jan 31 03:00:29 2007
@@ -0,0 +1,69 @@
+package org.apache.ivy.core.sort;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.resolve.IvyNode;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.plugins.circular.CircularDependencyException;
+
+public class SortEngine {
+	private IvySettings _settings;
+	
+    public SortEngine(IvySettings settings) {
+		_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
+         */
+        
+        Map dependenciesMap = new LinkedHashMap();
+        List nulls = new ArrayList();
+        for (Iterator iter = nodes.iterator(); iter.hasNext();) {
+            IvyNode node = (IvyNode)iter.next();
+            if (node.getDescriptor() == null) {
+                nulls.add(node);
+            } else {
+                List n = (List)dependenciesMap.get(node.getDescriptor());
+                if (n == null) {
+                    n = new ArrayList();
+                    dependenciesMap.put(node.getDescriptor(), n);
+                }
+                n.add(node);
+            }
+        }
+        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);            
+        }
+        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
+     * @return a List of sorted ModuleDescriptors
+     * @throws CircularDependencyException if a circular dependency exists
+     */
+    public List sortModuleDescriptors(Collection moduleDescriptors) throws CircularDependencyException {
+        return new ModuleDescriptorSorter(moduleDescriptors).sortModuleDescriptors(_settings.getVersionMatcher());   
+    }
+
+}

Added: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/IvySettingsAware.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/IvySettingsAware.java?view=auto&rev=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/IvySettingsAware.java (added)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/IvySettingsAware.java Wed Jan 31 03:00:29 2007
@@ -0,0 +1,24 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins;
+
+import org.apache.ivy.core.settings.IvySettings;
+
+public interface IvySettingsAware {
+    void setSettings(IvySettings settings);
+}

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=501796&r1=501795&r2=501796
==============================================================================
--- 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 Wed Jan 31 03:00:29 2007
@@ -17,19 +17,19 @@
  */
 package org.apache.ivy.plugins.conflict;
 
-import org.apache.ivy.Ivy;
-import org.apache.ivy.plugins.IvyAware;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.plugins.IvySettingsAware;
 
-public abstract class AbstractConflictManager implements ConflictManager, IvyAware {
+public abstract class AbstractConflictManager implements ConflictManager, IvySettingsAware {
     private String _name;
-    private Ivy _ivy;
+    private IvySettings _settings;
 
-    public Ivy getIvy() {
-        return _ivy;
+    public IvySettings getSettings() {
+        return _settings;
     }    
 
-    public void setIvy(Ivy ivy) {
-        _ivy = ivy;
+    public void setSettings(IvySettings ivy) {
+        _settings = ivy;
     }
 
     public String getName() {

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=501796&r1=501795&r2=501796
==============================================================================
--- 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 Wed Jan 31 03:00:29 2007
@@ -99,13 +99,13 @@
     public LatestStrategy getStrategy() {
         if (_strategy == null) {
             if (_strategyName != null) {
-                _strategy = getIvy().getLatestStrategy(_strategyName);
+                _strategy = getSettings().getLatestStrategy(_strategyName);
                 if (_strategy == null) {
                     Message.error("unknown latest strategy: "+_strategyName);
-                    _strategy = getIvy().getDefaultLatestStrategy();
+                    _strategy = getSettings().getDefaultLatestStrategy();
                 }
             } else {
-                _strategy = getIvy().getDefaultLatestStrategy();
+                _strategy = getSettings().getDefaultLatestStrategy();
             }
         }
         return _strategy;

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=501796&r1=501795&r2=501796
==============================================================================
--- 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 Wed Jan 31 03:00:29 2007
@@ -22,7 +22,6 @@
 import java.util.Iterator;
 
 import org.apache.ivy.core.resolve.IvyNode;
-import org.apache.ivy.plugins.conflict.AbstractConflictManager;
 import org.apache.ivy.util.Message;
 
 

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=501796&r1=501795&r2=501796
==============================================================================
--- 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 Wed Jan 31 03:00:29 2007
@@ -19,7 +19,6 @@
 
 import java.util.regex.PatternSyntaxException;
 
-import org.apache.ivy.util.Message;
 import org.apache.oro.text.GlobCompiler;
 import org.apache.oro.text.regex.MalformedPatternException;
 import org.apache.oro.text.regex.Pattern;

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java Wed Jan 31 03:00:29 2007
@@ -26,13 +26,13 @@
 import java.util.List;
 import java.util.Set;
 
-import org.apache.ivy.Ivy;
 import org.apache.ivy.core.module.descriptor.Configuration;
 import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.repository.Resource;
 import org.apache.ivy.plugins.repository.url.URLResource;
 import org.apache.ivy.util.Message;
@@ -42,8 +42,8 @@
 
 
 public abstract class AbstractModuleDescriptorParser implements ModuleDescriptorParser {
-    public ModuleDescriptor parseDescriptor(Ivy ivy, URL descriptorURL, boolean validate) throws ParseException, IOException {
-        return parseDescriptor(ivy, descriptorURL, new URLResource(descriptorURL), validate);
+    public ModuleDescriptor parseDescriptor(IvySettings ivySettings, URL descriptorURL, boolean validate) throws ParseException, IOException {
+        return parseDescriptor(ivySettings, descriptorURL, new URLResource(descriptorURL), validate);
     }
     
     protected abstract static class AbstractParser extends DefaultHandler {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParser.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParser.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParser.java Wed Jan 31 03:00:29 2007
@@ -23,14 +23,14 @@
 import java.net.URL;
 import java.text.ParseException;
 
-import org.apache.ivy.Ivy;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.repository.Resource;
 
 
 public interface ModuleDescriptorParser {
-    public ModuleDescriptor parseDescriptor(Ivy ivy, URL descriptorURL, boolean validate) throws ParseException, IOException;
-    public ModuleDescriptor parseDescriptor(Ivy ivy, URL descriptorURL, Resource res, boolean validate) throws ParseException, IOException;
+    public ModuleDescriptor parseDescriptor(IvySettings ivySettings, URL descriptorURL, boolean validate) throws ParseException, IOException;
+    public ModuleDescriptor parseDescriptor(IvySettings ivySettings, URL descriptorURL, Resource res, boolean validate) throws ParseException, IOException;
     
     /**
      * Convert a module descriptor to an ivy file.

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java Wed Jan 31 03:00:29 2007
@@ -26,8 +26,8 @@
 import java.util.LinkedList;
 import java.util.List;
 
-import org.apache.ivy.Ivy;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
 import org.apache.ivy.plugins.repository.Resource;
@@ -74,13 +74,13 @@
         return null;
     }    
     
-    public ModuleDescriptor parseDescriptor(Ivy ivy, URL descriptorURL, Resource res, boolean validate) throws ParseException, IOException {
+    public ModuleDescriptor parseDescriptor(IvySettings settings, URL descriptorURL, Resource res, boolean validate) throws ParseException, IOException {
         ModuleDescriptorParser parser = getParser(res);
         if (parser == null) {
             Message.warn("no module descriptor parser found for "+res);
             return null;
         }
-        return parser.parseDescriptor(ivy, descriptorURL, res, validate);
+        return parser.parseDescriptor(settings, descriptorURL, res, validate);
     }
 
     public boolean accept(Resource res) {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Wed Jan 31 03:00:29 2007
@@ -32,7 +32,6 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.apache.ivy.Ivy;
 import org.apache.ivy.core.IvyPatternHelper;
 import org.apache.ivy.core.module.descriptor.Configuration;
 import org.apache.ivy.core.module.descriptor.DefaultArtifact;
@@ -43,6 +42,7 @@
 import org.apache.ivy.core.module.id.ArtifactId;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.matcher.ExactPatternMatcher;
 import org.apache.ivy.plugins.matcher.PatternMatcher;
 import org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser;
@@ -77,7 +77,7 @@
     }
     
     private static final class Parser extends AbstractParser {
-        private Ivy _ivy;
+        private IvySettings _settings;
         private Stack _contextStack = new Stack();
         private String _organisation;
         private String _module;
@@ -88,9 +88,9 @@
         private DefaultDependencyDescriptor _dd;
         private Map _properties = new HashMap();
 
-        public Parser(ModuleDescriptorParser parser, Ivy ivy, Resource res) {
+        public Parser(ModuleDescriptorParser parser, IvySettings settings, Resource res) {
         	super(parser);
-            _ivy = ivy;
+            _settings = settings;
             setResource(res);
             _md.setResolvedPublicationDate(new Date(res.getLastModified()));
             for (int i = 0; i < MAVEN2_CONFIGURATIONS.length; i++) {
@@ -243,8 +243,8 @@
         
     }
 
-    public ModuleDescriptor parseDescriptor(Ivy ivy, URL descriptorURL, Resource res, boolean validate) throws ParseException, IOException {
-        Parser parser = new Parser(this, ivy, res);
+    public ModuleDescriptor parseDescriptor(IvySettings settings, URL descriptorURL, Resource res, boolean validate) throws ParseException, IOException {
+        Parser parser = new Parser(this, settings, res);
         try {
             XMLHelper.parse(descriptorURL, null, parser);
         } catch (SAXException ex) {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java Wed Jan 31 03:00:29 2007
@@ -40,6 +40,7 @@
 import org.apache.ivy.core.module.id.ArtifactId;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.conflict.ConflictManager;
 import org.apache.ivy.plugins.conflict.FixedConflictManager;
 import org.apache.ivy.plugins.matcher.PatternMatcher;
@@ -85,8 +86,8 @@
      * @throws ParseException
      * @throws IOException
      */
-    public ModuleDescriptor parseDescriptor(Ivy ivy, URL xmlURL, Resource res, boolean validate) throws ParseException, IOException {
-        Parser parser = new Parser(this, ivy, validate);
+    public ModuleDescriptor parseDescriptor(IvySettings ivySettings, URL xmlURL, Resource res, boolean validate) throws ParseException, IOException {
+        Parser parser = new Parser(this, ivySettings, validate);
         parser.parse(xmlURL, res, validate);
         return parser.getModuleDescriptor();
     }
@@ -132,7 +133,7 @@
     private MDArtifact _artifact;
     private String _conf;
     private boolean _validate = true;
-    private Ivy _ivy;
+    private IvySettings _ivy;
     private boolean _artifactsDeclared = false;
     private PatternMatcher _defaultMatcher; 
 
@@ -146,9 +147,9 @@
     private static final int CONFLICT = 7;
     private int _state = NONE;
 
-    public Parser(ModuleDescriptorParser parser, Ivy ivy, boolean validate) {
+    public Parser(ModuleDescriptorParser parser, IvySettings ivySettings, boolean validate) {
     	super(parser);
-        _ivy = ivy;
+        _ivy = ivySettings;
         _validate = validate;
     }
 
@@ -535,9 +536,5 @@
 
     public String toString() {
         return "ivy parser";
-    }
-
-    public static void main(String[] args) throws Exception {
-        System.out.println(getInstance().parseDescriptor(new Ivy(), new File("test/xml/module1/module1.ivy.xml").toURL(), true));
     }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java Wed Jan 31 03:00:29 2007
@@ -38,6 +38,7 @@
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.namespace.Namespace;
 import org.apache.ivy.util.Message;
 import org.apache.ivy.util.XMLHelper;
@@ -74,13 +75,13 @@
         update(null, srcURL, destFile, resolvedRevisions, status, revision, pubdate, null, false);
     }
 
-    public static void update(final Ivy ivy, URL srcURL, File destFile, final Map resolvedRevisions, final String status, 
+    public static void update(final IvySettings settings, URL srcURL, File destFile, final Map resolvedRevisions, final String status, 
             final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude) 
                                 throws IOException, SAXException {
-    	update(ivy, srcURL.openStream(), destFile, resolvedRevisions, status, revision, pubdate, ns, replaceInclude);
+    	update(settings, srcURL.openStream(), destFile, resolvedRevisions, status, revision, pubdate, ns, replaceInclude);
     }
     
-    public static void update(final Ivy ivy, InputStream in, File destFile, final Map resolvedRevisions, final String status, 
+    public static void update(final IvySettings settings, InputStream in, File destFile, final Map resolvedRevisions, final String status, 
             final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude) 
                                 throws IOException, SAXException {
         if (destFile.getParentFile() != null) {
@@ -88,7 +89,7 @@
         }
         OutputStream fos = new FileOutputStream(destFile);
         try {
-           update(ivy, in, fos, resolvedRevisions, status, revision, pubdate, ns, replaceInclude);
+           update(settings, in, fos, resolvedRevisions, status, revision, pubdate, ns, replaceInclude);
         } finally {
            try {
                in.close();
@@ -101,7 +102,7 @@
     
     private static class UpdaterHandler extends DefaultHandler implements LexicalHandler {
     	
-    	private final Ivy ivy;
+    	private final IvySettings settings;
 		private final PrintWriter out;
 		private final Map resolvedRevisions;
 		private final String status;
@@ -111,9 +112,9 @@
 		private final boolean replaceInclude;
 		private boolean inHeader = true;
 		
-		public UpdaterHandler(final Ivy ivy, final PrintWriter out, final Map resolvedRevisions, final String status, 
+		public UpdaterHandler(final IvySettings settings, final PrintWriter out, final Map resolvedRevisions, final String status, 
             final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude) {
-				this.ivy = ivy;
+				this.settings = settings;
 				this.out = out;
 				this.resolvedRevisions = resolvedRevisions;
 				this.status = status;
@@ -141,39 +142,39 @@
             }
             _context.push(qName);
             if ("info".equals(qName)) {
-                _organisation = substitute(ivy, attributes.getValue("organisation"));
+                _organisation = substitute(settings, attributes.getValue("organisation"));
                 out.print("<info organisation=\""+_organisation
-                        				+"\" module=\""+substitute(ivy, attributes.getValue("module"))+"\"");
+                        				+"\" module=\""+substitute(settings, attributes.getValue("module"))+"\"");
                 if (revision != null) {
                     out.print(" revision=\""+revision+"\"");
                 } else if (attributes.getValue("revision") != null) {
-                    out.print(" revision=\""+substitute(ivy, attributes.getValue("revision"))+"\"");
+                    out.print(" revision=\""+substitute(settings, attributes.getValue("revision"))+"\"");
                 }
                 if (status != null) {
                     out.print(" status=\""+status+"\"");
                 } else {
-                    out.print(" status=\""+substitute(ivy, attributes.getValue("status"))+"\"");
+                    out.print(" status=\""+substitute(settings, attributes.getValue("status"))+"\"");
                 }
                 if (pubdate != null) {
                     out.print(" publication=\""+Ivy.DATE_FORMAT.format(pubdate)+"\"");
                 } else if (attributes.getValue("publication") != null) {
-                    out.print(" publication=\""+substitute(ivy, attributes.getValue("publication"))+"\"");
+                    out.print(" publication=\""+substitute(settings, attributes.getValue("publication"))+"\"");
                 }
                 Collection stdAtts = Arrays.asList(new String[] {"organisation", "module", "revision", "status", "publication", "namespace"});
                 if (attributes.getValue("namespace") != null) {
-                    out.print(" namespace=\""+substitute(ivy, attributes.getValue("namespace"))+"\"");
+                    out.print(" namespace=\""+substitute(settings, attributes.getValue("namespace"))+"\"");
                 }
                 for (int i=0; i<attributes.getLength(); i++) {
                 	if (!stdAtts.contains(attributes.getQName(i))) {
-                		out.print(" "+attributes.getQName(i)+"=\""+substitute(ivy, attributes.getValue(i))+"\"");
+                		out.print(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
                 	}
                 }
             } else if (replaceInclude && "include".equals(qName) && _context.contains("configurations")) {
                 try {
                     URL url;
-                    String fileName = substitute(ivy, attributes.getValue("file"));
+                    String fileName = substitute(settings, attributes.getValue("file"));
                     if (fileName == null) {
-                        String urlStr = substitute(ivy, attributes.getValue("url"));
+                        String urlStr = substitute(settings, attributes.getValue("url"));
                         url = new URL(urlStr);
                     } else {
                         url = new File(fileName).toURL();
@@ -184,11 +185,11 @@
                                 String qName, Attributes attributes)
                                 throws SAXException {
                             if ("configurations".equals(qName)) {
-                                String defaultconf = substitute(ivy, attributes.getValue("defaultconfmapping"));
+                                String defaultconf = substitute(settings, attributes.getValue("defaultconfmapping"));
                                 if (defaultconf != null) {
                                     _defaultConfMapping = defaultconf;
                                 }
-                                String mappingOverride = substitute(ivy, attributes.getValue("confmappingoverride"));
+                                String mappingOverride = substitute(settings, attributes.getValue("confmappingoverride"));
                                 if (mappingOverride != null) {
                                    _confMappingOverride = Boolean.valueOf(mappingOverride);
                                 }
@@ -201,7 +202,7 @@
                                 }
                                 out.print("<"+qName);
                                 for (int i=0; i<attributes.getLength(); i++) {
-                                    out.print(" "+attributes.getQName(i)+"=\""+substitute(ivy, attributes.getValue(i))+"\"");
+                                    out.print(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
                                 }
                             }
                         }
@@ -212,11 +213,11 @@
                 }
             } else if ("dependency".equals(qName)) {
                 out.print("<dependency");
-                String org = substitute(ivy, attributes.getValue("org"));
+                String org = substitute(settings, attributes.getValue("org"));
                 org = org == null ? _organisation : org;
-                String module = substitute(ivy, attributes.getValue("name"));
-                String branch = substitute(ivy, attributes.getValue("branch"));
-                String revision = substitute(ivy, attributes.getValue("rev"));
+                String module = substitute(settings, attributes.getValue("name"));
+                String branch = substitute(settings, attributes.getValue("branch"));
+                String revision = substitute(settings, attributes.getValue("rev"));
                 ModuleRevisionId localMid = ModuleRevisionId.newInstance(org, module, branch, revision);
                 ModuleRevisionId systemMid = ns == null ? 
                         localMid : 
@@ -238,14 +239,14 @@
                     } else if ("branch".equals(attName)) {
                         out.print(" branch=\""+systemMid.getBranch()+"\"");
                     } else {
-                        out.print(" "+attName+"=\""+substitute(ivy, attributes.getValue(attName))+"\"");
+                        out.print(" "+attName+"=\""+substitute(settings, attributes.getValue(attName))+"\"");
                     }
                 }
             } else if ("dependencies".equals(qName)) {
                 // copy
                 out.print("<"+qName);
                 for (int i=0; i<attributes.getLength(); i++) {
-                    out.print(" "+attributes.getQName(i)+"=\""+substitute(ivy, attributes.getValue(i))+"\"");
+                    out.print(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
                 }
                 // add default conf mapping if needed
                 if (_defaultConfMapping != null && attributes.getValue("defaultconfmapping") == null) {
@@ -259,14 +260,14 @@
                 // copy
                 out.print("<"+qName);
                 for (int i=0; i<attributes.getLength(); i++) {
-                    out.print(" "+attributes.getQName(i)+"=\""+substitute(ivy, attributes.getValue(i))+"\"");
+                    out.print(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
                 }
             }
             _justOpen = qName;
 //            indent.append("\t");
         }
 
-        private String substitute(Ivy ivy, String value) {
+        private String substitute(IvySettings ivy, String value) {
             return ivy == null ? value : ivy.substitute(value);
         }
 
@@ -339,7 +340,7 @@
 
     }
     
-    public static void update(final Ivy ivy, InputStream inStream, OutputStream outStream, final Map resolvedRevisions, final String status, 
+    public static void update(final IvySettings settings, InputStream inStream, OutputStream outStream, final Map resolvedRevisions, final String status, 
             final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude) 
                                 throws IOException, SAXException {
         final PrintWriter out = new PrintWriter(new OutputStreamWriter(outStream , "UTF-8"));
@@ -350,7 +351,7 @@
         in.reset(); // reposition the stream at the beginning
             
         try {
-        	UpdaterHandler updaterHandler = new UpdaterHandler(ivy,out,resolvedRevisions,status,revision,pubdate,ns,replaceInclude);
+        	UpdaterHandler updaterHandler = new UpdaterHandler(settings,out,resolvedRevisions,status,revision,pubdate,ns,replaceInclude);
 			XMLHelper.parse(in, null, updaterHandler, updaterHandler);
         } catch (ParserConfigurationException e) {
             IllegalStateException ise = new IllegalStateException("impossible to update Ivy files: parser problem");

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java Wed Jan 31 03:00:29 2007
@@ -23,8 +23,6 @@
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.module.descriptor.Artifact;

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java Wed Jan 31 03:00:29 2007
@@ -113,7 +113,7 @@
 			ModuleId mid = (ModuleId) iter.next();
 			out.println("\t\t<module organisation=\""+mid.getOrganisation()+"\"" +
 					" name=\""+mid.getName()+"\"" +
-					" resolver=\""+report.getIvy().getResolverName(mid)+"\">");
+					" resolver=\""+report.getResolveEngine().getSettings().getResolverName(mid)+"\">");
 			for (Iterator it2 = report.getNodes(mid).iterator(); it2.hasNext();) {
                 IvyNode dep = (IvyNode)it2.next();
                 ModuleDescriptor md = null;

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/AbstractRepository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/AbstractRepository.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/AbstractRepository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/AbstractRepository.java Wed Jan 31 03:00:29 2007
@@ -23,7 +23,6 @@
 
 import javax.swing.event.EventListenerList;
 
-import org.apache.ivy.core.IvyContext;
 import org.apache.ivy.core.module.descriptor.Artifact;
 
 
@@ -46,7 +45,7 @@
     }
     
     protected void fireTransferInitiated(Resource res, int requestType) {
-        _evt = new TransferEvent(IvyContext.getContext().getIvy(), this, res, TransferEvent.TRANSFER_INITIATED, requestType);
+        _evt = new TransferEvent(this, res, TransferEvent.TRANSFER_INITIATED, requestType);
         fireTransferEvent(_evt);
     }
     

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferEvent.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferEvent.java Wed Jan 31 03:00:29 2007
@@ -19,7 +19,6 @@
 
 import java.io.File;
 
-import org.apache.ivy.Ivy;
 import org.apache.ivy.core.event.IvyEvent;
 
 
@@ -114,8 +113,8 @@
     private long _totalLength;
     private boolean _isTotalLengthSet = false;
 
-    public TransferEvent(Ivy ivy, final Repository repository, final Resource resource, final int eventType, final int requestType) {
-    	super(ivy, getName(eventType));
+    public TransferEvent(final Repository repository, final Resource resource, final int eventType, final int requestType) {
+    	super(getName(eventType));
     	
         _repository = repository;
         addAttribute("repository", _repository.getName());
@@ -128,14 +127,14 @@
         addAttribute("request-type", requestType == REQUEST_GET?"get":"put");
     }
 
-	public TransferEvent(Ivy ivy, final Repository repository, final Resource resource, final Exception exception, final int requestType) {
-        this(ivy, repository, resource, TRANSFER_ERROR, requestType);
+	public TransferEvent(final Repository repository, final Resource resource, final Exception exception, final int requestType) {
+        this(repository, resource, TRANSFER_ERROR, requestType);
 
         _exception = exception;
     }
 
-    public TransferEvent(Ivy ivy, final Repository repository, final Resource resource, long length, final int requestType) {
-        this(ivy, repository, resource, TRANSFER_PROGRESS, requestType);
+    public TransferEvent(final Repository repository, final Resource resource, long length, final int requestType) {
+        this(repository, resource, TRANSFER_PROGRESS, requestType);
 
         _length = length;
         _totalLength = length;

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java Wed Jan 31 03:00:29 2007
@@ -26,10 +26,10 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import com.jcraft.jsch.Channel;
 import com.jcraft.jsch.ChannelExec;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.Session;
-import com.jcraft.jsch.Channel;
 
 /**
  * This class is using the scp client to transfer data and information for the

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java Wed Jan 31 03:00:29 2007
@@ -87,7 +87,7 @@
             host = newHost;
             user = newUser;
             port = newPort;
-            IvyContext.getContext().getIvy().addIvyListener(new IvyListener() {
+            IvyContext.getContext().getEventManager().addIvyListener(new IvyListener() {
                 public void progress(IvyEvent event) {
                     event.getSource().removeIvyListener(this);
                     clearSession(session);

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java Wed Jan 31 03:00:29 2007
@@ -21,11 +21,15 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.ArrayList;
 
-import org.apache.commons.vfs.*;
+import org.apache.commons.vfs.FileContent;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.FileType;
 import org.apache.commons.vfs.impl.StandardFileSystemManager;
 import org.apache.ivy.plugins.repository.AbstractRepository;
 import org.apache.ivy.plugins.repository.RepositoryCopyProgressListener;

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java?view=diff&rev=501796&r1=501795&r2=501796
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java Wed Jan 31 03:00:29 2007
@@ -463,7 +463,7 @@
 				}
 
 				if (_ivy != null) {
-					_ivy.addIvyListener(new IvyListener() {
+					_ivy.getEventManager().addIvyListener(new IvyListener() {
 						public void progress(IvyEvent event) {
 							disconnect();
 							event.getSource().removeIvyListener(this);