Thu, 31 Aug 2017 15:18:52 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package com.sun.xml.internal.ws.server; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import com.sun.istack.internal.NotNull; |
aoqi@0 | 29 | import com.sun.xml.internal.ws.api.EndpointAddress; |
aoqi@0 | 30 | import com.sun.xml.internal.ws.api.config.management.policy.ManagedClientAssertion; |
aoqi@0 | 31 | import com.sun.xml.internal.ws.api.config.management.policy.ManagedServiceAssertion; |
aoqi@0 | 32 | import com.sun.xml.internal.ws.api.config.management.policy.ManagementAssertion.Setting; |
aoqi@0 | 33 | import com.sun.xml.internal.ws.api.server.Container; |
aoqi@0 | 34 | import com.sun.xml.internal.ws.api.server.WSEndpoint; |
aoqi@0 | 35 | import com.sun.xml.internal.ws.client.Stub; |
aoqi@0 | 36 | import com.sun.org.glassfish.external.amx.AMXGlassfish; |
aoqi@0 | 37 | import com.sun.org.glassfish.gmbal.Description; |
aoqi@0 | 38 | import com.sun.org.glassfish.gmbal.InheritedAttribute; |
aoqi@0 | 39 | import com.sun.org.glassfish.gmbal.InheritedAttributes; |
aoqi@0 | 40 | import com.sun.org.glassfish.gmbal.ManagedData; |
aoqi@0 | 41 | import com.sun.org.glassfish.gmbal.ManagedObjectManager; |
aoqi@0 | 42 | import com.sun.org.glassfish.gmbal.ManagedObjectManagerFactory; |
aoqi@0 | 43 | import java.io.IOException; |
aoqi@0 | 44 | import java.lang.reflect.*; |
aoqi@0 | 45 | import java.util.logging.Level; |
aoqi@0 | 46 | import java.util.logging.Logger; |
aoqi@0 | 47 | |
aoqi@0 | 48 | // BEGIN IMPORTS FOR RewritingMOM |
aoqi@0 | 49 | import java.util.ResourceBundle ; |
aoqi@0 | 50 | import java.lang.reflect.AnnotatedElement ; |
aoqi@0 | 51 | import java.lang.annotation.Annotation ; |
aoqi@0 | 52 | import javax.management.ObjectName ; |
aoqi@0 | 53 | import javax.management.MBeanServer ; |
aoqi@0 | 54 | import com.sun.org.glassfish.gmbal.AMXClient; |
aoqi@0 | 55 | import com.sun.org.glassfish.gmbal.GmbalMBean; |
aoqi@0 | 56 | // END IMPORTS FOR RewritingMOM |
aoqi@0 | 57 | |
aoqi@0 | 58 | /** |
aoqi@0 | 59 | * @author Harold Carr |
aoqi@0 | 60 | */ |
aoqi@0 | 61 | public abstract class MonitorBase { |
aoqi@0 | 62 | |
aoqi@0 | 63 | private static final Logger logger = Logger.getLogger( |
aoqi@0 | 64 | com.sun.xml.internal.ws.util.Constants.LoggingDomain + ".monitoring"); |
aoqi@0 | 65 | |
aoqi@0 | 66 | /** |
aoqi@0 | 67 | * Endpoint monitoring is ON by default. |
aoqi@0 | 68 | * |
aoqi@0 | 69 | * prop | no assert | assert/no mon | assert/mon off | assert/mon on |
aoqi@0 | 70 | * ------------------------------------------------------------------- |
aoqi@0 | 71 | * not set | on | on | off | on |
aoqi@0 | 72 | * false | off | off | off | off |
aoqi@0 | 73 | * true | on | on | off | on |
aoqi@0 | 74 | */ |
aoqi@0 | 75 | @NotNull public ManagedObjectManager createManagedObjectManager(final WSEndpoint endpoint) { |
aoqi@0 | 76 | // serviceName + portName identifies the managed objects under it. |
aoqi@0 | 77 | // There can be multiple services in the container. |
aoqi@0 | 78 | // The same serviceName+portName can live in different apps at |
aoqi@0 | 79 | // different endpoint addresses. |
aoqi@0 | 80 | // |
aoqi@0 | 81 | // In general, monitoring will add -N, where N is unique integer, |
aoqi@0 | 82 | // in case of collisions. |
aoqi@0 | 83 | // |
aoqi@0 | 84 | // The endpoint address would be unique, but we do not know |
aoqi@0 | 85 | // the endpoint address until the first request comes in, |
aoqi@0 | 86 | // which is after monitoring is setup. |
aoqi@0 | 87 | |
aoqi@0 | 88 | String rootName = |
aoqi@0 | 89 | endpoint.getServiceName().getLocalPart() |
aoqi@0 | 90 | + "-" |
aoqi@0 | 91 | + endpoint.getPortName().getLocalPart(); |
aoqi@0 | 92 | |
aoqi@0 | 93 | if (rootName.equals("-")) { |
aoqi@0 | 94 | rootName = "provider"; |
aoqi@0 | 95 | } |
aoqi@0 | 96 | |
aoqi@0 | 97 | // contextPath is not always available |
aoqi@0 | 98 | final String contextPath = getContextPath(endpoint); |
aoqi@0 | 99 | if (contextPath != null) { |
aoqi@0 | 100 | rootName = contextPath + "-" + rootName; |
aoqi@0 | 101 | } |
aoqi@0 | 102 | |
aoqi@0 | 103 | final ManagedServiceAssertion assertion = |
aoqi@0 | 104 | ManagedServiceAssertion.getAssertion(endpoint); |
aoqi@0 | 105 | if (assertion != null) { |
aoqi@0 | 106 | final String id = assertion.getId(); |
aoqi@0 | 107 | if (id != null) { |
aoqi@0 | 108 | rootName = id; |
aoqi@0 | 109 | } |
aoqi@0 | 110 | if (assertion.monitoringAttribute() == Setting.OFF) { |
aoqi@0 | 111 | return disabled("This endpoint", rootName); |
aoqi@0 | 112 | } |
aoqi@0 | 113 | } |
aoqi@0 | 114 | |
aoqi@0 | 115 | if (endpointMonitoring.equals(Setting.OFF)) { |
aoqi@0 | 116 | return disabled("Global endpoint", rootName); |
aoqi@0 | 117 | } |
aoqi@0 | 118 | return createMOMLoop(rootName, 0); |
aoqi@0 | 119 | } |
aoqi@0 | 120 | |
aoqi@0 | 121 | private String getContextPath(final WSEndpoint endpoint) { |
aoqi@0 | 122 | try { |
aoqi@0 | 123 | Container container = endpoint.getContainer(); |
aoqi@0 | 124 | Method getSPI = |
aoqi@0 | 125 | container.getClass().getDeclaredMethod("getSPI", Class.class); |
aoqi@0 | 126 | getSPI.setAccessible(true); |
aoqi@0 | 127 | Class servletContextClass = |
aoqi@0 | 128 | Class.forName("javax.servlet.ServletContext"); |
aoqi@0 | 129 | Object servletContext = |
aoqi@0 | 130 | getSPI.invoke(container, servletContextClass); |
aoqi@0 | 131 | if (servletContext != null) { |
aoqi@0 | 132 | Method getContextPath = servletContextClass.getDeclaredMethod("getContextPath"); |
aoqi@0 | 133 | getContextPath.setAccessible(true); |
aoqi@0 | 134 | return (String) getContextPath.invoke(servletContext); |
aoqi@0 | 135 | } |
aoqi@0 | 136 | return null; |
aoqi@0 | 137 | } catch (Throwable t) { |
aoqi@0 | 138 | logger.log(Level.FINEST, "getContextPath", t); |
aoqi@0 | 139 | } |
aoqi@0 | 140 | return null; |
aoqi@0 | 141 | } |
aoqi@0 | 142 | |
aoqi@0 | 143 | /** |
aoqi@0 | 144 | * Client monitoring is OFF by default because there is |
aoqi@0 | 145 | * no standard stub.close() method. Therefore people do |
aoqi@0 | 146 | * not typically close a stub when they are done with it |
aoqi@0 | 147 | * (even though the RI does provide a .close). |
aoqi@0 | 148 | * <pre> |
aoqi@0 | 149 | * prop | no assert | assert/no mon | assert/mon off | assert/mon on |
aoqi@0 | 150 | * ------------------------------------------------------------------- |
aoqi@0 | 151 | * not set | off | off | off | on |
aoqi@0 | 152 | * false | off | off | off | off |
aoqi@0 | 153 | * true | on | on | off | on |
aoqi@0 | 154 | * </pre> |
aoqi@0 | 155 | */ |
aoqi@0 | 156 | @NotNull public ManagedObjectManager createManagedObjectManager(final Stub stub) { |
aoqi@0 | 157 | EndpointAddress ea = stub.requestContext.getEndpointAddress(); |
aoqi@0 | 158 | if (ea == null) { |
aoqi@0 | 159 | return ManagedObjectManagerFactory.createNOOP(); |
aoqi@0 | 160 | } |
aoqi@0 | 161 | |
aoqi@0 | 162 | String rootName = ea.toString(); |
aoqi@0 | 163 | |
aoqi@0 | 164 | final ManagedClientAssertion assertion = |
aoqi@0 | 165 | ManagedClientAssertion.getAssertion(stub.getPortInfo()); |
aoqi@0 | 166 | if (assertion != null) { |
aoqi@0 | 167 | final String id = assertion.getId(); |
aoqi@0 | 168 | if (id != null) { |
aoqi@0 | 169 | rootName = id; |
aoqi@0 | 170 | } |
aoqi@0 | 171 | if (assertion.monitoringAttribute() == Setting.OFF) { |
aoqi@0 | 172 | return disabled("This client", rootName); |
aoqi@0 | 173 | } else if (assertion.monitoringAttribute() == Setting.ON && |
aoqi@0 | 174 | clientMonitoring != Setting.OFF) { |
aoqi@0 | 175 | return createMOMLoop(rootName, 0); |
aoqi@0 | 176 | } |
aoqi@0 | 177 | } |
aoqi@0 | 178 | |
aoqi@0 | 179 | if (clientMonitoring == Setting.NOT_SET || |
aoqi@0 | 180 | clientMonitoring == Setting.OFF) |
aoqi@0 | 181 | { |
aoqi@0 | 182 | return disabled("Global client", rootName); |
aoqi@0 | 183 | } |
aoqi@0 | 184 | return createMOMLoop(rootName, 0); |
aoqi@0 | 185 | } |
aoqi@0 | 186 | |
aoqi@0 | 187 | @NotNull private ManagedObjectManager disabled(final String x, final String rootName) { |
aoqi@0 | 188 | final String msg = x + " monitoring disabled. " + rootName + " will not be monitored"; |
aoqi@0 | 189 | logger.log(Level.CONFIG, msg); |
aoqi@0 | 190 | return ManagedObjectManagerFactory.createNOOP(); |
aoqi@0 | 191 | } |
aoqi@0 | 192 | |
aoqi@0 | 193 | private @NotNull ManagedObjectManager createMOMLoop(final String rootName, final int unique) { |
aoqi@0 | 194 | final boolean isFederated = AMXGlassfish.getGlassfishVersion() != null; |
aoqi@0 | 195 | ManagedObjectManager mom = createMOM(isFederated); |
aoqi@0 | 196 | mom = initMOM(mom); |
aoqi@0 | 197 | mom = createRoot(mom, rootName, unique); |
aoqi@0 | 198 | return mom; |
aoqi@0 | 199 | } |
aoqi@0 | 200 | |
aoqi@0 | 201 | private @NotNull ManagedObjectManager createMOM(final boolean isFederated) { |
aoqi@0 | 202 | try { |
aoqi@0 | 203 | return new RewritingMOM(isFederated ? |
aoqi@0 | 204 | ManagedObjectManagerFactory.createFederated( |
aoqi@0 | 205 | AMXGlassfish.DEFAULT.serverMon(AMXGlassfish.DEFAULT.dasName())) |
aoqi@0 | 206 | : |
aoqi@0 | 207 | ManagedObjectManagerFactory.createStandalone("com.sun.metro")); |
aoqi@0 | 208 | } catch (Throwable t) { |
aoqi@0 | 209 | if (isFederated) { |
aoqi@0 | 210 | logger.log(Level.CONFIG, "Problem while attempting to federate with GlassFish AMX monitoring. Trying standalone.", t); |
aoqi@0 | 211 | return createMOM(false); |
aoqi@0 | 212 | } else { |
aoqi@0 | 213 | logger.log(Level.WARNING, "Ignoring exception - starting up without monitoring", t); |
aoqi@0 | 214 | return ManagedObjectManagerFactory.createNOOP(); |
aoqi@0 | 215 | } |
aoqi@0 | 216 | } |
aoqi@0 | 217 | } |
aoqi@0 | 218 | |
aoqi@0 | 219 | private @NotNull ManagedObjectManager initMOM(final ManagedObjectManager mom) { |
aoqi@0 | 220 | try { |
aoqi@0 | 221 | if (typelibDebug != -1) { |
aoqi@0 | 222 | mom.setTypelibDebug(typelibDebug); |
aoqi@0 | 223 | } |
aoqi@0 | 224 | if (registrationDebug.equals("FINE")) { |
aoqi@0 | 225 | mom.setRegistrationDebug(ManagedObjectManager.RegistrationDebugLevel.FINE); |
aoqi@0 | 226 | } else if (registrationDebug.equals("NORMAL")) { |
aoqi@0 | 227 | mom.setRegistrationDebug(ManagedObjectManager.RegistrationDebugLevel.NORMAL); |
aoqi@0 | 228 | } else { |
aoqi@0 | 229 | mom.setRegistrationDebug(ManagedObjectManager.RegistrationDebugLevel.NONE); |
aoqi@0 | 230 | } |
aoqi@0 | 231 | |
aoqi@0 | 232 | mom.setRuntimeDebug(runtimeDebug); |
aoqi@0 | 233 | |
aoqi@0 | 234 | // Instead of GMBAL throwing an exception and logging |
aoqi@0 | 235 | // duplicate name, just have it return null. |
aoqi@0 | 236 | mom.suppressDuplicateRootReport(true); |
aoqi@0 | 237 | |
aoqi@0 | 238 | mom.stripPrefix( |
aoqi@0 | 239 | "com.sun.xml.internal.ws.server", |
aoqi@0 | 240 | "com.sun.xml.internal.ws.rx.rm.runtime.sequence"); |
aoqi@0 | 241 | |
aoqi@0 | 242 | // Add annotations to a standard class |
aoqi@0 | 243 | mom.addAnnotation(javax.xml.ws.WebServiceFeature.class, DummyWebServiceFeature.class.getAnnotation(ManagedData.class)); |
aoqi@0 | 244 | mom.addAnnotation(javax.xml.ws.WebServiceFeature.class, DummyWebServiceFeature.class.getAnnotation(Description.class)); |
aoqi@0 | 245 | mom.addAnnotation(javax.xml.ws.WebServiceFeature.class, DummyWebServiceFeature.class.getAnnotation(InheritedAttributes.class)); |
aoqi@0 | 246 | |
aoqi@0 | 247 | // Defer so we can register "this" as root from |
aoqi@0 | 248 | // within constructor. |
aoqi@0 | 249 | mom.suspendJMXRegistration(); |
aoqi@0 | 250 | |
aoqi@0 | 251 | } catch (Throwable t) { |
aoqi@0 | 252 | try { |
aoqi@0 | 253 | mom.close(); |
aoqi@0 | 254 | } catch (IOException e) { |
aoqi@0 | 255 | logger.log(Level.CONFIG, "Ignoring exception caught when closing unused ManagedObjectManager", e); |
aoqi@0 | 256 | } |
aoqi@0 | 257 | logger.log(Level.WARNING, "Ignoring exception - starting up without monitoring", t); |
aoqi@0 | 258 | return ManagedObjectManagerFactory.createNOOP(); |
aoqi@0 | 259 | } |
aoqi@0 | 260 | return mom; |
aoqi@0 | 261 | } |
aoqi@0 | 262 | |
aoqi@0 | 263 | private ManagedObjectManager createRoot(final ManagedObjectManager mom, final String rootName, int unique) { |
aoqi@0 | 264 | final String name = rootName + (unique == 0 ? "" : "-" + String.valueOf(unique)); |
aoqi@0 | 265 | try { |
aoqi@0 | 266 | final Object ignored = mom.createRoot(this, name); |
aoqi@0 | 267 | if (ignored != null) { |
aoqi@0 | 268 | ObjectName ignoredName = mom.getObjectName(mom.getRoot()); |
aoqi@0 | 269 | // The name is null when the MOM is a NOOP. |
aoqi@0 | 270 | if (ignoredName != null) { |
aoqi@0 | 271 | logger.log(Level.INFO, "Metro monitoring rootname successfully set to: {0}", ignoredName); |
aoqi@0 | 272 | } |
aoqi@0 | 273 | return mom; |
aoqi@0 | 274 | } |
aoqi@0 | 275 | try { |
aoqi@0 | 276 | mom.close(); |
aoqi@0 | 277 | } catch (IOException e) { |
aoqi@0 | 278 | logger.log(Level.CONFIG, "Ignoring exception caught when closing unused ManagedObjectManager", e); |
aoqi@0 | 279 | } |
aoqi@0 | 280 | final String basemsg ="Duplicate Metro monitoring rootname: " + name + " : "; |
aoqi@0 | 281 | if (unique > maxUniqueEndpointRootNameRetries) { |
aoqi@0 | 282 | final String msg = basemsg + "Giving up."; |
aoqi@0 | 283 | logger.log(Level.INFO, msg); |
aoqi@0 | 284 | return ManagedObjectManagerFactory.createNOOP(); |
aoqi@0 | 285 | } |
aoqi@0 | 286 | final String msg = basemsg + "Will try to make unique"; |
aoqi@0 | 287 | logger.log(Level.CONFIG, msg); |
aoqi@0 | 288 | return createMOMLoop(rootName, ++unique); |
aoqi@0 | 289 | } catch (Throwable t) { |
aoqi@0 | 290 | logger.log(Level.WARNING, "Error while creating monitoring root with name: " + rootName, t); |
aoqi@0 | 291 | return ManagedObjectManagerFactory.createNOOP(); |
aoqi@0 | 292 | } |
aoqi@0 | 293 | } |
aoqi@0 | 294 | |
aoqi@0 | 295 | private static Setting clientMonitoring = Setting.NOT_SET; |
aoqi@0 | 296 | private static Setting endpointMonitoring = Setting.NOT_SET; |
aoqi@0 | 297 | private static int typelibDebug = -1; |
aoqi@0 | 298 | private static String registrationDebug = "NONE"; |
aoqi@0 | 299 | private static boolean runtimeDebug = false; |
aoqi@0 | 300 | private static int maxUniqueEndpointRootNameRetries = 100; |
aoqi@0 | 301 | private static final String monitorProperty = "com.sun.xml.internal.ws.monitoring."; |
aoqi@0 | 302 | |
aoqi@0 | 303 | private static Setting propertyToSetting(String propName) { |
aoqi@0 | 304 | String s = System.getProperty(propName); |
aoqi@0 | 305 | if (s == null) { |
aoqi@0 | 306 | return Setting.NOT_SET; |
aoqi@0 | 307 | } |
aoqi@0 | 308 | s = s.toLowerCase(); |
aoqi@0 | 309 | if (s.equals("false") || s.equals("off")) { |
aoqi@0 | 310 | return Setting.OFF; |
aoqi@0 | 311 | } else if (s.equals("true") || s.equals("on")) { |
aoqi@0 | 312 | return Setting.ON; |
aoqi@0 | 313 | } |
aoqi@0 | 314 | return Setting.NOT_SET; |
aoqi@0 | 315 | } |
aoqi@0 | 316 | |
aoqi@0 | 317 | static { |
aoqi@0 | 318 | try { |
aoqi@0 | 319 | endpointMonitoring = propertyToSetting(monitorProperty + "endpoint"); |
aoqi@0 | 320 | |
aoqi@0 | 321 | clientMonitoring = propertyToSetting(monitorProperty + "client"); |
aoqi@0 | 322 | |
aoqi@0 | 323 | Integer i = Integer.getInteger(monitorProperty + "typelibDebug"); |
aoqi@0 | 324 | if (i != null) { |
aoqi@0 | 325 | typelibDebug = i; |
aoqi@0 | 326 | } |
aoqi@0 | 327 | |
aoqi@0 | 328 | String s = System.getProperty(monitorProperty + "registrationDebug"); |
aoqi@0 | 329 | if (s != null) { |
aoqi@0 | 330 | registrationDebug = s.toUpperCase(); |
aoqi@0 | 331 | } |
aoqi@0 | 332 | |
aoqi@0 | 333 | s = System.getProperty(monitorProperty + "runtimeDebug"); |
aoqi@0 | 334 | if (s != null && s.toLowerCase().equals("true")) { |
aoqi@0 | 335 | runtimeDebug = true; |
aoqi@0 | 336 | } |
aoqi@0 | 337 | |
aoqi@0 | 338 | i = Integer.getInteger(monitorProperty + "maxUniqueEndpointRootNameRetries"); |
aoqi@0 | 339 | if (i != null) { |
aoqi@0 | 340 | maxUniqueEndpointRootNameRetries = i; |
aoqi@0 | 341 | } |
aoqi@0 | 342 | } catch (Exception e) { |
aoqi@0 | 343 | logger.log(Level.WARNING, "Error while reading monitoring properties", e); |
aoqi@0 | 344 | } |
aoqi@0 | 345 | } |
aoqi@0 | 346 | } |
aoqi@0 | 347 | |
aoqi@0 | 348 | |
aoqi@0 | 349 | // This enables us to annotate the WebServiceFeature class even thought |
aoqi@0 | 350 | // we can't explicitly put the annotations in the class itself. |
aoqi@0 | 351 | @ManagedData |
aoqi@0 | 352 | @Description("WebServiceFeature") |
aoqi@0 | 353 | @InheritedAttributes({ |
aoqi@0 | 354 | @InheritedAttribute(methodName="getID", description="unique id for this feature"), |
aoqi@0 | 355 | @InheritedAttribute(methodName="isEnabled", description="true if this feature is enabled") |
aoqi@0 | 356 | }) |
aoqi@0 | 357 | interface DummyWebServiceFeature {} |
aoqi@0 | 358 | |
aoqi@0 | 359 | class RewritingMOM implements ManagedObjectManager |
aoqi@0 | 360 | { |
aoqi@0 | 361 | private final ManagedObjectManager mom; |
aoqi@0 | 362 | |
aoqi@0 | 363 | private final static String gmbalQuotingCharsRegex = "\n|\\|\"|\\*|\\?|:|=|,"; |
aoqi@0 | 364 | private final static String replacementChar = "-"; |
aoqi@0 | 365 | |
aoqi@0 | 366 | RewritingMOM(final ManagedObjectManager mom) { this.mom = mom; } |
aoqi@0 | 367 | |
aoqi@0 | 368 | private String rewrite(final String x) { |
aoqi@0 | 369 | return x.replaceAll(gmbalQuotingCharsRegex, replacementChar); |
aoqi@0 | 370 | } |
aoqi@0 | 371 | |
aoqi@0 | 372 | // The interface |
aoqi@0 | 373 | |
aoqi@0 | 374 | @Override public void suspendJMXRegistration() { mom.suspendJMXRegistration(); } |
aoqi@0 | 375 | @Override public void resumeJMXRegistration() { mom.resumeJMXRegistration(); } |
aoqi@0 | 376 | @Override public GmbalMBean createRoot() { return mom.createRoot(); } |
aoqi@0 | 377 | @Override public GmbalMBean createRoot(Object root) { return mom.createRoot(root); } |
aoqi@0 | 378 | @Override public GmbalMBean createRoot(Object root, String name) { |
aoqi@0 | 379 | return mom.createRoot(root, rewrite(name)); |
aoqi@0 | 380 | } |
aoqi@0 | 381 | @Override public Object getRoot() { return mom.getRoot(); } |
aoqi@0 | 382 | @Override public GmbalMBean register(Object parent, Object obj, String name) { |
aoqi@0 | 383 | return mom.register(parent, obj, rewrite(name)); |
aoqi@0 | 384 | } |
aoqi@0 | 385 | @Override public GmbalMBean register(Object parent, Object obj) { return mom.register(parent, obj);} |
aoqi@0 | 386 | @Override public GmbalMBean registerAtRoot(Object obj, String name) { |
aoqi@0 | 387 | return mom.registerAtRoot(obj, rewrite(name)); |
aoqi@0 | 388 | } |
aoqi@0 | 389 | @Override public GmbalMBean registerAtRoot(Object obj) { return mom.registerAtRoot(obj); } |
aoqi@0 | 390 | @Override public void unregister(Object obj) { mom.unregister(obj); } |
aoqi@0 | 391 | @Override public ObjectName getObjectName(Object obj) { return mom.getObjectName(obj); } |
aoqi@0 | 392 | @Override public AMXClient getAMXClient(Object obj) { return mom.getAMXClient(obj); } |
aoqi@0 | 393 | @Override public Object getObject(ObjectName oname) { return mom.getObject(oname); } |
aoqi@0 | 394 | @Override public void stripPrefix(String... str) { mom.stripPrefix(str); } |
aoqi@0 | 395 | @Override public void stripPackagePrefix() { mom.stripPackagePrefix(); } |
aoqi@0 | 396 | @Override public String getDomain() { return mom.getDomain(); } |
aoqi@0 | 397 | @Override public void setMBeanServer(MBeanServer server){mom.setMBeanServer(server); } |
aoqi@0 | 398 | @Override public MBeanServer getMBeanServer() { return mom.getMBeanServer(); } |
aoqi@0 | 399 | @Override public void setResourceBundle(ResourceBundle rb) { mom.setResourceBundle(rb); } |
aoqi@0 | 400 | @Override public ResourceBundle getResourceBundle() { return mom.getResourceBundle(); } |
aoqi@0 | 401 | @Override public void addAnnotation(AnnotatedElement element, Annotation annotation) { mom.addAnnotation(element, annotation); } |
aoqi@0 | 402 | @Override public void setRegistrationDebug(RegistrationDebugLevel level) { mom.setRegistrationDebug(level); } |
aoqi@0 | 403 | @Override public void setRuntimeDebug(boolean flag) { mom.setRuntimeDebug(flag); } |
aoqi@0 | 404 | @Override public void setTypelibDebug(int level) { mom.setTypelibDebug(level); } |
aoqi@0 | 405 | @Override public String dumpSkeleton(Object obj) { return mom.dumpSkeleton(obj); } |
aoqi@0 | 406 | @Override public void suppressDuplicateRootReport(boolean suppressReport) { mom.suppressDuplicateRootReport(suppressReport); } |
aoqi@0 | 407 | @Override public void close() throws IOException { mom.close(); } |
aoqi@0 | 408 | @Override public void setJMXRegistrationDebug(boolean x) { mom.setJMXRegistrationDebug(x); } |
aoqi@0 | 409 | @Override public boolean isManagedObject(Object x) { return mom.isManagedObject(x); } |
aoqi@0 | 410 | } |
aoqi@0 | 411 | |
aoqi@0 | 412 | // End of file. |