FELIX-4286 remove unnecessary DelayedComponentManager class and improve some class names
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1532922 13f79535-47bb-0310-9956-ffa450edef68
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 9a12d1e..9b307a9 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
@@ -35,7 +35,7 @@
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 @@
}
else
{
- holder = new ImmediateComponentHolder(activator, metadata);
+ holder = new ConfigurableComponentHolder(activator, metadata);
}
return holder;
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 4f47851..2615fa4 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
@@ -24,7 +24,7 @@
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 @@
* 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 );
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
similarity index 84%
rename from scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java
rename to scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
index 0fbf4b2..1a7ab04 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
@@ -30,8 +30,7 @@
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 @@
/**
- * 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 @@
* <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 @@
* 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 @@
* 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 @@
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 );
+ manager = new ServiceFactoryComponentManager<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 );
- }
- }
+
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 @@
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 @@
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 @@
}
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 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 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 void disableComponents( final boolean async )
{
- ImmediateComponentManager[] cms;
+ SingleComponentManager[] cms;
synchronized ( m_components )
{
m_enabled = false;
@@ -407,10 +390,10 @@
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 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 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 @@
* 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 @@
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 TargetedPID getConfigurationTargetedPID(TargetedPID pid)
{
- ImmediateComponentManager icm = null;
+ SingleComponentManager icm = null;
synchronized (m_components)
{
if ( pid.getServicePid().equals( m_componentMetadata.getConfigurationPid() )) {
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 dd4f1fa..b9f8eae 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
@@ -40,7 +40,7 @@
*/
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 @@
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 @@
Arrays.fill( edgeInfos, null );
}
- protected ImmediateComponentManager<S> getComponentManager()
+ protected SingleComponentManager<S> getComponentManager()
{
return m_componentManager;
}
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 b35cc47..b81f819 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
@@ -70,7 +70,7 @@
* 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 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 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 void disposed( ImmediateComponentManager component )
+ public void disposed( SingleComponentManager component )
{
synchronized ( m_componentInstances )
{
@@ -489,18 +489,18 @@
/**
- * 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 @@
}
}
- static class ComponentFactoryNewInstance<S> extends ImmediateComponentManager<S> {
+ static class ComponentFactoryNewInstance<S> extends SingleComponentManager<S> {
public ComponentFactoryNewInstance( BundleComponentActivator activator, ComponentHolder componentHolder,
ComponentMetadata metadata, ComponentMethods componentMethods )
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java
index 3f31f3b..58d06af 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java
@@ -54,10 +54,10 @@
/**
* 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 @@
}
else
{
- ImmediateComponentManager<S> cm;
+ SingleComponentManager<S> cm;
synchronized ( m_configuredServices )
{
cm = m_configuredServices.remove( pid );
@@ -139,7 +139,7 @@
}
else //non-spec backwards compatible
{
- ImmediateComponentManager<S> cm;
+ SingleComponentManager<S> cm;
synchronized ( m_configuredServices )
{
cm = m_configuredServices.get( pid );
@@ -218,7 +218,7 @@
}
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 @@
/**
- * 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 )
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/DelayedComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/DelayedComponentManager.java
deleted file mode 100644
index a8ebbd0..0000000
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/DelayedComponentManager.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.scr.impl.manager;
-
-
-import org.apache.felix.scr.impl.BundleComponentActivator;
-import org.apache.felix.scr.impl.config.ComponentHolder;
-import org.apache.felix.scr.impl.helper.ComponentMethods;
-import org.apache.felix.scr.impl.metadata.ComponentMetadata;
-
-
-/**
- * The <code>DelayedComponentManager</code> marker class. Needed?
- */
-public class DelayedComponentManager<S> extends ImmediateComponentManager<S>
-{
-
- /**
- * @param activator
- * @param metadata
- * @param componentMethods
- */
- public DelayedComponentManager( BundleComponentActivator activator, ComponentHolder componentHolder,
- ComponentMetadata metadata, ComponentMethods componentMethods )
- {
- super( activator, componentHolder, metadata, componentMethods );
- }
-
-}
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 4658333..3a30c78 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
@@ -43,7 +43,7 @@
* The <code>ServiceFactoryComponentManager</code> for components specified with <service serviceFactory='true'/>
* 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
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
similarity index 98%
rename from scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
rename to scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
index b3e5373..ffedf46 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
@@ -46,7 +46,7 @@
* 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 @@
* @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 );
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 5d3cc72..5d301c4 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
@@ -29,7 +29,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
- 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 @@
}
- 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 @@
}
}
- private static class TestingConfiguredComponentHolder extends ImmediateComponentHolder
+ private static class TestingConfiguredComponentHolder extends ConfigurableComponentHolder
{
TestingConfiguredComponentHolder( ComponentMetadata metadata )
{
@@ -221,13 +221,13 @@
}
- 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;
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java b/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
index 2833eaf..de7eaad 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
@@ -25,7 +25,7 @@
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 @@
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 @@
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" ) );
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java b/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java
index f3989bb..6b9c74c 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java
@@ -21,7 +21,7 @@
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 @@
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 );
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 ae0adf5..16af92e 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
@@ -149,7 +149,7 @@
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 );
}