Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2012-10-05 12:59:25 -0400
committerChristopher Frost2012-10-05 12:59:25 -0400
commit7ae68025f99ae240c7e35d45b2564ae42180bde1 (patch)
treef0d7e7ba0f084d43671e9b734af9c17e89b0a0c6
parentf6dca20237b43c8a244e87e905fdf85ab28c50ae (diff)
downloadorg.eclipse.virgo.kernel-7ae68025f99ae240c7e35d45b2564ae42180bde1.tar.gz
org.eclipse.virgo.kernel-7ae68025f99ae240c7e35d45b2564ae42180bde1.tar.xz
org.eclipse.virgo.kernel-7ae68025f99ae240c7e35d45b2564ae42180bde1.zip
390707 Fixed bad method names on the state dump MXBeans
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiWire.java24
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/js/bundlesGui.js31
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/js/dumps.js44
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/styles/common.css1
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/styles/dumps.css14
5 files changed, 86 insertions, 28 deletions
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 5c5c2a9a..19f5534e 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.virgo.kernel.userregion.internal.management;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -49,10 +51,10 @@ public class JMXQuasiWire {
this.namespace = BundleDescription.HOST_NAMESPACE;
this.providerId = provider.getBundleId();
this.requirerId = requirer.getBundleId();
- this.bundleCapabilityAttributes = this.getProperties();
- this.bundleCapabilityDirectives = this.getProperties();
+ this.bundleCapabilityAttributes = new HashMap<String, String>();
+ this.bundleCapabilityDirectives = new HashMap<String, String>();
this.bundleRequirementAttributes = this.getProperties(new String[]{"host", provider.getSymbolicName()}, new String[]{"bundle-version", provider.getVersion().toString()});
- this.bundleRequirementDirectives = this.getProperties();
+ this.bundleRequirementDirectives = new HashMap<String, String>();
}
public JMXQuasiWire(QuasiRequiredBundle provider,QuasiBundle requirer) {
@@ -67,7 +69,7 @@ public class JMXQuasiWire {
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();
+ this.bundleRequirementDirectives = new HashMap<String, String>();
}
public final long getRequirerBundleId(){
@@ -101,7 +103,19 @@ public class JMXQuasiWire {
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());
+ if(entry.getValue().getClass().isArray()){
+ Object[] valueArray = (Object[]) entry.getValue();
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < valueArray.length; i++) {
+ builder.append(valueArray[i].toString());
+ if(i < valueArray.length -1){
+ builder.append(", ");
+ }
+ }
+ properties.put(entry.getKey(), builder.toString());
+ }else{
+ properties.put(entry.getKey(), entry.getValue().toString());
+ }
}
return properties;
}
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/js/bundlesGui.js b/org.eclipse.virgo.management.console/src/main/webapp/js/bundlesGui.js
index 4c0dc4fc..fd986070 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/js/bundlesGui.js
+++ b/org.eclipse.virgo.management.console/src/main/webapp/js/bundlesGui.js
@@ -212,6 +212,7 @@ var LayoutManager = function(bundleCanvas, width, height, dataSource){
};
self.getInfoBoxWithWire = function(wire){
+ console.log(wire);
var name = 'wire' + wire.ProviderBundleId + '-' + wire.RequirerBundleId;
var title = 'Wire(s) between Bundles ' + wire.ProviderBundleId + ' and ' + wire.RequirerBundleId;
var infoBox = $('<ul></ul>');
@@ -344,23 +345,17 @@ var Bundle = function(paper, rawBundle, x, y, dblClickCallback){
var name = 'bundle' + rawBundle.Identifier;
var title = 'Bundle [' + rawBundle.Identifier + '] ' + rawBundle.SymbolicName + ': ' + rawBundle.Version;
var infoBox = $('<ul></ul>');
- infoBox.append($('<li>State - ' + rawBundle.State + '</li>'));
- if(rawBundle.StartLevel){
- infoBox.append($('<li>StartLevel - ' + rawBundle.StartLevel + '</li>'));
- }
infoBox.append($('<li>Region - ' + rawBundle.Region + '</li>'));
infoBox.append($('<li>Location - ' + rawBundle.Location + '</li>'));
- if(rawBundle.LastModified){
- infoBox.append($('<li>LastModified - ' + rawBundle.LastModified + '</li>'));
- }
- infoBox.append($('<li>Is a fragment - ' + rawBundle.Fragment + '</li>'));
- if(rawBundle.PersistentlyStarted){
- infoBox.append($('<li>PersistentlyStarted - ' + rawBundle.PersistentlyStarted + '</li>'));
- }
- if(rawBundle.ActivationPolicyUsed){
- infoBox.append($('<li>ActivationPolicyUsed - ' + rawBundle.ActivationPolicyUsed + '</li>'));
- }
- infoBox.append($('<li>Required - ' + rawBundle.Required + '</li>'));
+
+ self.appendIfPresent(infoBox, 'State', rawBundle.State);
+ self.appendIfPresent(infoBox, 'LastModified', rawBundle.LastModified);
+ self.appendIfPresent(infoBox, 'Fragment', rawBundle.Fragment);
+ self.appendIfPresent(infoBox, 'StartLevel', rawBundle.StartLevel);
+ self.appendIfPresent(infoBox, 'PersistentlyStarted', rawBundle.PersistentlyStarted);
+ self.appendIfPresent(infoBox, 'ActivationPolicyUsed', rawBundle.ActivationPolicyUsed);
+ self.appendIfPresent(infoBox, 'Required', rawBundle.Required);
+
if(!rawBundle.ExportedPackages || rawBundle.ExportedPackages.length == 0){
infoBox.append($('<li>No exported packages</li>'));
} else {
@@ -379,6 +374,12 @@ var Bundle = function(paper, rawBundle, x, y, dblClickCallback){
}
return new InfoBox({name: name, title: title, content: infoBox, closeable: true});
};
+
+ self.appendIfPresent = function(element, name, field){
+ if(field){
+ element.append($('<li>' + name + ' - ' + field + '</li>'));
+ }
+ };
};
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/js/dumps.js b/org.eclipse.virgo.management.console/src/main/webapp/js/dumps.js
index e7be6a4b..c67b3146 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/js/dumps.js
+++ b/org.eclipse.virgo.management.console/src/main/webapp/js/dumps.js
@@ -157,7 +157,9 @@ var DumpViewer = function(){
self.displayOSGiStateDumpEntry = function(dumpId){
$('#dump-item-content').empty();
+ var controls = $('<div />', {id: 'gui-controls'});
var bundleCanvas = $('<div />', {id: 'bundle-canvas'});
+ $('#dump-item-content').append(controls);
$('#dump-item-content').append(bundleCanvas);
var width = 1000;
var height = 562;
@@ -166,13 +168,18 @@ var DumpViewer = function(){
var dataSource = new QuasiDataSource(self.dumpLocation + '!/' + dumpId);
dataSource.updateData(function(){
dataSource.getUnresolvedBundleIds(function(bundles){
- var bundleToDisplay;
- if(bundles.length == 0){
- bundleToDisplay = 1;
+ layoutManager = new LayoutManager('bundle-canvas', width, height, dataSource);
+ if(bundles.length < 1){
+ controls.append($('<div />').text('There were no unresolved bundles at the time of this state dump.'));
+ layoutManager.displayBundle(5);
}else{
- bundleToDisplay = bundles[0].identifier;
+ $.each(bundles, function(index, unresolvedBundle){
+ var displayLink = $('<div />').text('Bundle ' + unresolvedBundle.identifier + ' unresolved.').click(unresolvedBundle.identifier, layoutManager.displayBundle);
+ var cause = $('<div />', {'class': 'unresolved-bundle-cause'}).text(unresolvedBundle.description);
+ controls.append($('<div />', {'class': 'unresolved-bundle'}).append(displayLink).append(cause));
+ });
+ layoutManager.displayBundle(bundles[0].identifier);
}
- new LayoutManager('bundle-canvas', width, height, dataSource).displayBundle(bundleToDisplay);
});
});
};
@@ -256,11 +263,34 @@ var QuasiDataSource = function(dumpFolder){
self.updateBundle = function(bundleId, callback){
util.doQuery('exec/org.eclipse.virgo.kernel:type=Medic,name=StateDumpInspector/getBundle/' + self.dumpFolder + '/' + bundleId, function(response){
console.log(response.value);
- self.bundles[bundleId].ProvidedWires = response.value.providedWires;
- self.bundles[bundleId].RequiredWires = response.value.requiredWires;
+ self.bundles[bundleId].ProvidedWires = self.processWires(response.value.providedWires);
+ self.bundles[bundleId].RequiredWires = self.processWires(response.value.requiredWires);
callback();
});
};
+
+ self.processWires = function(badlyFormattedWires){
+ var wellFormattedWires = new Array();
+ $.each(badlyFormattedWires, function(index, badlyFormattedWire){
+ wellFormattedWires.push({ProviderBundleId: badlyFormattedWire.providerBundleId,
+ RequirerBundleId: badlyFormattedWire.requirerBundleId,
+ BundleRequirement: {Namespace: badlyFormattedWire.namespace,
+ Attributes: self.processProperties(badlyFormattedWire.bundleRequirementAttributes),
+ Directives: self.processProperties(badlyFormattedWire.bundleRequirementDirectives)},
+ BundleCapability: {Namespace: badlyFormattedWire.namespace,
+ Attributes: self.processProperties(badlyFormattedWire.bundleCapabilityAttributes),
+ Directives: self.processProperties(badlyFormattedWire.bundleCapabilityDirectives)}});
+ });
+ return wellFormattedWires;
+ };
+
+ self.processProperties = function(wellFormattedProperties){
+ var specFormattedProperties = {};
+ $.each(wellFormattedProperties, function(key, value){
+ specFormattedProperties[key] = {'Key': key, 'Value': value};
+ });
+ return specFormattedProperties;
+ };
};
\ No newline at end of file
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/styles/common.css b/org.eclipse.virgo.management.console/src/main/webapp/styles/common.css
index 61406382..785f62fb 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/styles/common.css
+++ b/org.eclipse.virgo.management.console/src/main/webapp/styles/common.css
@@ -497,6 +497,7 @@ td {
padding: 0 5px;
min-width: 400px;
max-width: 800px;
+ white-space: pre-wrap;
word-wrap: break-word;
word-break: break-all;
}
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/styles/dumps.css b/org.eclipse.virgo.management.console/src/main/webapp/styles/dumps.css
index 82d94fbe..d52f6e28 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/styles/dumps.css
+++ b/org.eclipse.virgo.management.console/src/main/webapp/styles/dumps.css
@@ -11,7 +11,7 @@
#side-bar {
position: absolute;
width: 250px;
- min-height: 550px;
+ min-height: 594px;
}
#side-bar h2 {
@@ -73,6 +73,18 @@
background-color: #BAD9EC;
}
+#gui-controls {
+ margin: 15px 0;
+}
+
+.unresolved-bundle {
+ margin-bottom: 10px;
+}
+
+.unresolved-bundle-cause {
+ padding-left: 20px;
+}
+
#bundle-canvas {
border: 1px solid #BAD9EC;
margin-left: auto;

Back to the top