felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r1102838 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: ./ cache/ resolver/
Date Fri, 13 May 2011 18:09:28 GMT
Author: rickhall
Date: Fri May 13 18:09:27 2011
New Revision: 1102838

URL: http://svn.apache.org/viewvc?rev=1102838&view=rev
Log:
Various cleaning up of the code. (FELIX-2950)

Added:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/Content.java
Removed:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Content.java
Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/RequiredBundleImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverWire.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
Fri May 13 18:09:27 2011
@@ -23,7 +23,19 @@ import java.io.InputStream;
 import java.util.Dictionary;
 
 import org.apache.felix.framework.ext.FelixBundleContext;
-import org.osgi.framework.*;
+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServicePermission;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.SynchronousBundleListener;
 
 class BundleContextImpl implements FelixBundleContext
 {

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java Fri May
13 18:09:27 2011
@@ -28,7 +28,15 @@ import org.apache.felix.framework.cache.
 import org.apache.felix.framework.ext.SecurityProvider;
 import org.apache.felix.framework.util.StringMap;
 import org.apache.felix.framework.util.Util;
-import org.osgi.framework.*;
+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServicePermission;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.BundleWire;
 

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
Fri May 13 18:09:27 2011
@@ -30,7 +30,7 @@ import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
 import org.apache.felix.framework.Felix.StatefulResolver;
-import org.apache.felix.framework.resolver.Content;
+import org.apache.felix.framework.cache.Content;
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.SecureAction;
 import org.apache.felix.framework.util.manifestparser.ManifestParser;

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java Fri
May 13 18:09:27 2011
@@ -41,7 +41,7 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 import org.apache.felix.framework.Felix.StatefulResolver;
 import org.apache.felix.framework.cache.JarContent;
-import org.apache.felix.framework.resolver.Content;
+import org.apache.felix.framework.cache.Content;
 import org.apache.felix.framework.resolver.HostedCapability;
 import org.apache.felix.framework.resolver.HostedRequirement;
 import org.apache.felix.framework.resolver.ResolveException;
@@ -54,7 +54,6 @@ import org.apache.felix.framework.util.U
 import org.apache.felix.framework.util.manifestparser.R4Library;
 import org.apache.felix.framework.wiring.BundleCapabilityImpl;
 import org.apache.felix.framework.wiring.BundleRequirementImpl;
-import org.apache.felix.framework.wiring.BundleWireImpl;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.BundleReference;
@@ -403,7 +402,7 @@ public class BundleWiringImpl implements
         return m_wires;
     }
 
-    public synchronized void addDynamicWire(BundleWireImpl wire)
+    public synchronized void addDynamicWire(BundleWire wire)
     {
         m_wires.add(wire);
         m_importedPkgs.put(

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java Fri
May 13 18:09:27 2011
@@ -44,7 +44,7 @@ import org.apache.felix.framework.util.F
 import org.apache.felix.framework.util.StringMap;
 import org.apache.felix.framework.util.Util;
 import org.apache.felix.framework.util.manifestparser.ManifestParser;
-import org.apache.felix.framework.resolver.Content;
+import org.apache.felix.framework.cache.Content;
 import org.apache.felix.framework.util.manifestparser.R4Library;
 import org.apache.felix.framework.wiring.BundleCapabilityImpl;
 import org.osgi.framework.AdminPermission;

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Fri May 13 18:09:27
2011
@@ -4579,20 +4579,15 @@ public class Felix extends BundleImpl im
             // visibility, since we need to include those packages too.
             if (br.getWiring() == null)
             {
-System.out.println("+++ br.getWiring() = " + br.getWiring());
                 for (ResolverWire rw : wireMap.get(br))
                 {
-System.out.println("+++ rw.getCapability() = " + rw.getCapability());
-System.out.println("+++ rw.getRequirement() = " + rw.getRequirement());
                     if (rw.getCapability().getNamespace().equals(
                         BundleCapabilityImpl.BUNDLE_NAMESPACE))
                     {
                         String dir = rw.getRequirement()
                             .getDirectives().get(Constants.VISIBILITY_DIRECTIVE);
-System.out.println("+++ dir = " + dir);
                         if ((dir != null) && (dir.equals(Constants.VISIBILITY_REEXPORT)))
                         {
-System.out.println("+++ rw.getProvider() = " + rw.getProvider());
                             calculateExportedAndReexportedPackages(
                                 rw.getProvider(),
                                 wireMap,

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/RequiredBundleImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/RequiredBundleImpl.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/RequiredBundleImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/RequiredBundleImpl.java
Fri May 13 18:09:27 2011
@@ -18,12 +18,9 @@
  */
 package org.apache.felix.framework;
 
-import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.service.packageadmin.RequiredBundle;
 
 class RequiredBundleImpl implements RequiredBundle

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
Fri May 13 18:09:27 2011
@@ -23,7 +23,6 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.StringTokenizer;

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
Fri May 13 18:09:27 2011
@@ -22,7 +22,6 @@ import java.io.File;
 import java.util.Map;
 
 import org.apache.felix.framework.Logger;
-import org.apache.felix.framework.resolver.Content;
 
 /**
  * <p>

Added: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/Content.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/Content.java?rev=1102838&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/Content.java (added)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/Content.java Fri
May 13 18:09:27 2011
@@ -0,0 +1,124 @@
+/*
+ * 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.framework.cache;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+public interface Content
+{
+    /**
+     * <p>
+     * This method must be called when the content is no longer needed so
+     * that any resourses being used (e.g., open files) can be closed. Once
+     * this method is called, the content is no longer usable. If the content
+     * is already closed, then calls on this method should have no effect.
+     * </p>
+    **/
+    void close();
+
+    /**
+     * <p>
+     * This method determines if the specified named entry is contained in
+     * the associated content. The entry name is a relative path with '/'
+     * separators.
+     * </p>
+     * @param name The name of the entry to find.
+     * @return <tt>true</tt> if a corresponding entry was found, <tt>false</tt>
+     *         otherwise.
+    **/
+    boolean hasEntry(String name);
+
+    /**
+     * <p>
+     * Returns an enumeration of entry names as <tt>String</tt> objects.
+     * An entry name is a path constructed with '/' as path element
+     * separators and is relative to the root of the content. Entry names
+     * for entries that represent directories should end with the '/'
+     * character.
+     * </p>
+     * @returns An enumeration of entry names or <tt>null</tt>.
+    **/
+    Enumeration getEntries();
+
+    /**
+     * <p>
+     * This method returns the named entry as an array of bytes.
+     * </p>
+     * @param name The name of the entry to retrieve as a byte array.
+     * @return An array of bytes if the corresponding entry was found, <tt>null</tt>
+     *         otherwise.
+    **/
+    byte[] getEntryAsBytes(String name);
+
+    /**
+     * <p>
+     * This method returns the named entry as an input stream.
+     * </p>
+     * @param name The name of the entry to retrieve as an input stream.
+     * @return An input stream if the corresponding entry was found, <tt>null</tt>
+     *         otherwise.
+     * @throws <tt>java.io.IOException</tt> if any error occurs.
+    **/
+    InputStream getEntryAsStream(String name) throws IOException;
+
+    /**
+     * <p>
+     * This method returns the named entry as an <tt>IContent</tt> Typically,
+     * this method only makes sense for entries that correspond to some form
+     * of aggregated resource (e.g., an embedded JAR file or directory), but
+     * implementations are free to interpret this however makes sense. This method
+     * should return a new <tt>IContent</tt> instance for every invocation and
+     * the caller is responsible for opening and closing the returned content
+     * object.
+     * </p>
+     * @param name The name of the entry to retrieve as an <tt>IContent</tt>.
+     * @return An <tt>IContent</tt> instance if a corresponding entry was found,
+     *         <tt>null</tt> otherwise.
+    **/
+    Content getEntryAsContent(String name);
+
+    /**
+     * <p>
+     * This method returns the named entry as a file in the file system for
+     * use as a native library. It may not be possible for all content
+     * implementations (e.g., memory only) to implement this method, in which
+     * case it is acceptable to return <tt>null</tt>. Since native libraries
+     * can only be associated with a single class loader, this method should
+     * return a unique file per request.
+     * </p>
+     * @param name The name of the entry to retrieve as a file.
+     * @return A string corresponding to the absolute path of the file if a
+     *         corresponding entry was found, <tt>null</tt> otherwise.
+    **/
+    String getEntryAsNativeLibrary(String name);
+
+    /**
+     * <p>
+     *  This method allows retrieving an entry as a local URL.
+     * </p>
+     *
+     * @param name The name of the entry to retrieve as a URL
+     * @return A URL using a local protocol such as file, jar
+     *           or null if not possible.
+     */
+    URL getEntryAsURL(String name);
+}
\ No newline at end of file

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java
Fri May 13 18:09:27 2011
@@ -18,7 +18,6 @@
  */
 package org.apache.felix.framework.cache;
 
-import org.apache.felix.framework.resolver.Content;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java
Fri May 13 18:09:27 2011
@@ -18,7 +18,6 @@
  */
 package org.apache.felix.framework.cache;
 
-import org.apache.felix.framework.resolver.Content;
 import java.io.*;
 import java.net.MalformedURLException;
 import java.net.URL;

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
Fri May 13 18:09:27 2011
@@ -26,7 +26,6 @@ import java.util.jar.Manifest;
 
 import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.util.StringMap;
-import org.apache.felix.framework.resolver.Content;
 
 /**
  * <p>

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java Fri
May 13 18:09:27 2011
@@ -34,7 +34,6 @@ import org.apache.felix.framework.Logger
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.ZipFileX;
 import org.apache.felix.framework.util.Util;
-import org.apache.felix.framework.resolver.Content;
 import org.osgi.framework.Constants;
 
 public class JarContent implements Content

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
Fri May 13 18:09:27 2011
@@ -32,7 +32,6 @@ import org.apache.felix.framework.Logger
 import org.apache.felix.framework.util.ZipFileX;
 import org.apache.felix.framework.util.StringMap;
 import org.apache.felix.framework.util.Util;
-import org.apache.felix.framework.resolver.Content;
 
 /**
  * <p>

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
Fri May 13 18:09:27 2011
@@ -90,7 +90,7 @@ public class ResolverImpl implements Res
 
                     // If the requested revision is a fragment, then
                     // ultimately we will verify the host.
-                    BundleRequirementImpl hostReq = getHostRequirement(revision);
+                    BundleRequirement hostReq = getHostRequirement(revision);
                     BundleRevision target = revision;
 
                     do
@@ -323,25 +323,25 @@ public class ResolverImpl implements Res
         return singletons;
     }
 
-    private static BundleCapabilityImpl getHostCapability(BundleRevision br)
+    private static BundleCapability getHostCapability(BundleRevision br)
     {
         for (BundleCapability c : br.getDeclaredCapabilities(null))
         {
             if (c.getNamespace().equals(BundleCapabilityImpl.HOST_NAMESPACE))
             {
-                return (BundleCapabilityImpl) c;
+                return c;
             }
         }
         return null;
     }
 
-    private static BundleRequirementImpl getHostRequirement(BundleRevision br)
+    private static BundleRequirement getHostRequirement(BundleRevision br)
     {
         for (BundleRequirement r : br.getDeclaredRequirements(null))
         {
             if (r.getNamespace().equals(BundleCapabilityImpl.HOST_NAMESPACE))
             {
-                return (BundleRequirementImpl) r;
+                return r;
             }
         }
         return null;
@@ -460,8 +460,8 @@ public class ResolverImpl implements Res
 
         // Create parallel arrays for requirement and proposed candidate
         // capability or actual capability if revision is resolved or not.
-        List<BundleRequirementImpl> reqs = new ArrayList();
-        List<BundleCapabilityImpl> caps = new ArrayList();
+        List<BundleRequirement> reqs = new ArrayList();
+        List<BundleCapability> caps = new ArrayList();
         boolean isDynamicImporting = false;
         if (revision.getWiring() != null)
         {
@@ -488,8 +488,8 @@ public class ResolverImpl implements Res
                         wire.getProviderWiring().getRevision(),
                         (BundleCapabilityImpl) c);
                 }
-                reqs.add((BundleRequirementImpl) r);
-                caps.add((BundleCapabilityImpl) c);
+                reqs.add(r);
+                caps.add(c);
             }
 
             // Since the revision is resolved, it could be dynamically importing,
@@ -508,8 +508,8 @@ public class ResolverImpl implements Res
                 }
 
                 BundleCapability cap = candCaps.iterator().next();
-                reqs.add((BundleRequirementImpl) req);
-                caps.add((BundleCapabilityImpl) cap);
+                reqs.add(req);
+                caps.add(cap);
                 isDynamicImporting = true;
                 // Can only dynamically import one at a time, so break
                 // out of the loop after the first.
@@ -530,8 +530,8 @@ public class ResolverImpl implements Res
                 }
 
                 BundleCapability cap = candCaps.iterator().next();
-                reqs.add((BundleRequirementImpl) req);
-                caps.add((BundleCapabilityImpl) cap);
+                reqs.add(req);
+                caps.add(cap);
             }
         }
 
@@ -542,8 +542,8 @@ public class ResolverImpl implements Res
         // Second, add all imported packages to the target revision's package space.
         for (int i = 0; i < reqs.size(); i++)
         {
-            BundleRequirementImpl req = reqs.get(i);
-            BundleCapabilityImpl cap = caps.get(i);
+            BundleRequirement req = reqs.get(i);
+            BundleCapability cap = caps.get(i);
             calculateExportedPackages(cap.getRevision(), allCandidates, revisionPkgMap);
             mergeCandidatePackages(revision, req, cap, revisionPkgMap, allCandidates);
         }
@@ -574,7 +574,7 @@ public class ResolverImpl implements Res
                     // Ignore revisions that import from themselves.
                     if (!blame.m_cap.getRevision().equals(revision))
                     {
-                        List<BundleRequirementImpl> blameReqs = new ArrayList();
+                        List<BundleRequirement> blameReqs = new ArrayList();
                         blameReqs.add(blame.m_reqs.get(0));
 
                         mergeUses(
@@ -592,7 +592,7 @@ public class ResolverImpl implements Res
             {
                 for (Blame blame : entry.getValue())
                 {
-                    List<BundleRequirementImpl> blameReqs = new ArrayList();
+                    List<BundleRequirement> blameReqs = new ArrayList();
                     blameReqs.add(blame.m_reqs.get(0));
 
                     mergeUses(
@@ -609,7 +609,7 @@ public class ResolverImpl implements Res
     }
 
     private void mergeCandidatePackages(
-        BundleRevision current, BundleRequirementImpl currentReq, BundleCapability candCap,
+        BundleRevision current, BundleRequirement currentReq, BundleCapability candCap,
         Map<BundleRevision, Packages> revisionPkgMap,
         Candidates allCandidates)
     {
@@ -667,7 +667,7 @@ public class ResolverImpl implements Res
 
     private void mergeCandidatePackage(
         BundleRevision current, boolean requires,
-        BundleRequirementImpl currentReq, BundleCapability candCap,
+        BundleRequirement currentReq, BundleCapability candCap,
         Map<BundleRevision, Packages> revisionPkgMap)
     {
         if (candCap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
@@ -717,7 +717,7 @@ public class ResolverImpl implements Res
 
     private void mergeUses(
         BundleRevision current, Packages currentPkgs,
-        BundleCapability mergeCap, List<BundleRequirementImpl> blameReqs,
+        BundleCapability mergeCap, List<BundleRequirement> blameReqs,
         Map<BundleRevision, Packages> revisionPkgMap,
         Candidates allCandidates,
         Map<BundleCapability, List<BundleRevision>> cycleMap)
@@ -776,7 +776,7 @@ public class ResolverImpl implements Res
                 {
                     if (blame.m_reqs != null)
                     {
-                        List<BundleRequirementImpl> blameReqs2 = new ArrayList(blameReqs);
+                        List<BundleRequirement> blameReqs2 = new ArrayList(blameReqs);
                         blameReqs2.add(blame.m_reqs.get(blame.m_reqs.size() - 1));
                         usedCaps.add(new Blame(blame.m_cap, blameReqs2));
                         mergeUses(current, currentPkgs, blame.m_cap, blameReqs2,
@@ -813,7 +813,7 @@ public class ResolverImpl implements Res
 
         ResolveException rethrow = null;
         Candidates permutation = null;
-        Set<BundleRequirementImpl> mutated = null;
+        Set<BundleRequirement> mutated = null;
 
         // Check for conflicting imports from fragments.
         for (Entry<String, List<Blame>> entry : pkgs.m_importedPkgs.entrySet())
@@ -898,11 +898,11 @@ public class ResolverImpl implements Res
 
                     mutated = (mutated != null)
                         ? mutated
-                        : new HashSet();
+                        : new HashSet<BundleRequirement>();
 
                     for (int reqIdx = usedBlame.m_reqs.size() - 1; reqIdx >= 0; reqIdx--)
                     {
-                        BundleRequirementImpl req = usedBlame.m_reqs.get(reqIdx);
+                        BundleRequirement req = usedBlame.m_reqs.get(reqIdx);
 
                         // If we've already permutated this requirement in another
                         // uses constraint, don't permutate it again just continue
@@ -991,7 +991,7 @@ public class ResolverImpl implements Res
 
                         for (int reqIdx = usedBlame.m_reqs.size() - 1; reqIdx >= 0; reqIdx--)
                         {
-                            BundleRequirementImpl req = usedBlame.m_reqs.get(reqIdx);
+                            BundleRequirement req = usedBlame.m_reqs.get(reqIdx);
 
                             // If we've already permutated this requirement in another
                             // uses constraint, don't permutate it again just continue
@@ -1036,7 +1036,7 @@ public class ResolverImpl implements Res
                     // Try to permutate the candidate for the original
                     // import requirement; only permutate it if we haven't
                     // done so already.
-                    BundleRequirementImpl req = importBlame.m_reqs.get(0);
+                    BundleRequirement req = importBlame.m_reqs.get(0);
                     if (!mutated.contains(req))
                     {
                         // Since there may be lots of uses constraint violations
@@ -1083,7 +1083,7 @@ public class ResolverImpl implements Res
                         // to backtrack on our current candidate selection.
                         if (permCount == (m_usesPermutations.size() + m_importPermutations.size()))
                         {
-                            BundleRequirementImpl req = importBlame.m_reqs.get(0);
+                            BundleRequirement req = importBlame.m_reqs.get(0);
                             permutate(allCandidates, req, m_importPermutations);
                         }
                         throw ex;
@@ -1094,7 +1094,7 @@ public class ResolverImpl implements Res
     }
 
     private static void permutate(
-        Candidates allCandidates, BundleRequirementImpl req, List<Candidates> permutations)
+        Candidates allCandidates, BundleRequirement req, List<Candidates> permutations)
     {
         SortedSet<BundleCapability> candidates = allCandidates.getCandidates(req);
         if (candidates.size() > 1)
@@ -1109,7 +1109,7 @@ public class ResolverImpl implements Res
     }
 
     private static void permutateIfNeeded(
-        Candidates allCandidates, BundleRequirementImpl req, List<Candidates> permutations)
+        Candidates allCandidates, BundleRequirement req, List<Candidates> permutations)
     {
         SortedSet<BundleCapability> candidates = allCandidates.getCandidates(req);
         if (candidates.size() > 1)
@@ -1203,7 +1203,7 @@ public class ResolverImpl implements Res
         for (Entry<String, BundleCapability> entry : exports.entrySet())
         {
             packages.m_exportedPkgs.put(
-                entry.getKey(), new Blame((BundleCapabilityImpl) entry.getValue(), null));
+                entry.getKey(), new Blame(entry.getValue(), null));
         }
 
         revisionPkgMap.put(revision, packages);
@@ -1359,9 +1359,9 @@ public class ResolverImpl implements Res
                         Packages candPkgs = revisionPkgMap.get(cand.getRevision());
                         ResolverWire wire = new ResolverWireImpl(
                             unwrappedRevision,
-                            (BundleRequirementImpl) getActualRequirement(req),
+                            getActualRequirement(req),
                             getActualBundleRevision(cand.getRevision()),
-                            (BundleCapabilityImpl) getActualCapability(cand));
+                            getActualCapability(cand));
                         if (req.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
                         {
                             packageWires.add(wire);
@@ -1442,7 +1442,7 @@ public class ResolverImpl implements Res
                                 Collections.EMPTY_MAP,
                                 attrs),
                             getActualBundleRevision(blame.m_cap.getRevision()),
-                            (BundleCapabilityImpl) getActualCapability(blame.m_cap)));
+                            getActualCapability(blame.m_cap)));
                 }
             }
         }
@@ -1494,7 +1494,7 @@ public class ResolverImpl implements Res
         {
             for (int i = 0; i < blame.m_reqs.size(); i++)
             {
-                BundleRequirementImpl req = blame.m_reqs.get(i);
+                BundleRequirement req = blame.m_reqs.get(i);
                 sb.append("  ");
                 sb.append(req.getRevision().getSymbolicName());
                 sb.append(" [");
@@ -1508,7 +1508,7 @@ public class ResolverImpl implements Res
                 {
                     sb.append("    require: ");
                 }
-                sb.append(req.getFilter().toString());
+                sb.append(((BundleRequirementImpl) req).getFilter().toString());
                 sb.append("\n     |");
                 if (req.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
                 {
@@ -1522,7 +1522,7 @@ public class ResolverImpl implements Res
                 {
                     BundleCapability cap = Util.getSatisfyingCapability(
                         blame.m_reqs.get(i + 1).getRevision(),
-                        blame.m_reqs.get(i));
+                        (BundleRequirementImpl) blame.m_reqs.get(i));
                     if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
                     {
                         sb.append(BundleCapabilityImpl.PACKAGE_ATTR);
@@ -1533,13 +1533,13 @@ public class ResolverImpl implements Res
                         {
                             usedCap = Util.getSatisfyingCapability(
                                 blame.m_reqs.get(i + 2).getRevision(),
-                                blame.m_reqs.get(i + 1));
+                                (BundleRequirementImpl) blame.m_reqs.get(i + 1));
                         }
                         else
                         {
                             usedCap = Util.getSatisfyingCapability(
                                 blame.m_cap.getRevision(),
-                                blame.m_reqs.get(i + 1));
+                                (BundleRequirementImpl) blame.m_reqs.get(i + 1));
                         }
                         sb.append("; uses:=");
                         sb.append(usedCap.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR));
@@ -1554,7 +1554,7 @@ public class ResolverImpl implements Res
                 {
                     BundleCapability export = Util.getSatisfyingCapability(
                         blame.m_cap.getRevision(),
-                        blame.m_reqs.get(i));
+                        (BundleRequirementImpl) blame.m_reqs.get(i));
                     sb.append(BundleCapabilityImpl.PACKAGE_ATTR);
                     sb.append("=");
                     sb.append(export.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR).toString());
@@ -1600,9 +1600,9 @@ public class ResolverImpl implements Res
     private static class Blame
     {
         public final BundleCapability m_cap;
-        public final List<BundleRequirementImpl> m_reqs;
+        public final List<BundleRequirement> m_reqs;
 
-        public Blame(BundleCapability cap, List<BundleRequirementImpl> reqs)
+        public Blame(BundleCapability cap, List<BundleRequirement> reqs)
         {
             m_cap = cap;
             m_reqs = reqs;

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverWire.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverWire.java?rev=1102838&r1=1102837&r2=1102838&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverWire.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverWire.java
Fri May 13 18:09:27 2011
@@ -18,7 +18,6 @@
  */
 package org.apache.felix.framework.resolver;
 
-import java.util.Set;
 import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleRequirement;
 import org.osgi.framework.wiring.BundleRevision;



Mime
View raw message