1 23 24 29 30 package com.sun.enterprise.management.j2ee; 31 32 import java.util.Set ; 33 import java.util.Map ; 34 import java.util.HashMap ; 35 import java.util.Collections ; 36 37 import javax.management.ObjectName ; 38 import javax.management.InstanceNotFoundException ; 39 40 import com.sun.appserv.management.base.Util; 41 import com.sun.appserv.management.base.AMX; 42 import com.sun.appserv.management.base.XTypes; 43 import com.sun.appserv.management.j2ee.JVM; 44 import com.sun.appserv.management.j2ee.J2EEServer; 45 46 import com.sun.appserv.management.j2ee.J2EETypes; 47 48 import com.sun.appserv.management.config.ServerConfig; 49 50 import com.sun.appserv.management.util.misc.GSetUtil; 51 52 import com.sun.enterprise.management.support.Delegate; 53 54 57 public final class JVMImpl 58 extends J2EEManagedObjectImplBase 59 { 60 public 61 JVMImpl( final Delegate delegate ) 62 { 63 super( delegate ); 64 } 65 66 public String 67 getjavaVendor() 68 { 69 return( (String )delegateGetAttributeNoThrow( "javaVendor" ) ); 70 } 71 72 protected String 73 getConfigPeerName() 74 { 75 return( AMX.NO_NAME ); 76 } 77 78 protected String 79 getConfigPeerJ2EEType() 80 { 81 return( XTypes.JAVA_CONFIG ); 82 } 83 84 protected Map <String ,String > 85 getConfigPeerProps() 86 { 87 final J2EEServer server = (J2EEServer)getContainer(); 88 final ServerConfig serverConfig = (ServerConfig)server.getConfigPeer(); 89 final String configName = serverConfig.getReferencedConfigName(); 90 91 final Map <String ,String > props = new HashMap <String ,String >(); 92 93 props.put( XTypes.CONFIG_CONFIG, configName ); 94 props.put( AMX.J2EE_TYPE_KEY, XTypes.JAVA_CONFIG ); 95 96 return props; 97 } 98 99 public String 100 getjavaVersion() 101 { 102 return( (String )delegateGetAttributeNoThrow( "javaVersion" ) ); 103 } 104 105 public String 106 getnode() 107 { 108 String fullyQualifiedHostName = (String )delegateGetAttributeNoThrow( "node" ); 109 110 119 try 120 { 121 fullyQualifiedHostName = java.net.InetAddress.getLocalHost().getCanonicalHostName(); 122 } 123 catch( java.net.UnknownHostException e) 124 { 125 } 126 127 return( fullyQualifiedHostName ); 128 } 129 130 131 private final static Set <String > DONT_MAP_SET = Collections.unmodifiableSet( 132 GSetUtil.newSet( new String [] { "node", "javaVersion", "javaVendor" }) ); 133 134 protected Set <String > 135 getDontMapAttributeNames() 136 { 137 final Set <String > all = GSetUtil.newSet( DONT_MAP_SET ); 138 all.addAll( super.getDontMapAttributeNames() ); 139 return( all ); 140 } 141 142 143 } 144 | Popular Tags |