pull common config field up class hierarchy to avoid duplication


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@994973 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/common/core/src/org/apache/felix/sigil/common/core/repository/BundleResolver.java b/sigil/common/core/src/org/apache/felix/sigil/common/core/repository/BundleResolver.java
index ad940d0..77b740d 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/common/core/repository/BundleResolver.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/common/core/repository/BundleResolver.java
@@ -348,7 +348,7 @@
         }
     };
 
-    private AbstractRepositoryManager repositoryManager;
+    private final AbstractRepositoryManager repositoryManager;
 
     public BundleResolver(AbstractRepositoryManager repositoryManager)
     {
diff --git a/sigil/common/core/src/org/apache/felix/sigil/common/repository/AbstractRepositoryManager.java b/sigil/common/core/src/org/apache/felix/sigil/common/repository/AbstractRepositoryManager.java
index 3ee7abd..7032f68 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/common/repository/AbstractRepositoryManager.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/common/repository/AbstractRepositoryManager.java
@@ -30,6 +30,7 @@
 import java.util.Map;
 import java.util.TreeMap;
 
+import org.apache.felix.sigil.common.config.IRepositoryConfig;
 import org.apache.felix.sigil.common.core.repository.BundleResolver;
 import org.apache.felix.sigil.common.model.IModelWalker;
 import org.apache.felix.sigil.common.model.eclipse.ILibrary;
@@ -44,14 +45,28 @@
 
     private boolean initialised;
 
-    private HashMap<String, IBundleRepository> repositories = new HashMap<String, IBundleRepository>();
-    private ArrayList<IBundleRepository> order = new ArrayList<IBundleRepository>();
-    private TreeMap<Integer, HashSet<IBundleRepository>> levelMap = new TreeMap<Integer, HashSet<IBundleRepository>>();
+    private final HashMap<String, IBundleRepository> repositories = new HashMap<String, IBundleRepository>();
+    private final ArrayList<IBundleRepository> order = new ArrayList<IBundleRepository>();
+    private final TreeMap<Integer, HashSet<IBundleRepository>> levelMap = new TreeMap<Integer, HashSet<IBundleRepository>>();
+    private final ArrayList<ILibrary> libraries = new ArrayList<ILibrary>();
+    
+    private final BundleResolver resolver = new BundleResolver(this);
+
     private int[] levels;
 
-    private BundleResolver resolver = new BundleResolver(this);
-
-    private ArrayList<ILibrary> libraries = new ArrayList<ILibrary>();
+    private final IRepositoryConfig config;
+    
+    public AbstractRepositoryManager(IRepositoryConfig config) {
+        this.config = config;
+    }
+    
+    /**
+     * @return
+     */
+    protected IRepositoryConfig getConfig()
+    {
+        return config;
+    }
 
     public void initialise()
     {
@@ -85,6 +100,7 @@
 
     public void notifyChange(IBundleRepository repository)
     {
+        
         notifyListeners(new RepositoryChangeEvent(repository, Type.CHANGED));
     }
 
diff --git a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/AbstractEclipseRepositoryManager.java b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/AbstractEclipseRepositoryManager.java
index bfd04db..1deb3ad 100644
--- a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/AbstractEclipseRepositoryManager.java
+++ b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/AbstractEclipseRepositoryManager.java
@@ -45,6 +45,7 @@
     
     public AbstractEclipseRepositoryManager(IRepositoryConfig config, IRepositoryCache repositoryMap)
     {
+        super(config);
         this.config = config;
         this.repositoryCache = repositoryMap;
     }
diff --git a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldRepositoryManager.java b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldRepositoryManager.java
index 20f67c1..4d925de 100644
--- a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldRepositoryManager.java
+++ b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldRepositoryManager.java
@@ -36,7 +36,6 @@
 public class BldRepositoryManager extends AbstractRepositoryManager
 {
     private static Map<String, String> aliases = new HashMap<String, String>();
-    private final IRepositoryConfig config;
 
     static
     {
@@ -53,14 +52,14 @@
      */
     public BldRepositoryManager(IRepositoryConfig config)
     {
-        this.config = config;
+        super(config);
     }
 
     @Override
     protected void loadRepositories()
     {
         List<IBundleRepository> list = new ArrayList<IBundleRepository>();
-        scanRepositories(config.getRepositoryPath(), list);
+        scanRepositories(getConfig().getRepositoryPath(), list);
         setRepositories(list.toArray(new IBundleRepository[list.size()]));
     }
     
@@ -81,7 +80,7 @@
                     }
                 }
                 List<String> subpath = new LinkedList<String>();
-                for (String key : config.getAllRepositories()) {
+                for (String key : getConfig().getAllRepositories()) {
                     if (!defined.contains(key))
                     {
                         subpath.add(key);
@@ -90,7 +89,7 @@
                 scanRepositories(subpath, list);
             }
             else {
-                Properties props = config.getRepositoryConfig(name);
+                Properties props = getConfig().getRepositoryConfig(name);
                 if (props != null) {
                     IBundleRepository repo = buildRepository(name, props);