1 22 package org.jboss.console.plugins; 23 24 import javax.management.ObjectName ; 25 26 import org.jboss.console.manager.interfaces.ManageableResource; 27 import org.jboss.console.manager.interfaces.ResourceTreeNode; 28 import org.jboss.console.manager.interfaces.TreeNode; 29 import org.jboss.console.manager.interfaces.impl.MBeanResource; 30 import org.jboss.console.plugins.helpers.AbstractPluginWrapper; 31 import org.jboss.management.j2ee.WebModuleMBean; 32 import org.jboss.mx.util.MBeanProxyExt; 33 49 public class WebModuleLister 50 extends AbstractPluginWrapper 51 { 52 private static final long serialVersionUID = -8019251323455453105L; 53 54 protected final static String JMX_JSR77_DOMAIN = "jboss.management.local"; 55 56 public WebModuleLister () { super(); } 57 58 ResourceTreeNode[] createBeans (ObjectName parent) throws Exception 59 { 60 WebModuleMBean wmProxy = (WebModuleMBean) 61 MBeanProxyExt.create(WebModuleMBean.class, parent, getMBeanServer()); 62 63 String [] servletsObjectName = wmProxy.getservlets(); 64 65 ResourceTreeNode[] servlets = new ResourceTreeNode[servletsObjectName.length]; 66 for (int i=0; i< servletsObjectName.length; i++) 67 { 68 ObjectName objectName = new ObjectName (servletsObjectName[i]); 69 String name = objectName.getKeyProperty("name"); 70 71 servlets[i] = createResourceNode( 72 name, "'" + name + "' Servlet", "images/serviceset.gif", "Servlet.jsp?ObjectName=" + encode(objectName.toString()), null, 77 null, null, objectName.toString(), 80 org.jboss.management.j2ee.Servlet.class.getName() 81 ); 82 83 } 84 85 return servlets; 86 } 87 88 protected TreeNode getTreeForResource(String profile, ManageableResource resource) 89 { 90 try 91 { 92 ObjectName objName = ((MBeanResource)resource).getObjectName(); 93 94 return createTreeNode 95 ( 96 objName.getKeyProperty("name"), "", "images/spirale.gif", "WebModule.jsp?ObjectName=" + encode(objName.toString()), null, 101 null, createBeans (objName) ).setMasterNode(true); 104 105 } 106 catch (Exception e) 107 { 108 e.printStackTrace (); 109 System.out.println (checker); 110 return null; 111 112 } 113 } 114 115 } 116 | Popular Tags |