1 5 package org.exoplatform.portlets.monitor.jvm.component; 6 7 import java.lang.management.MemoryManagerMXBean ; 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 UIMemoryManagerInfo extends UIExoComponentBase { 26 static private Element TEMPLATE = 27 new Table().setCssClass("UIGrid"). 28 add(new Rows().setShowHeader(true). 29 add(new Column("#{UIMemoryManagerInfo.label.name}", "${name}")). 30 add(new Column("#{UIMemoryManagerInfo.label.is-valid}","${isValid()}")). 31 add(new Column("#{UIMemoryManagerInfo.label.memory-pool-names}", "${memoryPoolNames}"). 32 setFomater(new ArrayFormater(null, ", ")))). 33 optimize() ; 34 35 private ListBeanDataHandler dataHandler_ ; 36 37 public UIMemoryManagerInfo() { 38 setRendererType("TemplateRenderer") ; 39 List list = 40 (List )RootContainer.getInstance().getComponentInstance(JVMRuntimeInfo.MEMORY_MANAGER_MXBEANS) ; 41 dataHandler_ = new ListBeanDataHandler(MemoryManagerMXBean .class) ; 42 dataHandler_.setBeans(list) ; 43 44 } 45 46 public DataHandler getDataHandler(Class type) { 47 return dataHandler_ ; 48 } 49 50 public Element getTemplate() { return TEMPLATE ; } 51 } | Popular Tags |