Author: rickhall
Date: Wed Oct 10 07:57:27 2007
New Revision: 583501

URL: http://svn.apache.org/viewvc?rev=583501&view=rev
Log:
Auto-property handling now installs bundles into the default bundle start
level if a start level is not specified. (FELIX-359)

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

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=583501&r1=583500&r2=583501&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 
Wed Oct 10 07:57:27 2007
@@ -3604,9 +3604,19 @@
         for (Iterator i = m_configMap.keySet().iterator(); i.hasNext(); )
         {
             String key = (String) i.next();
-            if (key.startsWith(FelixConstants.AUTO_INSTALL_PROP))
+
+            // Ignore all keys that are not the auto-install property.
+            if (!key.startsWith(FelixConstants.AUTO_INSTALL_PROP))
+            {
+                continue;
+            }
+
+            // If the auto-install property does not have a start level,
+            // then assume it is the default bundle start level, otherwise
+            // parse the specified start level.
+            int startLevel = getInitialBundleStartLevel();
+            if (!key.equals(FelixConstants.AUTO_INSTALL_PROP))
             {
-                int startLevel = 1;
                 try
                 {
                     startLevel = 
Integer.parseInt(key.substring(key.lastIndexOf('.') + 1));
@@ -3615,29 +3625,30 @@
                 {
                     m_logger.log(Logger.LOG_ERROR, "Invalid property: " + key);
                 }
-                StringTokenizer st = new StringTokenizer((String) 
m_configMap.get(key), "\" ",true);
-                if (st.countTokens() > 0)
+            }
+
+            StringTokenizer st = new StringTokenizer((String) 
m_configMap.get(key), "\" ",true);
+            if (st.countTokens() > 0)
+            {
+                String location = null;
+                do
                 {
-                    String location = null;
-                    do
+                    location = nextLocation(st);
+                    if (location != null)
                     {
-                        location = nextLocation(st);
-                        if (location != null)
+                        try
+                        {
+                            FelixBundle b = (FelixBundle) 
installBundle(location, null);
+                            b.getInfo().setStartLevel(startLevel);
+                        }
+                        catch (Exception ex)
                         {
-                            try
-                            {
-                                FelixBundle b = (FelixBundle) 
installBundle(location, null);
-                                b.getInfo().setStartLevel(startLevel);
-                            }
-                            catch (Exception ex)
-                            {
-                                m_logger.log(
-                                    Logger.LOG_ERROR, "Auto-properties 
install.", ex);
-                            }
+                            m_logger.log(
+                                Logger.LOG_ERROR, "Auto-properties install.", 
ex);
                         }
                     }
-                    while (location != null);
                 }
+                while (location != null);
             }
         }
 
@@ -3651,9 +3662,19 @@
         for (Iterator i = m_configMap.keySet().iterator(); i.hasNext(); )
         {
             String key = (String) i.next();
-            if (key.startsWith(FelixConstants.AUTO_START_PROP))
+
+            // Ignore all keys that are not the auto-start property.
+            if (!key.startsWith(FelixConstants.AUTO_START_PROP))
+            {
+                continue;
+            }
+
+            // If the auto-start property does not have a start level,
+            // then assume it is the default bundle start level, otherwise
+            // parse the specified start level.
+            int startLevel = getInitialBundleStartLevel();
+            if (!key.equals(FelixConstants.AUTO_START_PROP))
             {
-                int startLevel = 1;
                 try
                 {
                     startLevel = 
Integer.parseInt(key.substring(key.lastIndexOf('.') + 1));
@@ -3662,28 +3683,29 @@
                 {
                     m_logger.log(Logger.LOG_ERROR, "Invalid property: " + key);
                 }
-                StringTokenizer st = new StringTokenizer((String) 
m_configMap.get(key), "\" ",true);
-                if (st.countTokens() > 0)
+            }
+
+            StringTokenizer st = new StringTokenizer((String) 
m_configMap.get(key), "\" ",true);
+            if (st.countTokens() > 0)
+            {
+                String location = null;
+                do
                 {
-                    String location = null;
-                    do
+                    location = nextLocation(st);
+                    if (location != null)
                     {
-                        location = nextLocation(st);
-                        if (location != null)
+                        try
+                        {
+                            FelixBundle b = (FelixBundle) 
installBundle(location, null);
+                            b.getInfo().setStartLevel(startLevel);
+                        }
+                        catch (Exception ex)
                         {
-                            try
-                            {
-                                FelixBundle b = (FelixBundle) 
installBundle(location, null);
-                                b.getInfo().setStartLevel(startLevel);
-                            }
-                            catch (Exception ex)
-                            {
-                                m_logger.log(Logger.LOG_ERROR, 
"Auto-properties install.", ex);
-                            }
+                            m_logger.log(Logger.LOG_ERROR, "Auto-properties 
install.", ex);
                         }
                     }
-                    while (location != null);
                 }
+                while (location != null);
             }
         }
 


Reply via email to