felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r883476 - in /felix/trunk/dependencymanager: core/src/main/java/org/apache/felix/dependencymanager/ test/src/test/java/org/apache/felix/dependencymanager/test/
Date Mon, 23 Nov 2009 19:56:18 GMT
Author: marrs
Date: Mon Nov 23 19:56:08 2009
New Revision: 883476

URL: http://svn.apache.org/viewvc?rev=883476&view=rev
Log:
FELIX-1546 applied the patch with some modifications

Modified:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyActivatorBase.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyManager.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dependencymanager/test/ServiceDependencyTest.java

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyActivatorBase.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyActivatorBase.java?rev=883476&r1=883475&r2=883476&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyActivatorBase.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyActivatorBase.java
Mon Nov 23 19:56:08 2009
@@ -108,6 +108,16 @@
     }
     
     /**
+     * Creates a new temporal service dependency.
+     * 
+     * @param timeout the max number of milliseconds to wait for a service availability.
+     * @return the service dependency
+     */
+    public TemporalServiceDependency createTemporalServiceDependency() {
+        return new TemporalServiceDependency(m_context, m_logger);
+    }
+    
+    /**
      * Creates a new configuration dependency.
      * 
      * @return the configuration dependency

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyManager.java?rev=883476&r1=883475&r2=883476&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyManager.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/DependencyManager.java
Mon Nov 23 19:56:08 2009
@@ -85,6 +85,16 @@
         return new ServiceDependency(m_context, m_logger);
     }
     
+    /**
+     * Creates a new temporal service dependency.
+     * 
+     * @param timeout the max number of milliseconds to wait for a service availability.
+     * @return the service dependency
+     */
+    public TemporalServiceDependency createTemporalServiceDependency() {
+        return new TemporalServiceDependency(m_context, m_logger);
+    }
+    
     public ConfigurationDependency createConfigurationDependency() {
         return new ConfigurationDependency(m_context, m_logger);
     }

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java?rev=883476&r1=883475&r2=883476&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java
Mon Nov 23 19:56:08 2009
@@ -41,11 +41,11 @@
  */
 public class ServiceDependency implements Dependency, ServiceTrackerCustomizer, ServiceComponentDependency
{
     private boolean m_isRequired;
-    private Service m_service;
-    private volatile ServiceTracker m_tracker;
-    private BundleContext m_context;
+    protected Service m_service;
+    protected volatile ServiceTracker m_tracker;
+    protected BundleContext m_context;
     private boolean m_isAvailable;
-    private volatile Class m_trackedServiceName;
+    protected volatile Class m_trackedServiceName;
     private Object m_nullObject;
     private volatile String m_trackedServiceFilter;
     private volatile String m_trackedServiceFilterUnmodified;
@@ -56,8 +56,8 @@
     private String m_callbackChanged;
     private String m_callbackRemoved;
     private boolean m_autoConfig;
-    private ServiceReference m_reference;
-    private Object m_serviceInstance;
+    protected ServiceReference m_reference;
+    protected Object m_serviceInstance;
     private final Logger m_logger;
     private String m_autoConfigInstance;
     private boolean m_autoConfigInvoked;
@@ -407,7 +407,7 @@
         }
     }
     
-    private synchronized boolean makeAvailable() {
+    protected synchronized boolean makeAvailable() {
         if (!m_isAvailable) {
             m_isAvailable = true;
             return true;

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dependencymanager/test/ServiceDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dependencymanager/test/ServiceDependencyTest.java?rev=883476&r1=883475&r2=883476&view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dependencymanager/test/ServiceDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dependencymanager/test/ServiceDependencyTest.java
Mon Nov 23 19:56:08 2009
@@ -52,12 +52,15 @@
         // create a service provider and consumer
         Service sp = m.createService().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(),
null);
         Service sc = m.createService().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
+        Service sc2 = m.createService().setImplementation(new ServiceConsumerCallbacks(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(false).setCallbacks("add",
"remove"));
         m.add(sp);
         m.add(sc);
-        m.remove(sp);
         m.remove(sc);
+        m.add(sc2);
+        m.remove(sp);
+        m.remove(sc2);
         // ensure we executed all steps inside the component instance
-        e.step(4);
+        e.step(6);
     }
 }
 
@@ -92,3 +95,18 @@
         m_ensure.step(3);
     }
 }
+
+class ServiceConsumerCallbacks {
+    private final Ensure m_ensure;
+
+    public ServiceConsumerCallbacks(Ensure e) {
+        m_ensure = e;
+    }
+    
+    public void add(ServiceInterface service) {
+        m_ensure.step(4);
+    }
+    public void remove(ServiceInterface service) {
+        m_ensure.step(5);
+    }
+}



Mime
View raw message