felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r920362 - in /felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse: ./ internal/repository/eclipse/
Date Mon, 08 Mar 2010 15:44:08 GMT
Author: dsavage
Date: Mon Mar  8 15:44:07 2010
New Revision: 920362

URL: http://svn.apache.org/viewvc?rev=920362&view=rev
Log:
Patch for FELIX-2180 - now global repository and project specific repository managers share
a common repository map to ensure same objects are used throughout the IDE

Added:
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/RepositoryMap.java
Modified:
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/GlobalRepositoryManager.java
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/SigilRepositoryManager.java

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java?rev=920362&r1=920361&r2=920362&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java (original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java Mon Mar
 8 15:44:07 2010
@@ -40,6 +40,7 @@
 import org.apache.felix.sigil.eclipse.internal.model.project.SigilProject;
 import org.apache.felix.sigil.eclipse.internal.model.repository.RepositoryConfiguration;
 import org.apache.felix.sigil.eclipse.internal.repository.eclipse.GlobalRepositoryManager;
+import org.apache.felix.sigil.eclipse.internal.repository.eclipse.RepositoryMap;
 import org.apache.felix.sigil.eclipse.internal.repository.eclipse.SigilRepositoryManager;
 import org.apache.felix.sigil.eclipse.internal.resources.ProjectResourceListener;
 import org.apache.felix.sigil.eclipse.internal.resources.SigilProjectManager;
@@ -132,14 +133,13 @@
     private ServiceTracker descriptorTracker;
     private ServiceTracker registryTracker;
     private ServiceTracker serializerTracker;
-
     private static IRepositoryConfiguration repositoryConfig;
     private static SigilProjectManager projectManager;
     private static OSGiInstallManager installs;
     private static ISigilModelRoot modelRoot;
     private static HashMap<Object, SigilRepositoryManager> repositoryManagers = new
HashMap<Object, SigilRepositoryManager>();
     private static GlobalRepositoryManager globalRepositoryManager;
-
+    private static RepositoryMap repositoryMap;
 
     /**
      * Returns the shared instance
@@ -277,7 +277,8 @@
 
         installs = new OSGiInstallManager();
 
-        globalRepositoryManager = new GlobalRepositoryManager();
+        repositoryMap = new RepositoryMap();
+        globalRepositoryManager = new GlobalRepositoryManager(repositoryMap);
         globalRepositoryManager.initialise();
         
         projectManager = new SigilProjectManager();
@@ -449,7 +450,7 @@
             manager = repositoryManagers.get( NULL );
             if ( manager == null )
             {
-                manager = new SigilRepositoryManager( null );
+                manager = new SigilRepositoryManager( null, repositoryMap );
                 manager.initialise();
                 repositoryManagers.put( NULL, manager );
             }
@@ -460,7 +461,7 @@
 
             if ( manager == null )
             {
-                manager = new SigilRepositoryManager( set );
+                manager = new SigilRepositoryManager( set, repositoryMap );
                 manager.initialise();
                 repositoryManagers.put( set, manager );
             }

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/GlobalRepositoryManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/GlobalRepositoryManager.java?rev=920362&r1=920361&r2=920362&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/GlobalRepositoryManager.java
(original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/GlobalRepositoryManager.java
Mon Mar  8 15:44:07 2010
@@ -31,9 +31,9 @@
 public class GlobalRepositoryManager extends SigilRepositoryManager implements IRepositoryManager
 {
 
-    public GlobalRepositoryManager()
+    public GlobalRepositoryManager(RepositoryMap map)
     {
-        super( null );
+        super( null, map );
     }
 
 

Added: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/RepositoryMap.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/RepositoryMap.java?rev=920362&view=auto
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/RepositoryMap.java
(added)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/RepositoryMap.java
Mon Mar  8 15:44:07 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.felix.sigil.eclipse.internal.repository.eclipse;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.apache.felix.sigil.repository.IBundleRepository;
+
+public class RepositoryMap
+{
+    static class RepositoryCache
+    {
+        final Properties pref;
+        final IBundleRepository repo;
+
+
+        RepositoryCache( Properties pref, IBundleRepository repo )
+        {
+            this.pref = pref;
+            this.repo = repo;
+        }
+    }
+    
+    private HashMap<String, RepositoryCache> cachedRepositories = new HashMap<String,
RepositoryCache>();
+
+    synchronized void retainAll(Collection<String> ids)
+    {
+        for ( Iterator<String> i = cachedRepositories.keySet().iterator(); i.hasNext();
)
+        {
+            if ( !ids.contains( i.next() ) )
+            {
+                i.remove();
+            }
+        }
+    }
+
+    synchronized RepositoryCache get(String id)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    synchronized void put(String id, RepositoryCache cache)
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+
+}

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/SigilRepositoryManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/SigilRepositoryManager.java?rev=920362&r1=920361&r2=920362&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/SigilRepositoryManager.java
(original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/SigilRepositoryManager.java
Mon Mar  8 15:44:07 2010
@@ -24,12 +24,11 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Properties;
 
 import org.apache.felix.sigil.eclipse.SigilCore;
+import org.apache.felix.sigil.eclipse.internal.repository.eclipse.RepositoryMap.RepositoryCache;
 import org.apache.felix.sigil.eclipse.model.repository.IRepositoryModel;
 import org.apache.felix.sigil.eclipse.model.repository.IRepositorySet;
 import org.apache.felix.sigil.eclipse.model.repository.IRepositoryType;
@@ -55,25 +54,12 @@
 
     private final String repositorySet;
 
-    private HashMap<String, RepositoryCache> cachedRepositories = new HashMap<String,
RepositoryCache>();
+    private RepositoryMap cachedRepositories;
 
-    class RepositoryCache
-    {
-        private final Properties pref;
-        private final IBundleRepository repo;
-
-
-        RepositoryCache( Properties pref, IBundleRepository repo )
-        {
-            this.pref = pref;
-            this.repo = repo;
-        }
-    }
-
-
-    public SigilRepositoryManager( String repositorySet )
+    public SigilRepositoryManager( String repositorySet, RepositoryMap cachedRepositories
)
     {
         this.repositorySet = repositorySet;
+        this.cachedRepositories = cachedRepositories;
     }
 
 
@@ -134,13 +120,7 @@
 
         setRepositories( repos.toArray( new IBundleRepository[repos.size()] ) );
 
-        for ( Iterator<String> i = cachedRepositories.keySet().iterator(); i.hasNext();
)
-        {
-            if ( !ids.contains( i.next() ) )
-            {
-                i.remove();
-            }
-        }
+        cachedRepositories.retainAll( ids );
     }
 
 



Mime
View raw message