Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2012-11-02 13:25:57 -0400
committerChristopher Frost2012-11-02 13:25:57 -0400
commit8a104d1920b263239bd853aee463e1b81b301027 (patch)
tree12d640a2177c77a5c821a67b2f0429de15516948
parent25bee07e55552e20ff0a21bab4fcb14ab7c3985a (diff)
downloadorg.eclipse.virgo.kernel-8a104d1920b263239bd853aee463e1b81b301027.tar.gz
org.eclipse.virgo.kernel-8a104d1920b263239bd853aee463e1b81b301027.tar.xz
org.eclipse.virgo.kernel-8a104d1920b263239bd853aee463e1b81b301027.zip
392459 Adding a list of bundles to select from when browsing the state dump
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/management/JMXQuasiWire.java13
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/js/dumps.js82
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/styles/dumps.css8
3 files changed, 98 insertions, 5 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 19f5534e..13108535 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,14 +10,13 @@
*******************************************************************************/
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;
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;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiRequiredBundle;
@@ -41,8 +40,14 @@ public class JMXQuasiWire {
this.namespace = BundleDescription.PACKAGE_NAMESPACE;
this.providerId = quasiImportPackage.getProvider().getExportingBundle().getBundleId();
this.requirerId = quasiImportPackage.getImportingBundle().getBundleId();
- this.bundleCapabilityAttributes = this.stringifyMap(quasiImportPackage.getProvider().getAttributes());
- this.bundleCapabilityDirectives = this.stringifyMap(quasiImportPackage.getProvider().getDirectives());
+ QuasiExportPackage provider = quasiImportPackage.getProvider();
+ if(provider != null){
+ this.bundleCapabilityAttributes = this.stringifyMap(provider.getAttributes());
+ this.bundleCapabilityDirectives = this.stringifyMap(provider.getDirectives());
+ }else{
+ this.bundleCapabilityAttributes = new HashMap<String, String>();
+ this.bundleCapabilityDirectives = new HashMap<String, String>();
+ }
this.bundleRequirementAttributes = this.stringifyMap(quasiImportPackage.getAttributes());
this.bundleRequirementDirectives = this.stringifyMap(quasiImportPackage.getDirectives());
}
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 2610fbfb..fa624f11 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
@@ -180,6 +180,10 @@ var DumpViewer = function(){
});
layoutManager.displayBundle(bundles[0].identifier);
}
+ var tableHolder = $('<div />', {id: 'table-holder'});
+ controls.append(tableHolder);
+ new TopBar(tableHolder, layoutManager, dataSource).init();
+ $('#side-bar').height($('#dump-item-content').height() - 32);
});
});
};
@@ -291,4 +295,82 @@ var QuasiDataSource = function(dumpFolder){
};
};
+
+
+var TopBar = function(container, layoutManager, dataSource){
+
+ var self = this;
+
+ self.dataSource = dataSource;
+
+ self.layoutManager = layoutManager;
+
+ self.container = container;
+
+ self.focused = -1;
+
+ self.layoutManager.setFocusListener(function(bundleId){
+ if(bundleId != self.focused){
+ self.setFocused(bundleId);
+ }
+ });
+
+ self.setFocused = function(bundleId){
+ self.focused = bundleId;
+ var rowIds = $('td:first-child', self.bundlesTable);
+ $.each(rowIds, function(index, rowId){
+ if($(rowId).text() == bundleId){
+ self.container.scrollTop($(rowId).position().top);
+ $('.table-tr-selected', self.bundlesTable).removeClass('table-tr-selected');
+ $(rowId).parent().addClass('table-tr-selected');
+ }
+ });
+ };
+
+ self.init = function(){
+ var tRows = new Array();
+ $.each(dataSource.bundles, function(id, bundle){
+ tRows.push([id, self.getFormattedBundleName(bundle), bundle.Version]);
+ });
+
+ self.bundlesTable = util.makeTable({
+ id: 'bundle-table',
+ headers: [{title: 'Id', type: 'numeric'}, {title: 'SymbolicName', type: 'alpha'}, {title: 'Version', type: 'version'}],
+ rows: tRows,
+ sortable : true,
+ sortIndex: 0,
+ selectable : self.clickEvent
+ });
+ self.container.append(self.bundlesTable);
+ if(util.pageLocation && util.pageLocation.length > 0){
+ self.setFocused(util.pageLocation);
+ }
+ };
+
+ self.getFormattedBundleName = function(bundle){
+ var formatBundleList = function(bundleIdArray){
+ var result = bundleIdArray[0];
+ for(var i = 1; i < bundleIdArray.length; i++) {
+ result = result + ', ' + bundleIdArray[i];
+ }
+ return result;
+ };
+ if(bundle.Fragments && bundle.Fragments.length > 0){
+ return bundle.SymbolicName + ' - Fragments [' + formatBundleList(bundle.Fragments) + ']';
+ }
+ if(bundle.Hosts && bundle.Hosts.length > 0){
+ return bundle.SymbolicName + ' - Host [' + formatBundleList(bundle.Hosts) + ']';
+ }else if(bundle.Fragment == 'true'){
+ return bundle.SymbolicName + ' Is Fragments';
+ }
+ return bundle.SymbolicName;
+ };
+
+ self.clickEvent = function(row){
+ var bundleId = $('td:first-child', row).text();
+ self.focused = bundleId;
+ self.layoutManager.displayBundle(bundleId);
+ };
+
+};
\ No newline at end of file
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 d52f6e28..b4cd92f5 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: 594px;
+ min-height: 550px;
}
#side-bar h2 {
@@ -77,6 +77,12 @@
margin: 15px 0;
}
+#table-holder {
+ margin-top: 15px;
+ max-height: 200px;
+ overflow: auto;
+}
+
.unresolved-bundle {
margin-bottom: 10px;
}

Back to the top