1 5 package org.exoplatform.portlets.monitor.jvm.component; 6 7 import java.lang.management.GarbageCollectorMXBean ; 8 import java.util.List ; 9 import org.exoplatform.container.RootContainer; 10 import org.exoplatform.container.monitor.jvm.JVMRuntimeInfo; 11 import org.exoplatform.faces.core.component.UIExoComponentBase; 12 import org.exoplatform.text.template.DataHandler; 13 import org.exoplatform.text.template.ListBeanDataHandler; 14 import org.exoplatform.text.template.ArrayFormater; 15 import org.exoplatform.text.template.xhtml.Column; 16 import org.exoplatform.text.template.xhtml.Element; 17 import org.exoplatform.text.template.xhtml.Rows; 18 import org.exoplatform.text.template.xhtml.Table; 19 25 public class UIGCInfo extends UIExoComponentBase { 26 static private Element TEMPLATE = 27 new Table().setCssClass("UIGrid"). 28 add(new Rows().setShowHeader(true). 29 add(new Column("#{UIGCInfo.label.name}", "${name}")). 30 add(new Column("#{UIGCInfo.label.is-valid}","${isValid()}")). 31 add(new Column("#{UIGCInfo.label.collection-count}","${collectionCount}")). 32 add(new Column("#{UIGCInfo.label.collectionTime}","${collectionTime}")). 33 add(new Column("#{UIGCInfo.label.memory-pool-names}", "${memoryPoolNames}"). 34 setFomater(new ArrayFormater(null, ", ")))). 35 optimize() ; 36 37 private ListBeanDataHandler dataHandler_ ; 38 39 public UIGCInfo() { 40 setRendererType("TemplateRenderer") ; 41 List list = 42 (List )RootContainer.getInstance().getComponentInstance(JVMRuntimeInfo.GARBAGE_COLLECTOR_MXBEANS) ; 43 dataHandler_ = new ListBeanDataHandler(GarbageCollectorMXBean .class) ; 44 dataHandler_.setBeans(list) ; 45 } 46 47 public DataHandler getDataHandler(Class type) { 48 return dataHandler_ ; 49 } 50 51 public Element getTemplate() { return TEMPLATE ; } 52 } | Popular Tags |