1 23 24 package com.sun.enterprise.management.model; 25 26 import java.util.*; 27 import javax.management.*; 28 import com.sun.enterprise.management.util.J2EEModuleCallBack; 30 31 32 public abstract class J2EEModuleMdl extends J2EEDeployedObjectMdl { 33 HashSet externalVMs = new HashSet(); 34 35 J2EEModuleMdl(J2EEModuleCallBack module) { 36 super(module); 37 } 38 39 public String [] getjavaVMs() { 40 Set res = new HashSet(); 43 if (!(this instanceof AppClientModuleMdl)) { 44 } 46 Iterator vmNames = externalVMs.iterator(); 48 while(vmNames.hasNext()) { 49 String vmName = (String )vmNames.next(); 50 Set x = findNames("j2eeType=JVM,name=" + vmName); 51 if(x.size() > 0) { 52 res.addAll(x); 53 } else { 54 externalVMs.remove(vmName); 56 vmNames = externalVMs.iterator(); 57 } 58 } 59 Iterator it = res.iterator(); 60 String [] vms = new String [res.size()]; 61 int i =0; 62 while(it.hasNext()) { 63 vms[i++] = ((ObjectName)it.next()).toString(); 64 } 65 return vms; 66 } 67 68 72 public String getobjectName() { 73 Set s = findNames("j2eeType="+getj2eeType()+",name="+this.getModuleName()+",J2EEApplication="+this.getJ2EEApplication()+",J2EEServer="+this.getJ2EEServer()); 74 Object [] objs = s.toArray(); 75 if (objs.length > 0) { 76 String name = ((ObjectName)objs[0]).toString(); 77 return name; 78 } else { 79 return null; 80 } 81 } 82 83 public void addVm(String name) { 84 externalVMs.add(name); 85 } 86 89 public boolean isstateManageable() { 90 94 return false; 95 } 96 99 public boolean iseventProvider() { 100 if(this.getJ2EEApplication().equals("null")) 101 return true; 102 return false; 103 } 104 105 public abstract String getModuleName(); 106 public abstract String getJ2EEApplication(); 107 108 public static boolean isStandAloneModule(String applicationName){ 109 if ( applicationName == null 110 || applicationName.equals("") 111 || applicationName.equals("null") ) { 112 return true; 113 } 114 return false; 115 } 116 } 117 | Popular Tags |