felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r991616 - in /felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager: AbstractEclipseRepositoryManager.java EclipseRepositoryFactory.java
Date Wed, 01 Sep 2010 17:30:58 GMT
Author: dsavage
Date: Wed Sep  1 17:30:58 2010
New Revision: 991616

URL: http://svn.apache.org/viewvc?rev=991616&view=rev
Log:
handle singleton repository providers more intelligently part of FELIX-1355

Modified:
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/AbstractEclipseRepositoryManager.java
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/EclipseRepositoryFactory.java

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/AbstractEclipseRepositoryManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/AbstractEclipseRepositoryManager.java?rev=991616&r1=991615&r2=991616&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/AbstractEclipseRepositoryManager.java
(original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/AbstractEclipseRepositoryManager.java
Wed Sep  1 17:30:58 2010
@@ -28,8 +28,8 @@ import java.util.Properties;
 import org.apache.felix.sigil.common.config.IRepositoryConfig;
 import org.apache.felix.sigil.common.repository.AbstractRepositoryManager;
 import org.apache.felix.sigil.common.repository.IBundleRepository;
-import org.apache.felix.sigil.common.repository.IRepositoryProvider;
 import org.apache.felix.sigil.eclipse.SigilCore;
+import org.apache.felix.sigil.eclipse.internal.repository.manager.EclipseRepositoryFactory.EclipseRepositoryProviderWrapper;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
@@ -108,11 +108,13 @@ public abstract class AbstractEclipseRep
             else {
                 Properties props = config.getRepositoryConfig(name);
                 if (props != null) {
-                    String uid = config.getRepositoryDefinition(name).toString() + '#' +
name;
-                    IBundleRepository repo = buildRepository(uid, props);
-                    
+                    String def = config.getRepositoryDefinition(name).toString();
+                    IBundleRepository repo = buildRepository(def, name, props);
                     if ( repo != null ) {
-                        list.add(repo);
+                        // filter singletons but maintain order
+                        if ( !list.contains(repo) ) {
+                            list.add(repo);
+                        }
                     }
                 }
             }
@@ -123,7 +125,7 @@ public abstract class AbstractEclipseRep
      * @param repo
      * @return 
      */
-    private IBundleRepository buildRepository(String uid, Properties repo)
+    private IBundleRepository buildRepository(String def, String name, Properties repo)
     {
         String disabled = repo.getProperty("disabled", "false");
         if (Boolean.parseBoolean(disabled.trim())) return null;
@@ -134,7 +136,7 @@ public abstract class AbstractEclipseRep
         String alias = repo.getProperty(IRepositoryConfig.REPOSITORY_PROVIDER);
         if (alias == null)
         {
-            String msg = "provider not specified for repository: " + uid;
+            String msg = "provider not specified for repository: " + def + "->" + name;
             
             if (optional)            
                 SigilCore.log(msg);
@@ -146,8 +148,9 @@ public abstract class AbstractEclipseRep
 
         try
         {
-            IRepositoryProvider instance = EclipseRepositoryFactory.getProvider(alias);
-            IBundleRepository repository = repositoryCache.getRepository(uid, repo, instance);
+            EclipseRepositoryProviderWrapper wrapper = EclipseRepositoryFactory.getProvider(alias);
+            String uid = wrapper.getType().isDynamic() ? def + "#" + name : wrapper.getType().getName();
+            IBundleRepository repository = repositoryCache.getRepository(uid, repo, wrapper);
             return repository;
         }
         catch (Exception e)

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/EclipseRepositoryFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/EclipseRepositoryFactory.java?rev=991616&r1=991615&r2=991616&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/EclipseRepositoryFactory.java
(original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/manager/EclipseRepositoryFactory.java
Wed Sep  1 17:30:58 2010
@@ -61,12 +61,16 @@ public class EclipseRepositoryFactory
         {
             return new EclipseBundleRepository(delegate, type, id, properties);
         }
+        
+        public IRepositoryType getType() {
+            return type;
+        }
     }
     /**
      * @param alias
      * @return
      */
-    public static IRepositoryProvider getProvider(String alias)
+    public static EclipseRepositoryProviderWrapper getProvider(String alias)
     throws CoreException
     {
         IExtensionRegistry registry = Platform.getExtensionRegistry();



Mime
View raw message