Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2012-10-04 13:06:35 -0400
committerChristopher Frost2012-10-04 13:06:35 -0400
commit95468534003155ae7354db44a779d91f1b5d29a2 (patch)
treed4649a7969fe0ce5ea06ce33906815aa83551d85
parent95a71f880cf4ffe7421307b70fc471ee4744eb69 (diff)
downloadorg.eclipse.virgo.kernel-95468534003155ae7354db44a779d91f1b5d29a2.tar.gz
org.eclipse.virgo.kernel-95468534003155ae7354db44a779d91f1b5d29a2.tar.xz
org.eclipse.virgo.kernel-95468534003155ae7354db44a779d91f1b5d29a2.zip
390707 Fixing bad getters on MXBean API
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiBundle.java7
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiWire.java55
2 files changed, 35 insertions, 27 deletions
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiBundle.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiBundle.java
index 63410698..300b8e61 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiBundle.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiBundle.java
@@ -13,7 +13,6 @@ package org.eclipse.virgo.kernel.userregion.internal.management;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiExportPackage;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiImportPackage;
@@ -44,7 +43,7 @@ public final class JMXQuasiBundle extends JMXQuasiMinimalBundle{
List<QuasiBundle> fragments = this.quasiBundle.getFragments();
if(fragments != null && fragments.size() > 0){
for (QuasiBundle fragment : fragments) {
- wires.add(new JMXQuasiWire(this.quasiBundle, fragment, BundleDescription.HOST_NAMESPACE));
+ wires.add(new JMXQuasiWire(this.quasiBundle, fragment));
}
}
return wires.toArray(new JMXQuasiWire[wires.size()]);
@@ -59,13 +58,13 @@ public final class JMXQuasiBundle extends JMXQuasiMinimalBundle{
List<QuasiRequiredBundle> requiredBundles = this.quasiBundle.getRequiredBundles();
if(requiredBundles != null && requiredBundles.size() > 0){
for (QuasiRequiredBundle quasiRequiredBundle : requiredBundles) {
- wires.add(new JMXQuasiWire(quasiRequiredBundle, this.quasiBundle, BundleDescription.BUNDLE_NAMESPACE));
+ wires.add(new JMXQuasiWire(quasiRequiredBundle, this.quasiBundle));
}
}
List<QuasiBundle> hosts = this.quasiBundle.getHosts();
if(hosts != null && hosts.size() > 0){
for (QuasiBundle host : hosts) {
- wires.add(new JMXQuasiWire(host, this.quasiBundle, BundleDescription.HOST_NAMESPACE));
+ wires.add(new JMXQuasiWire(host, this.quasiBundle));
}
}
return wires.toArray(new JMXQuasiWire[wires.size()]);
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiWire.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiWire.java
index 0c617a1a..5c5c2a9a 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiWire.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiWire.java
@@ -12,6 +12,7 @@ package org.eclipse.virgo.kernel.userregion.internal.management;
import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
@@ -26,26 +27,26 @@ public class JMXQuasiWire {
private final long requirerId;
- private final Map<String, Object> bundleCapabilityAttributes;
+ private final Map<String, String> bundleCapabilityAttributes;
- private final Map<String, Object> bundleCapabilityDirectives;
+ private final Map<String, String> bundleCapabilityDirectives;
- private final Map<String, Object> bundleRequirementAttributes;
+ private final Map<String, String> bundleRequirementAttributes;
- private final Map<String, Object> bundleRequirementDirectives;
+ private final Map<String, String> bundleRequirementDirectives;
public JMXQuasiWire(QuasiImportPackage quasiImportPackage) {
this.namespace = BundleDescription.PACKAGE_NAMESPACE;
this.providerId = quasiImportPackage.getProvider().getExportingBundle().getBundleId();
this.requirerId = quasiImportPackage.getImportingBundle().getBundleId();
- this.bundleCapabilityAttributes = quasiImportPackage.getProvider().getAttributes();
- this.bundleCapabilityDirectives = quasiImportPackage.getProvider().getDirectives();
- this.bundleRequirementAttributes = quasiImportPackage.getAttributes();
- this.bundleRequirementDirectives = quasiImportPackage.getDirectives();
+ this.bundleCapabilityAttributes = this.stringifyMap(quasiImportPackage.getProvider().getAttributes());
+ this.bundleCapabilityDirectives = this.stringifyMap(quasiImportPackage.getProvider().getDirectives());
+ this.bundleRequirementAttributes = this.stringifyMap(quasiImportPackage.getAttributes());
+ this.bundleRequirementDirectives = this.stringifyMap(quasiImportPackage.getDirectives());
}
- public JMXQuasiWire(QuasiBundle provider, QuasiBundle requirer, String hostNamespace) {
- this.namespace = hostNamespace;
+ public JMXQuasiWire(QuasiBundle provider, QuasiBundle requirer) {
+ this.namespace = BundleDescription.HOST_NAMESPACE;
this.providerId = provider.getBundleId();
this.requirerId = requirer.getBundleId();
this.bundleCapabilityAttributes = this.getProperties();
@@ -54,8 +55,8 @@ public class JMXQuasiWire {
this.bundleRequirementDirectives = this.getProperties();
}
- public JMXQuasiWire(QuasiRequiredBundle provider,QuasiBundle requirer, String bundleNamespace) {
- this.namespace = bundleNamespace;
+ public JMXQuasiWire(QuasiRequiredBundle provider,QuasiBundle requirer) {
+ this.namespace = BundleDescription.BUNDLE_NAMESPACE;
QuasiBundle quasiProvider = provider.getProvider();
if(quasiProvider == null){
this.providerId = -1l;
@@ -63,42 +64,50 @@ public class JMXQuasiWire {
this.providerId = quasiProvider.getBundleId();
}
this.requirerId = requirer.getBundleId();
- this.bundleCapabilityAttributes = provider.getAttributes();
- this.bundleCapabilityDirectives = provider.getDirectives();
+ this.bundleCapabilityAttributes = this.stringifyMap(provider.getAttributes());
+ this.bundleCapabilityDirectives = this.stringifyMap(provider.getDirectives());
this.bundleRequirementAttributes = this.getProperties(new String[]{"Required-Bundle", provider.getRequiredBundleName()}, new String[]{"Version-Constraint", provider.getVersionConstraint().toString()});
this.bundleRequirementDirectives = this.getProperties();
}
- public final long RequirerBundleId(){
+ public final long getRequirerBundleId(){
return this.requirerId;
}
- public final long ProviderBundleId(){
+ public final long getProviderBundleId(){
return this.providerId;
}
- public final String Namespace(){
+ public final String getNamespace(){
return this.namespace;
}
- public final Map<String, Object> BundleCapabilityAttributes(){
+ public final Map<String, String> getBundleCapabilityAttributes(){
return this.bundleCapabilityAttributes;
}
- public final Map<String, Object> BundleCapabilityDirectives(){
+ public final Map<String, String> getBundleCapabilityDirectives(){
return this.bundleCapabilityDirectives;
}
- public final Map<String, Object> BundleRequirementAttributes(){
+ public final Map<String, String> getBundleRequirementAttributes(){
return this.bundleRequirementAttributes;
}
- public final Map<String, Object> BundleRequirementDirectives(){
+ public final Map<String, String> getBundleRequirementDirectives(){
return this.bundleRequirementDirectives;
}
- private final Map<String, Object> getProperties(String[]... strings){
- Map<String, Object> properties = new HashMap<String, Object>();
+ private Map<String, String> stringifyMap(Map<String, Object> map){
+ Map<String, String> properties = new HashMap<String, String>();
+ for(Entry<String, Object> entry: map.entrySet()){
+ properties.put(entry.getKey(), entry.getValue().toString());
+ }
+ return properties;
+ }
+
+ private Map<String, String> getProperties(String[]... strings){
+ Map<String, String> properties = new HashMap<String, String>();
for (int i = 0; i < strings.length; i++) {
properties.put(strings[i][0], strings[i][1]);
}

Back to the top