aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/main/java/com/yahoo/jdisc/core
diff options
context:
space:
mode:
authorArnstein Ressem <aressem@gmail.com>2023-01-09 08:25:27 +0100
committerGitHub <noreply@github.com>2023-01-09 08:25:27 +0100
commit170af02d92a5f5e5442c45d6041cd367e46be3ad (patch)
tree62b7e1e947697ddc92e410a0ed1b951e67302f3d /jdisc_core/src/main/java/com/yahoo/jdisc/core
parente704b1b4ae95eabfa30f7fc4ea0f44ac4e7ee177 (diff)
Revert "More user friendly class resolution"
Diffstat (limited to 'jdisc_core/src/main/java/com/yahoo/jdisc/core')
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java
index 203c2e975e4..3212bb4e6de 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java
@@ -1,11 +1,11 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.core;
-import com.yahoo.jdisc.application.BsnVersion;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.Version;
import org.osgi.framework.hooks.bundle.CollisionHook;
import org.osgi.framework.hooks.bundle.EventHook;
import org.osgi.framework.hooks.bundle.FindHook;
@@ -15,8 +15,10 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.logging.Logger;
+import java.util.stream.Collectors;
/**
* A bundle {@link CollisionHook} that contains a set of bundles that are allowed to collide with bundles
@@ -127,4 +129,31 @@ public class BundleCollisionHook implements CollisionHook, EventHook, FindHook {
}
}
+
+ static class BsnVersion {
+
+ private final String symbolicName;
+ private final Version version;
+
+ BsnVersion(Bundle bundle) {
+ this.symbolicName = bundle.getSymbolicName();
+ this.version = bundle.getVersion();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ BsnVersion that = (BsnVersion) o;
+ return Objects.equals(symbolicName, that.symbolicName) &&
+ version.equals(that.version);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(symbolicName, version);
+ }
+
+ }
+
}