1 23 24 package com.sun.enterprise.management.monitor; 25 26 import javax.management.ObjectName ; 27 import javax.management.MBeanServer ; 28 29 import com.sun.appserv.management.base.AMX; 30 import com.sun.appserv.management.base.XTypes; 31 import com.sun.appserv.management.base.Util; 32 import com.sun.appserv.management.monitor.ServerRootMonitor; 33 import com.sun.appserv.management.monitor.MonitoringRoot; 34 35 import com.sun.enterprise.management.support.AMXImplBase; 36 import com.sun.enterprise.management.support.Delegate; 37 38 import com.sun.appserv.management.util.misc.StringUtil; 39 import com.sun.appserv.management.util.jmx.JMXUtil; 40 41 45 public class MonitoringImplBase extends AMXImplBase 46 { 47 public 48 MonitoringImplBase( final String j2eeType, final Delegate delegate ) 49 { 50 super( j2eeType, delegate ); 51 } 52 53 public 54 MonitoringImplBase( final String j2eeType ) 55 { 56 this( j2eeType, null ); 57 } 58 59 public String 60 getGroup() 61 { 62 return( AMX.GROUP_MONITORING ); 63 } 64 65 public ObjectName 66 getServerRootMonitorObjectName() 67 { 68 ObjectName objectName = null; 69 70 final String name = getObjectName().getKeyProperty( XTypes.SERVER_ROOT_MONITOR ); 71 if ( name != null ) 72 { 73 final MonitoringRoot root = getDomainRoot().getMonitoringRoot(); 74 final ServerRootMonitor mon = 75 (ServerRootMonitor)root.getServerRootMonitorMap().get( name ); 76 77 objectName = Util.getObjectName( mon ); 78 } 79 80 return( objectName ); 81 } 82 83 93 protected final String 94 fixEJBModuleName( final String moduleName ) 95 { 96 final String JAR = "jar"; 97 98 String result = moduleName; 99 100 if ( moduleName.endsWith( "_" + JAR ) ) 101 { 102 result = StringUtil.stripSuffix( moduleName, "_" + JAR ) + "." +JAR; 103 } 104 105 return( result ); 106 } 107 108 protected final ObjectName 109 fixEJBModuleName( 110 final ObjectName objectNameIn, 111 final String key ) 112 { 113 ObjectName objectNameOut = objectNameIn; 114 115 final String origName = objectNameIn.getKeyProperty( key ); 116 if ( origName != null ) 117 { 118 final String fixedName = fixEJBModuleName( origName ); 119 120 if ( ! fixedName.equals( origName ) ) 121 { 122 objectNameOut = JMXUtil.setKeyProperty( objectNameIn, key, fixedName); 123 } 124 } 125 126 if ( ! objectNameOut.equals( objectNameIn ) ) 127 { 128 logFiner( "MonitoringImplBase.fixEJBModuleName: modified " + 129 quote( objectNameIn ) + " => " + quote( objectNameOut ) ); 130 } 131 return( objectNameOut ); 132 } 133 134 137 protected ObjectName 138 preRegisterModifyName( 139 final MBeanServer server, 140 final ObjectName nameIn ) 141 { 142 ObjectName objectNameOut = super.preRegisterModifyName( server, nameIn ); 143 144 if ( nameIn.getKeyProperty( XTypes.EJB_MODULE_MONITOR ) != null ) 145 { 146 objectNameOut = fixEJBModuleName( objectNameOut, XTypes.EJB_MODULE_MONITOR ); 147 } 148 149 return objectNameOut; 150 } 151 } 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | Popular Tags |