felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r373842 [1/2] - in /incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix: framework/ framework/searchpolicy/ framework/util/ moduleloader/
Date Tue, 31 Jan 2006 15:34:51 GMT
Author: rickhall
Date: Tue Jan 31 07:34:32 2006
New Revision: 373842

URL: http://svn.apache.org/viewcvs?rev=373842&view=rev
Log:
Renaming, reorganizing, and restructuring, but the code has mostly stayed
the same. These changes are preparation for the next changes that will
further refactor the current Module Loader implementation.

Added:
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java
      - copied, changed from r372830, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ExportImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java
      - copied, changed from r372830, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ImportImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java
      - copied, changed from r373542, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryHeader.java
      - copied, changed from r373542, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryHeader.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java
      - copied, changed from r372830, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/PackageImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicy.java
  (with props)
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
      - copied, changed from r372830, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/WireImpl.java
Removed:
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ExportImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ImportImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryHeader.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/PackageImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/SearchPolicyImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/WireImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IExport.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IImport.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IPackage.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IWire.java
Modified:
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundle.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ResolveListener.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/util/Util.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleListener.java

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java?rev=373842&r1=373841&r2=373842&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
Tue Jan 31 07:34:32 2006
@@ -270,7 +270,7 @@
         }
 
         // Create search policy for module loader.
-        SearchPolicyImpl searchPolicy = new SearchPolicyImpl(m_logger);
+        R4SearchPolicy searchPolicy = new R4SearchPolicy(m_logger);
 
         // Add a resolver listener to the search policy
         // so that we will be notified when modules are resolved
@@ -1362,7 +1362,7 @@
         }
 
         // Get the import search policy.
-        SearchPolicyImpl search = (SearchPolicyImpl) m_factory.getSearchPolicy();
+        R4SearchPolicy search = (R4SearchPolicy) m_factory.getSearchPolicy();
 
         IModule module = bundle.getInfo().getCurrentModule();
         try
@@ -2512,8 +2512,8 @@
     {
         // First, find the bundle exporting the package.
         BundleImpl bundle = null;
-        SearchPolicyImpl search = (SearchPolicyImpl) m_factory.getSearchPolicy();
-        IModule[] exporters = search.getInUseExporters(new ImportImpl(pkgName, null, null));
+        R4SearchPolicy search = (R4SearchPolicy) m_factory.getSearchPolicy();
+        IModule[] exporters = search.getInUseExporters(new R4Import(pkgName, null, null));
         if (exporters != null)
         {
             // Since OSGi R4 there may be more than one exporting, so just
@@ -2539,7 +2539,7 @@
             IModule[] modules = bundle.getInfo().getModules();
             for (int modIdx = 0; modIdx < modules.length; modIdx++)
             {
-                IExport export = SearchPolicyImpl.getExportPackage(modules[modIdx], pkgName);
+                R4Export export = R4SearchPolicy.getExportPackage(modules[modIdx], pkgName);
                 if (export != null)
                 {
                     return new ExportedPackageImpl(this, bundle, pkgName, export.getVersion());
@@ -2614,7 +2614,7 @@
     **/
     private void getExportedPackages(BundleImpl bundle, List list)
     {
-        SearchPolicyImpl policy = (SearchPolicyImpl) m_factory.getSearchPolicy();
+        R4SearchPolicy policy = (R4SearchPolicy) m_factory.getSearchPolicy();
 
         // Since a bundle may have many modules associated with it,
         // one for each revision in the cache, search each module
@@ -2622,9 +2622,9 @@
         IModule[] modules = bundle.getInfo().getModules();
         for (int modIdx = 0; modIdx < modules.length; modIdx++)
         {
-            IExport[] exports = (IExport[])
+            R4Export[] exports = (R4Export[])
                 modules[modIdx].getAttribute(
-                        SearchPolicyImpl.EXPORTS_ATTR, new IExport[0]);
+                        R4SearchPolicy.EXPORTS_ATTR, new R4Export[0]);
             if (exports.length > 0)
             {
                 for (int expIdx = 0; expIdx < exports.length; expIdx++)
@@ -2633,7 +2633,7 @@
                     // "in use" exporters of the package.
                     IModule[] inUseModules =
                         policy.getInUseExporters(
-                            new ImportImpl(exports[expIdx].getName(), null, null));
+                            new R4Import(exports[expIdx].getName(), null, null));
                     // Search through the current providers to find the target
                     // module.
                     for (int i = 0; (inUseModules != null) && (i < inUseModules.length);
i++)
@@ -2675,7 +2675,7 @@
                 IModule[] modules = importer.getInfo().getModules();
                 for (int modIdx = 0; modIdx < modules.length; modIdx++)
                 {
-                    IWire wire = SearchPolicyImpl.getWire(modules[modIdx], ep.getName());
+                    R4Wire wire = R4SearchPolicy.getWire(modules[modIdx], ep.getName());
     
                     // If the resolving module is associated with the
                     // exporting bundle, then add current bundle to
@@ -2841,12 +2841,12 @@
         }
 
         // Get import packages from bundle manifest.
-        IPackage[] pkgs = PackageImpl.parseImportOrExportHeader(
+        R4Package[] pkgs = R4Package.parseImportOrExportHeader(
             (String) headerMap.get(Constants.IMPORT_PACKAGE));
-        IImport[] imports = new IImport[pkgs.length];
+        R4Import[] imports = new R4Import[pkgs.length];
         for (int i = 0; i < pkgs.length; i++)
         {
-            imports[i] = new ImportImpl(pkgs[i]);
+            imports[i] = new R4Import(pkgs[i]);
         }
 
         // Check to make sure that R3 bundles have only specified
@@ -2875,12 +2875,12 @@
         }
 
         // Get export packages from bundle manifest.
-        pkgs = PackageImpl.parseImportOrExportHeader(
+        pkgs = R4Package.parseImportOrExportHeader(
             (String) headerMap.get(Constants.EXPORT_PACKAGE));
-        IExport[] exports = new IExport[pkgs.length];
+        R4Export[] exports = new R4Export[pkgs.length];
         for (int i = 0; i < pkgs.length; i++)
         {
-            exports[i] = new ExportImpl(pkgs[i]);
+            exports[i] = new R4Export(pkgs[i]);
         }
 
         // Check to make sure that R3 bundles have only specified
@@ -2908,11 +2908,11 @@
                 }
             }
             
-            IImport[] newImports = new IImport[imports.length + exports.length];
+            R4Import[] newImports = new R4Import[imports.length + exports.length];
             System.arraycopy(imports, 0, newImports, 0, imports.length);
             for (int i = 0; i < exports.length; i++)
             {
-                newImports[i + imports.length] = new ImportImpl(exports[i]);
+                newImports[i + imports.length] = new R4Import(exports[i]);
             }
             imports = newImports;
         }
@@ -2935,7 +2935,7 @@
                 FelixConstants.USES_DIRECTIVE, usesValue);
             for (int i = 0; (exports != null) && (i < exports.length); i++)
             {
-                exports[i] = new ExportImpl(
+                exports[i] = new R4Export(
                     exports[i].getName(),
                     new R4Directive[] { uses },
                     exports[i].getAttributes());
@@ -2944,12 +2944,12 @@
 
 // TODO: CHECK FOR DUPLICATE IMPORTS/EXPORTS HERE.
         // Get dynamic import packages from bundle manifest.
-        pkgs = PackageImpl.parseImportOrExportHeader(
+        pkgs = R4Package.parseImportOrExportHeader(
             (String) headerMap.get(Constants.DYNAMICIMPORT_PACKAGE));
-        IImport[] dynamics = new IImport[pkgs.length];
+        R4Import[] dynamics = new R4Import[pkgs.length];
         for (int i = 0; i < pkgs.length; i++)
         {
-            dynamics[i] = new ImportImpl(pkgs[i]);
+            dynamics[i] = new R4Import(pkgs[i]);
         }
 
         // Check to make sure that R3 bundles have no attributes or
@@ -2970,13 +2970,13 @@
         }
 
         // Get native library entry names for module library sources.
-        LibraryHeader[] libraryHeaders =
+        R4LibraryHeader[] libraryHeaders =
             Util.parseLibraryStrings(
                 m_logger,
                 Util.parseDelimitedString(
                     (String) headerMap.get(Constants.BUNDLE_NATIVECODE), ","));
         ILibrary[] libs = {
-            new LibraryImpl(
+            new R4Library(
                 m_logger, m_cache, id, revision,
                 getProperty(Constants.FRAMEWORK_OS_NAME),
                 getProperty(Constants.FRAMEWORK_PROCESSOR),
@@ -2984,10 +2984,10 @@
         };
 
         Object[][] attributes = {
-            new Object[] { SearchPolicyImpl.EXPORTS_ATTR, exports },
-            new Object[] { SearchPolicyImpl.IMPORTS_ATTR, imports },
-            new Object[] { SearchPolicyImpl.DYNAMICIMPORTS_ATTR, dynamics },
-            new Object[] { SearchPolicyImpl.LIBRARIES_ATTR, libs }
+            new Object[] { R4SearchPolicy.EXPORTS_ATTR, exports },
+            new Object[] { R4SearchPolicy.IMPORTS_ATTR, imports },
+            new Object[] { R4SearchPolicy.DYNAMICIMPORTS_ATTR, dynamics },
+            new Object[] { R4SearchPolicy.LIBRARIES_ATTR, libs }
         };
 
         // Get the content loader associated with the module archive.
@@ -3233,11 +3233,11 @@
             System.getProperty("os.version"));
 
         String s = null;
-        s = LibraryImpl.normalizePropertyValue(
+        s = R4Library.normalizePropertyValue(
             FelixConstants.FRAMEWORK_OS_NAME,
             System.getProperty("os.name"));
         m_configMutable.put(FelixConstants.FRAMEWORK_OS_NAME, s);
-        s = LibraryImpl.normalizePropertyValue(
+        s = R4Library.normalizePropertyValue(
             FelixConstants.FRAMEWORK_PROCESSOR,
             System.getProperty("os.arch"));
         m_configMutable.put(FelixConstants.FRAMEWORK_PROCESSOR, s);

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java?rev=373842&r1=373841&r2=373842&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
Tue Jan 31 07:34:32 2006
@@ -16,8 +16,8 @@
  */
 package org.apache.felix.framework;
 
-import org.apache.felix.framework.searchpolicy.SearchPolicyImpl;
-import org.apache.felix.moduleloader.IWire;
+import org.apache.felix.framework.searchpolicy.R4SearchPolicy;
+import org.apache.felix.framework.searchpolicy.R4Wire;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceReference;
 
@@ -119,9 +119,9 @@
         String pkgName =
             org.apache.felix.moduleloader.Util.getClassPackage(className);
         // Get package wiring from service provider and requester.
-        IWire requesterWire = SearchPolicyImpl.getWire(
+        R4Wire requesterWire = R4SearchPolicy.getWire(
             ((BundleImpl) requester).getInfo().getCurrentModule(), pkgName);
-        IWire providerWire = SearchPolicyImpl.getWire(
+        R4Wire providerWire = R4SearchPolicy.getWire(
             ((BundleImpl) m_bundle).getInfo().getCurrentModule(), pkgName);
 
         // There are three situations that may occur here:

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundle.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundle.java?rev=373842&r1=373841&r2=373842&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundle.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundle.java
Tue Jan 31 07:34:32 2006
@@ -24,7 +24,7 @@
 import org.apache.felix.framework.searchpolicy.*;
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.StringMap;
-import org.apache.felix.moduleloader.*;
+import org.apache.felix.moduleloader.IContentLoader;
 import org.osgi.framework.*;
 
 class SystemBundle extends BundleImpl
@@ -63,15 +63,15 @@
 
         // Get system property that specifies which class path
         // packages should be exported by the system bundle.
-        IPackage[] classPathPkgs = null;
+        R4Package[] classPathPkgs = null;
         try
         {
-            classPathPkgs = PackageImpl.parseImportOrExportHeader(
+            classPathPkgs = R4Package.parseImportOrExportHeader(
                 getFelix().getConfig().get(FelixConstants.FRAMEWORK_SYSTEMPACKAGES));
         }
         catch (Exception ex)
         {
-            classPathPkgs = new IPackage[0];
+            classPathPkgs = new R4Package[0];
             getFelix().getLogger().log(
                 Logger.LOG_ERROR,
                 "Error parsing system bundle export statement.", ex);
@@ -79,24 +79,24 @@
 
         // Now, create the list of standard framework exports for
         // the system bundle.
-        IExport[] exports = new IExport[classPathPkgs.length + 4];
+        R4Export[] exports = new R4Export[classPathPkgs.length + 4];
 
-        exports[0] = new ExportImpl(
+        exports[0] = new R4Export(
             "org.osgi.framework",
             new R4Directive[0],
             new R4Attribute[] { new R4Attribute("version", "1.3.0", false) });
 
-        exports[1] = new ExportImpl(
+        exports[1] = new R4Export(
             "org.osgi.service.packageadmin",
             new R4Directive[0],
             new R4Attribute[] { new R4Attribute("version", "1.2.0", false) });
 
-        exports[2] = new ExportImpl(
+        exports[2] = new R4Export(
                 "org.osgi.service.startlevel",
                 new R4Directive[0],
                 new R4Attribute[] { new R4Attribute("version", "1.0.0", false) });
 
-        exports[3] = new ExportImpl(
+        exports[3] = new R4Export(
                 "org.osgi.service.url",
                 new R4Directive[0],
                 new R4Attribute[] { new R4Attribute("version", "1.0.0", false) });
@@ -104,12 +104,12 @@
         // Copy the class path exported packages.
         for (int i = 0; i < classPathPkgs.length; i++)
         {
-            exports[i + 4] = new ExportImpl(classPathPkgs[i]);
+            exports[i + 4] = new R4Export(classPathPkgs[i]);
         }
 
         m_attributes = new Object[][] {
-            new Object[] { SearchPolicyImpl.EXPORTS_ATTR, exports },
-            new Object[] { SearchPolicyImpl.IMPORTS_ATTR, new IImport[0] }
+            new Object[] { R4SearchPolicy.EXPORTS_ATTR, exports },
+            new Object[] { R4SearchPolicy.IMPORTS_ATTR, new R4Import[0] }
         };
 
         m_contentLoader = new SystemBundleContentLoader(getFelix().getLogger());

Copied: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java
(from r372830, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ExportImpl.java)
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java?p2=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java&p1=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ExportImpl.java&r1=372830&r2=373842&rev=373842&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ExportImpl.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java
Tue Jan 31 07:34:32 2006
@@ -4,21 +4,19 @@
 
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.Util;
-import org.apache.felix.moduleloader.IExport;
-import org.apache.felix.moduleloader.IPackage;
 
-public class ExportImpl extends PackageImpl implements IExport
+public class R4Export extends R4Package
 {
     private String[] m_uses = null;
     private String[][] m_includeFilter = null;
     private String[][] m_excludeFilter = null;
 
-    public ExportImpl(IPackage pkg)
+    public R4Export(R4Package pkg)
     {
         this(pkg.getName(), pkg.getDirectives(), pkg.getAttributes());
     }
 
-    public ExportImpl(String name, R4Directive[] directives, R4Attribute[] attrs)
+    public R4Export(String name, R4Directive[] directives, R4Attribute[] attrs)
     {
         super(name, directives, attrs);
 

Copied: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java
(from r372830, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ImportImpl.java)
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java?p2=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java&p1=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ImportImpl.java&r1=372830&r2=373842&rev=373842&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ImportImpl.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java
Tue Jan 31 07:34:32 2006
@@ -1,27 +1,23 @@
 package org.apache.felix.framework.searchpolicy;
 
 import org.apache.felix.framework.util.FelixConstants;
-import org.apache.felix.moduleloader.*;
 import org.osgi.framework.Version;
 
-public class ImportImpl extends PackageImpl implements IImport
+public class R4Import extends R4Package
 {
-    private Version m_versionHigh = null;
-    private boolean m_isLowInclusive = false;
-    private boolean m_isHighInclusive = false;
+    private VersionRange m_versionRange = null;
     private boolean m_isOptional = false;
 
-    public ImportImpl(IPackage pkg)
+    public R4Import(R4Package pkg)
     {
         this(pkg.getName(), pkg.getDirectives(), pkg.getAttributes());
     }
 
-    public ImportImpl(String name, R4Directive[] directives, R4Attribute[] attrs)
+    public R4Import(String name, R4Directive[] directives, R4Attribute[] attrs)
     {
         super(name, directives, attrs);
 
         // Find all import directives: resolution.
-        String mandatory = "", uses = "";
         for (int i = 0; i < m_directives.length; i++)
         {
             if (m_directives[i].getName().equals(FelixConstants.RESOLUTION_DIRECTIVE))
@@ -46,26 +42,23 @@
             }
         }
         
-        VersionRange range = parseVersionInterval(versionInterval);
-        m_version = range.getLow();
-        m_versionHigh = range.getHigh();
-        m_isLowInclusive = range.isLowInclusive();
-        m_isHighInclusive = range.isHighInclusive();
+        m_versionRange = parseVersionInterval(versionInterval);
+        m_version = m_versionRange.getLow();
     }
 
     public Version getVersionHigh()
     {
-        return m_versionHigh;
+        return m_versionRange.getHigh();
     }
 
     public boolean isLowInclusive()
     {
-        return m_isLowInclusive;
+        return m_versionRange.isLowInclusive();
     }
 
     public boolean isHighInclusive()
     {
-        return m_isHighInclusive;
+        return m_versionRange.isHighInclusive();
     }
 
     public boolean isOptional()
@@ -73,7 +66,7 @@
         return m_isOptional;
     }
 
-    public boolean isSatisfied(IExport export)
+    public boolean isSatisfied(R4Export export)
     {
         // For packages to be compatible, they must have the
         // same name.
@@ -82,34 +75,11 @@
             return false;
         }
         
-        return isVersionInRange(export.getVersion(), getVersion(), getVersionHigh())
+        return m_versionRange.isInRange(export.getVersion())
             && doAttributesMatch(export);
     }
 
-    // PREVIOUSLY PART OF COMPATIBILITY POLICY.
-    public boolean isVersionInRange(Version version, Version low, Version high)
-    {
-        // We might not have an upper end to the range.
-        if (high == null)
-        {
-            return (version.compareTo(low) >= 0);
-        }
-        else if (isLowInclusive() && isHighInclusive())
-        {
-            return (version.compareTo(low) >= 0) && (version.compareTo(high) <=
0);
-        }
-        else if (isHighInclusive())
-        {
-            return (version.compareTo(low) > 0) && (version.compareTo(high) <=
0);
-        }
-        else if (isLowInclusive())
-        {
-            return (version.compareTo(low) >= 0) && (version.compareTo(high) <
0);
-        }
-        return (version.compareTo(low) > 0) && (version.compareTo(high) < 0);
-    }
-
-    private boolean doAttributesMatch(IExport export)
+    private boolean doAttributesMatch(R4Export export)
     {
         // Cycle through all attributes of this import package
         // and make sure its values match the attribute values

Copied: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java
(from r373542, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryImpl.java)
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java?p2=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java&p1=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryImpl.java&r1=373542&r2=373842&rev=373842&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryImpl.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java
Tue Jan 31 07:34:32 2006
@@ -21,7 +21,7 @@
 import org.apache.felix.moduleloader.ILibrary;
 import org.osgi.framework.Constants;
 
-public class LibraryImpl implements ILibrary
+public class R4Library implements ILibrary
 {
     private Logger m_logger = null;
     private BundleCache m_cache = null;
@@ -29,11 +29,11 @@
     private int m_revision = -1;
     private String m_os = null;
     private String m_processor = null;
-    private LibraryHeader[] m_headers = null;
+    private R4LibraryHeader[] m_headers = null;
 
-    public LibraryImpl(
+    public R4Library(
         Logger logger, BundleCache cache, long bundleId, int revision,
-        String os, String processor, LibraryHeader[] headers)
+        String os, String processor, R4LibraryHeader[] headers)
     {
         m_logger = logger;
         m_cache = cache;
@@ -53,7 +53,7 @@
             // Check to see if we have a matching library.
             // TODO: This "matching" algorithm does not fully
             // match the spec and should be improved.
-            LibraryHeader library = null;
+            R4LibraryHeader library = null;
             for (int i = 0; (library == null) && (i < m_headers.length); i++)
             {
                 boolean osOkay = checkOS(m_headers[i].getOSNames());

Copied: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryHeader.java
(from r373542, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryHeader.java)
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryHeader.java?p2=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryHeader.java&p1=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryHeader.java&r1=373542&r2=373842&rev=373842&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/LibraryHeader.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryHeader.java
Tue Jan 31 07:34:32 2006
@@ -21,7 +21,7 @@
 import org.apache.felix.framework.Logger;
 import org.osgi.framework.Constants;
 
-public class LibraryHeader
+public class R4LibraryHeader
 {
     private String m_name = null;
     private String[] m_osnames = null;
@@ -29,7 +29,7 @@
     private String[] m_processors = null;
     private String[] m_languages = null;
 
-    public LibraryHeader(String name, String[] osnames, String[] osversions,
+    public R4LibraryHeader(String name, String[] osnames, String[] osversions,
         String[] processors, String[] languages)
     {
         m_name = name;
@@ -39,7 +39,7 @@
         m_languages = languages;
     }
 
-    public LibraryHeader(LibraryHeader library)
+    public R4LibraryHeader(R4LibraryHeader library)
     {
         m_name = library.m_name;
         m_osnames = library.m_osnames;
@@ -68,7 +68,7 @@
         return m_processors;
     }
 
-    public static LibraryHeader[] parse(Logger logger, String s)
+    public static R4LibraryHeader[] parse(Logger logger, String s)
     {
         try
         {
@@ -151,11 +151,11 @@
                 return null;
             }
 
-            LibraryHeader[] libraries = new LibraryHeader[libCount];
+            R4LibraryHeader[] libraries = new R4LibraryHeader[libCount];
             for (int i = 0; i < libCount; i++)
             {
                 libraries[i] =
-                    new LibraryHeader(
+                    new R4LibraryHeader(
                         libs[i],
                         (String[]) osNameList.toArray(new String[0]),
                         (String[]) osVersionList.toArray(new String[0]),

Copied: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java
(from r372830, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/PackageImpl.java)
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java?p2=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java&p1=incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/PackageImpl.java&r1=372830&r2=373842&rev=373842&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/PackageImpl.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java
Tue Jan 31 07:34:32 2006
@@ -5,17 +5,16 @@
 
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.Util;
-import org.apache.felix.moduleloader.IPackage;
 import org.osgi.framework.Version;
 
-public class PackageImpl implements IPackage
+public class R4Package
 {
     private String m_name = "";
     protected R4Directive[] m_directives = null;
     protected R4Attribute[] m_attrs = null;
     protected Version m_version = null;
 
-    public PackageImpl(String name, R4Directive[] directives, R4Attribute[] attrs)
+    public R4Package(String name, R4Directive[] directives, R4Attribute[] attrs)
     {
         m_name = name;
         m_directives = (directives == null) ? new R4Directive[0] : directives;
@@ -59,9 +58,9 @@
 
     // Like this: pkg1; pkg2; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2,
     //            pkg1; pkg2; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
-    public static IPackage[] parseImportOrExportHeader(String s)
+    public static R4Package[] parseImportOrExportHeader(String s)
     {
-        IPackage[] pkgs = null;
+        R4Package[] pkgs = null;
         if (s != null)
         {
             if (s.length() == 0)
@@ -73,11 +72,11 @@
                 s, FelixConstants.CLASS_PATH_SEPARATOR);
             pkgs = parsePackageStrings(ss);
         }
-        return (pkgs == null) ? new IPackage[0] : pkgs;
+        return (pkgs == null) ? new R4Package[0] : pkgs;
     }
 
     // Like this: pkg1; pkg2; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
-    public static IPackage[] parsePackageStrings(String[] ss)
+    public static R4Package[] parsePackageStrings(String[] ss)
         throws IllegalArgumentException
     {
         if (ss == null)
@@ -168,17 +167,17 @@
             // Create package attributes for each package and
             // set directives/attributes. Add each package to
             // completel list of packages.
-            IPackage[] pkgs = new IPackage[pkgCount];
+            R4Package[] pkgs = new R4Package[pkgCount];
             for (int pkgIdx = 0; pkgIdx < pkgCount; pkgIdx++)
             {
-                pkgs[pkgIdx] = new PackageImpl(pieces[pkgIdx], dirsFinal, attrsFinal);
+                pkgs[pkgIdx] = new R4Package(pieces[pkgIdx], dirsFinal, attrsFinal);
                 completeList.add(pkgs[pkgIdx]);
             }
         }
     
-        IPackage[] ips = (IPackage[])
-            completeList.toArray(new IPackage[completeList.size()]);
-        return ips;
+        R4Package[] pkgs = (R4Package[])
+            completeList.toArray(new R4Package[completeList.size()]);
+        return pkgs;
     }
 
     public static VersionRange parseVersionInterval(String interval)



Mime
View raw message