Author: fmeschbe
Date: Tue Oct  2 05:38:44 2007
New Revision: 581211

URL: http://svn.apache.org/viewvc?rev=581211&view=rev
Log:
FELIX-374 Register ManagedService on behalf of components to receive 
Configuration

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/ComponentFactoryImpl.java
    
felix/trunk/scr/src/main/java/org/apache/felix/scr/ImmediateComponentManager.java

Modified: 
felix/trunk/scr/src/main/java/org/apache/felix/scr/ComponentFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/ComponentFactoryImpl.java?rev=581211&r1=581210&r2=581211&view=diff
==============================================================================
--- 
felix/trunk/scr/src/main/java/org/apache/felix/scr/ComponentFactoryImpl.java 
(original)
+++ 
felix/trunk/scr/src/main/java/org/apache/felix/scr/ComponentFactoryImpl.java 
Tue Oct  2 05:38:44 2007
@@ -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 );
         }
     }
 

Modified: 
felix/trunk/scr/src/main/java/org/apache/felix/scr/ImmediateComponentManager.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/ImmediateComponentManager.java?rev=581211&r1=581210&r2=581211&view=diff
==============================================================================
--- 
felix/trunk/scr/src/main/java/org/apache/felix/scr/ImmediateComponentManager.java
 (original)
+++ 
felix/trunk/scr/src/main/java/org/apache/felix/scr/ImmediateComponentManager.java
 Tue Oct  2 05:38:44 2007
@@ -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;


Reply via email to