FELIX-3697 enable components after all of them are known

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1393714 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java b/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
index 8ae7c33..fc1257f 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
@@ -147,6 +147,15 @@
                 loadDescriptor( descriptorURLs[i] );
             }
         }
+        //enable all the enabled components
+        for (Iterator it = m_managers.iterator(); it.hasNext();)
+        {
+            ComponentHolder componentHolder = ( ComponentHolder ) it.next();
+            if (componentHolder.getComponentMetadata().isEnabled())
+            {
+                componentHolder.enableComponents( false );
+            }
+        }
     }
 
 
@@ -239,11 +248,6 @@
                     m_componentRegistry.registerComponentHolder( key, holder );
                     m_managers.add( holder );
 
-                    // enable the component
-                    if ( metadata.isEnabled() )
-                    {
-                        holder.enableComponents( false );
-                    }
                 }
                 catch ( Throwable t )
                 {