FELIX-374 Register ManagedService on behalf of components to receive Configuration
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@581211 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/ComponentFactoryImpl.java b/scr/src/main/java/org/apache/felix/scr/ComponentFactoryImpl.java
index deb3a36..50dd172 100644
--- a/scr/src/main/java/org/apache/felix/scr/ComponentFactoryImpl.java
+++ b/scr/src/main/java/org/apache/felix/scr/ComponentFactoryImpl.java
@@ -156,7 +156,7 @@
else if ( cm instanceof ImmediateComponentManager )
{
// update the configuration as if called as ManagedService
- ( ( ImmediateComponentManager ) cm ).updated( configuration );
+ ( ( ImmediateComponentManager ) cm ).reconfigure( configuration );
}
}
diff --git a/scr/src/main/java/org/apache/felix/scr/ImmediateComponentManager.java b/scr/src/main/java/org/apache/felix/scr/ImmediateComponentManager.java
index 14d5693..12b4935 100644
--- a/scr/src/main/java/org/apache/felix/scr/ImmediateComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/ImmediateComponentManager.java
@@ -39,7 +39,7 @@
* implementation object's lifecycle.
*
*/
-class ImmediateComponentManager extends AbstractComponentManager implements ManagedService
+class ImmediateComponentManager extends AbstractComponentManager
{
// the component ID
private long m_componentId;
@@ -87,8 +87,17 @@
+ getComponentMetadata().getName() );
props.put( Constants.SERVICE_VENDOR, "Apache Software Foundation" );
+ // register an anonymous managed service instance
+ ManagedService ms = new ManagedService()
+ {
+ public void updated( Dictionary properties )
+ {
+ reconfigure( properties );
+ }
+ };
+
m_managedServiceRegistration = activator.getBundleContext().registerService(
- ManagedService.class.getName(), this, props );
+ ManagedService.class.getName(), ms, props );
}
}
@@ -372,8 +381,6 @@
}
- //---------- ManagedService interface
-
/**
* Called by the Configuration Admin Service to update the component with
* Configuration properties.
@@ -382,7 +389,7 @@
* the Configuration Admin Service or <code>null</code> if there is
* no configuration or if the configuration has just been deleted.
*/
- public void updated( Dictionary configuration )
+ public void reconfigure( Dictionary configuration )
{
// store the properties
m_configurationProperties = configuration;