1 23 24 package com.sun.enterprise.management.model; 25 26 import javax.management.ObjectName ; 27 import java.util.Set ; 28 29 public class JVMMdl extends J2EEManagedObjectMdl { 30 private static String MANAGED_OBJECT_TYPE = "JVM"; 31 private String jvmName; 32 public JVMMdl(String name){ 33 super(name,false,false,false); 34 this.jvmName = name; 35 } 36 37 public String getjavaVersion(){ return System.getProperty("java.version"); } 38 39 public String getjavaVendor(){ return System.getProperty("java.vendor"); } 40 41 public String getnode(){ 42 try { 43 return java.net.InetAddress.getLocalHost().toString(); 44 } catch(Exception e) { 45 return null; 46 } 47 } 48 49 52 public String getj2eeType() { 53 return MANAGED_OBJECT_TYPE; 54 } 55 56 60 public String getobjectName() { 61 Set s = findNames("j2eeType="+getj2eeType()+",name="+this.jvmName); 62 Object [] objs = s.toArray(); 63 if (objs.length > 0) { 64 String name = ((ObjectName )objs[0]).toString(); 65 return name; 66 } else { 67 return null; 68 } 69 } 70 } 71 | Popular Tags |