FELIX-4785 : Incompatible SCR API

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1660067 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/Component.java b/scr-compat/src/main/java/org/apache/felix/scr/Component.java
similarity index 100%
rename from scr/src/main/java/org/apache/felix/scr/Component.java
rename to scr-compat/src/main/java/org/apache/felix/scr/Component.java
diff --git a/scr/src/main/java/org/apache/felix/scr/Reference.java b/scr-compat/src/main/java/org/apache/felix/scr/Reference.java
similarity index 100%
rename from scr/src/main/java/org/apache/felix/scr/Reference.java
rename to scr-compat/src/main/java/org/apache/felix/scr/Reference.java
diff --git a/scr/src/main/java/org/apache/felix/scr/ScrInfo.java b/scr-compat/src/main/java/org/apache/felix/scr/ScrInfo.java
similarity index 100%
rename from scr/src/main/java/org/apache/felix/scr/ScrInfo.java
rename to scr-compat/src/main/java/org/apache/felix/scr/ScrInfo.java
diff --git a/scr/src/main/java/org/apache/felix/scr/ScrService.java b/scr-compat/src/main/java/org/apache/felix/scr/ScrService.java
similarity index 100%
rename from scr/src/main/java/org/apache/felix/scr/ScrService.java
rename to scr-compat/src/main/java/org/apache/felix/scr/ScrService.java
diff --git a/scr/bnd.bnd b/scr/bnd.bnd
index 8461471..b84f0a3 100644
--- a/scr/bnd.bnd
+++ b/scr/bnd.bnd
@@ -8,8 +8,7 @@
                    version:Version="1.3"
                    
 
-Export-Package: org.apache.felix.scr;version=1.8.1;provide:=true, \
- org.apache.felix.scr.component;version=1.1.0;provide:=true, \
+Export-Package: org.apache.felix.scr.component;version=1.1.0;provide:=true, \
  org.osgi.service.component;version=1.3;-split-package:=first;provide:=true, \
  org.osgi.service.component.runtime;version=1.3;provide:=true, \
  org.osgi.service.component.runtime.dto;version=1.3;provide:=true, \
diff --git a/scr/pom.xml b/scr/pom.xml
index 7edf8de..c69a658 100644
--- a/scr/pom.xml
+++ b/scr/pom.xml
@@ -323,6 +323,7 @@
                     <excludePackageNames>*.impl</excludePackageNames>
                 </configuration>
             </plugin>
+<!-- Disable for now             
              <plugin>
                 <groupId>org.apache.aries.versioning</groupId>
                 <artifactId>org.apache.aries.versioning.plugin</artifactId>
@@ -340,6 +341,7 @@
                     </execution>
                 </executions>
             </plugin>
+-->
         </plugins>
     </build>
 
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/Activator.java b/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
index 69b28a5..72f0ff1 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
@@ -26,7 +26,6 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.felix.scr.ScrService;
 import org.apache.felix.scr.impl.config.ScrConfiguration;
 import org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl;
 import org.apache.felix.utils.extender.AbstractExtender;
@@ -149,9 +148,8 @@
         m_componentBundles = new HashMap<Long, BundleComponentActivator>();
         m_componentRegistry = new ComponentRegistry( m_context );
 
-        ServiceComponentRuntime runtime = new ServiceComponentRuntimeImpl(m_context, m_componentRegistry);
-        m_runtime_reg = m_context.registerService(new String[] {ScrService.class.getName(),
-                ServiceComponentRuntime.class.getName()},
+        final ServiceComponentRuntime runtime = new ServiceComponentRuntimeImpl(m_context, m_componentRegistry);
+        m_runtime_reg = m_context.registerService(ServiceComponentRuntime.class,
                 runtime, null);
 
         // log SCR startup
@@ -167,7 +165,6 @@
         super.doStart();
 
         m_scrCommand = ScrCommand.register(m_context, runtime, m_configuration);
-        m_configuration.setScrCommand( m_scrCommand );
     }
 
     @Override
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
index 8f26af2..c09506a 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
@@ -358,18 +358,6 @@
     }
 
     /**
-     * We only need this for the ScrService implementation
-     * @param componentId
-     * @return
-     */
-    public final AbstractComponentManager<?> getComponentManagerById(final long componentId)
-    {
-        synchronized ( m_componentsById )
-        {
-            return m_componentsById.get( componentId );
-        }
-    }
-    /**
      * Returns an array of all values currently stored in the component holders
      * map. The entries in the array are either String types for component
      * name reservations or {@link ComponentHolder} instances for actual
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java b/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
index ff5074a..9fb7fcb 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
@@ -33,7 +33,6 @@
 import java.util.TreeMap;
 import java.util.regex.Pattern;
 
-import org.apache.felix.scr.ScrInfo;
 import org.apache.felix.scr.impl.config.ScrConfiguration;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -53,14 +52,13 @@
  * {@link #register(BundleContext, ScrService, ScrConfiguration)} method
  * instantiates and registers the Gogo and Shell commands as possible.
  */
-public class ScrCommand implements ScrInfo
+public class ScrCommand
 {
 
     private final BundleContext bundleContext;
     private final ServiceComponentRuntime scrService;
     private final ScrConfiguration scrConfiguration;
-    
-    private ServiceRegistration<ScrInfo> reg;
+
     private ServiceRegistration<?> gogoReg;
     private ServiceRegistration<?> shellReg;
 
@@ -130,8 +128,8 @@
             // Ignore.
         }
     }
-    
-    void unregister() 
+
+    void unregister()
     {
         if (gogoReg != null)
         {
@@ -147,29 +145,7 @@
 
     // ---------- Actual implementation
 
-    
-    public void update( boolean infoAsService )
-    {
-        if (infoAsService)
-        {
-            if ( reg == null )
-            {
-                final Hashtable<String, Object> props = new Hashtable<String, Object>();
-                props.put(Constants.SERVICE_DESCRIPTION, "SCR Info service");
-                props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
-                reg = bundleContext.registerService( ScrInfo.class, this, props );
-            }
-        }
-        else
-        {
-            if ( reg != null )
-            {
-                reg.unregister();
-                reg = null;
-            }
-        }
-    }
-    
+
     /* (non-Javadoc)
      * @see org.apache.felix.scr.impl.ScrInfo#list(java.lang.String, java.io.PrintStream, java.io.PrintStream)
      */
@@ -228,16 +204,16 @@
             }
         }
 
-        Collections.sort( components, new Comparator<ComponentDescriptionDTO>() 
+        Collections.sort( components, new Comparator<ComponentDescriptionDTO>()
                 {
 
                     public int compare(ComponentDescriptionDTO c1, ComponentDescriptionDTO c2)
                     {
                         return c1.name.compareTo(c2.name);
                     }
-            
+
                 });
-        
+
         out.println(" Name  BundleId DefaultEnabled");
         for ( ComponentDescriptionDTO component : components )
         {
@@ -257,7 +233,7 @@
             return;
         }
 
-        Collections.sort( new ArrayList<ComponentDescriptionDTO>(components), new Comparator<ComponentDescriptionDTO>() 
+        Collections.sort( new ArrayList<ComponentDescriptionDTO>(components), new Comparator<ComponentDescriptionDTO>()
                 {
 
                     public int compare(ComponentDescriptionDTO c1, ComponentDescriptionDTO c2)
@@ -271,14 +247,14 @@
                         }
                         return result;
                     }
-            
+
                 });
-        
+
         long bundleId = -1;
 
         for ( ComponentDescriptionDTO component : components )
         {
-            if ( component.bundle.id != bundleId ) 
+            if ( component.bundle.id != bundleId )
             {
                 if ( bundleId != -1 )
                 {
@@ -361,7 +337,7 @@
                     out.println( ref.policyOption );
                     out.print( "    Reference Scope: ");
                     out.println( ref.scope);
-                    
+
                 }
             }
 
@@ -372,7 +348,7 @@
                 info(cc, out);
             }
         }
-        
+
         out.flush();
     }
 
@@ -404,7 +380,7 @@
                         }
                     }
                     out.println("]");
-                } 
+                }
                 else
                 {
                     out.println( prop );
@@ -420,7 +396,7 @@
         out.println( cc.id );
         out.print("    State: ");
         out.println( toStateString(cc.state));
-        for ( SatisfiedReferenceDTO ref: cc.satisfiedReferences) 
+        for ( SatisfiedReferenceDTO ref: cc.satisfiedReferences)
         {
             out.print( "    SatisfiedReference: ");
             out.println( ref.name );
@@ -443,7 +419,7 @@
           }
 
         }
-        for ( UnsatisfiedReferenceDTO ref: cc.unsatisfiedReferences) 
+        for ( UnsatisfiedReferenceDTO ref: cc.unsatisfiedReferences)
         {
             out.print( "    UnsatisfiedReference: ");
             out.println( ref.name );
@@ -529,10 +505,8 @@
         out.println(scrConfiguration.stopTimeout());
         out.print("Global extender: ");
         out.println(scrConfiguration.globalExtender());
-        out.print("Info Service registered: ");
-        out.println(scrConfiguration.infoAsService() ? "Supported" : "Unsupported");
     }
-    
+
     private String toStateString(int state)
     {
         switch (state) {
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ReferenceManager.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ReferenceManager.java
index bc812ad..85a9d3b 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ReferenceManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ReferenceManager.java
@@ -20,7 +20,6 @@
 
 import java.util.List;
 
-import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
 import org.osgi.framework.ServiceReference;
 
 public interface ReferenceManager<S, T> {
@@ -47,6 +46,4 @@
 	String getTarget();
 
     boolean isSatisfied();
-
-    ReferenceMetadata getReferenceMetadata();
 }
\ No newline at end of file
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java
index f6ee3ec..5f6d3c0 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java
@@ -23,7 +23,6 @@
 import java.util.Hashtable;
 
 import org.apache.felix.scr.impl.Activator;
-import org.apache.felix.scr.impl.ScrCommand;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
@@ -64,8 +63,6 @@
 
     public static final String PROP_DELAYED_KEEP_INSTANCES = "ds.delayed.keepInstances";
 
-    public static final String PROP_INFO_SERVICE = "ds.info.service";
-
     public static final String PROP_LOCK_TIMEOUT = "ds.lock.timeout.milliseconds";
 
     public static final String PROP_STOP_TIMEOUT = "ds.stop.timeout.milliseconds";
@@ -73,7 +70,7 @@
     public static final long DEFAULT_LOCK_TIMEOUT_MILLISECONDS = 5000;
 
     public static final long DEFAULT_STOP_TIMEOUT_MILLISECONDS = 60000;
-    
+
     public static final String PROP_LOGLEVEL = "ds.loglevel";
 
     private static final String LOG_LEVEL_DEBUG = "debug";
@@ -87,9 +84,9 @@
     private static final String PROP_SHOWTRACE = "ds.showtrace";
 
     private static final String PROP_SHOWERRORS = "ds.showerrors";
-    
+
     public static final String PROP_GLOBAL_EXTENDER="ds.global.extender";
-    
+
     private final Activator activator;
 
     private int logLevel;
@@ -97,20 +94,16 @@
     private boolean factoryEnabled;
 
     private boolean keepInstances;
-    
-    private boolean infoAsService;
-    
+
     private long lockTimeout = DEFAULT_LOCK_TIMEOUT_MILLISECONDS;
 
     private long stopTimeout = DEFAULT_STOP_TIMEOUT_MILLISECONDS;
-    
+
     private Boolean globalExtender;
 
     private BundleContext bundleContext;
 
     private ServiceRegistration<ManagedService> managedService;
-    
-    private ScrCommand scrCommand;
 
     public ScrConfiguration( Activator activator )
     {
@@ -118,7 +111,7 @@
     }
 
     @SuppressWarnings("unchecked")
-    public void start(final BundleContext bundleContext) 
+    public void start(final BundleContext bundleContext)
     {
         this.bundleContext = bundleContext;
 
@@ -133,7 +126,7 @@
         // overriden by configuration admin later.
         // Note that if the managed service is registered first then it is random which will win since
         // configuration may be delivered asynchronously
-        configure( null, false );            
+        configure( null, false );
 
         managedService = ( ServiceRegistration<ManagedService> ) bundleContext.registerService("org.osgi.service.cm.ManagedService", new ScrManagedServiceServiceFactory(this),
             props);
@@ -147,12 +140,6 @@
 
         this.bundleContext = null;
     }
-    
-    public void setScrCommand(ScrCommand scrCommand)
-    {
-        this.scrCommand = scrCommand;
-        scrCommand.update(infoAsService());
-    }
 
     // Called from the ScrManagedService.updated method to reconfigure
     void configure( Dictionary<String, ?> config, boolean fromConfig )
@@ -170,7 +157,6 @@
                         logLevel = LogService.LOG_ERROR;
                         factoryEnabled = false;
                         keepInstances = false;
-                        infoAsService = false;
                         lockTimeout = DEFAULT_LOCK_TIMEOUT_MILLISECONDS;
                         stopTimeout = DEFAULT_STOP_TIMEOUT_MILLISECONDS;
                         newGlobalExtender = false;
@@ -180,7 +166,6 @@
                         logLevel = getDefaultLogLevel();
                         factoryEnabled = getDefaultFactoryEnabled();
                         keepInstances = getDefaultKeepInstances();
-                        infoAsService = getDefaultInfoAsService();
                         lockTimeout = getDefaultLockTimeout();
                         stopTimeout = getDefaultStopTimeout();
                         newGlobalExtender = getDefaultGlobalExtender();
@@ -196,17 +181,12 @@
                 logLevel = getLogLevel( config.get( PROP_LOGLEVEL ) );
                 factoryEnabled = VALUE_TRUE.equalsIgnoreCase( String.valueOf( config.get( PROP_FACTORY_ENABLED ) ) );
                 keepInstances = VALUE_TRUE.equalsIgnoreCase( String.valueOf( config.get( PROP_DELAYED_KEEP_INSTANCES ) ) );
-                infoAsService = VALUE_TRUE.equalsIgnoreCase( String.valueOf( config.get( PROP_INFO_SERVICE) ) );
                 Long timeout = ( Long ) config.get( PROP_LOCK_TIMEOUT );
                 lockTimeout = timeout == null? DEFAULT_LOCK_TIMEOUT_MILLISECONDS: timeout;
                 timeout = ( Long ) config.get( PROP_STOP_TIMEOUT );
                 stopTimeout = timeout == null? DEFAULT_STOP_TIMEOUT_MILLISECONDS: timeout;
                 newGlobalExtender = VALUE_TRUE.equalsIgnoreCase( String.valueOf( config.get( PROP_GLOBAL_EXTENDER) ) );
             }
-            if ( scrCommand != null )
-            {
-                scrCommand.update( infoAsService() );
-            }
             oldGlobalExtender = this.globalExtender;
             this.globalExtender = newGlobalExtender;
         }
@@ -236,11 +216,6 @@
     {
         return keepInstances;
     }
-    
-    public boolean infoAsService()
-    {
-        return infoAsService;
-    }
 
     public long lockTimeout()
     {
@@ -251,7 +226,7 @@
     {
         return stopTimeout;
     }
-    
+
     public boolean globalExtender()
     {
         return globalExtender;
@@ -273,11 +248,6 @@
     {
         return getLogLevel( bundleContext.getProperty( PROP_LOGLEVEL ) );
     }
-    
-    private boolean getDefaultInfoAsService()
-    {
-        return VALUE_TRUE.equalsIgnoreCase( bundleContext.getProperty( PROP_INFO_SERVICE) );
-    }
 
     private long getDefaultLockTimeout()
     {
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceMetaTypeProvider.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceMetaTypeProvider.java
index 0239f3c..951a940 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceMetaTypeProvider.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceMetaTypeProvider.java
@@ -102,12 +102,6 @@
                     .getScrConfiguration().keepInstances() ) );
 
         adList.add( new AttributeDefinitionImpl(
-                ScrConfiguration.PROP_INFO_SERVICE,
-                "Bind Info Service",
-                "Whether to bind a service backing the console commands providing info on components.",
-                this.getScrConfiguration().infoAsService() ) );
-
-        adList.add( new AttributeDefinitionImpl(
                 ScrConfiguration.PROP_LOCK_TIMEOUT,
                 "Lock timeout milliseconds",
                 "How long a lock is held before releasing due to suspected deadlock",
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
index 0280ddf..07a5a8a 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
@@ -109,11 +109,6 @@
         }
     }
 
-    public ReferenceMetadata getReferenceMetadata()
-    {
-        return this.m_dependencyMetadata;
-    }
-
     private static int defaultMinimumCardinality(ReferenceMetadata dependency)
     {
         return dependency.isOptional()? 0: 1;
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java b/scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java
index 977f45c..6ce83b8 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java
@@ -21,22 +21,14 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Dictionary;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.felix.scr.Component;
-import org.apache.felix.scr.Reference;
-import org.apache.felix.scr.ScrService;
-import org.apache.felix.scr.impl.BundleComponentActivator;
 import org.apache.felix.scr.impl.ComponentRegistry;
 import org.apache.felix.scr.impl.config.ComponentHolder;
 import org.apache.felix.scr.impl.config.ComponentManager;
 import org.apache.felix.scr.impl.config.ReferenceManager;
-import org.apache.felix.scr.impl.manager.AbstractComponentManager;
-import org.apache.felix.scr.impl.manager.SingleComponentManager;
 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
 import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
 import org.osgi.dto.DTO;
@@ -46,7 +38,6 @@
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.dto.BundleDTO;
 import org.osgi.framework.dto.ServiceReferenceDTO;
-import org.osgi.service.component.ComponentInstance;
 import org.osgi.service.component.runtime.ServiceComponentRuntime;
 import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
 import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
@@ -55,7 +46,7 @@
 import org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO;
 import org.osgi.util.promise.Promise;
 
-public class ServiceComponentRuntimeImpl implements ServiceComponentRuntime, ScrService
+public class ServiceComponentRuntimeImpl implements ServiceComponentRuntime
 {
 
 	private static final String[] EMPTY = {};
@@ -352,343 +343,4 @@
 		b.version = bundle.getVersion().toString();
 		return b;
 	}
-
-	// ScrService
-
-    /**
-     * @see org.apache.felix.scr.ScrService#getComponents()
-     */
-    public Component[] getComponents()
-    {
-        final List<ComponentHolder<?>> holders = componentRegistry.getComponentHolders();
-        ArrayList<Component> list = new ArrayList<Component>();
-        for ( ComponentHolder<?> holder: holders )
-        {
-            if ( holder != null )
-            {
-                final List<? extends ComponentManager<?>> components = holder.getComponents();
-                for ( ComponentManager<?> component: components )
-                {
-                    list.add( new ComponentWrapper((AbstractComponentManager<?>)component) );
-                }
-            }
-        }
-
-        // nothing to return
-        if ( list.isEmpty() )
-        {
-            return null;
-        }
-
-        return list.toArray( new Component[list.size()] );
-    }
-
-
-    /**
-     * @see org.apache.felix.scr.ScrService#getComponents(org.osgi.framework.Bundle)
-     */
-    public Component[] getComponents( Bundle bundle )
-    {
-        final List<ComponentHolder<?>> holders = componentRegistry.getComponentHolders();
-        ArrayList<Component> list = new ArrayList<Component>();
-        for ( ComponentHolder<?> holder: holders )
-        {
-            if ( holder != null )
-            {
-                BundleComponentActivator activator = holder.getActivator();
-                if ( activator != null && activator.getBundleContext().getBundle() == bundle )
-                {
-                    final List<? extends ComponentManager<?>> components = holder.getComponents();
-                    for ( ComponentManager<?> component: components )
-                    {
-                        list.add( new ComponentWrapper((AbstractComponentManager<?>)component) );
-                    }
-                }
-            }
-        }
-
-        // nothing to return
-        if ( list.isEmpty() )
-        {
-            return null;
-        }
-
-        return list.toArray( new Component[list.size()] );
-    }
-
-
-    /**
-     * @see org.apache.felix.scr.ScrService#getComponent(long)
-     */
-    public Component getComponent( long componentId )
-    {
-        final AbstractComponentManager<?> c = componentRegistry.getComponentManagerById(componentId);
-        if ( c != null )
-        {
-            return new ComponentWrapper(c);
-        }
-        return null;
-    }
-
-    /**
-     * @see org.apache.felix.scr.ScrService#getComponents(java.lang.String)
-     */
-    public Component[] getComponents( final String componentName )
-    {
-        final List<Component> list = new ArrayList<Component>();
-        final List<ComponentHolder<?>> holders = componentRegistry.getComponentHolders();
-        for ( ComponentHolder<?> holder: holders )
-        {
-            if ( holder.getComponentMetadata().getName().equals(componentName) )
-            {
-                final List<? extends ComponentManager<?>> components = holder.getComponents();
-                for ( ComponentManager<?> component: components )
-                {
-                    list.add( new ComponentWrapper((AbstractComponentManager<?>)component) );
-                }
-            }
-        }
-
-        return ( list.isEmpty() ) ? null : list.toArray( new Component[list.size()] );
-    }
-
-
-    private static final class ComponentWrapper implements Component
-    {
-        private final AbstractComponentManager<?> mgr;
-
-        public ComponentWrapper(final AbstractComponentManager<?> mgr)
-        {
-            this.mgr = mgr;
-        }
-
-        public long getId()
-        {
-            return mgr.getId();
-        }
-
-        public String getName()
-        {
-            return mgr.getComponentMetadata().getName();
-        }
-
-        public int getState()
-        {
-            final int s = mgr.getState();
-            switch ( s )
-            {
-                case ComponentManager.STATE_DISPOSED : return Component.STATE_DISPOSED;
-                case ComponentManager.STATE_DISABLED : return Component.STATE_DISABLED;
-                case ComponentManager.STATE_UNSATISFIED_REFERENCE : return Component.STATE_UNSATISFIED;
-                case ComponentManager.STATE_ACTIVE : return Component.STATE_ACTIVE;
-                default: // satisfied
-                    return Component.STATE_ENABLED;
-            }
-        }
-
-        public Bundle getBundle()
-        {
-            return mgr.getBundle();
-        }
-
-        public String getFactory()
-        {
-            return mgr.getComponentMetadata().getFactoryIdentifier();
-        }
-
-        public boolean isServiceFactory()
-        {
-            return mgr.getComponentMetadata().isFactory();
-        }
-
-        public String getClassName()
-        {
-            return mgr.getComponentMetadata().getImplementationClassName();
-        }
-
-        public boolean isDefaultEnabled()
-        {
-            return mgr.getComponentMetadata().isEnabled();
-        }
-
-        public boolean isImmediate()
-        {
-            return mgr.getComponentMetadata().isImmediate();
-        }
-
-        public String[] getServices()
-        {
-            if ( mgr.getComponentMetadata().getServiceMetadata() != null )
-            {
-                return mgr.getComponentMetadata().getServiceMetadata().getProvides();
-            }
-
-            return null;
-        }
-
-        public Dictionary getProperties()
-        {
-            return new Hashtable<String, Object>(mgr.getComponentMetadata().getProperties());
-        }
-
-        public Reference[] getReferences()
-        {
-            final List<? extends ReferenceManager<?, ?>> refs = mgr.getReferenceManagers();
-            if ( refs != null && refs.size() > 0 )
-            {
-                final List<Reference> list = new ArrayList<Reference>();
-                for(final ReferenceManager<?, ?> rm : refs)
-                {
-                    list.add(new ReferenceWrapper(rm));
-                }
-                return list.toArray(
-                        new Reference[list.size()] );
-            }
-
-            return null;
-        }
-
-        public ComponentInstance getComponentInstance()
-        {
-            if ( mgr instanceof SingleComponentManager<?> )
-            {
-                return ((SingleComponentManager<?>)mgr).getComponentInstance();
-            }
-
-            return null;
-        }
-
-        public String getActivate()
-        {
-            return mgr.getComponentMetadata().getActivate();
-        }
-
-        public boolean isActivateDeclared()
-        {
-            return mgr.getComponentMetadata().isActivateDeclared();
-        }
-
-        public String getDeactivate()
-        {
-            return mgr.getComponentMetadata().getDeactivate();
-        }
-
-        public boolean isDeactivateDeclared()
-        {
-            return mgr.getComponentMetadata().isDeactivateDeclared();
-        }
-
-        public String getModified()
-        {
-            return mgr.getComponentMetadata().getModified();
-        }
-
-        public String getConfigurationPolicy()
-        {
-            return mgr.getComponentMetadata().getConfigurationPolicy();
-        }
-
-        public String getConfigurationPid()
-        {
-            final List<String> pids = mgr.getComponentMetadata().getConfigurationPid();
-            if ( pids != null && pids.size() > 0 )
-            {
-                return pids.get(0);
-            }
-            return null;
-        }
-
-        public boolean isConfigurationPidDeclared()
-        {
-            return mgr.getComponentMetadata().isConfigurationPidDeclared();
-        }
-
-        public void enable()
-        {
-            mgr.enable(false);
-        }
-
-        public void disable()
-        {
-            mgr.disable(false);
-        }
-    }
-
-    private static final class ReferenceWrapper implements Reference
-    {
-        private final ReferenceManager<?, ?> mgr;
-
-        public ReferenceWrapper(final ReferenceManager<?, ?> mgr)
-        {
-            this.mgr = mgr;
-        }
-
-        public String getName()
-        {
-            return mgr.getReferenceMetadata().getName();
-        }
-
-        public String getServiceName()
-        {
-            return mgr.getReferenceMetadata().getInterface();
-        }
-
-        public ServiceReference[] getServiceReferences()
-        {
-            final List<ServiceReference<?>> refs = this.mgr.getServiceReferences();
-            return refs.toArray(new ServiceReference<?>[refs.size()]);
-        }
-
-        public ServiceReference<?>[] getBoundServiceReferences()
-        {
-            final List<ServiceReference<?>> refs = this.mgr.getServiceReferences();
-            return refs.toArray(new ServiceReference<?>[refs.size()]);
-        }
-
-        public boolean isSatisfied()
-        {
-            return mgr.isSatisfied();
-        }
-
-        public boolean isOptional()
-        {
-            return this.mgr.getReferenceMetadata().isOptional();
-        }
-
-        public boolean isMultiple()
-        {
-            return this.mgr.getReferenceMetadata().isMultiple();
-        }
-
-        public boolean isStatic()
-        {
-            return this.mgr.getReferenceMetadata().isStatic();
-        }
-
-        public boolean isReluctant()
-        {
-            return this.mgr.getReferenceMetadata().isReluctant();
-        }
-
-        public String getTarget()
-        {
-            return this.mgr.getTarget();
-        }
-
-        public String getBindMethodName()
-        {
-            return this.mgr.getReferenceMetadata().getBind();
-        }
-
-        public String getUnbindMethodName()
-        {
-            return this.mgr.getReferenceMetadata().getUnbind();
-        }
-
-        public String getUpdatedMethodName()
-        {
-            return this.mgr.getReferenceMetadata().getUpdated();
-        }
-
-    }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java b/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
index d0db51d..9ea45fd 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
@@ -43,17 +43,14 @@
 import java.lang.reflect.Method;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.TreeSet;
 import java.util.concurrent.LinkedBlockingQueue;
 
 import javax.inject.Inject;
@@ -62,7 +59,6 @@
 import junit.framework.TestCase;
 
 import org.apache.felix.scr.impl.ScrCommand;
-import org.apache.felix.scr.impl.config.ScrConfiguration;
 import org.apache.felix.scr.integration.components.SimpleComponent;
 import org.junit.After;
 import org.junit.Before;
@@ -133,10 +129,10 @@
     protected volatile Log log;
 
 	protected static String[] ignoredWarnings; //null unless you need it.
-    
+
     //set to true to only get last 1000 lines of log.
     protected static boolean restrictedLogging;
-    
+
     protected static String felixCaVersion = System.getProperty( "felix.ca.version" );
 
     protected static final String PROP_NAME_FACTORY = ComponentTestBase.PROP_NAME + ".factory";
@@ -159,7 +155,7 @@
                                             "org.apache.felix.scr.integration.components.deadlock," +
                                             "org.apache.felix.scr.integration.components.felix3680," +
                                             "org.apache.felix.scr.integration.components.felix3680_2");
-        builder.setHeader("Import-Package", "org.apache.felix.scr,org.apache.felix.scr.component");
+        builder.setHeader("Import-Package", "org.apache.felix.scr.component");
         builder.setHeader("Bundle-ManifestVersion", "2");
         return builder;
     }
@@ -200,7 +196,7 @@
         log.start();
         bundleContext.addFrameworkListener( log );
         bundleContext.registerService( LogService.class.getName(), log, null );
-        
+
         scrTracker = new ServiceTracker<ServiceComponentRuntime, ServiceComponentRuntime>( bundleContext, ServiceComponentRuntime.class, null );
         scrTracker.open();
         configAdminTracker = new ServiceTracker<ConfigurationAdmin, ConfigurationAdmin>( bundleContext, ConfigurationAdmin.class, null );
@@ -269,12 +265,12 @@
         {
         	for (ComponentConfigurationDTO cc: ccs)
         	{
-        		Assert.assertEquals( "for ComponentConfiguration name: " + cc.description.name + " properties" + cc.properties + "Expected state " + STATES.get(expected) + " but was " + STATES.get(cc.state), expected, cc.state);        			
+        		Assert.assertEquals( "for ComponentConfiguration name: " + cc.description.name + " properties" + cc.properties + "Expected state " + STATES.get(expected) + " but was " + STATES.get(cc.state), expected, cc.state);
         	}
         }
         return ccs;
     }
-    
+
     protected Collection<ComponentConfigurationDTO> findComponentConfigurationsByName( String name, int expected )
     {
     	return findComponentConfigurationsByName(bundle, name, expected);
@@ -291,15 +287,15 @@
     {
     	return findComponentConfigurationByName( bundle, name, expected );
     }
-    
+
     static final Map<Integer, String> STATES = new HashMap<Integer, String>();
-    
+
     static {
     	STATES.put(ComponentConfigurationDTO.UNSATISFIED_REFERENCE, "Unsatisfied (" + ComponentConfigurationDTO.UNSATISFIED_REFERENCE + ")" );
     	STATES.put(ComponentConfigurationDTO.SATISFIED, "Satisified (" + ComponentConfigurationDTO.SATISFIED + ")" );
     	STATES.put(ComponentConfigurationDTO.ACTIVE, "Active (" + ComponentConfigurationDTO.ACTIVE + ")" );
     }
-    
+
     protected ComponentConfigurationDTO getDisabledConfigurationAndEnable( Bundle b, String name, int initialState ) throws InvocationTargetException, InterruptedException
     {
     	int count = 1;
@@ -308,13 +304,13 @@
 		ComponentConfigurationDTO cc = ccs.iterator().next();
     	return cc;
     }
-    
+
     protected ComponentConfigurationDTO getDisabledConfigurationAndEnable( String name, int initialState ) throws InvocationTargetException, InterruptedException
     {
     	return getDisabledConfigurationAndEnable( bundle, name, initialState );
     }
 
-    protected Collection<ComponentConfigurationDTO> getConfigurationsDisabledThenEnable( Bundle b, String name, int count, int initialState) throws InvocationTargetException, InterruptedException 
+    protected Collection<ComponentConfigurationDTO> getConfigurationsDisabledThenEnable( Bundle b, String name, int count, int initialState) throws InvocationTargetException, InterruptedException
     {
 		ServiceComponentRuntime scr = scrTracker.getService();
         if ( scr == null )
@@ -325,7 +321,7 @@
     	Assert.assertFalse("Expected component disabled", scr.isComponentEnabled(cd));
     	scr.enableComponent(cd).getValue();
     	Assert.assertTrue("Expected component enabled", scr.isComponentEnabled(cd));
-    	
+
     	Collection<ComponentConfigurationDTO> ccs = scr.getComponentConfigurationDTOs(cd);
     	Assert.assertEquals(count, ccs.size());
     	for (ComponentConfigurationDTO cc: ccs) {
@@ -335,14 +331,14 @@
 		}
 		return ccs;
 	}
-    
-    protected Collection<ComponentConfigurationDTO> getConfigurationsDisabledThenEnable( String name, int count, int initialState) throws InvocationTargetException, InterruptedException 
+
+    protected Collection<ComponentConfigurationDTO> getConfigurationsDisabledThenEnable( String name, int count, int initialState) throws InvocationTargetException, InterruptedException
     {
     	return getConfigurationsDisabledThenEnable(bundle, name, count, initialState);
     }
-    
+
     protected ComponentDescriptionDTO checkConfigurationCount( Bundle b, String name, int count, int expectedState )
-    {		
+    {
     	ServiceComponentRuntime scr = scrTracker.getService();
     	if ( scr == null )
     	{
@@ -364,12 +360,12 @@
     	}
     	return cd;
     }
-    
+
     protected ComponentDescriptionDTO checkConfigurationCount( String name, int count, int expectedState )
-    {	
+    {
     	return checkConfigurationCount(bundle, name, count, expectedState);
     }
-    
+
     protected <S> S getServiceFromConfiguration( ComponentConfigurationDTO dto, Class<S> clazz )
     {
         long id = dto.id;
@@ -387,7 +383,7 @@
             return null;//unreachable in fact
         }
     }
-    
+
     protected <S> void ungetServiceFromConfiguration( ComponentConfigurationDTO dto, Class<S> clazz )
     {
         long id = dto.id;
@@ -402,7 +398,7 @@
             TestCase.fail(e.getMessage());
         }
     }
-    
+
     protected void enableAndCheck( ComponentDescriptionDTO cd ) throws InvocationTargetException, InterruptedException
     {
         ServiceComponentRuntime scr = scrTracker.getService();
@@ -411,11 +407,11 @@
             scr.enableComponent(cd).getValue();
         	Assert.assertTrue("Expected component enabled", scr.isComponentEnabled(cd));
         }
-        else 
+        else
         {
         	throw new NullPointerException("no ServiceComponentRuntime");
         }
-    	
+
     }
 
     protected void disableAndCheck( ComponentConfigurationDTO cc ) throws InvocationTargetException, InterruptedException
@@ -431,7 +427,7 @@
         	scr.disableComponent(cd).getValue();
         	Assert.assertFalse("Expected component disabled", scr.isComponentEnabled(cd));
         }
-        else 
+        else
         {
         	throw new NullPointerException("no ServiceComponentRuntime");
         }
@@ -439,7 +435,7 @@
 
 	protected void disableAndCheck(String name) throws InvocationTargetException, InterruptedException {
 		ComponentDescriptionDTO cd = findComponentDescriptorByName(name);
-		disableAndCheck(cd);		
+		disableAndCheck(cd);
 	}
 
     protected static void delay()
@@ -461,7 +457,7 @@
 
     protected ConfigurationAdmin getConfigurationAdmin()
     {
-        ConfigurationAdmin ca = ( ConfigurationAdmin ) configAdminTracker.getService();
+        ConfigurationAdmin ca = configAdminTracker.getService();
         if ( ca == null )
         {
             TestCase.fail( "Missing ConfigurationAdmin service" );
@@ -472,7 +468,7 @@
     protected org.osgi.service.cm.Configuration configure( String pid )
     {
         return configure( pid, null );
-        
+
     }
 
     protected org.osgi.service.cm.Configuration configure( String pid, String bundleLocation )
@@ -558,7 +554,7 @@
             TestCase.fail( "Failed deleting configurations " + factoryPid + ": " + ioe.toString() );
         }
     }
-    
+
     //component factory test helper methods
     protected ComponentFactory getComponentFactory(final String componentfactory)
         throws InvalidSyntaxException
@@ -647,7 +643,7 @@
             return null; // keep the compiler happy
         }
     }
-    
+
     protected Object getComponentManagerFromComponentInstance( Object instance )
     {
         Object cc = getFieldValue( instance, "m_componentContext");
@@ -672,7 +668,7 @@
             }
             clazz = clazz.getSuperclass();
         }
-        throw new NoSuchFieldException(fieldName);        
+        throw new NoSuchFieldException(fieldName);
     }
 
 
@@ -680,7 +676,7 @@
     {
         return installBundle(descriptorFile, componentPackage, "simplecomponent", "0.0.11", null);
     }
-    
+
     protected Bundle installBundle( final String descriptorFile, String componentPackage, String symbolicName, String version, String location ) throws BundleException
     {
         final InputStream bundleStream = bundle()
@@ -719,7 +715,7 @@
         PrintStream out = System.out;
         info( new PrintWriter(out) );
     }
-    
+
     private static class InfoWriter extends ScrCommand
     {
 
@@ -727,7 +723,7 @@
         {
             super(null, scrService, null);
         }
-        
+
     }
 
     void info( PrintWriter out )
@@ -739,8 +735,8 @@
         }
         new InfoWriter(scr).list(null, out);
     }
-    
-    protected boolean isAtLeastR5() 
+
+    protected boolean isAtLeastR5()
     {
         try
         {
@@ -793,6 +789,7 @@
         }
 
 
+        @Override
         public String toString()
         {
             return m_msg;
@@ -828,7 +825,7 @@
             return m_thread;
         }
     }
-    
+
     public static class Log implements LogService, FrameworkListener, Runnable
     {
         private static final int RESTRICTED_LOG_SIZE = 1000;
@@ -864,7 +861,7 @@
             m_logThread.start();
         }
 
-        
+
         public void stop()
         {
             System.setOut(m_realOut);
@@ -900,7 +897,7 @@
         {
             return m_warnings;
         }
-        
+
         Throwable getFirstFrameworkThrowable()
         {
             return firstFrameworkThrowable;