1 7 package net.sf.panoptes.component.jmx.model; 8 9 import java.util.ArrayList ; 10 import java.util.List ; 11 12 import net.sf.panoptes.model.node.Node; 13 import net.sf.panoptes.model.node.NodeDescriptor; 14 import net.sf.panoptes.model.node.NodeSupport; 15 16 26 public class DomainQuery extends NodeSupport { 27 private boolean global; 28 private List domainCache = null; 29 35 public DomainQuery(NodeSupport parent, boolean global) { 36 super(parent); 37 this.global = global; 38 } 39 40 public void init() { 41 42 } 43 44 47 public NodeDescriptor getConfigDescriptor() { 48 if (super.getConfigDescriptor() != null) 49 return super.getConfigDescriptor(); 50 else 51 return new NodeDescriptor("Domains", "Domains", Node.ICON_DOMAIN); 52 } 53 54 public List getChildren() { 55 return getDomains(); 56 } 57 58 59 private List getDomains() { 60 if (domainCache == null) { 61 domainCache = new ArrayList (); 62 try { 63 if (global) 64 domainCache.addAll(ServerRegistry.getInstance().queryDomains()); 65 else 66 domainCache.addAll( 67 (((MBeanServerNode) getContext().get(MBeanServerNode.MBEANSERVERNODE_KEY)) 68 .getDomains())); 69 } catch (Exception e) { 70 log.error("Unable to execute query", e); 71 } 72 73 } 74 return domainCache; 75 } 76 public boolean mightHaveChildren() { 77 return true; 78 } 79 80 public void refresh() { 81 domainCache = null; 82 getDomains(); 83 } 84 85 88 public Object getBean() { 89 return this; 90 } 91 92 93 } 94 | Popular Tags |