felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r418758 - /incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
Date Mon, 03 Jul 2006 12:54:50 GMT
Author: rickhall
Date: Mon Jul  3 05:54:50 2006
New Revision: 418758

URL: http://svn.apache.org/viewvc?rev=418758&view=rev
Log:
Added some validity checks for installing R4 bundles (e.g., must specify
bundle symbolic name and cannot install bundles with duplicate symbolic
names and versions).

Modified:
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java?rev=418758&r1=418757&r2=418758&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
(original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
Mon Jul  3 05:54:50 2006
@@ -3017,8 +3017,34 @@
         R4Import[] dynamics =
             (R4Import[]) dupeMap.values().toArray(new R4Import[dupeMap.size()]);
 
-        // Do validity checking and conversion on bundles with R3 headers.
-        if (version.equals("1"))
+        // Do some validity checking on bundles with R4 headers.
+        if (version.equals("2"))
+        {
+            // Verify that bundle symbolic name is specified.
+            String targetSym = (String) headerMap.get(FelixConstants.BUNDLE_SYMBOLICNAME);
+            if (targetSym == null)
+            {
+                throw new BundleException("R4 bundle manifests must include bundle symbolic
name.");
+            }
+            // Verify that the bundle symbolic name and version is unique.
+            String targetVer = (String) headerMap.get(FelixConstants.BUNDLE_VERSION);
+            targetVer = (targetVer == null) ? "0.0.0" : targetVer;
+            Bundle[] bundles = getBundles();
+            for (int i = 0; (bundles != null) && (i < bundles.length); i++)
+            {
+                String sym = (String) ((BundleImpl) bundles[i])
+                    .getInfo().getCurrentHeader().get(Constants.BUNDLE_SYMBOLICNAME);
+                String ver = (String) ((BundleImpl) bundles[i])
+                    .getInfo().getCurrentHeader().get(Constants.BUNDLE_VERSION);
+                ver = (ver == null) ? "0.0.0" : ver;
+                if (targetSym.equals(sym) && targetVer.equals(ver))
+                {
+                    throw new BundleException("Bundle symbolic name and version are not unique.");
+                }
+            }
+        }
+        // Do some validity checking and conversion on bundles with R3 headers.
+        else if (version.equals("1"))
         {
             // Check to make sure that R3 bundles have only specified
             // the 'specification-version' attribute and no directives



Mime
View raw message