aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/main
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-01-09 01:26:06 +0100
committerGitHub <noreply@github.com>2023-01-09 01:26:06 +0100
commite704b1b4ae95eabfa30f7fc4ea0f44ac4e7ee177 (patch)
tree8e58757d3d0b2557b332c037d585c4f9b67027e1 /jdisc_core/src/main
parent6cedb4636301e1348d64e58886fe135be8b2b527 (diff)
parent52cf70ebb4edcae9766af8913faf3da8ffc6e0cd (diff)
Merge pull request #25443 from vespa-engine/More_user_friendly_class_resolution
More user friendly class resolution
Diffstat (limited to 'jdisc_core/src/main')
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/application/BsnVersion.java21
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java31
2 files changed, 22 insertions, 30 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/application/BsnVersion.java b/jdisc_core/src/main/java/com/yahoo/jdisc/application/BsnVersion.java
new file mode 100644
index 00000000000..40573eee3b2
--- /dev/null
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/application/BsnVersion.java
@@ -0,0 +1,21 @@
+package com.yahoo.jdisc.application;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * A bundle's symbolic name and version.
+ *
+ * @author gjoranv
+ */
+public record BsnVersion(String symbolicName, Version version) {
+
+ public BsnVersion(Bundle bundle) {
+ this(bundle.getSymbolicName(), bundle.getVersion());
+ }
+
+ public String toReadableString() {
+ return symbolicName + " version:" + version;
+ }
+
+}
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 3212bb4e6de..203c2e975e4 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,10 +15,8 @@ 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
@@ -129,31 +127,4 @@ 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);
- }
-
- }
-
}