Fix FELIX-4143
Filter out all bundles not importing the @Configuration package so the processing is much faster.
Also ignore the iPOJO bundle

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1495451 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/manipulator-it/pom.xml b/ipojo/manipulator/manipulator-it/pom.xml
index 24d2a20..22672d5 100644
--- a/ipojo/manipulator/manipulator-it/pom.xml
+++ b/ipojo/manipulator/manipulator-it/pom.xml
@@ -213,7 +213,8 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.ipojo</artifactId>
-            <version>1.10.0</version>
+            <!-- To update before the release -->
+            <version>${project.version}</version>
         </dependency>
 
         <dependency>
diff --git a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ConfigurationProcessor.java b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ConfigurationProcessor.java
index e24bc4c..729c412 100644
--- a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ConfigurationProcessor.java
+++ b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ConfigurationProcessor.java
@@ -21,6 +21,7 @@
 
 import org.apache.felix.ipojo.configuration.Instance;
 import org.apache.felix.ipojo.extender.internal.BundleProcessor;
+import org.apache.felix.ipojo.extender.internal.Extender;
 import org.apache.felix.ipojo.extender.internal.declaration.DefaultInstanceDeclaration;
 import org.apache.felix.ipojo.extender.internal.declaration.DefaultTypeDeclaration;
 import org.apache.felix.ipojo.util.InvocationResult;
@@ -28,6 +29,7 @@
 import org.objectweb.asm.ClassReader;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
 import org.osgi.framework.wiring.BundleWiring;
 
 import java.io.Closeable;
@@ -101,9 +103,17 @@
      * @param bundle the bundle
      */
     public void activate(Bundle bundle) {
-        if (! m_enabled) { return; }
+        if (! m_enabled  && Extender.getIPOJOBundleContext().getBundle().getBundleId() == bundle.getBundleId()) {
+            // Fast return if the configuration tracking is disabled, or if we are iPOJO
+            return;
+        }
 
-        // TODO - optimization, ignore all bundles that do not import org.apache.felix.ipojo.configuration
+        // It's not required to process bundle not importing the configuration package.
+        final String imports = bundle.getHeaders().get(Constants.IMPORT_PACKAGE);
+        if (imports == null  || ! imports.contains("org.apache.felix.ipojo.configuration")) {
+            // TODO Check dynamic imports to verify if the package is not imported lazily.
+            return;
+        }
 
         BundleWiring wiring = bundle.adapt(BundleWiring.class);
         if (wiring == null) {