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.HashSet ; 35 import java.util.Collections ; 36 import java.util.Iterator ; 37 38 import javax.management.ObjectName ; 39 40 import com.sun.appserv.server.util.Version; 41 42 import com.sun.appserv.management.j2ee.J2EEServer; 43 import com.sun.appserv.management.j2ee.JVM; 44 import com.sun.appserv.management.j2ee.J2EETypes; 45 46 import com.sun.appserv.management.util.misc.GSetUtil; 47 48 import com.sun.appserv.management.base.Util; 49 import com.sun.appserv.management.base.AMX; 50 51 import com.sun.enterprise.management.support.ObjectNames; 52 import com.sun.enterprise.management.support.TypeInfos; 53 import com.sun.enterprise.management.support.TypeInfo; 54 55 import com.sun.enterprise.management.support.Delegate; 56 57 import com.sun.enterprise.management.support.AMXAttributeNameMapper; 58 59 62 public class J2EEServerImpl 63 extends J2EELogicalServerImplBase 64 { 65 66 67 private static final String serverVendor = "Sun Microsystems, Inc."; 68 69 public 70 J2EEServerImpl( final Delegate delegate ) 71 { 72 super( delegate ); 73 } 74 75 protected 76 J2EEServerImpl( String j2eeType, Delegate delegate ) 77 { 78 super( j2eeType, delegate ); 79 } 80 81 82 private J2EEServer 83 getSelfProxy() 84 { 85 return (J2EEServer)getSelf(); 86 } 87 88 public String [] 89 getjavaVMs() 90 { 91 final JVM jvm = getSelfProxy().getJVM(); 92 93 String [] result = null; 94 if ( jvm == null ) 95 { 96 result = new String [ 0 ]; 97 } 98 else 99 { 100 result = new String [] { "" + Util.getObjectName( jvm ) }; 101 } 102 103 return result; 104 } 105 106 private static final Set <String > RESOURCE_TYPES = 107 GSetUtil.newUnmodifiableStringSet( 108 J2EETypes.JDBC_RESOURCE, 109 J2EETypes.JAVA_MAIL_RESOURCE, 110 J2EETypes.JCA_RESOURCE, 111 J2EETypes.JMS_RESOURCE, 112 J2EETypes.JNDI_RESOURCE, 113 J2EETypes.JTA_RESOURCE, 114 J2EETypes.RMI_IIOP_RESOURCE, 115 J2EETypes.URL_RESOURCE ); 116 117 118 public String [] 119 getresources() 120 { 121 return GSetUtil.toStringArray( getResourcesObjectNameSet() ); 122 } 123 124 public Set <ObjectName > 125 getResourcesObjectNameSet() 126 { 127 return getContaineeObjectNameSet( RESOURCE_TYPES ); 128 } 129 130 public String 131 getserverVersion() 132 { 133 return ( Version.getVersion() ); 134 } 135 136 public boolean 137 isstatisticProvider() 138 { 139 return( false ); 140 } 141 142 public boolean 143 isstatisticsProvider() 144 { 145 return isstatisticProvider(); 146 } 147 148 public String 149 getserverVendor() 150 { 151 return serverVendor; 152 } 153 154 private final static Set <String > DONT_MAP_SET = 155 GSetUtil.newUnmodifiableStringSet( "serverVendor" ); 156 157 protected Set <String > 158 getDontMapAttributeNames() 159 { 160 return( GSetUtil.newSet( DONT_MAP_SET, super.getDontMapAttributeNames() ) ); 161 } 162 163 protected final Set <String > 164 getFauxChildTypes() 165 { 166 final TypeInfo j2eeApplicationInfo = 167 TypeInfos.getInstance().getInfo( J2EETypes.J2EE_APPLICATION ); 168 169 final Set <String > childJ2EETypes = j2eeApplicationInfo.getChildJ2EETypes(); 170 return( childJ2EETypes ); 171 } 172 173 177 public final Set <ObjectName > 178 getContaineeObjectNameSet( final String childJ2EEType ) 179 { 180 final Set <ObjectName > result = super.getContaineeObjectNameSet( childJ2EEType ); 181 182 if ( getFauxChildTypes().contains( childJ2EEType ) ) 183 { 184 final String nullAppProp = Util.makeProp( J2EETypes.J2EE_APPLICATION, AMX.NULL_NAME ); 185 186 final Set <ObjectName > fauxContainees = 187 getFauxContaineeObjectNameSet( childJ2EEType, nullAppProp); 188 result.addAll( fauxContainees ); 189 } 190 191 return( result ); 192 } 193 194 public boolean 195 getRestartRequired() 196 { 197 return (Boolean )delegateGetAttributeNoThrow( "restartRequired" ); 198 } 199 } 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | Popular Tags |