1 23 24 package com.sun.enterprise.management.model; 25 26 import java.util.*; 27 import javax.management.*; 28 import com.sun.enterprise.deployment.Application; 29 import com.sun.enterprise.deployment.WebService; 30 import com.sun.enterprise.deployment.WebServiceEndpoint; 31 import com.sun.enterprise.management.util.J2EEModuleCallBack; 32 33 public class J2EEApplicationMdl extends J2EEDeployedObjectMdl { 34 35 private static String MANAGED_OBJECT_TYPE = "J2EEApplication"; 36 private String appName = null; 37 private boolean hasWebServices=false; 38 private String [] endpointAddresses = null; 39 40 public J2EEApplicationMdl(J2EEModuleCallBack module, Application app) { 41 super(module); 42 43 appName = module.getParentName(); 44 if (app==null) { 45 return; 46 } 47 Set webServices = app.getWebServiceDescriptors(); 48 if (webServices.size()>0) { 49 hasWebServices = true; 50 Vector endpointList = new Vector(); 51 for (Iterator itr = webServices.iterator();itr.hasNext();) { 52 WebService webService = (WebService) itr.next(); 53 for (Iterator endpoints = webService.getWebServicesDescriptor().getEndpoints().iterator(); 54 endpoints.hasNext();) { 55 WebServiceEndpoint wse = (WebServiceEndpoint) endpoints.next(); 56 endpointList.add(wse.getEndpointAddressUri()); 57 } 58 } 59 endpointAddresses = new String [endpointList.size()]; 60 endpointList.copyInto(endpointAddresses); 61 } 62 } 63 64 public String [] getmodules() { 65 66 Set appMods = findNames("j2eeType=EJBModule,J2EEServer=" + getJ2EEServer()+",J2EEApplication="+this.appName); 67 appMods.addAll(findNames("j2eeType=WebModule,J2EEServer=" + getJ2EEServer()+",J2EEApplication="+this.appName)); 68 appMods.addAll(findNames("j2eeType=ResourceAdapterModule,J2EEServer=" + getJ2EEServer()+",J2EEApplication="+this.appName)); 69 appMods.addAll(findNames("j2eeType=AppClientModule,J2EEServer=" + getJ2EEServer()+",J2EEApplication="+this.appName)); 70 71 Iterator it = appMods.iterator(); 72 String [] mods = new String [appMods.size()]; 73 int i =0; 74 while(it.hasNext()) { 75 mods[i++] = ((ObjectName)it.next()).toString(); 76 } 77 return mods; 78 } 79 80 83 public String getj2eeType() { 84 return MANAGED_OBJECT_TYPE; 85 } 86 87 91 public String getobjectName() { 92 Set s = findNames("j2eeType="+getj2eeType()+",name="+this.appName+",J2EEServer="+getJ2EEServer()); 93 Object [] objs = s.toArray(); 94 if (objs.length > 0) { 95 String name = ((ObjectName)objs[0]).toString(); 96 return name; 97 } else { 98 return null; 99 } 100 } 101 102 105 public boolean gethasWebServices() { 106 return hasWebServices; 107 } 108 109 112 public String [] getendpointAddresses() { 113 return endpointAddresses; 114 } 115 } 116 | Popular Tags |