FELIX-4402 remove commented out code, improve generics, reduce eclipse warnings

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1602650 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/component/ExtComponentContext.java b/scr/src/main/java/org/apache/felix/scr/component/ExtComponentContext.java
index b31b482..c189f1b 100644
--- a/scr/src/main/java/org/apache/felix/scr/component/ExtComponentContext.java
+++ b/scr/src/main/java/org/apache/felix/scr/component/ExtComponentContext.java
@@ -50,6 +50,6 @@
      * @throws IllegalStateException if this method is called for a
      *      Component Factory component
      */
-    void setServiceProperties( Dictionary properties );
+    void setServiceProperties( Dictionary<String, ?> properties );
 
 }
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 7166530..d9246f3 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
@@ -63,10 +63,10 @@
     private static Bundle m_bundle;
 
     // the log service to log messages to
-    private static volatile ServiceTracker m_logService;
+    private static volatile ServiceTracker<LogService, LogService> m_logService;
 
     // the package admin service (see BindMethod.getParameterClass)
-    private static volatile ServiceTracker m_packageAdmin;
+    private static volatile ServiceTracker<?, ?> m_packageAdmin;
 
     // map of BundleComponentActivator instances per Bundle indexed by Bundle id
     private Map<Long, BundleComponentActivator> m_componentBundles;
@@ -96,7 +96,7 @@
         m_context = context;
         m_bundle = context.getBundle();
         // require the log service
-        m_logService = new ServiceTracker( m_context, LOGSERVICE_CLASS, null );
+        m_logService = new ServiceTracker<LogService, LogService>( m_context, LOGSERVICE_CLASS, null );
         m_logService.open();
         // get the configuration
         m_configuration.start( m_context ); //this will call restart, which calls super.start.
@@ -310,6 +310,7 @@
         {
             BundleComponentActivator ga = new BundleComponentActivator( m_componentRegistry, m_componentActor, context,
                 m_configuration );
+            ga.initialEnable();
 
             // replace bundle activator in the map
             synchronized ( m_componentBundles )
@@ -419,8 +420,8 @@
     {
         if ( isLogEnabled( level ) )
         {
-            ServiceTracker t = m_logService;
-            Object logger = ( t != null ) ? t.getService() : null;
+            ServiceTracker<LogService, LogService> t = m_logService;
+            LogService logger = ( t != null ) ? t.getService() : null;
             if ( logger == null )
             {
                 // output depending on level
@@ -471,7 +472,7 @@
             }
             else
             {
-                ( ( LogService ) logger ).log( level, message, ex );
+                logger.log( level, message, ex );
             }
         }
     }
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 5d82523..766fa8b 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
@@ -26,6 +26,7 @@
 import java.net.URL;
 import java.text.MessageFormat;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.StringTokenizer;
@@ -66,10 +67,10 @@
     private final BundleContext m_context;
 
     // This is a list of component instance managers that belong to a particular bundle
-    private List<ComponentHolder> m_managers = new ArrayList<ComponentHolder>();
+    private final List<ComponentHolder<?>> m_managers = new ArrayList<ComponentHolder<?>>();
 
     // The Configuration Admin tracker providing configuration for components
-    private final ServiceTracker m_logService;
+    private final ServiceTracker<LogService, LogService> m_logService;
 
     // thread acting upon configurations
     private final ComponentActorThread m_componentActor;
@@ -103,7 +104,7 @@
         m_bundle = context.getBundle();
 
         // have the LogService handy (if available)
-        m_logService = new ServiceTracker( context, Activator.LOGSERVICE_CLASS, null );
+        m_logService = new ServiceTracker<LogService, LogService>( context, Activator.LOGSERVICE_CLASS, null );
         m_logService.open();
         m_configuration = configuration;
 
@@ -158,8 +159,17 @@
                 loadDescriptor( descriptorURL );
             }
         }
+    }
+
+
+    /**
+     * Called outside the constructor so that the m_managers field is completely initialized.  
+     * A component might possibly start a thread to enable other components, which could access m_managers
+     */
+    void initialEnable()
+    {
         //enable all the enabled components
-        for ( ComponentHolder componentHolder : m_managers )
+        for ( ComponentHolder<?> componentHolder : m_managers )
         {
             log( LogService.LOG_DEBUG, "BundleComponentActivator : Bundle [{0}] May enable component holder {1}",
                     new Object[] {m_bundle.getBundleId(), componentHolder.getComponentMetadata().getName()}, null, null, null );
@@ -262,7 +272,7 @@
                     metadata.validate( this );
 
                     // Request creation of the component manager
-                    ComponentHolder holder = m_componentRegistry.createComponentHolder( this, metadata );
+                    ComponentHolder<?> holder = m_componentRegistry.createComponentHolder( this, metadata );
 
                     // register the component after validation
                     m_componentRegistry.registerComponentHolder( key, holder );
@@ -326,12 +336,10 @@
             log( LogService.LOG_DEBUG, "BundleComponentActivator : Bundle [{0}] will destroy {1} instances", new Object[]
                     { m_bundle.getBundleId(), m_managers.size() }, null, null, null );
 
-            while ( m_managers.size() != 0 )
+            for (ComponentHolder<?> holder: m_managers )
             {
-                ComponentHolder holder = m_managers.get( 0 );
                 try
                 {
-                    m_managers.remove( holder );
                     holder.disposeComponents( reason );
                 }
                 catch ( Exception e )
@@ -409,13 +417,8 @@
      */
     public void enableComponent( final String name )
     {
-        final ComponentHolder[] holder = getSelectedComponents( name );
-        if ( holder == null )
-        {
-            return;
-        }
-
-        for ( ComponentHolder aHolder : holder )
+        final List<ComponentHolder<?>> holder = getSelectedComponents( name );
+        for ( ComponentHolder<?> aHolder : holder )
         {
             try
             {
@@ -441,13 +444,8 @@
      */
     public void disableComponent( final String name )
     {
-        final ComponentHolder[] holder = getSelectedComponents( name );
-        if ( holder == null )
-        {
-            return;
-        }
-
-        for ( ComponentHolder aHolder : holder )
+        final List<ComponentHolder<?>> holder = getSelectedComponents( name );
+        for ( ComponentHolder<?> aHolder : holder )
         {
             try
             {
@@ -477,32 +475,32 @@
      *      to the <code>name</code> parameter or <code>null</code> if no
      *      component manager with the given name is currently registered.
      */
-    private ComponentHolder[] getSelectedComponents( String name )
+    private List<ComponentHolder<?>> getSelectedComponents( String name )
     {
         // if all components are selected
         if ( name == null )
         {
-            return m_managers.toArray( new ComponentHolder[m_managers.size()] );
+            return m_managers;
         }
 
-        ComponentHolder componentHolder = m_componentRegistry.getComponentHolder( m_bundle, name );
+        ComponentHolder<?> componentHolder = m_componentRegistry.getComponentHolder( m_bundle, name );
         if (componentHolder != null)
         {
-            return new ComponentHolder[] { componentHolder };
+            return Collections.<ComponentHolder<?>>singletonList( componentHolder );
         }
 
         // if the component is not known
-        return null;
+        return Collections.emptyList();
     }
 
 
     //---------- Component ID support
 
-    public long registerComponentId(AbstractComponentManager componentManager) {
+    public long registerComponentId(AbstractComponentManager<?> componentManager) {
         return m_componentRegistry.registerComponentId(componentManager);
     }
 
-    public void unregisterComponentId(AbstractComponentManager componentManager) {
+    public void unregisterComponentId(AbstractComponentManager<?> componentManager) {
         m_componentRegistry.unregisterComponentId(componentManager.getId());
     }
 
@@ -607,17 +605,17 @@
                 }
             }
 
-            ServiceTracker logService = m_logService;
+            ServiceTracker<LogService, LogService> logService = m_logService;
             if ( logService != null )
             {
-                Object logger = logService.getService();
+                LogService logger = logService.getService();
                 if ( logger == null )
                 {
                     Activator.log( level, m_bundle, message, ex );
                 }
                 else
                 {
-                    ( ( LogService ) logger ).log( level, message, ex );
+                    logger.log( level, message, ex );
                 }
             }
             else
@@ -628,12 +626,12 @@
         }
     }
 
-    public void missingServicePresent( ServiceReference serviceReference )
+    public void missingServicePresent( ServiceReference<?> serviceReference )
     {
         m_componentRegistry.missingServicePresent( serviceReference, m_componentActor );
     }
 
-    public void registerMissingDependency( DependencyManager dependencyManager, ServiceReference serviceReference, int trackingCount )
+    public <T> void registerMissingDependency( DependencyManager<?, T> dependencyManager, ServiceReference<T> serviceReference, int trackingCount )
     {
         m_componentRegistry.registerMissingDependency(dependencyManager, serviceReference, trackingCount );
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java b/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
index 0194a9f..40ca435 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
@@ -46,12 +46,12 @@
     };
 
     // the queue of Runnable instances  to be run
-    private LinkedList tasks;
+    private LinkedList<Runnable> tasks;
 
 
     ComponentActorThread()
     {
-        tasks = new LinkedList();
+        tasks = new LinkedList<Runnable>();
     }
 
 
@@ -82,7 +82,7 @@
                     }
                 }
 
-                task = ( Runnable ) tasks.removeFirst();
+                task = tasks.removeFirst();
             }
 
             try
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 ea58709..6bc2688 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
@@ -41,6 +41,7 @@
 import org.osgi.framework.ServiceListener;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.component.ComponentConstants;
 import org.osgi.service.component.ComponentException;
 import org.osgi.service.log.LogService;
@@ -114,17 +115,11 @@
      */
     private long m_componentCounter = -1;
 
-    /**
-     * The OSGi service registration for the ScrService provided by this
-     * instance.
-     */
-    private ServiceRegistration m_registration;
-
     // ConfigurationAdmin support -- created on demand upon availability of
     // the ConfigurationAdmin service
     private ConfigurationSupport configurationSupport;
 
-    private final Map<ServiceReference<?>, List<Entry>> m_missingDependencies = new HashMap<ServiceReference<?>, List<Entry>>( );
+    private final Map<ServiceReference<?>, List<Entry<?, ?>>> m_missingDependencies = new HashMap<ServiceReference<?>, List<Entry<?, ?>>>( );
 
     protected ComponentRegistry( BundleContext context )
     {
@@ -150,12 +145,6 @@
             getOrCreateConfigurationSupport();
         }
 
-        // register as ScrService
-//        Dictionary<String, Object> props = new Hashtable<String, Object>();
-//        props.put( Constants.SERVICE_DESCRIPTION, "Declarative Services Management Agent" );
-//        props.put( Constants.SERVICE_VENDOR, "The Apache Software Foundation" );
-//        m_registration = context.registerService( new String[]
-//            { ScrService.class.getName(), }, this, props );
     }
 
 
@@ -169,91 +158,9 @@
             configurationSupport = null;
         }
 
-        if ( m_registration != null )
-        {
-            m_registration.unregister();
-            m_registration = null;
-        }
     }
 
 
-    //---------- ScrService interface
-
-//    public Component[] getComponents()
-//    {
-//        List<ComponentHolder<?>> holders = getComponentHolders();
-//        ArrayList<Component> list = new ArrayList<Component>();
-//        for ( ComponentHolder holder: holders )
-//        {
-//            if ( holder != null )
-//            {
-//                list.addAll(holder.getComponents());
-//            }
-//        }
-//
-//        // nothing to return
-//        if ( list.isEmpty() )
-//        {
-//            return null;
-//        }
-//
-//        return ( Component[] ) list.toArray( new Component[list.size()] );
-//    }
-
-
-//    public Component[] getComponents( Bundle bundle )
-//    {
-//        List<ComponentHolder<?>> holders = getComponentHolders();
-//        List<Component> list = new ArrayList<Component>();
-//        for ( ComponentHolder<?> holder: holders )
-//        {
-//            if ( holder != null )
-//            {
-//                BundleComponentActivator activator = holder.getActivator();
-//                if ( activator != null && activator.getBundleContext().getBundle() == bundle )
-//                {
-//                    list.addAll(holder.getComponents());
-//                }
-//            }
-//        }
-//
-//        // nothing to return
-//        if ( list.isEmpty() )
-//        {
-//            return null;
-//        }
-//
-//        return list.toArray( new Component[list.size()] );
-//    }
-//
-//
-//    public Component getComponent( long componentId )
-//    {
-//        synchronized ( m_componentsById )
-//        {
-//            return m_componentsById.get( componentId );
-//        }
-//    }
-
-
-//    public Component[] getComponents( String componentName )
-//    {
-//        List<Component> list = new ArrayList<Component>();
-//        synchronized ( m_componentHoldersByName )
-//        {
-//            for ( ComponentHolder<?> c: m_componentHoldersByName.values() )
-//            {
-//                if ( c.getComponentMetadata().getName().equals( componentName ) )
-//                {
-//                    list.addAll( c.getComponents() );
-//                }
-//            }
-//        }
-//
-//        return ( list.isEmpty() ) ? null : list.toArray( new Component[list.size()] );
-//    }
-
-
     //---------- ComponentManager registration by component Id
 
     /**
@@ -369,7 +276,7 @@
      * @throws ComponentException if the name has not been reserved through
      *      {@link #checkComponentName(String)} yet.
      */
-    final void registerComponentHolder( final ComponentRegistryKey key, ComponentHolder componentHolder )
+    final void registerComponentHolder( final ComponentRegistryKey key, ComponentHolder<?> componentHolder )
     {
         Activator.log(LogService.LOG_DEBUG, null, 
                 "Registering component with pid {0} for bundle {1}",
@@ -419,7 +326,7 @@
      * Returns the component registered under the given name or <code>null</code>
      * if no component is registered yet.
      */
-    public final ComponentHolder getComponentHolder( final Bundle bundle, final String name )
+    public final ComponentHolder<?> getComponentHolder( final Bundle bundle, final String name )
     {
         synchronized ( m_componentHoldersByName )
         {
@@ -443,7 +350,7 @@
             // only return the entry if non-null and not a reservation
             if (set != null)
             {
-                for (ComponentHolder holder: set)
+                for (ComponentHolder<?> holder: set)
                 {
                     if (targetedPid.matchesTarget(holder))
                     {
@@ -549,9 +456,9 @@
      * Factory method to issue {@link ComponentHolder} instances to manage
      * components described by the given component <code>metadata</code>.
      */
-    public ComponentHolder createComponentHolder( BundleComponentActivator activator, ComponentMetadata metadata )
+    public <S> ComponentHolder<S> createComponentHolder( BundleComponentActivator activator, ComponentMetadata metadata )
     {
-        return new ConfigurableComponentHolder(activator, metadata);
+        return new ConfigurableComponentHolder<S>(activator, metadata);
     }
 
 
@@ -571,8 +478,8 @@
         {
             ConfigurationSupport configurationSupport = getOrCreateConfigurationSupport();
 
-            final ServiceReference caRef = event.getServiceReference();
-            final Object service = m_bundleContext.getService(caRef);
+            final ServiceReference<ConfigurationAdmin> caRef = (ServiceReference<ConfigurationAdmin>) event.getServiceReference();
+            final ConfigurationAdmin service = m_bundleContext.getService(caRef);
             if (service != null)
             {
                 try
@@ -653,9 +560,9 @@
         }
     }
 
-    public synchronized void missingServicePresent( final ServiceReference serviceReference, ComponentActorThread actor )
+    public synchronized <T> void missingServicePresent( final ServiceReference<T> serviceReference, ComponentActorThread actor )
     {
-        final List<Entry> dependencyManagers = m_missingDependencies.remove( serviceReference );
+        final List<Entry<?, ?>> dependencyManagers = m_missingDependencies.remove( serviceReference );
         if ( dependencyManagers != null )
         {
             actor.schedule( new Runnable()
@@ -663,9 +570,9 @@
 
                 public void run()
                 {
-                    for ( Entry entry : dependencyManagers )
+                    for ( Entry<?, ?> entry : dependencyManagers )
                     {
-                        entry.getDm().invokeBindMethodLate( serviceReference, entry.getTrackingCount() );
+                        ((DependencyManager<?, T>)entry.getDm()).invokeBindMethodLate( serviceReference, entry.getTrackingCount() );
                     }
                 }
 
@@ -679,34 +586,34 @@
         }
     }
 
-    public synchronized void registerMissingDependency( DependencyManager<?,?> dependencyManager, ServiceReference serviceReference, int trackingCount )
+    public synchronized <S, T> void registerMissingDependency( DependencyManager<S, T> dependencyManager, ServiceReference<T> serviceReference, int trackingCount )
     {
         //check that the service reference is from scr
         if ( serviceReference.getProperty( ComponentConstants.COMPONENT_NAME ) == null || serviceReference.getProperty( ComponentConstants.COMPONENT_ID ) == null )
         {
             return;
         }
-        List<Entry> dependencyManagers = m_missingDependencies.get( serviceReference );
+        List<Entry<?, ?>> dependencyManagers = m_missingDependencies.get( serviceReference );
         if ( dependencyManagers == null )
         {
-            dependencyManagers = new ArrayList<Entry>();
+            dependencyManagers = new ArrayList<Entry<?, ?>>();
             m_missingDependencies.put( serviceReference, dependencyManagers );
         }
-        dependencyManagers.add( new Entry( dependencyManager, trackingCount ) );
+        dependencyManagers.add( new Entry<S, T>( dependencyManager, trackingCount ) );
     }
 
-    private static class Entry
+    private static class Entry<S,T>
     {
-        private final DependencyManager<?,?> dm;
+        private final DependencyManager<S, T> dm;
         private final int trackingCount;
 
-        private Entry( DependencyManager<?,?> dm, int trackingCount )
+        private Entry( DependencyManager<S, T> dm, int trackingCount )
         {
             this.dm = dm;
             this.trackingCount = trackingCount;
         }
 
-        public DependencyManager<?,?> getDm()
+        public DependencyManager<S, T> getDm()
         {
             return dm;
         }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/TargetedPID.java b/scr/src/main/java/org/apache/felix/scr/impl/TargetedPID.java
index e8ccedd..3afd7be 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/TargetedPID.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/TargetedPID.java
@@ -144,7 +144,7 @@
      * @return <code>true</code> if the referenced service matches the
      *      target of this PID.
      */
-    public boolean matchesTarget( ComponentHolder holder )
+    public boolean matchesTarget( ComponentHolder<?> holder )
     {
         // already unregistered
         final Bundle serviceBundle = holder.getActivator().getBundleContext().getBundle();
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
index 3720446..2ca10f4 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
@@ -57,7 +57,7 @@
      * Configuration Admin service.
      *
      * @param pid The PID of the deleted configuration
-     * @param factoryPid TODO
+     * @param factoryPid The factory PID of the deleted configuration
      */
     void configurationDeleted( TargetedPID pid, TargetedPID factoryPid );
 
@@ -85,7 +85,7 @@
     /**
      * Returns the targeted PID used to configure this component
      * @param pid a targetedPID containing the service pid for the component desired (the rest of the targeted pid is ignored)
-     * @param factoryPid TODO
+     * @param factoryPid a targetedPID containing the factory pid for the component desired.
      * @return the complete targeted pid actually used to configure the comonent.
      */
     TargetedPID getConfigurationTargetedPID(TargetedPID pid, TargetedPID factoryPid);
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentManager.java
index b6cec2b..f8c8572 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentManager.java
@@ -29,8 +29,6 @@
 	int STATE_SATISFIED = ComponentConfigurationDTO.SATISFIED;
 	int STATE_UNSATISFIED = ComponentConfigurationDTO.UNSATISFIED;
 	int STATE_ACTIVE = ComponentConfigurationDTO.ACTIVE;
-	int STATE_FACTORY = 8;
-	int STATE_FACTORY_INSTANCE = 16;
 	int STATE_DISPOSED = 32;
 	int STATE_DISABLED = 64; //TODO????
 
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
index 2ef0184..25bb54e 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
@@ -234,11 +234,6 @@
 
         synchronized ( m_components )
         {
-            //            // FELIX-2231: nothing to do any more, all components have been disposed off
-            //            if (m_singleComponent == null) 
-            //            {
-            //                return;
-            //            }
             if (factoryPid != null) {
                 checkFactoryPidIndex(factoryPid);
                 String servicePid = pid.getServicePid();
@@ -632,11 +627,6 @@
             m_enabled = false;
 
             cms = getComponentManagers( true );
-            //       		if (m_singleComponent != null && m_factoryPidIndex == null && 
-            //    				(m_componentMetadata.isConfigurationIgnored() || m_componentMetadata.isConfigurationOptional()))
-            //    		{
-            //    			m_singleComponent = null;
-            //    		}
         }
         for ( AbstractComponentManager<S> cm : cms )
         {
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
index 7503a1c..4b084a6 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
@@ -406,7 +406,7 @@
     {
         private final Dictionary<String, Object> props;
         private final String bundleLocation;
-        private long changeCount;
+        private final long changeCount;
         
         public ConfigurationInfo(Dictionary<String, Object> props, String bundleLocation, long changeCount)
         {
@@ -420,11 +420,6 @@
             return changeCount;
         }
 
-        public void setChangeCount(long changeCount)
-        {
-            this.changeCount = changeCount;
-        }
-
         public Dictionary<String, Object> getProps()
         {
             return props;
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 9bc0281..7889c7a 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
@@ -44,7 +44,7 @@
     implements MetaTypeProvider
 {
 
-    static ManagedService create(final ScrConfiguration scrConfiguration)
+    static ScrManagedService create(final ScrConfiguration scrConfiguration)
     {
         return new ScrManagedServiceMetaTypeProvider(scrConfiguration);
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceServiceFactory.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceServiceFactory.java
index 2177311..91b256c 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceServiceFactory.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceServiceFactory.java
@@ -36,7 +36,7 @@
  * core OSGi API and thus may be instantiated without the Configuration Admin
  * and/or MetaType Service API actually available at the time of instantiation.
  */
-public class ScrManagedServiceServiceFactory implements ServiceFactory
+public class ScrManagedServiceServiceFactory implements ServiceFactory<ScrManagedService>
 {
     private final ScrConfiguration scrConfiguration;
 
@@ -45,7 +45,7 @@
         this.scrConfiguration = scrConfiguration;
     }
 
-    public Object getService(Bundle bundle, ServiceRegistration registration)
+    public ScrManagedService getService(Bundle bundle, ServiceRegistration<ScrManagedService> registration)
     {
         try
         {
@@ -64,7 +64,7 @@
         return new ScrManagedService( this.scrConfiguration );
     }
 
-    public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
+    public void ungetService(Bundle bundle, ServiceRegistration<ScrManagedService> registration, ScrManagedService service)
     {
         // nothing really todo; GC will do the rest
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
index 1f11aad..43f72a4 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
@@ -40,17 +40,17 @@
 {
 
     // class references to simplify parameter checking
-    protected static final Class COMPONENT_CONTEXT_CLASS = ComponentContext.class;
-    protected static final Class BUNDLE_CONTEXT_CLASS = BundleContext.class;
-    protected static final Class SERVICE_REFERENCE_CLASS = ServiceReference.class;
-    protected static final Class MAP_CLASS = Map.class;
-    protected static final Class INTEGER_CLASS = Integer.class;
+    protected static final Class<?> COMPONENT_CONTEXT_CLASS = ComponentContext.class;
+    protected static final Class<?> BUNDLE_CONTEXT_CLASS = BundleContext.class;
+    protected static final Class<?> SERVICE_REFERENCE_CLASS = ServiceReference.class;
+    protected static final Class<?> MAP_CLASS = Map.class;
+    protected static final Class<?> INTEGER_CLASS = Integer.class;
 
     private final boolean isDS11;
     private final boolean isDS12Felix;
 
     private final String m_methodName;
-    private final Class m_componentClass;
+    private final Class<?> m_componentClass;
 
     private volatile Method m_method;
 
@@ -59,14 +59,14 @@
     private volatile State m_state;
 
     protected BaseMethod( final String methodName,
-            final Class componentClass, final boolean ds11, final boolean ds12Felix )
+            final Class<?> componentClass, final boolean ds11, final boolean ds12Felix )
     {
         this( methodName, methodName != null, componentClass, ds11, ds12Felix );
     }
 
 
     protected BaseMethod( final String methodName,
-            final boolean methodRequired, final Class componentClass, final boolean ds11, final boolean ds12Felix )
+            final boolean methodRequired, final Class<?> componentClass, final boolean ds11, final boolean ds12Felix )
     {
         m_methodName = methodName;
         m_methodRequired = methodRequired;
@@ -105,7 +105,7 @@
         return m_method;
     }
 
-    protected final Class getComponentClass()
+    protected final Class<?> getComponentClass()
     {
         return m_componentClass;
     }
@@ -161,10 +161,10 @@
         boolean acceptPrivate = isDS11();
         boolean acceptPackage = isDS11();
 
-        final Class targetClass = getComponentClass();
+        final Class<?> targetClass = getComponentClass();
         final ClassLoader targetClasslLoader = targetClass.getClassLoader();
         final String targetPackage = getPackageName( targetClass );
-        Class theClass = targetClass;
+        Class<?> theClass = targetClass;
 
         while (true) 
         {
@@ -214,7 +214,7 @@
     }
 
 
-    protected abstract Method doFindMethod( final Class targetClass, final boolean acceptPrivate,
+    protected abstract Method doFindMethod( final Class<?> targetClass, final boolean acceptPrivate,
             final boolean acceptPackage, SimpleLogger logger ) throws SuitableMethodNotAccessibleException, InvocationTargetException;
 
 
@@ -231,7 +231,7 @@
                 Object result = m_method.invoke(componentInstance, params);
                 logger.log( LogService.LOG_DEBUG, "invoked {0}: {1}", new Object[]
                     { getMethodNamePrefix(), getMethodName() }, null );
-                return new MethodResult((m_method.getReturnType() != Void.TYPE), (Map) result);
+                return new MethodResult((m_method.getReturnType() != Void.TYPE), (Map<String, Object>) result);
             }
             else
             {
@@ -315,7 +315,7 @@
      * @throws InvocationTargetException If an unexpected Throwable is caught
      *      trying to access the desired method.
      */
-    public /* static */ Method getMethod( Class clazz, String name, Class[] parameterTypes, boolean acceptPrivate,
+    public /* static */ Method getMethod( Class<?> clazz, String name, Class[] parameterTypes, boolean acceptPrivate,
             boolean acceptPackage, SimpleLogger logger ) throws SuitableMethodNotAccessibleException,
         InvocationTargetException
     {
@@ -469,7 +469,7 @@
      * Returns the name of the package to which the class belongs or an
      * empty string if the class is in the default package.
      */
-    public static String getPackageName( Class clazz )
+    public static String getPackageName( Class<?> clazz )
     {
         String name = clazz.getName();
         int dot = name.lastIndexOf( '.' );
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java
index 8ed77d0..c799db6 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java
@@ -37,7 +37,7 @@
 public class BindMethod extends BaseMethod
 {
 
-    private static final Class OBJECT_CLASS = Object.class;
+    private static final Class<?> OBJECT_CLASS = Object.class;
 
     private final String m_referenceClassName;
 
@@ -49,7 +49,7 @@
 
 
     public BindMethod( final String methodName,
-            final Class componentClass, final String referenceClassName, final boolean isDS11, final boolean isDS12Felix )
+            final Class<?> componentClass, final String referenceClassName, final boolean isDS11, final boolean isDS12Felix )
     {
         super( methodName, componentClass, isDS11, isDS12Felix );
         m_referenceClassName = referenceClassName;
@@ -74,7 +74,7 @@
      * @throws InvocationTargetException If an unexpected Throwable is caught
      *      trying to find the requested method.
      */
-    protected Method doFindMethod( Class targetClass, boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger )
+    protected Method doFindMethod( Class<?> targetClass, boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger )
         throws SuitableMethodNotAccessibleException, InvocationTargetException
     {
         // 112.3.1 The method is searched for using the following priority
@@ -114,7 +114,7 @@
         }
 
         // for further methods we need the class of the service object
-        final Class parameterClass = getParameterClass( targetClass, logger );
+        final Class<?> parameterClass = getParameterClass( targetClass, logger );
         if ( parameterClass != null )
         {
 
@@ -230,7 +230,7 @@
      *      if the class loader of the <code>targetClass</code> cannot see that
      *      class.
      */
-    private Class getParameterClass( final Class targetClass, SimpleLogger logger )
+    private Class<?> getParameterClass( final Class<?> targetClass, SimpleLogger logger )
     {
         if ( logger.isLogEnabled( LogService.LOG_DEBUG ) )
         {
@@ -250,7 +250,7 @@
                 loader = ClassLoader.getSystemClassLoader();
             }
 
-            final Class referenceClass = loader.loadClass( m_referenceClassName );
+            final Class<?> referenceClass = loader.loadClass( m_referenceClassName );
             if ( logger.isLogEnabled( LogService.LOG_DEBUG ) )
             {
                 logger.log( LogService.LOG_DEBUG,
@@ -291,7 +291,7 @@
                                     new Object[] {pkg[i].getExportingBundle().getSymbolicName(), pkg[i].getExportingBundle().getBundleId()}, null );
                         }
 
-                        Class referenceClass = pkg[i].getExportingBundle().loadClass( m_referenceClassName );
+                        Class<?> referenceClass = pkg[i].getExportingBundle().loadClass( m_referenceClassName );
                         if ( logger.isLogEnabled( LogService.LOG_DEBUG ) )
                         {
                             logger.log( LogService.LOG_DEBUG,
@@ -347,7 +347,7 @@
      * @throws InvocationTargetException If an unexpected Throwable is caught
      *      trying to find the requested method.
      */
-    private Method getServiceReferenceMethod( final Class targetClass, boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger )
+    private Method getServiceReferenceMethod( final Class<?> targetClass, boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger )
         throws SuitableMethodNotAccessibleException, InvocationTargetException
     {
         return getMethod( targetClass, getMethodName(), new Class[]
@@ -374,7 +374,7 @@
      * @throws InvocationTargetException If an unexpected Throwable is caught
      *      trying to find the requested method.
      */
-    private Method getServiceObjectMethod( final Class targetClass, final Class parameterClass, boolean acceptPrivate,
+    private Method getServiceObjectMethod( final Class<?> targetClass, final Class<?> parameterClass, boolean acceptPrivate,
             boolean acceptPackage, SimpleLogger logger ) throws SuitableMethodNotAccessibleException, InvocationTargetException
     {
         return getMethod( targetClass, getMethodName(), new Class[]
@@ -400,7 +400,7 @@
      * @throws SuitableMethodNotAccessibleException If a suitable method was
      *      found which is not accessible
      */
-    private Method getServiceObjectAssignableMethod( final Class targetClass, final Class parameterClass,
+    private Method getServiceObjectAssignableMethod( final Class<?> targetClass, final Class<?> parameterClass,
             boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger ) throws SuitableMethodNotAccessibleException
     {
         // Get all potential bind methods
@@ -439,7 +439,7 @@
                 }
 
                 // Get the parameter type
-                final Class theParameter = parameters[0];
+                final Class<?> theParameter = parameters[0];
 
                 // Check if the parameter type is ServiceReference
                 // or is assignable from the type specified by the
@@ -497,7 +497,7 @@
      * @throws InvocationTargetException If an unexpected Throwable is caught
      *      trying to find the requested method.
      */
-    private Method getServiceObjectWithMapMethod( final Class targetClass, final Class parameterClass,
+    private Method getServiceObjectWithMapMethod( final Class<?> targetClass, final Class<?> parameterClass,
             boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger ) throws SuitableMethodNotAccessibleException,
         InvocationTargetException
     {
@@ -523,7 +523,7 @@
      * @throws SuitableMethodNotAccessibleException If a suitable method was
      *      found which is not accessible
      */
-    private Method getServiceObjectAssignableWithMapMethod( final Class targetClass, final Class parameterClass,
+    private Method getServiceObjectAssignableWithMapMethod( final Class<?> targetClass, final Class<?> parameterClass,
         boolean acceptPrivate, boolean acceptPackage ) throws SuitableMethodNotAccessibleException
     {
         // Get all potential bind methods
@@ -563,13 +563,13 @@
         return null;
     }
 
-    public boolean getServiceObject( RefPair refPair, BundleContext context, SimpleLogger logger )
+    public <T> boolean getServiceObject( RefPair<T> refPair, BundleContext context, SimpleLogger logger )
     {
         //??? this resolves which we need.... better way?
         if ( refPair.getServiceObject() == null && methodExists( logger ) )
         {
             if (m_paramStyle == SERVICE_OBJECT || m_paramStyle == SERVICE_OBJECT_AND_MAP) {
-                Object service = context.getService( refPair.getRef() );
+                T service = context.getService( refPair.getRef() );
                 if ( service == null )
                 {
                     refPair.setFailed();
@@ -591,7 +591,7 @@
 
     protected Object[] getParameters( Method method, Object rawParameter )
     {
-        RefPair refPair = ( RefPair ) rawParameter;
+        RefPair<?> refPair = ( RefPair<?> ) rawParameter;
         if (m_paramStyle == SERVICE_REFERENCE )
         {
             return new Object[] {refPair.getRef()};
@@ -602,7 +602,7 @@
         }
         if (m_paramStyle == SERVICE_OBJECT_AND_MAP  )
         {
-            return new Object[] {refPair.getServiceObject(), new ReadOnlyDictionary( refPair.getRef() )};
+            return new Object[] {refPair.getServiceObject(), new ReadOnlyDictionary<String, Object>( refPair.getRef() )};
         }
         throw new IllegalStateException( "Unexpected m_paramStyle of " + m_paramStyle );
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethods.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethods.java
index 30531de..249bdae 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethods.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethods.java
@@ -32,7 +32,7 @@
     private final UpdatedMethod m_updated;
     private final UnbindMethod m_unbind;
 
-    BindMethods( ReferenceMetadata m_dependencyMetadata, Class instanceClass,
+    BindMethods( ReferenceMetadata m_dependencyMetadata, Class<?> instanceClass,
             final boolean isDS11, final boolean isDS12Felix )
     {
         m_bind = new BindMethod(
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/Coercions.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/Coercions.java
index 3a296f0..0b747b4 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/Coercions.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/Coercions.java
@@ -373,7 +373,7 @@
         {
             throw new ComponentException("Not a collection: " + raw);
         }
-        Collection c = ( Collection ) raw;
+        Collection<?> c = ( Collection<?> ) raw;
         if (c.isEmpty())
         {
             return defaultValue;
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/ComponentMethods.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/ComponentMethods.java
index d38f7d7..01465e4 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/ComponentMethods.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/ComponentMethods.java
@@ -21,7 +21,6 @@
 package org.apache.felix.scr.impl.helper;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
@@ -37,9 +36,9 @@
     private ModifiedMethod m_modifiedMethod;
     private DeactivateMethod m_deactivateMethod;
 
-    private final Map bindMethodMap = new HashMap();//<String, BindMethods>
+    private final Map<String, BindMethods> bindMethodMap = new HashMap<String, BindMethods>();
 
-    public synchronized void initComponentMethods( ComponentMetadata componentMetadata, Class implementationObjectClass )
+    public synchronized void initComponentMethods( ComponentMetadata componentMetadata, Class<?> implementationObjectClass )
     {
         if (m_activateMethod != null)
         {
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/DeactivateMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/DeactivateMethod.java
index a74c4df..df5fcd7 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/DeactivateMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/DeactivateMethod.java
@@ -27,7 +27,7 @@
 
 
     public DeactivateMethod( final String methodName,
-            final boolean methodRequired, final Class componentClass, final boolean isDS11, final boolean isDS12Felix )
+            final boolean methodRequired, final Class<?> componentClass, final boolean isDS11, final boolean isDS12Felix )
     {
         super( methodName, methodRequired, componentClass, isDS11, isDS12Felix );
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/ModifiedMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/ModifiedMethod.java
index 68966c4..b16ea48 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/ModifiedMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/ModifiedMethod.java
@@ -23,7 +23,7 @@
 {
 
     public ModifiedMethod( final String methodName,
-            final Class componentClass, final boolean isDS11, final boolean isDS12Felix )
+            final Class<?> componentClass, final boolean isDS11, final boolean isDS12Felix )
     {
         super( methodName, methodName != null, componentClass, isDS11, isDS12Felix );
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/ReadOnlyDictionary.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/ReadOnlyDictionary.java
index f426cc6..e62d910 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/ReadOnlyDictionary.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/ReadOnlyDictionary.java
@@ -66,7 +66,7 @@
      * Creates a wrapper for the given service reference providing read only
      * access to the reference properties.
      */
-    public ReadOnlyDictionary( final ServiceReference serviceReference )
+    public ReadOnlyDictionary( final ServiceReference<?> serviceReference )
     {
         Hashtable properties = new Hashtable();
         final String[] keys = serviceReference.getPropertyKeys();
@@ -159,25 +159,25 @@
     }
 
 
-    public Set entrySet()
+    public Set<Entry<S, T>> entrySet()
     {
         return Collections.unmodifiableSet( m_delegate.entrySet() );
     }
 
 
-    public Set keySet()
+    public Set<S> keySet()
     {
         return Collections.unmodifiableSet( m_delegate.keySet() );
     }
 
 
-    public void putAll( Map m )
+    public void putAll( Map<? extends S, ? extends T> m )
     {
         // nop, this map is read only
     }
 
 
-    public Collection values()
+    public Collection<T> values()
     {
         return Collections.unmodifiableCollection( m_delegate.values() );
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/UnbindMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/UnbindMethod.java
index c5d4cff..2fc2ab9 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/UnbindMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/UnbindMethod.java
@@ -26,7 +26,7 @@
 {
 
     public UnbindMethod( final String methodName,
-            final Class componentClass, final String referenceClassName, final boolean isDS11, final boolean isDS12Felix )
+            final Class<?> componentClass, final String referenceClassName, final boolean isDS11, final boolean isDS12Felix )
     {
         super( methodName, componentClass, referenceClassName, isDS11, isDS12Felix );
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/UpdatedMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/UpdatedMethod.java
index 80f24b6..91ab29c 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/UpdatedMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/UpdatedMethod.java
@@ -26,7 +26,7 @@
 {
 
     public UpdatedMethod( final String methodName,
-            final Class componentClass, final String referenceClassName, final boolean isDS11, final boolean isDS12Felix )
+            final Class<?> componentClass, final String referenceClassName, final boolean isDS11, final boolean isDS12Felix )
     {
         super( methodName, componentClass, referenceClassName, isDS11, isDS12Felix );
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
index 7c48dde..63a1310 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
@@ -386,22 +386,6 @@
     //---------- Asynchronous frontend to state change methods ----------------
     private static final AtomicLong taskCounter = new AtomicLong( );
 
-//    /**
-//     * Enables this component and - if satisfied - also activates it. If
-//     * enabling the component fails for any reason, the component ends up
-//     * disabled.
-//     * <p>
-//     * This method ignores the <i>enabled</i> flag of the component metadata
-//     * and just enables as requested.
-//     * <p>
-//     * This method enables and activates the component immediately.
-//     */
-//    public final void enable()
-//    {
-//        enable( true );
-//    }
-
-
     public final void enable( final boolean async )
     {
         if (m_enabled)
@@ -661,14 +645,8 @@
         }
 
         registerComponentId();
-        // Before creating the implementation object, we are going to
-        // test if we have configuration if such is required
-//        if ( hasConfiguration() || !getComponentMetadata().isConfigurationRequired() )
-//        {
-            // Update our target filters.
-            log( LogService.LOG_DEBUG, "Updating target filters", null );
-            updateTargets( getProperties() );
-//        }
+        log( LogService.LOG_DEBUG, "Updating target filters", null );
+        updateTargets( getProperties() );
 
         m_internalEnabled = true;
         log( LogService.LOG_DEBUG, "Component enabled", null );
@@ -705,15 +683,6 @@
         log( LogService.LOG_DEBUG, "Activating component from state {0}", new Object[] {getState()},  null );
 
         // Before creating the implementation object, we are going to
-        // test if we have configuration if such is required
-        //TODO this should not be needed, no configuration >>> no manager
-//        if ( !hasConfiguration() && getComponentMetadata().isConfigurationRequired() )
-//        {
-//            log( LogService.LOG_DEBUG, "Missing required configuration, cannot activate", null );
-//            return;
-//        }
-
-        // Before creating the implementation object, we are going to
         // test that the bundle has enough permissions to register services
         if ( !hasServiceRegistrationPermissions() )
         {
@@ -1284,7 +1253,7 @@
 	 */
     public abstract Map<String, Object> getProperties();
 
-    public abstract void setServiceProperties( Dictionary<String, Object> serviceProperties );
+    public abstract void setServiceProperties( Dictionary<String, ?> serviceProperties );
 
     /**
      * Returns the subset of component properties to be used as service
@@ -1420,10 +1389,6 @@
         {
             return STATE_UNSATISFIED;
         }
-        if ( isFactory() && !m_factoryInstance )
-        {
-            return STATE_FACTORY;
-        }
         if ( hasInstance() )
         {
             return STATE_ACTIVE;
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentContextImpl.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentContextImpl.java
index 9a1db51..459c854 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentContextImpl.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentContextImpl.java
@@ -19,7 +19,6 @@
 package org.apache.felix.scr.impl.manager;
 
 
-import java.util.Arrays;
 import java.util.Dictionary;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -128,7 +127,7 @@
         m_componentManager.obtainActivationReadLock( "locate.services" );
         try
         {
-            DependencyManager dm = m_componentManager.getDependencyManager( name );
+            DependencyManager<S, ?> dm = m_componentManager.getDependencyManager( name );
             return ( dm != null ) ? dm.getServices() : null;
         }
         finally
@@ -184,7 +183,7 @@
 
     //---------- Speculative MutableProperties interface ------------------------------
 
-    public void setServiceProperties(Dictionary properties)
+    public void setServiceProperties(Dictionary<String, ?> properties)
     {
         getComponentManager().setServiceProperties(properties );
     }
@@ -223,11 +222,11 @@
         return null;
     }
     
-    private static class ComponentInstanceImpl implements ComponentInstance
+    private static class ComponentInstanceImpl<S> implements ComponentInstance
     {
-        private final ComponentContextImpl m_componentContext;
+        private final ComponentContextImpl<S> m_componentContext;
 
-        private ComponentInstanceImpl(ComponentContextImpl m_componentContext)
+        private ComponentInstanceImpl(ComponentContextImpl<S> m_componentContext)
         {
             this.m_componentContext = m_componentContext;
         }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
index 056492c..8b08da9 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
@@ -30,7 +30,6 @@
 import org.apache.felix.scr.impl.BundleComponentActivator;
 import org.apache.felix.scr.impl.TargetedPID;
 import org.apache.felix.scr.impl.config.ComponentContainer;
-import org.apache.felix.scr.impl.config.ComponentManager;
 import org.apache.felix.scr.impl.helper.ComponentMethods;
 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
 import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
@@ -92,7 +91,7 @@
     
     protected TargetedPID m_targetedPID;
 
-    public ComponentFactoryImpl( ComponentContainer container )
+    public ComponentFactoryImpl( ComponentContainer<S> container )
     {
         super( container, new ComponentMethods() );
         m_componentInstances = new IdentityHashMap<SingleComponentManager<S>, SingleComponentManager<S>>();
@@ -281,7 +280,7 @@
         return props;
     }
     
-    public void setServiceProperties( Dictionary<String, Object> serviceProperties )
+    public void setServiceProperties( Dictionary<String, ?> serviceProperties )
     {
         throw new IllegalStateException( "ComponentFactory service properties are immutable" );
     }
@@ -332,162 +331,7 @@
         return null;
     }
 
-
-//    //---------- ComponentHolder interface
-//
-//    public void configurationDeleted( TargetedPID pid, TargetedPID factoryPid )
-//    {
-//        m_targetedPID = null;
-//        if ( pid.equals( getComponentMetadata().getConfigurationPid() ) )
-//        {
-//            log( LogService.LOG_DEBUG, "Handling configuration removal", null );
-//
-//            m_changeCount = -1;
-//            // nothing to do if there is no configuration currently known.
-//            if ( !m_hasConfiguration )
-//            {
-//                log( LogService.LOG_DEBUG, "ignoring configuration removal: not currently configured", null );
-//                return;
-//            }
-//
-//            // So far, we were configured: clear the current configuration.
-//            m_hasConfiguration = false;
-//            m_configuration = new Hashtable<String, Object>();
-//
-//            log( LogService.LOG_DEBUG, "Current component factory state={0}", new Object[] {getState()}, null );
-//
-//            // And deactivate if we are not currently disposed and if configuration is required
-//            if ( ( getState() & STATE_DISPOSED ) == 0 && getComponentMetadata().isConfigurationRequired() )
-//            {
-//                log( LogService.LOG_DEBUG, "Deactivating component factory (required configuration has gone)", null );
-//                deactivateInternal( ComponentConstants.DEACTIVATION_REASON_CONFIGURATION_DELETED, true, false );
-//            }
-//        }
-//        else
-//        {
-//            // 112.7 Factory Configuration not allowed for factory component
-//            log( LogService.LOG_ERROR, "Component Factory cannot be configured by factory configuration", null );
-//        }
-//    }
-//
-//
-//    public boolean configurationUpdated( TargetedPID pid, TargetedPID factoryPid, Dictionary<String, Object> configuration, long changeCount )
-//    {
-//    	//TODO this needs somehow to be the same code as in ConfigurableComponentHolder.
-//        if ( m_targetedPID != null && !m_targetedPID.equals( pid ))
-//        {
-//            log( LogService.LOG_ERROR, "ImmediateComponentHolder unexpected change in targetedPID from {0} to {1}",
-//                    new Object[] {m_targetedPID, pid}, null);
-//            throw new IllegalStateException("Unexpected targetedPID change");
-//        }
-//        m_targetedPID = pid;
-//        if ( configuration != null )
-//        {
-//            if ( changeCount <= m_changeCount )
-//            {
-//                log( LogService.LOG_DEBUG,
-//                        "ImmediateComponentHolder out of order configuration updated for pid {0} with existing count {1}, new count {2}",
-//                        new Object[] { getComponentMetadata().getConfigurationPid(), m_changeCount, changeCount }, null );
-//                return false;
-//            }
-//            m_changeCount = changeCount;
-//        }
-//        else 
-//        {
-//            m_changeCount = -1;
-//        }
-//        if ( pid.equals( getComponentMetadata().getConfigurationPid() ) )
-//        {
-//            log( LogService.LOG_DEBUG, "Configuration PID updated for Component Factory", null );
-//
-//            // Ignore the configuration if our policy is 'ignore'
-//            if ( getComponentMetadata().isConfigurationIgnored() )
-//            {
-//                return false;
-//            }
-//
-//            // Store the config admin configuration
-////            m_configuration = configuration;
-//
-//            // We are now configured from config admin.
-//            m_hasConfiguration = true;
-//
-//            log( LogService.LOG_DEBUG, "Current ComponentFactory state={0}", new Object[]
-//                    {getState()}, null );
-//
-//            // If we are active, but if some config target filters don't match anymore
-//            // any required references, then deactivate.
-//            if ( getState() == STATE_FACTORY )
-//            {
-//                log( LogService.LOG_DEBUG, "Verifying if Active Component Factory is still satisfied", null );
-//
-//                // First update target filters.
-//                updateTargets( getProperties() );
-//
-//                // Next, verify dependencies
-//                if ( !verifyDependencyManagers() )
-//                {
-//                    log( LogService.LOG_DEBUG,
-//                            "Component Factory target filters not satisfied anymore: deactivating", null );
-//                    deactivateInternal( ComponentConstants.DEACTIVATION_REASON_REFERENCE, false, false );
-//                    return false;
-//                }
-//            }
-//
-//            // Unsatisfied component and required configuration may change targets
-//            // to satisfy references.
-//            if ( getState() == STATE_UNSATISFIED && getComponentMetadata().isConfigurationRequired() )
-//            {
-//                // try to activate our component factory, if all dependnecies are satisfied
-//                log( LogService.LOG_DEBUG, "Attempting to activate unsatisfied component", null );
-//                // First update target filters.
-//                updateTargets( getProperties() );
-//                activateInternal( getTrackingCount().get() );
-//            }
-//        }
-//        else
-//        {
-//            // 112.7 Factory Configuration not allowed for factory component
-//            log( LogService.LOG_ERROR, "Component Factory cannot be configured by factory configuration", null );
-//        }
-//        return false;
-//    }
-
-
-    public synchronized long getChangeCount( TargetedPID pid, TargetedPID targetedPid)
-    {
-        
-        return m_changeCount;
-    }
-
-	public List<? extends ComponentManager<S>> getComponents()
-    {
-        List<AbstractComponentManager<S>> cms = new ArrayList<AbstractComponentManager<S>>( );
-        getComponentManagers( m_componentInstances, cms );
-        return cms;
-    }
-
-
-    /**
-     * A component factory component holder enables the held components by
-     * enabling itself.
-     */
-    public void enableComponents( boolean async )
-    {
-        enable( async );
-    }
-
-
-    /**
-     * A component factory component holder disables the held components by
-     * disabling itself.
-     */
-    public void disableComponents( boolean async )
-    {
-        disable( async );
-    }
-
-
+    //TODO shouldn't something be calling this?
     /**
      * Disposes off all components ever created by this component holder. This
      * method is called if either the Declarative Services runtime is stopping
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 4ec37fb..64ad529 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
@@ -1557,7 +1557,7 @@
      *      be handed over to the bind method but the service cannot be
      *      retrieved using the service reference.
      */
-    boolean invokeBindMethod( S componentInstance, RefPair refPair, int trackingCount, EdgeInfo info )
+    boolean invokeBindMethod( S componentInstance, RefPair<T> refPair, int trackingCount, EdgeInfo info )
     {
         // The bind method is only invoked if the implementation object is not
         // null. This is valid for both immediate and delayed components
@@ -1585,7 +1585,7 @@
         }
     }
 
-    private boolean doInvokeBindMethod(S componentInstance, RefPair refPair)
+    private boolean doInvokeBindMethod(S componentInstance, RefPair<T> refPair)
     {
         MethodResult result = m_bindMethods.getBind().invoke( componentInstance, refPair, MethodResult.VOID, m_componentManager );
         if ( result == null )
@@ -1712,12 +1712,6 @@
         }
     }
     
-    private long getLockTimeout()
-    {
-        return m_componentManager.getLockTimeout();
-    }
-
-
     //------------- Service target filter support -----------------------------
 
     /**
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/EdgeInfo.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/EdgeInfo.java
index 0d33fb7..bc5be50 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/EdgeInfo.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/EdgeInfo.java
@@ -63,7 +63,7 @@
         return openLatch;
     }
     
-    public void waitForOpen(AbstractComponentManager m_componentManager, String componentName, String methodName)
+    public void waitForOpen(AbstractComponentManager<?> m_componentManager, String componentName, String methodName)
     {
         
         CountDownLatch latch = getOpenLatch();
@@ -71,7 +71,7 @@
         waitForLatch( m_componentManager, latch, componentName, methodName, latchName );
     }
 
-    public void waitForClose(AbstractComponentManager m_componentManager, String componentName, String methodName)
+    public void waitForClose(AbstractComponentManager<?> m_componentManager, String componentName, String methodName)
     {
         
         CountDownLatch latch = getCloseLatch();
@@ -79,7 +79,7 @@
         waitForLatch( m_componentManager, latch, componentName, methodName, latchName );
     }
 
-    private void waitForLatch(AbstractComponentManager m_componentManager, CountDownLatch latch, String componentName,
+    private void waitForLatch(AbstractComponentManager<?> m_componentManager, CountDownLatch latch, String componentName,
             String methodName, String latchName)
     {
         try
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/RegistrationManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/RegistrationManager.java
index adabae5..9e57e9f 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/RegistrationManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/RegistrationManager.java
@@ -19,7 +19,6 @@
 package org.apache.felix.scr.impl.manager;
 
 import java.util.ArrayList;
-import java.util.Dictionary;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
index bd0cc9c..0831bb8 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
@@ -22,7 +22,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.IdentityHashMap;
-import java.util.Iterator;
 
 import org.apache.felix.scr.impl.config.ComponentContainer;
 import org.apache.felix.scr.impl.helper.ActivateMethod;
@@ -32,7 +31,6 @@
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentConstants;
-import org.osgi.service.component.ComponentContext;
 import org.osgi.service.component.ComponentInstance;
 import org.osgi.service.log.LogService;
 
@@ -46,13 +44,13 @@
 
     // maintain the map of ComponentContext objects created for the
     // service instances
-    private IdentityHashMap<S, ComponentContextImpl> serviceContexts = new IdentityHashMap<S, ComponentContextImpl>();
+    private IdentityHashMap<S, ComponentContextImpl<S>> serviceContexts = new IdentityHashMap<S, ComponentContextImpl<S>>();
 
     /**
      * @param container ComponentHolder for configuration management
      * @param componentMethods
      */
-    public ServiceFactoryComponentManager( ComponentContainer container, ComponentMethods componentMethods )
+    public ServiceFactoryComponentManager( ComponentContainer<S> container, ComponentMethods componentMethods )
     {
         super( container, componentMethods );
     }
@@ -77,7 +75,7 @@
         {
             throw new IllegalStateException( "need write lock (deleteComponent)" );
         }
-        for (ComponentContextImpl componentContext: getComponentContexts() )
+        for (ComponentContextImpl<S> componentContext: getComponentContexts() )
         {
             disposeImplementationObject( componentContext, reason );
             log( LogService.LOG_DEBUG, "Unset implementation object for component {0} in deleteComponent for reason {1}", new Object[] { getName(), REASONS[ reason ] },  null );
@@ -188,11 +186,11 @@
         }
     }
 
-    private Collection<ComponentContextImpl> getComponentContexts()
+    private Collection<ComponentContextImpl<S>> getComponentContexts()
     {
         synchronized ( serviceContexts )
         {
-            return new ArrayList<ComponentContextImpl>( serviceContexts.values() );
+            return new ArrayList<ComponentContextImpl<S>>( serviceContexts.values() );
         }
     }
 
@@ -224,9 +222,9 @@
     {
         ModifiedMethod modifiedMethod = getComponentMethods().getModifiedMethod();
         MethodResult result = MethodResult.VOID;
-        for ( ComponentContextImpl componentContext : getComponentContexts() )
+        for ( ComponentContextImpl<S> componentContext : getComponentContexts() )
         {
-            Object instance = componentContext.getImplementationObject(true);
+            S instance = componentContext.getImplementationObject(true);
             result = modifiedMethod.invoke( instance,
                     new ActivateMethod.ActivatorParameter( componentContext, -1 ), MethodResult.VOID, this );
 
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
index 33944b6..730d6c6 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
@@ -213,7 +213,7 @@
     }
 
 
-    protected S createImplementationObject( Bundle usingBundle, SetImplementationObject setter )
+    protected S createImplementationObject( Bundle usingBundle, SetImplementationObject<S> setter )
     {
         final Class<S> implementationObjectClass;
         final S implementationObject;
@@ -244,7 +244,7 @@
             return null;
         }
         
-        ComponentContextImpl componentContext = new ComponentContextImpl(this, usingBundle, implementationObject);
+        ComponentContextImpl<S> componentContext = new ComponentContextImpl<S>(this, usingBundle, implementationObject);
 
         // 3. set the implementation object prematurely
         setter.presetComponentContext( componentContext );
@@ -278,7 +278,7 @@
         {
             // make sure, we keep no bindings. Only close the dm's we opened.
             boolean skip = true;
-            for ( DependencyManager md: getReversedDependencyManagers() )
+            for ( DependencyManager<S, ?> md: getReversedDependencyManagers() )
             {
                 if ( skip && failedDm == md )
                 {
@@ -303,7 +303,7 @@
         {
             // 112.5.8 If the activate method throws an exception, SCR must log an error message
             // containing the exception with the Log Service and activation fails
-            for ( DependencyManager md: getReversedDependencyManagers() )
+            for ( DependencyManager<S, ?> md: getReversedDependencyManagers() )
             {
                 md.close( implementationObject, componentContext.getEdgeInfo( md ) );
             }
@@ -344,7 +344,7 @@
                 setServiceProperties( result );
             }
             // 2. Unbind any bound services
-            for ( DependencyManager md: getReversedDependencyManagers() )
+            for ( DependencyManager<S, ?> md: getReversedDependencyManagers() )
             {
                 md.close( implementationObject, componentContext.getEdgeInfo( md ) );
             }
@@ -460,7 +460,7 @@
         return m_properties;
     }
 
-    public void setServiceProperties( Dictionary<String, Object> serviceProperties )
+    public void setServiceProperties( Dictionary<String, ?> serviceProperties )
     {
         if ( serviceProperties == null || serviceProperties.isEmpty() )
         {
@@ -488,7 +488,7 @@
 
     private void updateServiceRegistration()
     {
-        ServiceRegistration<?> sr = getServiceRegistration();
+        ServiceRegistration<S> sr = getServiceRegistration();
         if ( sr != null )
         {
             try
@@ -537,33 +537,6 @@
      */
     public void reconfigure( Map<String, Object> configuration, boolean configurationDeleted )
     {
-//        if ( targetedPID == null || !targetedPID.equals( m_targetedPID ) )
-//        {
-//            m_targetedPID = targetedPID;
-//            m_changeCount = -1;
-//        }
-//        if ( configuration != null )
-//        {
-//            if ( changeCount <= m_changeCount )
-//            {
-//                log( LogService.LOG_DEBUG,
-//                        "ImmediateComponentHolder out of order configuration updated for pid {0} with existing count {1}, new count {2}",
-//                        new Object[] { getConfigurationPid(), m_changeCount, changeCount }, null );
-//                return;
-//            }
-//            m_changeCount = changeCount;
-//        }
-//        else 
-//        {
-//            m_changeCount = -1;
-//        }
-//        // nothing to do if there is no configuration (see FELIX-714)
-//        if ( configuration == null && m_configurationProperties == null )
-//        {
-//            log( LogService.LOG_DEBUG, "No configuration provided (or deleted), nothing to do", null );
-//            return;
-//        }
-
         // store the properties
         m_configurationProperties = configuration;
 
@@ -589,18 +562,6 @@
                 return;
             }
 
-//            //TODO should be handled in Holder, not here
-//            // if the configuration has been deleted but configuration is required
-//            // this component must be deactivated
-//            if ( m_configurationProperties == null && getComponentMetadata().isConfigurationRequired() )
-//            {
-//                //deactivate and remove service listeners
-//                deactivateInternal( ComponentConstants.DEACTIVATION_REASON_CONFIGURATION_DELETED, true, false );
-//                //do not reset targets as that will reinstall the service listeners which may activate the component.
-//                //when a configuration arrives the properties will get set based on the new configuration.
-//                return;
-//            }
-
             // unsatisfied component and non-ignored configuration may change targets
             // to satisfy references
             obtainActivationWriteLock( "reconfigure" );
@@ -674,7 +635,7 @@
         // 3. check whether we can dynamically apply the configuration if
         // any target filters influence the bound services
         final Map<String, Object> props = getProperties();
-        for ( DependencyManager dm: getDependencyManagers() )
+        for ( DependencyManager<S, ?> dm: getDependencyManagers() )
         {
             if ( !dm.canUpdateDynamically( props ) )
             {
@@ -755,7 +716,7 @@
      * @return <code>true</code> if the registration service properties equals
      *         the prop properties, false if not.
      */
-    private boolean servicePropertiesMatches( ServiceRegistration reg, Dictionary<String, Object> props )
+    private boolean servicePropertiesMatches( ServiceRegistration<S> reg, Dictionary<String, Object> props )
     {
         Dictionary<String, Object> regProps = new Hashtable<String, Object>();
         String[] keys = reg.getReference().getPropertyKeys();
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java b/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java
index 62f7319..6788534 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java
@@ -19,7 +19,6 @@
 package org.apache.felix.scr.impl.metadata;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/metadata/XmlHandler.java b/scr/src/main/java/org/apache/felix/scr/impl/metadata/XmlHandler.java
index 45d866b..92326f6 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/metadata/XmlHandler.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/metadata/XmlHandler.java
@@ -24,12 +24,10 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import org.apache.felix.scr.impl.helper.Logger;
-import org.apache.felix.scr.impl.metadata.ServiceMetadata.Scope;
 import org.apache.felix.scr.impl.parser.KXml2SAXHandler;
 import org.apache.felix.scr.impl.parser.KXml2SAXParser.Attributes;
 import org.apache.felix.scr.impl.parser.ParseException;
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXHandler.java b/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXHandler.java
index 9a46f61..db9671b 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXHandler.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXHandler.java
@@ -18,8 +18,6 @@
  */

 package org.apache.felix.scr.impl.parser;

 

-import java.util.Properties;

-

 import org.apache.felix.scr.impl.parser.KXml2SAXParser.Attributes;

 

 /**

diff --git a/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXParser.java b/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXParser.java
index c9d2ad8..99d16dc 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXParser.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXParser.java
@@ -20,12 +20,9 @@
 

 

 import java.io.Reader;

-import java.util.Properties;

 import java.util.Stack;

 

-import org.apache.felix.scr.impl.helper.Logger;

 import org.kxml2.io.KXmlParser;

-import org.osgi.service.log.LogService;

 import org.xmlpull.v1.XmlPullParser;

 import org.xmlpull.v1.XmlPullParserException;

 

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 329d732..c7ddc6e 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
@@ -25,7 +25,6 @@
 import java.util.List;
 
 import org.apache.felix.scr.impl.ComponentRegistry;
-import org.apache.felix.scr.impl.config.ComponentContainer;
 import org.apache.felix.scr.impl.config.ComponentHolder;
 import org.apache.felix.scr.impl.config.ComponentManager;
 import org.apache.felix.scr.impl.config.ReferenceManager;
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java b/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
index 59cfb24..4215670 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
@@ -50,9 +50,6 @@
         final SingleComponentManager cmgr = getSingleManager( holder );
         assertNotNull( "Expect single component manager", cmgr );
         assertEquals( "Expect no other component manager list", 1, getComponentManagers( holder ).size());
-
-//        // assert no configuration of single component
-//        assertFalse( "Expect no configuration", cmgr.hasConfiguration() );
     }
 
 
@@ -69,9 +66,6 @@
         assertNotNull( "Expect single component manager", cmgr );
         assertEquals( "Expect no other component manager list", 1, getComponentManagers( holder ).size());
 
-//        // assert no configuration of single component
-//        assertFalse( "Expect no configuration", cmgr.hasConfiguration() );
-
         // configure with the singleton configuration
         final Dictionary config = new Hashtable();
         config.put( "value", name );
@@ -84,7 +78,6 @@
         assertEquals( "Expect no other component manager list", 1, getComponentManagers( holder ).size());
 
 //        // assert configuration of single component
-//        assertTrue( "Expect configuration after updating it", cmgrAfterConfig.hasConfiguration() );
         final Map componentConfig = ( ( MockImmediateComponentManager ) cmgrAfterConfig ).getConfiguration();
         assertEquals( "Expect exact configuration set", config, componentConfig );
 
@@ -115,9 +108,6 @@
         assertNotNull( "Expect single component manager", cmgr );
         assertEquals( "Expect no other component manager list", 1, getComponentManagers( holder ).size());
 
-//        // assert no configuration of single component
-//        assertFalse( "Expect no configuration", cmgr.hasConfiguration() );
-
         // configure with configuration
         final String pid1 = "test.factory.0001";
         final Dictionary config1 = new Hashtable();
@@ -140,20 +130,14 @@
         TargetedPID targetedPid2 = new TargetedPID(pid2);
 		holder.configurationUpdated( targetedPid2, targetedFactoryPid, config2, 1 );
 
-        // assert single component and single-entry map
-//        final SingleComponentManager cmgrAfterConfig2 = getSingleManager( holder );
         final List<SingleComponentManager> cmgrsAfterConfig2 = getComponentManagers( holder );
-//        assertNotNull( "Expect single component manager", cmgrAfterConfig2 );
         assertNotNull( "Expect component manager list", cmgrsAfterConfig2 );
         assertEquals( "Expect two component manager in list", 2, cmgrsAfterConfig2.size() );
 
         // remove second configuration
         holder.configurationDeleted( targetedPid2, targetedFactoryPid );
 
-        // assert single component and single-entry map
-//        final SingleComponentManager cmgrAfterUnConfig2 = getSingleManager( holder );
         final List<SingleComponentManager> cmgrsAfterUnConfig2 = getComponentManagers( holder );
-//        assertNotNull( "Expect single component manager", cmgrAfterUnConfig2 );
         assertNotNull( "Expect component manager list", cmgrsAfterUnConfig2 );
 //TODO Multipids fix correct assertion        assertEquals( "Expect one component manager in list", 1, cmgrsAfterUnConfig2.size() );
 
@@ -162,9 +146,7 @@
         holder.configurationDeleted( targetedPid1, targetedFactoryPid );
 
         // assert single component and single-entry map
-//        final SingleComponentManager cmgrAfterConfigUnconfig = getSingleManager( holder );
         final List<SingleComponentManager> cmgrsAfterConfigUnconfig = getComponentManagers( holder );
-//        assertNotNull( "Expect single component manager", cmgrAfterConfigUnconfig );
         assertNotNull( "Expect component manager list", cmgrsAfterConfigUnconfig );
 //TODO Multipids fix correct assertion        assertEquals( "Expect one component manager in list", 1, cmgrsAfterConfigUnconfig.size() );
 
@@ -172,7 +154,6 @@
         holder.configurationDeleted( targetedPid2, targetedFactoryPid );
 
         // assert single component and single-entry map
-//        final SingleComponentManager cmgrAfterAllUnconfig = getSingleManager( holder );
         final List<SingleComponentManager> cmgrsAfterAllUnconfig = getComponentManagers( holder );
         assertNotNull( "Expect single component manager", cmgrsAfterAllUnconfig );
 //TODO Multipids fix correct assertion        assertEquals( "Expect no component manager list", 1, cmgrsAfterAllUnconfig.size() );
@@ -196,36 +177,12 @@
     	List<SingleComponentManager> managers = getComponentManagers(holder);
     	assertEquals(1, managers.size());
     	return managers.get(0);
-//        try
-//        {
-//            final Field f = ConfigurableComponentHolder.class.getDeclaredField( "m_singleComponent" );
-//            f.setAccessible( true );
-//            return ( SingleComponentManager ) f.get( holder );
-//        }
-//        catch ( Throwable t )
-//        {
-//            fail( "Cannot access getComponentManagers method: " + t );
-//            return null; // compiler does not know about "fail" throwing
-//        }
     }
 
 
     private static List<SingleComponentManager> getComponentManagers( ConfigurableComponentHolder holder )
     {
     	return holder.getComponentManagers(false);
-//        try
-//        {
-//            final Method m = ConfigurableComponentHolder.class.getDeclaredMethod( "getComponentManagers", new Class[]
-//                { Boolean.TYPE } );
-//            m.setAccessible( true );
-//            return ( SingleComponentManager[] ) m.invoke( holder, new Object[]
-//                { Boolean.FALSE } );
-//        }
-//        catch ( Throwable t )
-//        {
-//            fail( "Cannot access getComponentManagers method: " + t );
-//            return null; // compiler does not know about "fail" throwing
-//        }
     }
 
     private static class TestingConfiguredComponentHolder extends ConfigurableComponentHolder
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/manager/AbstractComponentManagerTest.java b/scr/src/test/java/org/apache/felix/scr/impl/manager/AbstractComponentManagerTest.java
index 3733c22..209ac07 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/manager/AbstractComponentManagerTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/manager/AbstractComponentManagerTest.java
@@ -28,11 +28,11 @@
 
     public void test_copyTo_withoutExclusions()
     {
-        final Hashtable ht = new Hashtable();
+        final Hashtable<String, String> ht = new Hashtable<String, String>();
         ht.put( "p1", "v1" );
         ht.put( "p.2", "v2" );
         ht.put( ".p3", "v3" );
-        final Map dict = AbstractComponentManager.copyToMap( ht, true );
+        final Map<String, Object> dict = AbstractComponentManager.copyToMap( ht, true );
         assertNotNull( "Copy result is not null", dict );
         assertEquals( "Number of items", 3, dict.size() );
         assertEquals( "Value for key p1", "v1", dict.get( "p1" ) );
@@ -42,11 +42,11 @@
 
     public void test_copyTo_excludingStartingWithDot()
     {
-        final Hashtable ht = new Hashtable();
+        final Hashtable<String, String> ht = new Hashtable<String, String>();
         ht.put( "p1", "v1" );
         ht.put( "p.2", "v2" );
         ht.put( ".p3", "v3" );
-        final Map dict = AbstractComponentManager.copyToMap( ht, false );
+        final Map<String, Object> dict = AbstractComponentManager.copyToMap( ht, false );
         assertNotNull( "Copy result is not null", dict );
         assertEquals( "Number of items", 2, dict.size() );
         assertEquals( "Value for key p1", "v1", dict.get( "p1" ) );
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/CircularReferenceTest.java b/scr/src/test/java/org/apache/felix/scr/integration/CircularReferenceTest.java
index ea83841..c046817 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/CircularReferenceTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/CircularReferenceTest.java
@@ -109,12 +109,6 @@
         String componentNameB = "4.B.0.n.dynamic";
         final ComponentConfigurationDTO componentB = findComponentConfigurationByName( componentNameB, ComponentConfigurationDTO.SATISFIED );
 
-//        ServiceReference[] serviceReferences = bundleContext.getServiceReferences( A.class.getName(), "(service.pid=" + componentNameA + ")" );
-//        TestCase.assertEquals( 1, serviceReferences.length );
-//        ServiceReference serviceReference = serviceReferences[0];
-//        Object service = bundleContext.getService( serviceReference );
-//        assertNotNull( service );
-
         delay();
 
         A a = getServiceFromConfiguration(componentA, A.class);
@@ -160,11 +154,6 @@
         delay();
         enableAndCheck(componentA.description);
         delay();
-//        ServiceReference[] serviceReferencesA1 = bundleContext.getServiceReferences( A.class.getName(), "(service.pid=" + componentNameA + ")" );
-//        TestCase.assertEquals( 1, serviceReferencesA1.length );
-//        ServiceReference serviceReferenceA1 = serviceReferencesA1[0];
-//        Object serviceA1 = bundleContext.getService( serviceReferenceA1 );
-//        assertNotNull( serviceA1 );
 
         //new component.id, refetch configuration.
         componentA = findComponentConfigurationByName( componentNameA, ComponentConfigurationDTO.ACTIVE );
@@ -270,11 +259,6 @@
         delay();
         enableAndCheck(componentA.description);
         delay();
-//        ServiceReference[] serviceReferencesA1 = bundleContext.getServiceReferences( A.class.getName(), "(service.pid=" + componentNameA + ")" );
-//        TestCase.assertEquals( 1, serviceReferencesA1.length );
-//        ServiceReference serviceReferenceA1 = serviceReferencesA1[0];
-//        Object serviceA1 = bundleContext.getService( serviceReferenceA1 );
-//        assertNotNull( serviceA1 );
 
         //new component.id, refetch configuration.
         componentA = findComponentConfigurationByName( componentNameA, ComponentConfigurationDTO.ACTIVE );
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ComponentDisposeTest.java b/scr/src/test/java/org/apache/felix/scr/integration/ComponentDisposeTest.java
index 587e9f5..cc808e5 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/ComponentDisposeTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/ComponentDisposeTest.java
@@ -53,22 +53,6 @@
         delay();
 
         getConfigurationsDisabledThenEnable(factoryPid, 0, ComponentConfigurationDTO.ACTIVE);//there should be none
-//        // one single component exists without configuration
-//        final Component[] noConfigurations = findComponentConfigurationsByName( factoryPid, -1 );
-//        TestCase.assertNotNull( noConfigurations );
-//        TestCase.assertEquals( 1, noConfigurations.length );
-//        TestCase.assertEquals( Component.STATE_DISABLED, noConfigurations[0].getState() );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.isEmpty() );
-//
-//        // enable the component, configuration required, hence unsatisfied
-//        noConfigurations[0].enable();
-//        delay();
-//
-//        final Component[] enabledNoConfigs = findComponentConfigurationsByName( factoryPid, -1 );
-//        TestCase.assertNotNull( enabledNoConfigs );
-//        TestCase.assertEquals( 1, enabledNoConfigs.length );
-//        TestCase.assertEquals( Component.STATE_UNSATISFIED, enabledNoConfigs[0].getState() );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.isEmpty() );
 
         // create two factory configurations expecting two components
         final String pid0 = createFactoryConfiguration( factoryPid );
@@ -78,51 +62,11 @@
         Collection<ComponentConfigurationDTO> ccs = findComponentConfigurationsByName(factoryPid, ComponentConfigurationDTO.ACTIVE);
 		Assert.assertEquals(2, ccs.size());
         // expect two components, only first is active, second is disabled
-//        final Component[] twoConfigs = findComponentConfigurationsByName( factoryPid, -1 );
-//        TestCase.assertNotNull( twoConfigs );
-//        TestCase.assertEquals( 2, twoConfigs.length );
-//
-//        // find the active and inactive configs, fail if none
-//        int activeConfig;
-//        int inactiveConfig;
-//        if ( twoConfigs[0].getState() == Component.STATE_ACTIVE )
-//        {
-//            // [0] is active, [1] expected disabled
-//            activeConfig = 0;
-//            inactiveConfig = 1;
-//        }
-//        else if ( twoConfigs[1].getState() == Component.STATE_ACTIVE )
-//        {
-//            // [1] is active, [0] expected disabled
-//            activeConfig = 1;
-//            inactiveConfig = 0;
-//        }
-//        else
-//        {
-//            TestCase.fail( "One of two components expected active" );
-//            return; // eases the compiler...
-//        }
-//
-//        TestCase.assertEquals( Component.STATE_ACTIVE, twoConfigs[activeConfig].getState() );
-//        TestCase.assertEquals( Component.STATE_DISABLED, twoConfigs[inactiveConfig].getState() );
         TestCase.assertEquals( 2, SimpleComponent.INSTANCES.size() );
         for (ComponentConfigurationDTO cc: ccs)
         {
         	TestCase.assertTrue(SimpleComponent.INSTANCES.containsKey(cc.id));
         }
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( twoConfigs[activeConfig].getId() ) );
-//        TestCase.assertFalse( SimpleComponent.INSTANCES.containsKey( twoConfigs[inactiveConfig].getId() ) );
-
-        // enable second component
-//        twoConfigs[inactiveConfig].enable();
-//        delay();
-//
-//        // ensure both components active
-//        TestCase.assertEquals( Component.STATE_ACTIVE, twoConfigs[0].getState() );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, twoConfigs[1].getState() );
-//        TestCase.assertEquals( 2, SimpleComponent.INSTANCES.size() );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( twoConfigs[0].getId() ) );
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( twoConfigs[1].getId() ) );
 
         // dispose an instance
         final SimpleComponent anInstance = SimpleComponent.INSTANCE;
@@ -134,41 +78,12 @@
         // expect one component
         ComponentConfigurationDTO cc = findComponentConfigurationByName(factoryPid, ComponentConfigurationDTO.ACTIVE);
 
-//        final Component[] oneConfig = findComponentConfigurationsByName( factoryPid, -1 );
-//        TestCase.assertNotNull( oneConfig );
-//        TestCase.assertEquals( 1, oneConfig.length );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, oneConfig[0].getState() );
         TestCase.assertEquals( 1, SimpleComponent.INSTANCES.size() );
     	TestCase.assertTrue(SimpleComponent.INSTANCES.containsKey(cc.id));
-//        TestCase.assertTrue( SimpleComponent.INSTANCES.containsKey( oneConfig[0].getId() ) );
 
         final SimpleComponent instance = SimpleComponent.INSTANCES.values().iterator().next();
 
-//        final Object holder = getComponentHolder( instance.m_activateContext );
-//        TestCase.assertNotNull( holder );
-//
-//        Map<?, ?> m_components = ( Map<?, ?> ) getFieldValue( holder, "m_components" );
-//        TestCase.assertNotNull( m_components );
-//        TestCase.assertEquals( 1, m_components.size() );
     }
 
 
-//    private static Object getComponentHolder( ComponentContext ctx )
-//    {
-//        try
-//        {
-//            final Class<?> ccImpl = getType( ctx, "ComponentContextImpl" );
-//            final Field m_componentManager = getField( ccImpl, "m_componentManager" );
-//            final Object acm = m_componentManager.get( ctx );
-//
-//            final Class<?> cmImpl = getType( acm, "SingleComponentManager" );
-//            final Field m_componentHolder = getField( cmImpl, "m_componentHolder" );
-//            return m_componentHolder.get( acm );
-//        }
-//        catch ( Throwable t )
-//        {
-//            TestCase.fail( "Cannot get ComponentHolder for " + ctx + ": " + t );
-//            return null; // keep the compiler happy
-//        }
-//    }
 }
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 1a39e73..a7d3a23 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
@@ -286,11 +286,6 @@
     {
     	return findComponentConfigurationByName( bundle, name, expected );
     }
-//    protected ComponentConfigurationDTO checkState( String name, int expected)
-//    {
-//    	ComponentConfigurationDTO cc = findComponentConfigurationByName( name, expected);
-//    	return cc;
-//    }
     
     static final Map<Integer, String> STATES = new HashMap<Integer, String>();
     
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ConfigurationChangeTest.java b/scr/src/test/java/org/apache/felix/scr/integration/ConfigurationChangeTest.java
index a5b18f7..a868d93 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/ConfigurationChangeTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/ConfigurationChangeTest.java
@@ -268,7 +268,6 @@
         configure( pid );
 
         getDisabledConfigurationAndEnable(pid, ComponentConfigurationDTO.ACTIVE); //?????? Not clear what should happen.
-//        TestCase.assertEquals( Component.STATE_FACTORY, component.getState() );
         
         // create a component instance
         final ServiceReference[] refs = bundleContext.getServiceReferences( ComponentFactory.class.getName(), "("
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/Felix4350Test.java b/scr/src/test/java/org/apache/felix/scr/integration/Felix4350Test.java
index eaaf6f3..afa3d85 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/Felix4350Test.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/Felix4350Test.java
@@ -89,15 +89,11 @@
         dep1Reg.unregister();
         delay(2000); //dep2 getService has returned
 
-//        ComponentInstance mainCompInst = main.getComponentInstance();
-//        TestCase.assertNull(mainCompInst);
         Felix4350Component.check(0, 0, false);
 
         dep1Reg = register(new SimpleComponent(), 0);
         delay(300);
 
-//        mainCompInst = main.getComponentInstance();
-//        TestCase.assertNotNull(mainCompInst);
         Felix4350Component.check(1, 0, true);
 
         disableAndCheck(main);  //does not need to be asyncv??
@@ -116,8 +112,6 @@
         dep1Reg = register(new SimpleComponent(), 0);
         delay(2000);
 
-//        mainCompInst = main.getComponentInstance();
-//        TestCase.assertNotNull(mainCompInst);
         Felix4350Component.check(2, 1, true); //n.b. counts are cumulative
     }
     
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/LocationTest.java b/scr/src/test/java/org/apache/felix/scr/integration/LocationTest.java
index 231a3d7..4975d23 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/LocationTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/LocationTest.java
@@ -68,19 +68,11 @@
         Bundle b2 = installBundle( descriptorFile, COMPONENT_PACKAGE, "simplecomponent2", "0.0.11", null );
         b2.start();
         checkConfigurationCount(b2, pid, 0, -1);
-//        Component[] components = findComponentConfigurationsByName( pid, -1 );
-//        TestCase.assertEquals( 2, components.length );
-//        Component c2 = components[0] == component? components[1]: components[0];
-//        
-//        c2.enable();
-//        delay();
-//        TestCase.assertEquals( Component.STATE_UNSATISFIED, c2.getState() );
         
         bundle.stop();
         delay();
         
         checkConfigurationCount(b2, pid, 0, -1);
-//        TestCase.assertEquals( Component.STATE_UNSATISFIED, c2.getState() );
 
         ConfigurationListener listener = new ConfigurationListener() {
 
@@ -118,7 +110,6 @@
         delay();
 
         findComponentConfigurationByName(pid, ComponentConfigurationDTO.ACTIVE);
-//        TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
         TestCase.assertNotNull( SimpleComponent.INSTANCE );
         TestCase.assertEquals( PROP_NAME, SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
         
@@ -126,19 +117,11 @@
         Bundle b2 = installBundle( descriptorFile, COMPONENT_PACKAGE, "simplecomponent2", "0.0.11", null );
         b2.start();
         checkConfigurationCount(b2, pid, 0, -1);
-//        Component[] components = findComponentConfigurationsByName( pid, -1 );
-//        TestCase.assertEquals( 2, components.length );
-//        Component c2 = components[0] == component? components[1]: components[0];
-//        
-//        c2.enable();
-//        delay();
-//        TestCase.assertEquals( Component.STATE_UNSATISFIED, c2.getState() );
         
         bundle.stop();
         delay();
         
         checkConfigurationCount(b2, pid, 0, -1);
-//        TestCase.assertEquals( Component.STATE_UNSATISFIED, c2.getState() );
 
         ConfigurationListener listener = new ConfigurationListener() {
 
@@ -158,7 +141,6 @@
         if ( eventReceived )
         {
             checkConfigurationCount(b2, pid, 1, ComponentConfigurationDTO.ACTIVE);
-//            TestCase.assertEquals( Component.STATE_ACTIVE, c2.getState() );
         }
         
         sr.unregister();
@@ -187,22 +169,14 @@
         delay();
 
         findComponentConfigurationByName(pid,  ComponentConfigurationDTO.ACTIVE);
-//        TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
         TestCase.assertNotNull( SimpleComponent.INSTANCE );
         TestCase.assertEquals( PROP_NAME, SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
         
         
         Bundle b2 = installBundle( descriptorFile, COMPONENT_PACKAGE, "simplecomponent2", "0.0.11", null );
         b2.start();
-//        Component[] components = findComponentConfigurationsByName( pid, -1 );
-//        TestCase.assertEquals( 2, components.length );
-//        Component c2 = components[0] == component? components[1]: components[0];
-//        
-//        c2.enable();
-//        delay();
         checkConfigurationCount(b2, pid, 1, ComponentConfigurationDTO.ACTIVE);
-//        getDisabledConfigurationAndEnable(b2, pid, ComponentConfigurationDTO.ACTIVE);
-//        TestCase.assertEquals( Component.STATE_ACTIVE, c2.getState() );
+
     }
 
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindGreedyTest.java b/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindGreedyTest.java
index 675649e..2546f04 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindGreedyTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindGreedyTest.java
@@ -183,7 +183,6 @@
         // no delay, should be immediate
 
         findComponentConfigurationByName(name, ComponentConfigurationDTO.UNSATISFIED);
-//        findComponentConfigurationByName(name, ComponentConfigurationDTO.UNSATISFIED);
         final SimpleComponent comp11 = SimpleComponent.INSTANCE;
         TestCase.assertNull( comp11 );
 
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindTest.java b/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindTest.java
index fd540a9..2be9ade 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindTest.java
@@ -183,7 +183,6 @@
         // no delay, should be immediate
 
         findComponentConfigurationByName(name, ComponentConfigurationDTO.UNSATISFIED);
-//        findComponentConfigurationByName(name, ComponentConfigurationDTO.UNSATISFIED);
         final SimpleComponent comp11 = SimpleComponent.INSTANCE;
         TestCase.assertNull( comp11 );
 
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ServiceComponentTest.java b/scr/src/test/java/org/apache/felix/scr/integration/ServiceComponentTest.java
index 597217a..5c4e6ba 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/ServiceComponentTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/ServiceComponentTest.java
@@ -155,15 +155,6 @@
     public void test_DelayedSimpleComponent_service_keep_instance() throws IOException
     {
         // configure SCR to keep instances
-//        Configuration scrConfig = getConfigurationAdmin().getConfiguration( ScrConfiguration.PID, null );
-//        Dictionary props = scrConfig.getProperties();
-//        if ( props == null )
-//        {
-//            props = new Hashtable();
-//        }
-//        props.put( ScrConfiguration.PROP_DELAYED_KEEP_INSTANCES, Boolean.TRUE.toString() );
-//        scrConfig.update( props );
-//        delay();
 
         final String pid = "DelayedKeepInstancesServiceComponent";
 
@@ -194,7 +185,5 @@
         findComponentConfigurationByName(pid, ComponentConfigurationDTO.ACTIVE);
         TestCase.assertNotNull( SimpleComponent.INSTANCE );
 
-        // delete the SCR configuration again
-//        scrConfig.delete();
     }
 }
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/TargetedPIDTest.java b/scr/src/test/java/org/apache/felix/scr/integration/TargetedPIDTest.java
index 43e4caa..864f407 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/TargetedPIDTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/TargetedPIDTest.java
@@ -46,7 +46,6 @@
     private static final String TARGETED_PID = "targetedPID";
     private static final String COMPONENT_NAME = "SimpleComponent.configuration.require";
     private static final String REGION = "?foo";
-//    private boolean eventReceived;
 
     static
     {
@@ -95,7 +94,6 @@
         
         final ComponentConfigurationDTO component = findComponentConfigurationByName( COMPONENT_NAME, ComponentConfigurationDTO.ACTIVE );
         known.add( component );
-//        component.enable();
 
         TestCase.assertNotNull( SimpleComponent.INSTANCE );
         SimpleComponent sc = SimpleComponent.INSTANCE;
@@ -107,33 +105,19 @@
         findComponentConfigurationByName( bSN, pid, ComponentConfigurationDTO.ACTIVE );
 
         
-//        cSN.enable();
-//        delay();
-//        TestCase.assertEquals( Component.STATE_ACTIVE, cSN.getState() );
         SimpleComponent scSN = SimpleComponent.INSTANCE;
         TestCase.assertEquals( pidSN, scSN.getProperty( TARGETED_PID ) );
         
         Bundle bSNV = installBundle( descriptorFile, COMPONENT_PACKAGE, "simplecomponent2", "0.0.12", null );
         bSNV.start();
         findComponentConfigurationByName( bSNV, pid, ComponentConfigurationDTO.ACTIVE );
-//        TestCase.assertEquals( 3, components.size() );
-//        ComponentConfigurationDTO cSNV = getNewComponent( known, components ); 
-        
-//        cSNV.enable();
-//        delay();
-//        TestCase.assertEquals( Component.STATE_ACTIVE, cSNV.getState() );
         SimpleComponent scSNV = SimpleComponent.INSTANCE;
         TestCase.assertEquals( pidSNV, scSNV.getProperty( TARGETED_PID ) );
         
         Bundle bSNVL = installBundle( descriptorFile, COMPONENT_PACKAGE, "simplecomponent2", "0.0.12", "bundleLocation" );
         bSNVL.start();
         findComponentConfigurationsByName( bSNVL, pid, ComponentConfigurationDTO.ACTIVE );
-//        TestCase.assertEquals( 4, components.size() );
-//        ComponentConfigurationDTO cSNVL = getNewComponent( known, components ); 
-        
-//        cSNVL.enable();
-//        delay();
-//        TestCase.assertEquals( Component.STATE_ACTIVE, cSNVL.getState() );
+
         SimpleComponent scSNVL = SimpleComponent.INSTANCE;
         TestCase.assertEquals( pidSNVL, scSNVL.getProperty( TARGETED_PID ) );
         
@@ -142,42 +126,25 @@
         configSNVL.delete();
         delay();
         findComponentConfigurationsByName( bSNVL, pid, ComponentConfigurationDTO.ACTIVE );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, cSNVL.getState() );
         TestCase.assertEquals( pidSNV, scSNVL.getProperty( TARGETED_PID ) );
         
         configSNV.delete();
         delay();
         findComponentConfigurationsByName( bSNVL, pid, ComponentConfigurationDTO.ACTIVE );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, cSNVL.getState() );
         TestCase.assertEquals( pidSN, scSNVL.getProperty( TARGETED_PID ) );
         findComponentConfigurationByName( bSNV, pid, ComponentConfigurationDTO.ACTIVE );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, cSNV.getState() );
         TestCase.assertEquals( pidSN, scSNV.getProperty( TARGETED_PID ) );
         
         configSN.delete();
         delay();
         findComponentConfigurationsByName( bSNVL, pid, ComponentConfigurationDTO.ACTIVE );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, cSNVL.getState() );
         TestCase.assertEquals( pid, scSNVL.getProperty( TARGETED_PID ) );
         findComponentConfigurationByName( bSNV, pid, ComponentConfigurationDTO.ACTIVE );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, cSNV.getState() );
         TestCase.assertEquals( pid, scSNV.getProperty( TARGETED_PID ) );
         findComponentConfigurationByName( bSN, pid, ComponentConfigurationDTO.ACTIVE );
-//        TestCase.assertEquals( Component.STATE_ACTIVE, cSN.getState() );
         TestCase.assertEquals( pid, scSN.getProperty( TARGETED_PID ) );
         
         
     }
 
-
-//    private ComponentConfigurationDTO getNewComponent(Set<ComponentConfigurationDTO> known, Collection<ComponentConfigurationDTO> components)
-//    {
-//        List<ComponentConfigurationDTO> cs = new ArrayList(Arrays.asList( components )); 
-//        cs.removeAll( known );
-//        ComponentConfigurationDTO c = cs.get( 0 );
-//        known.add(c);
-//        return c;
-//    }
-
-
 }