felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1532922 - in /felix/trunk/scr/src: main/java/org/apache/felix/scr/impl/ main/java/org/apache/felix/scr/impl/config/ main/java/org/apache/felix/scr/impl/manager/ test/java/org/apache/felix/scr/impl/config/ test/java/org/apache/felix/scr/imp...
Date Wed, 16 Oct 2013 22:05:13 GMT
Author: djencks
Date: Wed Oct 16 22:05:12 2013
New Revision: 1532922

URL: http://svn.apache.org/r1532922
Log:
FELIX-4286 remove unnecessary DelayedComponentManager class and improve some class names

Added:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
  (contents, props changed)
      - copied, changed from r1532897, felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
  (contents, props changed)
      - copied, changed from r1532897, felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
Removed:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DelayedComponentManager.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentContextImpl.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentDisposeTest.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java Wed Oct
16 22:05:12 2013
@@ -35,7 +35,7 @@ import org.apache.felix.scr.Component;
 import org.apache.felix.scr.ScrService;
 import org.apache.felix.scr.impl.config.ComponentHolder;
 import org.apache.felix.scr.impl.config.ConfigurationSupport;
-import org.apache.felix.scr.impl.config.ImmediateComponentHolder;
+import org.apache.felix.scr.impl.config.ConfigurableComponentHolder;
 import org.apache.felix.scr.impl.manager.AbstractComponentManager;
 import org.apache.felix.scr.impl.manager.ComponentFactoryImpl;
 import org.apache.felix.scr.impl.manager.ConfigurationComponentFactoryImpl;
@@ -555,7 +555,7 @@ public class ComponentRegistry implement
         }
         else
         {
-            holder = new ImmediateComponentHolder(activator, metadata);
+            holder = new ConfigurableComponentHolder(activator, metadata);
         }
 
         return holder;

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java Wed
Oct 16 22:05:12 2013
@@ -24,7 +24,7 @@ import java.util.Dictionary;
 import org.apache.felix.scr.Component;
 import org.apache.felix.scr.impl.BundleComponentActivator;
 import org.apache.felix.scr.impl.TargetedPID;
-import org.apache.felix.scr.impl.manager.ImmediateComponentManager;
+import org.apache.felix.scr.impl.manager.SingleComponentManager;
 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
 
 
@@ -125,5 +125,5 @@ public interface ComponentHolder
      * Informs the holder that the component has been disposed as a result of
      * calling the dispose method.
      */
-    void disposed( ImmediateComponentManager component );
+    void disposed( SingleComponentManager component );
 }

Copied: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
(from r1532897, felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java)
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java?p2=felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java&p1=felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java&r1=1532897&r2=1532922&rev=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
Wed Oct 16 22:05:12 2013
@@ -30,8 +30,7 @@ import org.apache.felix.scr.impl.BundleC
 import org.apache.felix.scr.impl.TargetedPID;
 import org.apache.felix.scr.impl.helper.ComponentMethods;
 import org.apache.felix.scr.impl.helper.SimpleLogger;
-import org.apache.felix.scr.impl.manager.DelayedComponentManager;
-import org.apache.felix.scr.impl.manager.ImmediateComponentManager;
+import org.apache.felix.scr.impl.manager.SingleComponentManager;
 import org.apache.felix.scr.impl.manager.ServiceFactoryComponentManager;
 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
 import org.osgi.service.component.ComponentConstants;
@@ -39,14 +38,9 @@ import org.osgi.service.log.LogService;
 
 
 /**
- * The <code>ConfiguredComponentHolder</code> class is a
- * {@link ComponentHolder} for one or more components instances configured by
- * singleton or factory configuration objects received from the Configuration
- * Admin service.
- * <p>
- * This holder is used only for components configured (optionally or required)
- * by the Configuration Admin service. It is not used for components declared
- * as ignoring configuration or if no Configuration Admin service is available.
+ * The <code>ImmediateComponentHolder</code> class is a
+ * {@link ComponentHolder} for automatically configured components instances 
+ * that may or may not be configured through Config Admin.
  * <p>
  * The holder copes with three situations:
  * <ul>
@@ -59,7 +53,7 @@ import org.osgi.service.log.LogService;
  * <code>service.factoryPid</code> equals the component name.</li>
  * </ul>
  */
-public class ImmediateComponentHolder<S> implements ComponentHolder, SimpleLogger
+public class ConfigurableComponentHolder<S> implements ComponentHolder, SimpleLogger
 {
 
     /**
@@ -78,7 +72,7 @@ public class ImmediateComponentHolder<S>
      * The values are the {@link ImmediateComponentManager<S> component instances}
      * created on behalf of the configurations.
      */
-    private final Map<String, ImmediateComponentManager<S>> m_components;
+    private final Map<String, SingleComponentManager<S>> m_components;
 
     /**
      * The special component used if there is no configuration or a singleton
@@ -96,7 +90,7 @@ public class ImmediateComponentHolder<S>
      * by this field is also contained in the map</li>
      * <ul>
      */
-    private ImmediateComponentManager<S> m_singleComponent;
+    private SingleComponentManager<S> m_singleComponent;
 
     /**
      * Whether components have already been enabled by calling the
@@ -108,44 +102,33 @@ public class ImmediateComponentHolder<S>
     private volatile boolean m_enabled;
     private final ComponentMethods m_componentMethods;    
 
-    public ImmediateComponentHolder( final BundleComponentActivator activator, final ComponentMetadata
metadata )
+    public ConfigurableComponentHolder( final BundleComponentActivator activator, final ComponentMetadata
metadata )
     {
         this.m_activator = activator;
         this.m_componentMetadata = metadata;
-        this.m_components = new HashMap<String, ImmediateComponentManager<S>>();
+        this.m_components = new HashMap<String, SingleComponentManager<S>>();
         this.m_componentMethods = new ComponentMethods();
         this.m_singleComponent = createComponentManager();
         this.m_enabled = false;
     }
 
-    protected ImmediateComponentManager<S> createComponentManager()
+    protected SingleComponentManager<S> createComponentManager()
     {
 
-        ImmediateComponentManager<S> manager;
+        SingleComponentManager<S> manager;
         if ( m_componentMetadata.isFactory() )
         {
             throw new IllegalArgumentException( "Cannot create component factory for " +
m_componentMetadata.getName() );
         }
-        else if ( m_componentMetadata.isImmediate() )
+        else if ( m_componentMetadata.getServiceMetadata() != null && m_componentMetadata.getServiceMetadata().isServiceFactory()
)
         {
-            manager = new ImmediateComponentManager<S>( m_activator, this, m_componentMetadata,
m_componentMethods );
-        }
-        else if ( m_componentMetadata.getServiceMetadata() != null )
-        {
-            if ( m_componentMetadata.getServiceMetadata().isServiceFactory() )
-            {
-                manager = new ServiceFactoryComponentManager<S>( m_activator, this,
m_componentMetadata, m_componentMethods );
-            }
-            else
-            {
-                manager = new DelayedComponentManager<S>( m_activator, this, m_componentMetadata,
m_componentMethods );
-            }
+            manager = new ServiceFactoryComponentManager<S>( m_activator, this, m_componentMetadata,
m_componentMethods );
         }
+
         else
         {
-            // if we get here, which is not expected after all, we fail
-            throw new IllegalArgumentException( "Cannot create a component manager for "
-                + m_componentMetadata.getName() );
+            //immediate or delayed
+            manager = new SingleComponentManager<S>( m_activator, this, m_componentMetadata,
m_componentMethods );
         }
 
         return manager;
@@ -190,7 +173,7 @@ public class ImmediateComponentHolder<S>
                 new Object[] {pid}, null);
 
         // component to deconfigure or dispose of
-        final ImmediateComponentManager icm;
+        final SingleComponentManager icm;
         boolean deconfigure = false;
 
         synchronized ( m_components )
@@ -275,7 +258,7 @@ public class ImmediateComponentHolder<S>
                 new Object[] {pid, props}, null);
 
         // component to update or create
-        final ImmediateComponentManager icm;
+        final SingleComponentManager icm;
         final String message;
         final boolean enable;
         Object[] notEnabledArguments = null;
@@ -298,7 +281,7 @@ public class ImmediateComponentHolder<S>
             }
             else
             {
-                final ImmediateComponentManager existingIcm = m_components.get( pid );
+                final SingleComponentManager existingIcm = m_components.get( pid );
                 if ( existingIcm != null )
                 {
                     // factory configuration updated for existing component instance
@@ -363,7 +346,7 @@ public class ImmediateComponentHolder<S>
     public synchronized long getChangeCount( String pid)
     {
         
-        ImmediateComponentManager icm =  pid.equals( getComponentMetadata().getConfigurationPid())?

+        SingleComponentManager icm =  pid.equals( getComponentMetadata().getConfigurationPid())?

                 m_singleComponent: m_components.get( pid );
         return icm == null? -1: icm.getChangeCount();
     }
@@ -380,17 +363,17 @@ public class ImmediateComponentHolder<S>
 
     public void enableComponents( final boolean async )
     {
-        ImmediateComponentManager[] cms;
+        SingleComponentManager[] cms;
         synchronized ( m_components )
         {
             m_enabled = true;
             cms = getComponentManagers( false );
             if ( cms == null )
             {
-                cms = new ImmediateComponentManager[] { m_singleComponent };
+                cms = new SingleComponentManager[] { m_singleComponent };
             }
         }
-        for ( ImmediateComponentManager cm : cms )
+        for ( SingleComponentManager cm : cms )
         {
             cm.enable( async );
         }
@@ -399,7 +382,7 @@ public class ImmediateComponentHolder<S>
 
     public void disableComponents( final boolean async )
     {
-        ImmediateComponentManager[] cms;
+        SingleComponentManager[] cms;
         synchronized ( m_components )
         {
             m_enabled = false;
@@ -407,10 +390,10 @@ public class ImmediateComponentHolder<S>
             cms = getComponentManagers( false );
             if ( cms == null )
             {
-                cms = new ImmediateComponentManager[] { m_singleComponent };
+                cms = new SingleComponentManager[] { m_singleComponent };
             }
         }
-        for ( ImmediateComponentManager cm : cms )
+        for ( SingleComponentManager cm : cms )
         {
             cm.disable( async );
         }
@@ -419,28 +402,28 @@ public class ImmediateComponentHolder<S>
 
     public void disposeComponents( final int reason )
     {
-        ImmediateComponentManager[] cms;
+        SingleComponentManager[] cms;
         synchronized ( m_components )
         {
             // FELIX-1733: get a copy of the single component and clear
             // the field to prevent recreation in disposed(ICM)
-            final ImmediateComponentManager singleComponent = m_singleComponent;
+            final SingleComponentManager singleComponent = m_singleComponent;
             m_singleComponent = null;
 
             cms = getComponentManagers( true );
             if ( cms == null )
             {
-                cms = new ImmediateComponentManager[] { singleComponent };
+                cms = new SingleComponentManager[] { singleComponent };
             }
         }
-        for ( ImmediateComponentManager cm : cms )
+        for ( SingleComponentManager cm : cms )
         {
             cm.dispose( reason );
         }
     }
 
 
-    public void disposed( ImmediateComponentManager component )
+    public void disposed( SingleComponentManager component )
     {
         // ensure the component is removed from the components map
         synchronized ( m_components )
@@ -490,12 +473,12 @@ public class ImmediateComponentHolder<S>
      */
    public boolean equals(Object object)
     {
-        if (!(object instanceof ImmediateComponentHolder))
+        if (!(object instanceof ConfigurableComponentHolder))
         {
             return false;
         }
 
-        ImmediateComponentHolder other = (ImmediateComponentHolder) object;
+        ConfigurableComponentHolder other = (ConfigurableComponentHolder) object;
         return m_activator == other.m_activator
                 && getName().equals(other.getName());
     }
@@ -529,7 +512,7 @@ public class ImmediateComponentHolder<S>
      * from the map. If there are no components in the map, <code>null</code>
      * is returned.
      */
-    private ImmediateComponentManager[] getComponentManagers( final boolean clear )
+    private SingleComponentManager[] getComponentManagers( final boolean clear )
     {
         // fast exit if there is no component in the map
         if ( m_components.isEmpty() )
@@ -537,7 +520,7 @@ public class ImmediateComponentHolder<S>
             return null;
         }
 
-        final ImmediateComponentManager[] cm = new ImmediateComponentManager[m_components.size()];
+        final SingleComponentManager[] cm = new SingleComponentManager[m_components.size()];
         m_components.values().toArray( cm );
 
         if ( clear )
@@ -572,7 +555,7 @@ public class ImmediateComponentHolder<S>
 
     public TargetedPID getConfigurationTargetedPID(TargetedPID pid)
     {
-        ImmediateComponentManager icm = null;
+        SingleComponentManager icm = null;
         synchronized (m_components)
         {
             if ( pid.getServicePid().equals( m_componentMetadata.getConfigurationPid() ))
{

Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentContextImpl.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentContextImpl.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentContextImpl.java
Wed Oct 16 22:05:12 2013
@@ -40,7 +40,7 @@ import org.osgi.service.log.LogService;
  */
 public class ComponentContextImpl<S> implements ExtComponentContext {
 
-    private final ImmediateComponentManager<S> m_componentManager;
+    private final SingleComponentManager<S> m_componentManager;
     
     private final EdgeInfo[] edgeInfos;
     
@@ -54,7 +54,7 @@ public class ComponentContextImpl<S> imp
     
     private final CountDownLatch accessibleLatch = new CountDownLatch(1);
 
-    ComponentContextImpl( ImmediateComponentManager<S> componentManager, Bundle usingBundle,
S implementationObject )
+    ComponentContextImpl( SingleComponentManager<S> componentManager, Bundle usingBundle,
S implementationObject )
     {
         m_componentManager = componentManager;
         m_usingBundle = usingBundle;
@@ -86,7 +86,7 @@ public class ComponentContextImpl<S> imp
         Arrays.fill( edgeInfos, null );
     }
 
-    protected ImmediateComponentManager<S> getComponentManager()
+    protected SingleComponentManager<S> getComponentManager()
     {
         return m_componentManager;
     }

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
Wed Oct 16 22:05:12 2013
@@ -70,7 +70,7 @@ public class ComponentFactoryImpl<S> ext
      * entry is the same as the entry's key.
      * This is an IdentityHashMap for speed, thus not a Set.
      */
-    private final Map<ImmediateComponentManager<S>, ImmediateComponentManager<S>>
m_componentInstances;
+    private final Map<SingleComponentManager<S>, SingleComponentManager<S>>
m_componentInstances;
 
     /**
      * The configuration for the component factory. This configuration is
@@ -96,7 +96,7 @@ public class ComponentFactoryImpl<S> ext
     public ComponentFactoryImpl( BundleComponentActivator activator, ComponentMetadata metadata
)
     {
         super( activator, metadata, new ComponentMethods() );
-        m_componentInstances = new IdentityHashMap<ImmediateComponentManager<S>,
ImmediateComponentManager<S>>();
+        m_componentInstances = new IdentityHashMap<SingleComponentManager<S>, SingleComponentManager<S>>();
         m_configuration = new Hashtable<String, Object>();
     }
 
@@ -112,7 +112,7 @@ public class ComponentFactoryImpl<S> ext
     */
     public ComponentInstance newInstance( Dictionary<String, ?> dictionary )
     {
-        final ImmediateComponentManager<S> cm = createComponentManager();
+        final SingleComponentManager<S> cm = createComponentManager();
         log( LogService.LOG_DEBUG, "Creating new instance from component factory {0} with
configuration {1}",
                 new Object[] {getComponentMetadata().getName(), dictionary}, null );
 
@@ -476,7 +476,7 @@ public class ComponentFactoryImpl<S> ext
     }
 
 
-    public void disposed( ImmediateComponentManager component )
+    public void disposed( SingleComponentManager component )
     {
         synchronized ( m_componentInstances )
         {
@@ -489,18 +489,18 @@ public class ComponentFactoryImpl<S> ext
 
 
     /**
-     * Creates an {@link ImmediateComponentManager} instance with the
+     * Creates an {@link SingleComponentManager} instance with the
      * {@link BundleComponentActivator} and {@link ComponentMetadata} of this
      * instance. The component manager is kept in the internal set of created
      * components. The component is neither configured nor enabled.
      */
-    private ImmediateComponentManager<S> createComponentManager()
+    private SingleComponentManager<S> createComponentManager()
     {
         return new ComponentFactoryNewInstance<S>( getActivator(), this, getComponentMetadata(),
getComponentMethods() );
     }
 
 
-    protected void getComponentManagers( Map<?, ImmediateComponentManager<S>>
componentMap, List<AbstractComponentManager<S>> componentManagers )
+    protected void getComponentManagers( Map<?, SingleComponentManager<S>> componentMap,
List<AbstractComponentManager<S>> componentManagers )
     {
         if ( componentMap != null )
         {
@@ -511,7 +511,7 @@ public class ComponentFactoryImpl<S> ext
         }
     }
 
-    static class ComponentFactoryNewInstance<S> extends ImmediateComponentManager<S>
{
+    static class ComponentFactoryNewInstance<S> extends SingleComponentManager<S>
{
 
         public ComponentFactoryNewInstance( BundleComponentActivator activator, ComponentHolder
componentHolder,
                 ComponentMetadata metadata, ComponentMethods componentMethods )

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java
Wed Oct 16 22:05:12 2013
@@ -54,10 +54,10 @@ public class ConfigurationComponentFacto
 
     /**
      * The map of components created from Configuration objects maps PID to
-     * {@link org.apache.felix.scr.impl.manager.ImmediateComponentManager} for configuration
updating this map is
+     * {@link org.apache.felix.scr.impl.manager.SingleComponentManager} for configuration
updating this map is
      * lazily created.
      */
-    private final Map<String, ImmediateComponentManager<S>> m_configuredServices
= new HashMap<String, ImmediateComponentManager<S>>();
+    private final Map<String, SingleComponentManager<S>> m_configuredServices
= new HashMap<String, SingleComponentManager<S>>();
 
     public ConfigurationComponentFactoryImpl( BundleComponentActivator activator, ComponentMetadata
metadata )
     {
@@ -115,7 +115,7 @@ public class ConfigurationComponentFacto
         }
         else
         {
-            ImmediateComponentManager<S> cm;
+            SingleComponentManager<S> cm;
             synchronized ( m_configuredServices )
             {
                 cm = m_configuredServices.remove( pid );
@@ -139,7 +139,7 @@ public class ConfigurationComponentFacto
         }
         else   //non-spec backwards compatible
         {
-            ImmediateComponentManager<S> cm;
+            SingleComponentManager<S> cm;
             synchronized ( m_configuredServices )
             {
                 cm = m_configuredServices.get( pid );
@@ -218,7 +218,7 @@ public class ConfigurationComponentFacto
         }
         synchronized ( m_configuredServices )
         {
-            ImmediateComponentManager icm = m_configuredServices.get( pid );
+            SingleComponentManager icm = m_configuredServices.get( pid );
             return icm == null? -1: icm.getChangeCount();
         }
     }
@@ -228,17 +228,17 @@ public class ConfigurationComponentFacto
 
 
     /**
-     * Creates an {@link org.apache.felix.scr.impl.manager.ImmediateComponentManager} instance
with the
+     * Creates an {@link org.apache.felix.scr.impl.manager.SingleComponentManager} instance
with the
      * {@link org.apache.felix.scr.impl.BundleComponentActivator} and {@link org.apache.felix.scr.impl.metadata.ComponentMetadata}
of this
      * instance. The component manager is kept in the internal set of created
      * components. The component is neither configured nor enabled.
      */
-    private ImmediateComponentManager<S> createConfigurationComponentManager()
+    private SingleComponentManager<S> createConfigurationComponentManager()
     {
         return new ComponentFactoryConfiguredInstance<S>( getActivator(), this, getComponentMetadata(),
getComponentMethods() );
     }
 
-    static class ComponentFactoryConfiguredInstance<S> extends ImmediateComponentManager<S>
{
+    static class ComponentFactoryConfiguredInstance<S> extends SingleComponentManager<S>
{
 
         public ComponentFactoryConfiguredInstance( BundleComponentActivator activator, ComponentHolder
componentHolder,
                 ComponentMetadata metadata, ComponentMethods componentMethods )

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
Wed Oct 16 22:05:12 2013
@@ -43,7 +43,7 @@ import org.osgi.service.log.LogService;
  * The <code>ServiceFactoryComponentManager</code> for components specified with
&lt;service serviceFactory='true'/&gt;
  * in the xml metadata. The component must be delayed, not immediate or factory.
  */
-public class ServiceFactoryComponentManager<S> extends ImmediateComponentManager<S>
+public class ServiceFactoryComponentManager<S> extends SingleComponentManager<S>
 {
 
     // maintain the map of ComponentContext objects created for the

Copied: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
(from r1532897, felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java)
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java?p2=felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java&p1=felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java&r1=1532897&r2=1532922&rev=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
Wed Oct 16 22:05:12 2013
@@ -46,7 +46,7 @@ import org.osgi.service.log.LogService;
  * The default ComponentManager. Objects of this class are responsible for managing
  * implementation object's lifecycle.
  */
-public class ImmediateComponentManager<S> extends AbstractComponentManager<S>
implements ServiceFactory<S>
+public class SingleComponentManager<S> extends AbstractComponentManager<S> implements
ServiceFactory<S>
 {
 
     // keep the using bundles as reference "counters" for instance deactivation
@@ -85,13 +85,13 @@ public class ImmediateComponentManager<S
      * @param metadata
      * @param componentMethods
      */
-    public ImmediateComponentManager( BundleComponentActivator activator, ComponentHolder
componentHolder,
+    public SingleComponentManager( BundleComponentActivator activator, ComponentHolder componentHolder,
             ComponentMetadata metadata, ComponentMethods componentMethods )
     {
         this(activator, componentHolder, metadata, componentMethods, false);
     }
     
-    public ImmediateComponentManager( BundleComponentActivator activator, ComponentHolder
componentHolder,
+    public SingleComponentManager( BundleComponentActivator activator, ComponentHolder componentHolder,
             ComponentMetadata metadata, ComponentMethods componentMethods, boolean factoryInstance
)
     {
         super( activator, metadata, componentMethods, factoryInstance );

Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
Wed Oct 16 22:05:12 2013
@@ -29,7 +29,7 @@ import junit.framework.TestCase;
 import org.apache.felix.scr.impl.BundleComponentActivator;
 import org.apache.felix.scr.impl.TargetedPID;
 import org.apache.felix.scr.impl.helper.ComponentMethods;
-import org.apache.felix.scr.impl.manager.ImmediateComponentManager;
+import org.apache.felix.scr.impl.manager.SingleComponentManager;
 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
 import org.apache.felix.scr.impl.metadata.XmlHandler;
 
@@ -45,7 +45,7 @@ public class ConfiguredComponentHolderTe
         final TestingConfiguredComponentHolder holder = new TestingConfiguredComponentHolder(
cm );
 
         // assert single component and no map
-        final ImmediateComponentManager cmgr = getSingleManager( holder );
+        final SingleComponentManager cmgr = getSingleManager( holder );
         assertNotNull( "Expect single component manager", cmgr );
         assertNull( "Expect no component manager list", getComponentManagers( holder ) );
 
@@ -62,7 +62,7 @@ public class ConfiguredComponentHolderTe
         final TestingConfiguredComponentHolder holder = new TestingConfiguredComponentHolder(
cm );
 
         // assert single component and no map
-        final ImmediateComponentManager cmgr = getSingleManager( holder );
+        final SingleComponentManager cmgr = getSingleManager( holder );
         assertNotNull( "Expect single component manager", cmgr );
         assertNull( "Expect no component manager list", getComponentManagers( holder ) );
 
@@ -75,7 +75,7 @@ public class ConfiguredComponentHolderTe
         holder.configurationUpdated( name, config, 0, new TargetedPID(name) );
 
         // assert single component and no map
-        final ImmediateComponentManager cmgrAfterConfig = getSingleManager( holder );
+        final SingleComponentManager cmgrAfterConfig = getSingleManager( holder );
         assertNotNull( "Expect single component manager", cmgrAfterConfig );
         assertNull( "Expect no component manager list", getComponentManagers( holder ) );
 
@@ -88,7 +88,7 @@ public class ConfiguredComponentHolderTe
         holder.configurationDeleted( name );
 
         // assert single component and no map
-        final ImmediateComponentManager cmgrAfterUnconfig = getSingleManager( holder );
+        final SingleComponentManager cmgrAfterUnconfig = getSingleManager( holder );
         assertNotNull( "Expect single component manager", cmgrAfterUnconfig );
         assertNull( "Expect no component manager list", getComponentManagers( holder ) );
 
@@ -105,7 +105,7 @@ public class ConfiguredComponentHolderTe
         final TestingConfiguredComponentHolder holder = new TestingConfiguredComponentHolder(
cm );
 
         // assert single component and no map
-        final ImmediateComponentManager cmgr = getSingleManager( holder );
+        final SingleComponentManager cmgr = getSingleManager( holder );
         assertNotNull( "Expect single component manager", cmgr );
         assertNull( "Expect no component manager list", getComponentManagers( holder ) );
 
@@ -119,8 +119,8 @@ public class ConfiguredComponentHolderTe
         holder.configurationUpdated( pid1, config1, 0, new TargetedPID(name) );
 
         // assert single component and single-entry map
-        final ImmediateComponentManager cmgrAfterConfig = getSingleManager( holder );
-        final ImmediateComponentManager[] cmgrsAfterConfig = getComponentManagers( holder
);
+        final SingleComponentManager cmgrAfterConfig = getSingleManager( holder );
+        final SingleComponentManager[] cmgrsAfterConfig = getComponentManagers( holder );
         assertNotNull( "Expect single component manager", cmgrAfterConfig );
         assertNotNull( "Expect component manager list", cmgrsAfterConfig );
         assertEquals( "Expect one component manager in list", 1, cmgrsAfterConfig.length
);
@@ -132,8 +132,8 @@ public class ConfiguredComponentHolderTe
         holder.configurationUpdated( pid2, config2, 1, new TargetedPID(name) );
 
         // assert single component and single-entry map
-        final ImmediateComponentManager cmgrAfterConfig2 = getSingleManager( holder );
-        final ImmediateComponentManager[] cmgrsAfterConfig2 = getComponentManagers( holder
);
+        final SingleComponentManager cmgrAfterConfig2 = getSingleManager( holder );
+        final 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.length
);
@@ -142,8 +142,8 @@ public class ConfiguredComponentHolderTe
         holder.configurationDeleted( pid2 );
 
         // assert single component and single-entry map
-        final ImmediateComponentManager cmgrAfterUnConfig2 = getSingleManager( holder );
-        final ImmediateComponentManager[] cmgrsAfterUnConfig2 = getComponentManagers( holder
);
+        final SingleComponentManager cmgrAfterUnConfig2 = getSingleManager( holder );
+        final SingleComponentManager[] cmgrsAfterUnConfig2 = getComponentManagers( holder
);
         assertNotNull( "Expect single component manager", cmgrAfterUnConfig2 );
         assertNotNull( "Expect component manager list", cmgrsAfterUnConfig2 );
         assertEquals( "Expect one component manager in list", 1, cmgrsAfterUnConfig2.length
);
@@ -153,8 +153,8 @@ public class ConfiguredComponentHolderTe
         holder.configurationDeleted( pid1 );
 
         // assert single component and single-entry map
-        final ImmediateComponentManager cmgrAfterConfigUnconfig = getSingleManager( holder
);
-        final ImmediateComponentManager[] cmgrsAfterConfigUnconfig = getComponentManagers(
holder );
+        final SingleComponentManager cmgrAfterConfigUnconfig = getSingleManager( holder );
+        final SingleComponentManager[] cmgrsAfterConfigUnconfig = getComponentManagers( holder
);
         assertNotNull( "Expect single component manager", cmgrAfterConfigUnconfig );
         assertNotNull( "Expect component manager list", cmgrsAfterConfigUnconfig );
         assertEquals( "Expect one component manager in list", 1, cmgrsAfterConfigUnconfig.length
);
@@ -163,8 +163,8 @@ public class ConfiguredComponentHolderTe
         holder.configurationDeleted( pid2 );
 
         // assert single component and single-entry map
-        final ImmediateComponentManager cmgrAfterAllUnconfig = getSingleManager( holder );
-        final ImmediateComponentManager[] cmgrsAfterAllUnconfig = getComponentManagers( holder
);
+        final SingleComponentManager cmgrAfterAllUnconfig = getSingleManager( holder );
+        final SingleComponentManager[] cmgrsAfterAllUnconfig = getComponentManagers( holder
);
         assertNotNull( "Expect single component manager", cmgrAfterAllUnconfig );
         assertNull( "Expect no component manager list", cmgrsAfterAllUnconfig );
 
@@ -180,13 +180,13 @@ public class ConfiguredComponentHolderTe
     }
 
 
-    private static ImmediateComponentManager getSingleManager( ImmediateComponentHolder holder
)
+    private static SingleComponentManager getSingleManager( ConfigurableComponentHolder holder
)
     {
         try
         {
-            final Field f = ImmediateComponentHolder.class.getDeclaredField( "m_singleComponent"
);
+            final Field f = ConfigurableComponentHolder.class.getDeclaredField( "m_singleComponent"
);
             f.setAccessible( true );
-            return ( ImmediateComponentManager ) f.get( holder );
+            return ( SingleComponentManager ) f.get( holder );
         }
         catch ( Throwable t )
         {
@@ -196,14 +196,14 @@ public class ConfiguredComponentHolderTe
     }
 
 
-    private static ImmediateComponentManager[] getComponentManagers( ImmediateComponentHolder
holder )
+    private static SingleComponentManager[] getComponentManagers( ConfigurableComponentHolder
holder )
     {
         try
         {
-            final Method m = ImmediateComponentHolder.class.getDeclaredMethod( "getComponentManagers",
new Class[]
+            final Method m = ConfigurableComponentHolder.class.getDeclaredMethod( "getComponentManagers",
new Class[]
                 { Boolean.TYPE } );
             m.setAccessible( true );
-            return ( ImmediateComponentManager[] ) m.invoke( holder, new Object[]
+            return ( SingleComponentManager[] ) m.invoke( holder, new Object[]
                 { Boolean.FALSE } );
         }
         catch ( Throwable t )
@@ -213,7 +213,7 @@ public class ConfiguredComponentHolderTe
         }
     }
 
-    private static class TestingConfiguredComponentHolder extends ImmediateComponentHolder
+    private static class TestingConfiguredComponentHolder extends ConfigurableComponentHolder
     {
         TestingConfiguredComponentHolder( ComponentMetadata metadata )
         {
@@ -221,13 +221,13 @@ public class ConfiguredComponentHolderTe
         }
 
 
-        protected ImmediateComponentManager createComponentManager()
+        protected SingleComponentManager createComponentManager()
         {
             return new MockImmediateComponentManager( getActivator(), this, getComponentMetadata()
);
         }
     }
 
-    private static class MockImmediateComponentManager extends ImmediateComponentManager
+    private static class MockImmediateComponentManager extends SingleComponentManager
     {
 
         private Dictionary m_configuration;

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
Wed Oct 16 22:05:12 2013
@@ -25,7 +25,7 @@ import java.util.Hashtable;
 
 import junit.framework.TestCase;
 
-import org.apache.felix.scr.impl.manager.ImmediateComponentManager;
+import org.apache.felix.scr.impl.manager.SingleComponentManager;
 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
 import org.apache.felix.scr.impl.metadata.instances.AcceptMethod;
 import org.apache.felix.scr.impl.metadata.instances.BaseObject;
@@ -270,7 +270,7 @@ public class ActivateMethodTest extends 
                 return true;
             }
         };
-        ImmediateComponentManager icm = new ImmediateComponentManager( null, null, metadata,
new ComponentMethods() );
+        SingleComponentManager icm = new SingleComponentManager( null, null, metadata, new
ComponentMethods() );
         ActivateMethod am = new ActivateMethod( methodName, methodName != null, obj.getClass(),
true, false );
         am.invoke( obj, new ActivateMethod.ActivatorParameter( m_ctx, -1 ), null, icm );
         Method m = get(am, "m_method");
@@ -298,7 +298,7 @@ public class ActivateMethodTest extends 
                 return true;
             }
         };
-        ImmediateComponentManager icm = new ImmediateComponentManager( null, null, metadata,
new ComponentMethods() );
+        SingleComponentManager icm = new SingleComponentManager( null, null, metadata, new
ComponentMethods() );
         ActivateMethod am = new ActivateMethod( methodName, methodName != null, obj.getClass(),
true, false );
         am.invoke( obj, new ActivateMethod.ActivatorParameter( m_ctx, -1 ), null, icm );
         assertNull( get( am, "m_method" ) );

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java Wed
Oct 16 22:05:12 2013
@@ -21,7 +21,7 @@ package org.apache.felix.scr.impl.helper
 
 import junit.framework.TestCase;
 
-import org.apache.felix.scr.impl.manager.ImmediateComponentManager;
+import org.apache.felix.scr.impl.manager.SingleComponentManager;
 import org.apache.felix.scr.impl.manager.RefPair;
 import org.apache.felix.scr.impl.manager.components.FakeService;
 import org.apache.felix.scr.impl.manager.components.T1;
@@ -432,7 +432,7 @@ public class BindMethodTest extends Test
                 return isDS11;
             }
         };
-        ImmediateComponentManager icm = new ImmediateComponentManager( null, null, metadata,
new ComponentMethods() );
+        SingleComponentManager icm = new SingleComponentManager( null, null, metadata, new
ComponentMethods() );
         BindMethod bm = new BindMethod( methodName, component.getClass(),
                 FakeService.class.getName(), isDS11, false );
         RefPair refPair = new RefPair( m_serviceReference );

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentDisposeTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentDisposeTest.java?rev=1532922&r1=1532921&r2=1532922&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentDisposeTest.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentDisposeTest.java
Wed Oct 16 22:05:12 2013
@@ -149,7 +149,7 @@ public class ComponentDisposeTest extend
             final Field m_componentManager = getField( ccImpl, "m_componentManager" );
             final Object acm = m_componentManager.get( ctx );
 
-            final Class<?> cmImpl = getType( acm, "ImmediateComponentManager" );
+            final Class<?> cmImpl = getType( acm, "SingleComponentManager" );
             final Field m_componentHolder = getField( cmImpl, "m_componentHolder" );
             return m_componentHolder.get( acm );
         }



Mime
View raw message