1 19 package org.netbeans.modules.j2ee.sun.ide.runtime.nodes; 20 import com.sun.appserv.management.j2ee.AppClientModule; 21 import com.sun.appserv.management.j2ee.EJBModule; 22 import com.sun.appserv.management.j2ee.WebModule; 23 import java.util.List ; 24 import java.util.Arrays ; 25 import javax.management.ObjectName ; 26 import org.netbeans.modules.j2ee.sun.ide.controllers.AppClientModuleController; 27 import org.netbeans.modules.j2ee.sun.ide.controllers.ConnectorModuleController; 28 import org.netbeans.modules.j2ee.sun.ide.controllers.ControllerUtil; 29 import org.netbeans.modules.j2ee.sun.ide.controllers.EJBModuleController; 30 31 import org.netbeans.modules.j2ee.sun.ide.controllers.J2EEApplicationMgmtController; 32 import org.netbeans.modules.j2ee.sun.ide.controllers.WebModuleController; 33 import org.netbeans.modules.j2ee.sun.util.NodeTypes; 34 import org.openide.nodes.Children; 35 import org.openide.nodes.Node; 36 import com.sun.appserv.management.base.Util; 37 import com.sun.appserv.management.j2ee.ResourceAdapterModule; 38 39 41 public class EnterpriseApplicationNode extends AppserverMgmtApplicationsNode { 42 43 private static String NODE_TYPE = NodeTypes.ENTERPRISE_APPLICATION; 44 45 46 public EnterpriseApplicationNode(J2EEApplicationMgmtController controller) { 47 super(getChildNodes(controller), controller, NODE_TYPE, false); setDisplayName(controller.getName()); 49 } 50 51 52 60 static Children getChildNodes(J2EEApplicationMgmtController controller) { 61 return createEnterpriseApplicationChildren(controller); 62 } 63 64 65 66 75 static Children createEnterpriseApplicationChildren( 76 J2EEApplicationMgmtController controller) { 77 78 Children children = new Children.Array(); 79 java.util.Vector nodes = new java.util.Vector (); 80 81 if(controller.getJ2EEObject() != null){ 82 WebModuleController [] webControllers = controller.getWebModules(); 84 for(int i = 0; i < webControllers.length; i++) { 85 nodes.add(new WebModuleNode(webControllers[i], true)); 86 } 87 88 89 EJBModuleController [] ejbControllers = controller.getEJBModules(); 91 for(int i = 0; i < ejbControllers.length; i++) { 92 nodes.add(new EJBModuleNode(ejbControllers[i], true)); 93 } 94 95 96 AppClientModuleController [] appClientControllers = 98 controller.getAppClientModules(); 99 for(int i = 0; i < appClientControllers.length; i++) { 100 nodes.add(new AppClientModuleNode(appClientControllers[i], true)); 101 } 102 103 104 ConnectorModuleController [] connectorControllers = 106 controller.getConnectorModules(); 107 for(int i = 0; i < connectorControllers.length; i++) { 108 nodes.add(new ConnectorModuleNode(connectorControllers[i], true)); 109 } 110 }else{ 111 ObjectName [] subComponents = ControllerUtil.getSubComponentsFromConfig(controller.getName(), controller.getMBeanServerConnection()); 112 for(int i=0; i<subComponents.length; i++){ 113 ObjectName oname = subComponents[i]; 114 String type = Util.getJ2EEType(oname); 115 String name = Util.getName(oname); 116 if(WebModule.J2EE_TYPE.equals(type)){ 117 nodes.add(new WebModuleNode(name)); 118 }else if(EJBModule.J2EE_TYPE.equals(type)){ 119 nodes.add(new EJBModuleNode(name)); 120 }else if (AppClientModule.J2EE_TYPE.equals(type)){ 121 nodes.add(new AppClientModuleNode(name)); 122 }else if(ResourceAdapterModule.J2EE_TYPE.equals(type)){ 123 nodes.add(new ConnectorModuleNode(name)); 124 } 125 } 126 } 127 128 129 Node[] arrayToAdd = new Node[nodes.size()]; 130 children.add((Node[])nodes.toArray(arrayToAdd)); 131 return children; 132 } 133 134 protected List getPropertiesToIgnore() { 135 return Arrays.asList(NodeTypes.ENTERPRISE_APPLICATION_NODE); 136 } 137 138 } 139 | Popular Tags |