felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1579055 - /felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java
Date Tue, 18 Mar 2014 21:35:13 GMT
Author: pderop
Date: Tue Mar 18 21:35:13 2014
New Revision: 1579055

URL: http://svn.apache.org/r1579055
Log:
added this event for bundle events

Added:
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java

Added: felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java?rev=1579055&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java Tue
Mar 18 21:35:13 2014
@@ -0,0 +1,40 @@
+package dm.impl;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleEvent;
+
+public class BundleEventImpl extends EventImpl implements Comparable {
+    final Bundle m_bundle;
+    final BundleEvent m_event;
+    
+    public BundleEventImpl(Bundle bundle, BundleEvent event) {
+        m_bundle = bundle;
+        m_event = event;
+    }
+    
+    public Bundle getBundle() {
+        return m_bundle;
+    }
+    
+    public BundleEvent getBundleEvent() {
+        return m_event;
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof BundleEventImpl) {
+            return getBundle().getBundleId() == ((BundleEventImpl) obj).getBundle().getBundleId();
+        }
+        return false;
+    }
+    
+    @Override
+    public int hashCode() {
+        return getBundle().hashCode();
+    }
+
+    @Override
+    public int compareTo(Object b) {
+        return Long.compare(getBundle().getBundleId(), ((BundleEventImpl) b).getBundle().getBundleId());
+    }
+}



Mime
View raw message