You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ma...@apache.org on 2009/08/11 10:41:53 UTC

svn commit: r803030 - /felix/trunk/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java

Author: marrs
Date: Tue Aug 11 08:41:53 2009
New Revision: 803030

URL: http://svn.apache.org/viewvc?rev=803030&view=rev
Log:
FELIX-1278 changed the behaviour of setCallbacks() to turn off auto configuration if at least one valid callback was specified

Modified:
    felix/trunk/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java

Modified: felix/trunk/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java?rev=803030&r1=803029&r2=803030&view=diff
==============================================================================
--- felix/trunk/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java (original)
+++ felix/trunk/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java Tue Aug 11 08:41:53 2009
@@ -620,8 +620,10 @@
     }
     
     /**
-     * Sets the callbacks for this service. These callbacks can be used as hooks whenever
-     * a dependency is added or removed. They are called on the service implementation.
+     * Sets the callbacks for this service. These callbacks can be used as hooks whenever a
+     * dependency is added or removed. When you specify callbacks, the auto configuration 
+     * feature is automatically turned off, because we're assuming you don't need it in this 
+     * case.
      * 
      * @param added the method to call when a service was added
      * @param removed the method to call when a service was removed
@@ -630,16 +632,42 @@
     public synchronized ServiceDependency setCallbacks(String added, String removed) {
         return setCallbacks(null, added, null, removed);
     }
+
+    /**
+     * Sets the callbacks for this service. These callbacks can be used as hooks whenever a
+     * dependency is added, changed or removed. When you specify callbacks, the auto 
+     * configuration feature is automatically turned off, because we're assuming you don't 
+     * need it in this case.
+     * 
+     * @param added the method to call when a service was added
+     * @param changed the method to call when a service was changed
+     * @param removed the method to call when a service was removed
+     * @return this service dependency
+     */
     public synchronized ServiceDependency setCallbacks(String added, String changed, String removed) {
         return setCallbacks(null, added, changed, removed);
     }
+
+    /**
+     * Sets the callbacks for this service. These callbacks can be used as hooks whenever a
+     * dependency is added or removed. They are called on the instance you provide. When you
+     * specify callbacks, the auto configuration feature is automatically turned off, because
+     * we're assuming you don't need it in this case.
+     * 
+     * @param instance the instance to call the callbacks on
+     * @param added the method to call when a service was added
+     * @param removed the method to call when a service was removed
+     * @return this service dependency
+     */
     public synchronized ServiceDependency setCallbacks(Object instance, String added, String removed) {
         return setCallbacks(instance, added, null, removed);
     }
     
     /**
-     * Sets the callbacks for this service. These callbacks can be used as hooks whenever
-     * a dependency is added or removed. They are called on the instance you provide.
+     * Sets the callbacks for this service. These callbacks can be used as hooks whenever a
+     * dependency is added, changed or removed. They are called on the instance you provide. When you
+     * specify callbacks, the auto configuration feature is automatically turned off, because
+     * we're assuming you don't need it in this case.
      * 
      * @param instance the instance to call the callbacks on
      * @param added the method to call when a service was added
@@ -649,6 +677,10 @@
      */
     public synchronized ServiceDependency setCallbacks(Object instance, String added, String changed, String removed) {
         ensureNotActive();
+        // if at least one valid callback is specified, we turn off auto configuration
+        if (added != null || removed != null || changed != null) {
+            setAutoConfig(false);
+        }
         m_callbackInstance = instance;
         m_callbackAdded = added;
         m_callbackChanged = changed;