felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r951947 - /felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
Date Sun, 06 Jun 2010 20:07:13 GMT
Author: marrs
Date: Sun Jun  6 20:07:12 2010
New Revision: 951947

URL: http://svn.apache.org/viewvc?rev=951947&view=rev
Log:
FELIX-2344 FELIX-2369 bindService is now invoked with the new state on every relevant state
change (instead of the old state which was wrong) and as part of the bindService implementation,
the service is configured again (because the init() method might have added new dependencies)

Modified:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java?rev=951947&r1=951946&r2=951947&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
Sun Jun  6 20:07:12 2010
@@ -169,7 +169,7 @@ public class ServiceImpl implements Serv
         if (oldState.isTrackingOptional() && newState.isBound()) {
             m_executor.enqueue(new Runnable() {
                 public void run() {
-                    bindService(oldState);
+                    bindService(newState);
                 }});
         }
         if (oldState.isTrackingOptional() && newState.isInactive()) {
@@ -195,7 +195,7 @@ public class ServiceImpl implements Serv
         if (oldState.isWaitingForRequiredInstantiated() && newState.isBound()) {
             m_executor.enqueue(new Runnable() {
                 public void run() {
-                    bindService(oldState);
+                    bindService(newState);
                 }});
         }
         if (oldState.isBound() && newState.isWaitingForRequiredInstantiated()) {
@@ -538,6 +538,8 @@ public class ServiceImpl implements Serv
         synchronized (this) {
             start = m_callbackStart;
         }
+        // configure the service again, because init() might have added more dependencies
+        configureService(state);
         // inform the state listeners we're starting
         stateListenersStarting();
         // invoke the start callback, since we're now ready to be used
@@ -904,74 +906,6 @@ public class ServiceImpl implements Serv
             if (dependency.isRequired()) {
                 dependency.invokeAdded(this);
             }
-            
-            
-//            if (dependency instanceof ServiceDependencyImpl) {
-//                ServiceDependencyImpl sd = (ServiceDependencyImpl) dependency;
-//                if (sd.isAutoConfig()) {
-//                    if (sd.isRequired()) {
-//                        configureImplementation(sd.getInterface(), sd.getService(), sd.getAutoConfigName());
-//                    }
-//                    else {
-//                        // for optional services, we do an "ad-hoc" lookup to inject the
service if it is
-//                        // already available even though the tracker has not yet been started
-//                        configureImplementation(sd.getInterface(), sd.lookupService(),
sd.getAutoConfigName());
-//                    }
-//                }
-//                // for required dependencies, we invoke any callbacks here
-//                if (sd.isRequired()) {
-//                    sd.invokeAdded(this, sd.lookupServiceReference(), sd.lookupService());
-//                }
-//            }
-//            else if (dependency instanceof BundleDependencyImpl) {
-//                BundleDependencyImpl bd = (BundleDependencyImpl) dependency;
-//                if (bd.isAutoConfig()) {
-//                    if (bd.isRequired()) {
-//                        configureImplementation(Bundle.class, bd.getBundle()); // TODO
AutoConfigName support
-//                    }
-//                    else {
-//                        // for optional services, we do an "ad-hoc" lookup to inject the
service if it is
-//                        // already available even though the tracker has not yet been started
-//                        
-//                        // TODO !!! configureImplementation(sd.getInterface(), sd.lookupService(),
sd.getAutoConfigName());
-//                    }
-//                }
-//                // for required dependencies, we invoke any callbacks here
-//                if (bd.isRequired()) {
-//                    bd.invokeAdded(this, bd.getBundle());
-//                }
-//            }
-//            else if (dependency instanceof ResourceDependencyImpl) {
-//                ResourceDependencyImpl bd = (ResourceDependencyImpl) dependency;
-//                if (bd.isAutoConfig()) {
-//                    if (bd.isRequired()) {
-//                        configureImplementation(Resource.class, bd.getResource()); // TODO
AutoConfigName support
-//                    }
-//                    else {
-//                        // for optional services, we do an "ad-hoc" lookup to inject the
service if it is
-//                        // already available even though the tracker has not yet been started
-//                        
-//                        // TODO !!! configureImplementation(sd.getInterface(), sd.lookupService(),
sd.getAutoConfigName());
-//                    }
-//                }
-//                // for required dependencies, we invoke any callbacks here
-//                if (bd.isRequired()) {
-//                    bd.invokeAdded(this, bd.getResource());
-//                }
-//            }
-//            else if (dependency instanceof ConfigurationDependencyImpl) {
-//                ConfigurationDependencyImpl cd = (ConfigurationDependencyImpl) dependency;
-//                // for configuration dependencies, we invoke updated
-//                try {
-//                    cd.invokeUpdate(this, this.getService(), cd.getConfiguration());
-//                }
-//                catch (ConfigurationException e) {
-//                    // if this happens, it's definitely an inconsistency
-//                    // when sharing configuration dependencies between services, all implementations
-//                    // should accept the same configurations
-//                    e.printStackTrace();
-//                }
-//            }
         }
     }
 



Mime
View raw message