1 24 25 package org.objectweb.jonas.management.j2eemanagement; 26 27 import javax.management.AttributeNotFoundException ; 29 import javax.management.InstanceNotFoundException ; 30 import javax.management.MBeanException ; 31 import javax.management.MBeanServer ; 32 import javax.management.MBeanServerConnection ; 33 import javax.management.MalformedObjectNameException ; 34 import javax.management.ObjectName ; 35 import javax.management.ReflectionException ; 36 37 import org.objectweb.jonas.jmx.J2eeObjectName; 38 import org.objectweb.jonas.jmx.ManagementReprFactory; 39 40 45 public class J2EEModule extends J2EEDeployedObject { 46 47 49 private MBeanServerConnection localManagementRepr = ManagementReprFactory.getLocalManagementRepr(); 51 53 55 59 protected J2EEModule(String p_ObjectName) { 60 super(p_ObjectName); 61 } 62 63 70 protected J2EEModule(String p_ObjectName, boolean p_StateManageable 71 , boolean p_StatisticsProvider, boolean p_EventProvider) { 72 super(p_ObjectName, p_StateManageable, p_StatisticsProvider, p_EventProvider); 73 } 74 75 77 81 public String [] getJavaVMs() { 82 String [] as = new String [0]; 83 try { 84 ObjectName on = new ObjectName (getObjectName()); 85 ObjectName onServer = J2eeObjectName.J2EEServer(on.getDomain() 86 , on.getKeyProperty(J2EE_TYPE_SERVER)); 87 as = (String []) ((MBeanServer ) localManagementRepr).getAttribute(onServer, "javaVMs"); 88 } 89 catch (MalformedObjectNameException e) { 90 } catch (AttributeNotFoundException e) { 92 e.printStackTrace(); 94 } catch (InstanceNotFoundException e) { 95 e.printStackTrace(); 97 } catch (MBeanException e) { 98 e.printStackTrace(); 100 } catch (ReflectionException e) { 101 e.printStackTrace(); 103 } 104 return as; 105 } 106 107 } 108 | Popular Tags |