felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1640251 - in /felix/sandbox/pderop/dependencymanager-prototype: org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/customdep...
Date Mon, 17 Nov 2014 22:48:29 GMT
Author: pderop
Date: Mon Nov 17 22:48:28 2014
New Revision: 1640251

URL: http://svn.apache.org/r1640251
Log:
Event is now a class instead of an interface. This allows to make it easier to make custom dependencies
(no need to implement the Event).
Also; the org.apache.felix.dm.context package is not importing anymore some classes from the org.apache.felix.dm.impl package.

Added:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/EventImpl.java
Removed:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/EventImpl.java
Modified:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ToggleServiceDependency.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/customdep/PathDependency.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/AbstractDependency.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/Event.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleDependencyImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleEventImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationEventImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/FilterComponent.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceDependencyImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceEventImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceDependencyImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceEventImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/TemporalServiceDependencyImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ComponentTest.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConcurrencyTest.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConfigurationTest.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ToggleServiceDependency.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ToggleServiceDependency.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ToggleServiceDependency.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ToggleServiceDependency.java Mon Nov 17 22:48:28 2014
@@ -32,41 +32,7 @@ import org.apache.felix.dm.context.Event
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class ToggleServiceDependency extends AbstractDependency<ToggleServiceDependency> {
-    public class ToggleEvent implements Event {
-        @Override
-        public boolean equals(Object e) {
-            if (e instanceof ToggleEvent) {
-                return true;
-            }
-            return false;
-        }
-
-        @Override
-        public int hashCode() {
-            return ToggleEvent.class.hashCode();
-        }
-
-        @Override
-        public int compareTo(Event o) {
-            return 0;
-        }
-
-        @Override
-        public void close() {
-        }
-
-        @Override
-        public Object getEvent() {
-            return this;
-        }
-
-        @Override
-        public Dictionary<String, Object> getProperties() {
-            return EMPTY_PROPERTIES;
-        }
-    }
-    
+public class ToggleServiceDependency extends AbstractDependency<ToggleServiceDependency> {    
     public ToggleServiceDependency() {
         super.setRequired(true);
     }
@@ -82,9 +48,9 @@ public class ToggleServiceDependency ext
 
     public void activate(boolean active) {
         if (active) {
-            m_component.handleAdded(this, new ToggleEvent());
+            m_component.handleAdded(this, new Event(active));
         } else {
-            m_component.handleRemoved(this, new ToggleEvent());
+            m_component.handleRemoved(this, new Event(active));
         }
     }
 

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/customdep/PathDependency.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/customdep/PathDependency.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/customdep/PathDependency.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/customdep/PathDependency.java Mon Nov 17 22:48:28 2014
@@ -19,45 +19,6 @@ public class PathDependency extends Abst
     private final String m_path;
     private volatile Thread m_thread;
 
-    public class PathEvent implements Event {
-        final String m_path;
-        public PathEvent(String path) {
-            m_path = path;
-        }
-
-        @Override
-        public boolean equals(Object e) {
-            if (e instanceof PathEvent) {
-                return m_path.equals(((PathEvent) e).m_path);
-            }
-            return false;
-        }
-
-        @Override
-        public int hashCode() {
-            return m_path.hashCode();
-        }
-
-        @Override
-        public int compareTo(Event o) {
-            return m_path.compareTo(((PathEvent) o).m_path);
-        }
-
-        @Override
-        public void close() {
-        }
-
-        @Override
-        public Object getEvent() {
-            return m_path;
-        }
-
-        @Override
-        public Dictionary<String, Object> getProperties() {
-            return EMPTY_PROPERTIES;
-        }
-    }
-
     public PathDependency(String path) {
         super.setRequired(true);
         m_path = path;
@@ -124,9 +85,9 @@ public class PathDependency extends Abst
 						continue;
 					}
 					if (StandardWatchEventKinds.ENTRY_CREATE == kind) {
-				        m_component.handleAdded(this, new PathEvent(event.context().toString()));
+				        m_component.handleAdded(this, new Event(event.context().toString()));
 					} else if (StandardWatchEventKinds.ENTRY_DELETE == kind) {
-					    m_component.handleRemoved(this, new PathEvent(event.context().toString()));
+					    m_component.handleRemoved(this, new Event(event.context().toString()));
 					}
 				}
 				

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java Mon Nov 17 22:48:28 2014
@@ -202,7 +202,7 @@ public class DependencyManager {    
      * @return the service dependency
      */
     public ServiceDependency createServiceDependency() {
-        return new ServiceDependencyImpl(m_context, m_logger);
+        return new ServiceDependencyImpl(m_context);
     }
 
     /**
@@ -220,7 +220,7 @@ public class DependencyManager {    
      * @return a new BundleDependency instance.
      */
     public BundleDependency createBundleDependency() {
-        return new BundleDependencyImpl(m_context, m_logger);
+        return new BundleDependencyImpl(m_context);
     }
 
     /**
@@ -229,7 +229,7 @@ public class DependencyManager {    
      * @return the resource dependency
      */
     public ResourceDependency createResourceDependency() {
-        return new ResourceDependencyImpl(m_context, m_logger);
+        return new ResourceDependencyImpl(m_context);
     }
 
     /**
@@ -239,7 +239,7 @@ public class DependencyManager {    
      * @return a new timed service dependency
      */
     public ServiceDependency createTemporalServiceDependency(long timeout) {
-        return new TemporalServiceDependencyImpl(m_context, m_logger, timeout);
+        return new TemporalServiceDependencyImpl(m_context, timeout);
     }
 
     /**

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/AbstractDependency.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/AbstractDependency.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/AbstractDependency.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/AbstractDependency.java Mon Nov 17 22:48:28 2014
@@ -26,8 +26,6 @@ import java.util.Set;
 
 import org.apache.felix.dm.ComponentDependencyDeclaration;
 import org.apache.felix.dm.Dependency;
-import org.apache.felix.dm.impl.EventImpl;
-import org.apache.felix.dm.impl.Logger;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 
@@ -56,21 +54,15 @@ public abstract class AbstractDependency
     protected final BundleContext m_context;
     protected final Bundle m_bundle;
     protected final static Dictionary<String, Object> EMPTY_PROPERTIES = new Hashtable<>(0);
-    protected final Logger m_logger;
     
     public AbstractDependency() {
         this(true, null);
     }
-
-    public AbstractDependency(boolean autoConfig, BundleContext bc) {
-        this(autoConfig, bc, null);
-    }
     
-    public AbstractDependency(boolean autoConfig, BundleContext bc, Logger logger) {
+    public AbstractDependency(boolean autoConfig, BundleContext bc) {
         m_autoConfig = autoConfig;
         m_context = bc;
         m_bundle = m_context != null ? m_context.getBundle() : null;
-        m_logger = logger;
     }
 
     public AbstractDependency(AbstractDependency<T> prototype) {
@@ -89,7 +81,6 @@ public abstract class AbstractDependency
         m_propagateCallbackMethod = prototype.m_propagateCallbackMethod;
         m_context = prototype.m_context;
         m_bundle = prototype.m_bundle;
-        m_logger = prototype.m_logger;
     }
 
     // ----------------------- Dependency interface -----------------------------
@@ -197,7 +188,7 @@ public abstract class AbstractDependency
         if (event == null) {
             Object defaultService = getDefaultService(true);
             if (defaultService != null) {
-                event = new EventImpl(0, defaultService);
+                event = new Event(defaultService);
             }
         }
         return event;

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java Mon Nov 17 22:48:28 2014
@@ -23,8 +23,10 @@ import java.util.Set;
 import java.util.concurrent.Executor;
 
 import org.apache.felix.dm.Component;
+import org.osgi.service.log.LogService;
 
 public interface ComponentContext extends Component {
+    public void log(int level, String msg, Throwable err);
     public Component setThreadPool(Executor threadPool);
     public void start();
     public void stop();

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/Event.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/Event.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/Event.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/Event.java Mon Nov 17 22:48:28 2014
@@ -19,25 +19,58 @@
 package org.apache.felix.dm.context;
 
 import java.util.Dictionary;
-
+import java.util.Hashtable;
 
 /** 
  * An event holds all data that belongs to some external event as it comes in via
  * the 'changed' callback of a dependency.
  */
-public interface Event extends Comparable<Event> {
+public class Event<T> implements Comparable<Event<T>> {
+    protected final static Dictionary<String, Object> EMPTY_PROPERTIES = new Hashtable<>();
+    private final T m_event;    // the actual event object (a Service, a Bundle, a Configuration, etc ...)
+    
+    public Event(T event) {
+        m_event = event;
+    }
+
+    @Override
+    public int hashCode() {
+        return m_event.hashCode();
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public boolean equals(Object obj) {
+        // an instanceof check here is not "strong" enough with subclasses overriding the
+        // equals: we need to be sure that a.equals(b) == b.equals(a) at all times
+        if (obj != null && obj.getClass().equals(Event.class)) {
+            return (((Event<T>) obj).m_event).equals(m_event);
+        }
+        return false;
+    }
+    
+    @Override
+    public int compareTo(Event<T> o) {
+        return 0;
+    }
+    
     /**
-     * Returns the actual event object wrapped by this event (a Service Dependency, a Bundle for Bundle Dependency, etc...).
+     * Release the resources this event is holding (like service reference for example).
      */
-    Object getEvent();
+    public void close() {
+    }
     
     /**
-     * Returns the properties of the actual event object wrapped by this event (Service Dependency properties, ...).
+     * Returns the actual event object wrapped by this event (a Service Dependency, a Bundle for Bundle Dependency, etc...).
      */
-    Dictionary<String, Object> getProperties();
+    public T getEvent() {
+        return m_event;
+    }
     
     /**
-     * Release the resources this event is holding (like service reference for example).
+     * Returns the properties of the actual event object wrapped by this event (Service Dependency properties, ...).
      */
-    public void close();
+    public Dictionary<String, Object> getProperties() {
+        return EMPTY_PROPERTIES;
+    }
 }

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleDependencyImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleDependencyImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleDependencyImpl.java Mon Nov 17 22:48:28 2014
@@ -50,8 +50,8 @@ public class BundleDependencyImpl extend
     private Object m_propagateCallbackInstance;
     private String m_propagateCallbackMethod;
 
-    public BundleDependencyImpl(BundleContext context, Logger logger) {
-        super(true /* autoconfig */, context, logger);
+    public BundleDependencyImpl(BundleContext context) {
+        super(true /* autoconfig */, context);
     }
     
     public BundleDependencyImpl(BundleDependencyImpl prototype) {
@@ -233,10 +233,10 @@ public class BundleDependencyImpl extend
                     return (Dictionary<String, Object>) InvocationUtil.invokeCallbackMethod(m_propagateCallbackInstance, m_propagateCallbackMethod, new Class[][] {{ Bundle.class }}, new Object[][] {{ bundle }});
                 }
                 catch (InvocationTargetException e) {
-                    m_logger.log(LogService.LOG_WARNING, "Exception while invoking callback method", e.getCause());
+                    m_component.log(LogService.LOG_WARNING, "Exception while invoking callback method", e.getCause());
                 }
                 catch (Throwable e) {
-                    m_logger.log(LogService.LOG_WARNING, "Exception while trying to invoke callback method", e);
+                    m_component.log(LogService.LOG_WARNING, "Exception while trying to invoke callback method", e);
                 }
                 throw new IllegalStateException("Could not invoke callback");
             }
@@ -268,7 +268,7 @@ public class BundleDependencyImpl extend
                 m_nullObject = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] { Bundle.class }, new DefaultNullObject()); 
             }
             catch (Throwable e) {
-                m_logger.log(Logger.LOG_ERROR, "Could not create null object for Bundle.", e);
+                m_component.log(Logger.LOG_ERROR, "Could not create null object for Bundle.", e);
             }
         }
         return (Bundle) m_nullObject;

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleEventImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleEventImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleEventImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleEventImpl.java Mon Nov 17 22:48:28 2014
@@ -24,32 +24,22 @@ import org.apache.felix.dm.context.Event
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleEvent;
 
-public class BundleEventImpl implements Event {
-    final Bundle m_bundle;
+public class BundleEventImpl extends Event<Bundle> {
     final BundleEvent m_event;
     
     public BundleEventImpl(Bundle bundle, BundleEvent event) {
-        m_bundle = bundle;
+        super(bundle);
         m_event = event;
     }
-    
-    @Override
-    public Object getEvent() {
-        return getBundle();
+        
+    public Bundle getBundle() {
+        return getEvent();
     }
     
     @SuppressWarnings("unchecked")
     @Override
     public Dictionary<String, Object> getProperties() {
-        return m_bundle.getHeaders();
-    }
-    
-    @Override
-    public void close() {
-    }
-
-    public Bundle getBundle() {
-        return m_bundle;
+        return getBundle().getHeaders();
     }
     
     public BundleEvent getBundleEvent() {
@@ -69,6 +59,7 @@ public class BundleEventImpl implements 
         return getBundle().hashCode();
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
     public int compareTo(Event b) {
         return Long.compare(getBundle().getBundleId(), ((BundleEventImpl) b).getBundle().getBundleId());

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java Mon Nov 17 22:48:28 2014
@@ -1353,5 +1353,10 @@ public class ComponentImpl implements Co
     
     private Executor getExecutor() {
         return m_executor;
+    }
+
+    @Override
+    public void log(int level, String msg, Throwable err) {
+        m_logger.log(level, msg, err);        
     }        
 }

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java Mon Nov 17 22:48:28 2014
@@ -41,13 +41,15 @@ public class ConfigurationDependencyImpl
 	private ServiceRegistration m_registration;
     private MetaTypeProviderImpl m_metaType;
 	private final AtomicBoolean m_updateInvokedCache = new AtomicBoolean();
+	private final Logger m_logger;
 
     public ConfigurationDependencyImpl() {
-    	this(null, null);
+        this(null, null);
     }
-    
+	
     public ConfigurationDependencyImpl(BundleContext context, Logger logger) {
-    	super(false /* not autoconfig */, context, logger);
+    	super(false /* not autoconfig */, context);
+    	m_logger = logger;
         setRequired(true);
         setCallback("updated");
     }
@@ -55,6 +57,7 @@ public class ConfigurationDependencyImpl
 	public ConfigurationDependencyImpl(ConfigurationDependencyImpl prototype) {
 	    super(prototype);
 	    m_pid = prototype.m_pid;
+	    m_logger = prototype.m_logger;
         m_metaType = prototype.m_metaType != null ? new MetaTypeProviderImpl(prototype.m_metaType, this, null) : null;
 	}
 	
@@ -211,6 +214,7 @@ public class ConfigurationDependencyImpl
         }
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
     public void invokeAdd(Event event) {
 		try {
@@ -220,11 +224,13 @@ public class ConfigurationDependencyImpl
 		}
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
     public void invokeChange(Event event) {
         // We already did that synchronously, from our updated method
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
     public void invokeRemove(Event event) {
         // The state machine is stopping us. We have to invoke updated(null).

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationEventImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationEventImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationEventImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationEventImpl.java Mon Nov 17 22:48:28 2014
@@ -4,24 +4,19 @@ import java.util.Dictionary;
 
 import org.apache.felix.dm.context.Event;
 
-public class ConfigurationEventImpl implements Event {
-    private final Dictionary<String, Object> m_conf;
+public class ConfigurationEventImpl extends Event<Dictionary<String, Object>> {
     private final String m_pid;
     
     public ConfigurationEventImpl(String pid, Dictionary<String, Object> conf) {
+        super(conf);
         m_pid = pid;
-        m_conf = conf;
     }
     
     public String getPid() {
         return m_pid;
     }
         
-    @Override
-    public Object getEvent() {
-        return m_conf;
-    }
-
+    @SuppressWarnings("rawtypes")
     @Override
     public int compareTo(Event other) {
         return m_pid.compareTo(((ConfigurationEventImpl) other).m_pid);
@@ -29,10 +24,6 @@ public class ConfigurationEventImpl impl
 
     @Override
     public Dictionary<String, Object> getProperties() {
-        return m_conf;
-    }
-
-    @Override
-    public void close() {
+        return getEvent();
     }
 }

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/FilterComponent.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/FilterComponent.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/FilterComponent.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/FilterComponent.java Mon Nov 17 22:48:28 2014
@@ -347,4 +347,9 @@ public class FilterComponent implements 
     public Map<String, Long> getCallbacksTime() {
         return m_component.getCallbacksTime();
     }
+
+    @Override
+    public void log(int level, String msg, Throwable err) {
+        m_component.log(level, msg, err);
+    }
 }
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceDependencyImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceDependencyImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceDependencyImpl.java Mon Nov 17 22:48:28 2014
@@ -43,8 +43,8 @@ public class ResourceDependencyImpl exte
     private volatile String m_resourceFilter;
     private volatile URL m_trackedResource;
 
-    public ResourceDependencyImpl(BundleContext context, Logger logger) {
-        super(true /* autoconfig */, context, logger);
+    public ResourceDependencyImpl(BundleContext context) {
+        super(true /* autoconfig */, context);
     }
     
     public ResourceDependencyImpl(ResourceDependencyImpl prototype) {
@@ -115,6 +115,7 @@ public class ResourceDependencyImpl exte
         }
     }
     
+    @SuppressWarnings("rawtypes")
     @Override
     public void invokeAdd(Event e) {
         if (m_add != null) {
@@ -122,6 +123,7 @@ public class ResourceDependencyImpl exte
         }
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
     public void invokeChange(Event e) {
         if (m_change != null) {
@@ -129,6 +131,7 @@ public class ResourceDependencyImpl exte
         }
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
     public void invokeRemove(Event e) {
         if (m_remove != null) {
@@ -136,6 +139,7 @@ public class ResourceDependencyImpl exte
         }
     }
     
+    @SuppressWarnings("rawtypes")
     private void invoke(String method, Event e) {
         ResourceEventImpl re = (ResourceEventImpl) e;
         URL serviceInstance = re.getResource();
@@ -195,10 +199,10 @@ public class ResourceDependencyImpl exte
                     return (Dictionary<String, Object>) InvocationUtil.invokeCallbackMethod(m_propagateCallbackInstance, m_propagateCallbackMethod, new Class[][] {{ URL.class }}, new Object[][] {{ resource }});
                 }
                 catch (InvocationTargetException e) {
-                    m_logger.log(LogService.LOG_WARNING, "Exception while invoking callback method", e.getCause());
+                    m_component.log(LogService.LOG_WARNING, "Exception while invoking callback method", e.getCause());
                 }
                 catch (Throwable e) {
-                    m_logger.log(LogService.LOG_WARNING, "Exception while trying to invoke callback method", e);
+                    m_component.log(LogService.LOG_WARNING, "Exception while trying to invoke callback method", e);
                 }
                 throw new IllegalStateException("Could not invoke callback");
             }
@@ -219,7 +223,7 @@ public class ResourceDependencyImpl exte
                                 !key.equals(ResourceHandler.PORT)) {
                             props.put(key, resourceProperties.get(key).toString());
                         } else {
-                            m_logger.log(LogService.LOG_WARNING, "Custom resource property is overlapping with the default resource property for key: " + key);
+                            m_component.log(LogService.LOG_WARNING, "Custom resource property is overlapping with the default resource property for key: " + key, null);
                         }
                     }
                 }

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceEventImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceEventImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceEventImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceEventImpl.java Mon Nov 17 22:48:28 2014
@@ -23,32 +23,22 @@ import java.util.Dictionary;
 
 import org.apache.felix.dm.context.Event;
 
-public class ResourceEventImpl implements Event {
-    final URL m_resource;
+public class ResourceEventImpl extends Event<URL> {
     final Dictionary<String, Object> m_resourceProperties;
     
     @SuppressWarnings("unchecked")
     public ResourceEventImpl(URL resource, Dictionary<String, ?> resourceProperties) {
-        m_resource = resource;
+        super(resource);
         m_resourceProperties = (Dictionary<String, Object>) resourceProperties;
     }
     
     @Override
-    public Object getEvent() {
-        return getResource();
-    }
-
-    @Override
     public Dictionary<String, Object> getProperties() {
-        return m_resourceProperties == null ? ServiceUtil.EMPTY_PROPERTIES : m_resourceProperties;
-    }
-
-    @Override
-    public void close() {
+        return m_resourceProperties == null ? EMPTY_PROPERTIES : m_resourceProperties;
     }
 
     public URL getResource() {
-        return m_resource;
+        return getEvent();
     }
         
     @Override
@@ -81,6 +71,7 @@ public class ResourceEventImpl implement
         return result;
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
     public int compareTo(Event that) {
         if (this.equals(that)) {

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceDependencyImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceDependencyImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceDependencyImpl.java Mon Nov 17 22:48:28 2014
@@ -138,8 +138,8 @@ public class ServiceDependencyImpl exten
         }
     }
     
-	public ServiceDependencyImpl(BundleContext ctx, Logger logger) {
-		super(true /* autoconfig */, ctx, logger);
+	public ServiceDependencyImpl(BundleContext ctx) {
+		super(true /* autoconfig */, ctx);
 	}
 	
 	public ServiceDependencyImpl(ServiceDependencyImpl prototype) {
@@ -236,7 +236,7 @@ public class ServiceDependencyImpl exten
 		} catch (IllegalStateException e) {
 		    // most likely our bundle is being stopped. Only log an exception if our component is enabled.
 		    if (m_component.isActive()) {
-                m_logger.log(Logger.LOG_WARNING, "could not handle service dependency for component "
+                m_component.log(Logger.LOG_WARNING, "could not handle service dependency for component "
                     + m_component.getComponentDeclaration().getClassName(), e);
 		    }
 		    return null;		    
@@ -261,13 +261,15 @@ public class ServiceDependencyImpl exten
 	    m_component.handleRemoved(this, new ServiceEventImpl(m_bundle, m_context, reference, service));
 	}
 	
-	@Override
+	@SuppressWarnings("rawtypes")
+    @Override
     public void invokeAdd(Event e) {
         if (m_add != null) {
             invoke (m_add, e, getInstances());
         }
     }
 	
+    @SuppressWarnings("rawtypes")
 	@Override
 	public void invokeChange(Event e) {
 	    if (m_change != null) {
@@ -275,6 +277,7 @@ public class ServiceDependencyImpl exten
 	    }
 	}
 
+    @SuppressWarnings("rawtypes")
 	@Override
 	public void invokeRemove(Event e) {
 	    if (m_remove != null) {
@@ -282,6 +285,7 @@ public class ServiceDependencyImpl exten
 	    }
 	}
 	
+    @SuppressWarnings("rawtypes")
     @Override   
     public void invokeSwap(Event event, Event newEvent) {
         if (m_swap != null) {
@@ -358,9 +362,9 @@ public class ServiceDependencyImpl exten
                             new Class[][]{{ServiceReference.class, Object.class}, {ServiceReference.class}}, new Object[][]{
                                     {se.getReference(), se.getEvent()}, {se.getReference()}});
                 } catch (InvocationTargetException e) {
-                    m_logger.log(LogService.LOG_WARNING, "Exception while invoking callback method", e.getCause());
+                    m_component.log(LogService.LOG_WARNING, "Exception while invoking callback method", e.getCause());
                 } catch (Throwable e) {
-                    m_logger.log(LogService.LOG_WARNING, "Exception while trying to invoke callback method", e);
+                    m_component.log(LogService.LOG_WARNING, "Exception while trying to invoke callback method", e);
                 }
                 throw new IllegalStateException("Could not invoke callback");
             } else {
@@ -440,7 +444,7 @@ public class ServiceDependencyImpl exten
                     new Class[] { trackedServiceName }, new DefaultNullObject());
             }
             catch (Throwable err) {
-                m_logger.log(Logger.LOG_ERROR, "Could not create null object for " + trackedServiceName + ".", err);
+                m_component.log(Logger.LOG_ERROR, "Could not create null object for " + trackedServiceName + ".", err);
             }
         }
         return m_nullObject;
@@ -453,7 +457,7 @@ public class ServiceDependencyImpl exten
                     m_defaultImplementationInstance = ((Class<?>) m_defaultImplementation).newInstance();
                 }
                 catch (Throwable e) {
-                    m_logger.log(Logger.LOG_ERROR, "Could not create default implementation instance of class "
+                    m_component.log(Logger.LOG_ERROR, "Could not create default implementation instance of class "
                         + m_defaultImplementation + ".", e);
                 }
             }
@@ -464,6 +468,7 @@ public class ServiceDependencyImpl exten
         return m_defaultImplementationInstance;
     }
 
+    @SuppressWarnings("rawtypes")
     public void invoke(String method, Event e, Object[] instances) {
         ServiceEventImpl se = (ServiceEventImpl) e;
         ServicePropertiesMap propertiesMap = new ServicePropertiesMap(se.getReference());
@@ -535,7 +540,7 @@ public class ServiceDependencyImpl exten
                     {m_component, previousReference, previous, currentReference, current}}
 			);
     	} catch (Throwable e) {
-            m_logger.log(Logger.LOG_ERROR, "Could not invoke swap callback", e);
+    	    m_component.log(Logger.LOG_ERROR, "Could not invoke swap callback", e);
     	}
 	}
 

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceEventImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceEventImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceEventImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ServiceEventImpl.java Mon Nov 17 22:48:28 2014
@@ -25,17 +25,12 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
-public class ServiceEventImpl implements Event {
+public class ServiceEventImpl extends Event<Object> {
     /**
      * The service reference on which a service dependency depends on
      */
 	private final ServiceReference m_reference; 
-	
-	/**
-	 * The service instance on which the service dependency depends on
-	 */
-	private final Object m_service; 
-	
+		
     /**
      * The bundle context of the bundle which has created the service dependency. If not null, 
      * will be used in close method when ugetting the service reference of the dependency.
@@ -53,11 +48,11 @@ public class ServiceEventImpl implements
 	    this(null, null, reference, service);
 	}
 
-	public ServiceEventImpl(Bundle bundle, BundleContext bundleContext, ServiceReference reference, Object service) {
+    public ServiceEventImpl(Bundle bundle, BundleContext bundleContext, ServiceReference reference, Object service) {
+	    super(service);
 	    m_bundle = bundle;
 	    m_bundleContext = bundleContext;
 		m_reference = reference;
-		m_service = service;
 	}
 	
 	/**
@@ -80,12 +75,7 @@ public class ServiceEventImpl implements
 	public ServiceReference getReference() {
 		return m_reference;
 	}
-	
-    @Override
-    public Object getEvent() {
-        return m_service;
-    }
-    
+	    
     @Override
     public Dictionary<String, Object> getProperties() {
         return ServiceUtil.propertiesToDictionary(m_reference);
@@ -104,6 +94,7 @@ public class ServiceEventImpl implements
 		return getReference().hashCode();
 	}
 
+    @SuppressWarnings("rawtypes")
     @Override
     public int compareTo(Event b) {
     	return getReference().compareTo(((ServiceEventImpl) b).getReference());
@@ -111,7 +102,7 @@ public class ServiceEventImpl implements
         
     @Override
     public String toString() {
-    	return m_service.toString();
+    	return getEvent().toString();
     }
 
     @Override

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/TemporalServiceDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/TemporalServiceDependencyImpl.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/TemporalServiceDependencyImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/TemporalServiceDependencyImpl.java Mon Nov 17 22:48:28 2014
@@ -52,8 +52,8 @@ public class TemporalServiceDependencyIm
      * @param logger the logger our Internal logger for logging events.
      * @see DependencyActivatorBase#createTemporalServiceDependency()
      */
-    public TemporalServiceDependencyImpl(BundleContext context, Logger logger, long timeout) {
-        super(context, logger);
+    public TemporalServiceDependencyImpl(BundleContext context, long timeout) {
+        super(context);
         super.setRequired(true);
         if (timeout < 0) {
             throw new IllegalArgumentException("Invalid timeout value: " + timeout);

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ComponentTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ComponentTest.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ComponentTest.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ComponentTest.java Mon Nov 17 22:48:28 2014
@@ -24,7 +24,6 @@ import org.apache.felix.dm.ComponentStat
 import org.apache.felix.dm.Dependency;
 import org.apache.felix.dm.context.AbstractDependency;
 import org.apache.felix.dm.impl.ComponentImpl;
-import org.apache.felix.dm.impl.EventImpl;
 import org.junit.Assert;
 import org.junit.Test;
 

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConcurrencyTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConcurrencyTest.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConcurrencyTest.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConcurrencyTest.java Mon Nov 17 22:48:28 2014
@@ -27,7 +27,6 @@ import org.apache.felix.dm.Component;
 import org.apache.felix.dm.ComponentState;
 import org.apache.felix.dm.ComponentStateListener;
 import org.apache.felix.dm.impl.ComponentImpl;
-import org.apache.felix.dm.impl.EventImpl;
 import org.junit.Assert;
 import org.junit.Test;
 

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConfigurationTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConfigurationTest.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConfigurationTest.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ConfigurationTest.java Mon Nov 17 22:48:28 2014
@@ -24,7 +24,6 @@ import java.util.Hashtable;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.impl.ComponentImpl;
 import org.apache.felix.dm.impl.ConfigurationDependencyImpl;
-import org.apache.felix.dm.impl.EventImpl;
 import org.junit.Test;
 import org.osgi.service.cm.ConfigurationException;
 

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/EventImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/EventImpl.java?rev=1640251&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/EventImpl.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/EventImpl.java Mon Nov 17 22:48:28 2014
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package test;
+
+import org.apache.felix.dm.context.Event;
+
+/* in real life, this event might contain a service reference and service instance
+ * or something similar
+ */
+public class EventImpl extends Event<Object> { // the actual event object (a Service, a Bundle, a Configuration, etc ...)
+	private final int m_id;
+
+	public EventImpl() {
+		this(1);
+	}
+	/** By constructing events with different IDs, we can simulate different unique instances. */
+	public EventImpl(int id) {
+		this (id, null);
+	}
+	
+	public EventImpl(int id, Object event) {
+	    super(event);
+	    m_id = id;
+	}
+	
+
+	@Override
+	public int hashCode() {
+		return m_id;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		// an instanceof check here is not "strong" enough with subclasses overriding the
+		// equals: we need to be sure that a.equals(b) == b.equals(a) at all times
+		if (obj != null && obj.getClass().equals(EventImpl.class)) {
+			return ((EventImpl) obj).m_id == m_id;
+		}
+		return false;
+	}
+	
+    @SuppressWarnings("rawtypes")
+    @Override
+    public int compareTo(Event o) {
+        EventImpl a = this, b = (EventImpl) o;
+        if (a.m_id < b.m_id) {
+            return -1;
+        } else if (a.m_id == b.m_id){
+            return 0;
+        } else {
+            return 1;
+        }
+    }            
+}

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java?rev=1640251&r1=1640250&r2=1640251&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java Mon Nov 17 22:48:28 2014
@@ -30,7 +30,6 @@ import org.apache.felix.dm.ComponentStat
 import org.apache.felix.dm.context.Event;
 import org.apache.felix.dm.impl.ComponentImpl;
 import org.apache.felix.dm.impl.ConfigurationDependencyImpl;
-import org.apache.felix.dm.impl.EventImpl;
 import org.junit.Assert;
 import org.junit.Test;
 import org.osgi.service.cm.ConfigurationException;



Mime
View raw message