Tue, 06 Mar 2012 16:09:35 -0800
7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom
ohair@286 | 1 | /* |
ohair@286 | 2 | * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
ohair@286 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@286 | 4 | * |
ohair@286 | 5 | * This code is free software; you can redistribute it and/or modify it |
ohair@286 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@286 | 7 | * published by the Free Software Foundation. Oracle designates this |
ohair@286 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@286 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
ohair@286 | 10 | * |
ohair@286 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@286 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@286 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@286 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
ohair@286 | 15 | * accompanied this code). |
ohair@286 | 16 | * |
ohair@286 | 17 | * You should have received a copy of the GNU General Public License version |
ohair@286 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
ohair@286 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@286 | 20 | * |
ohair@286 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@286 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@286 | 23 | * questions. |
ohair@286 | 24 | */ |
ohair@286 | 25 | |
ohair@286 | 26 | package com.sun.xml.internal.ws.server; |
ohair@286 | 27 | |
ohair@286 | 28 | import com.sun.istack.internal.NotNull; |
ohair@286 | 29 | import com.sun.org.glassfish.gmbal.AMXClient; |
ohair@286 | 30 | import com.sun.org.glassfish.gmbal.GmbalMBean; |
ohair@286 | 31 | import com.sun.org.glassfish.gmbal.ManagedObjectManager; |
ohair@286 | 32 | |
ohair@286 | 33 | import javax.management.MBeanServer; |
ohair@286 | 34 | import javax.management.ObjectName; |
ohair@286 | 35 | import java.io.IOException; |
ohair@286 | 36 | import java.lang.annotation.Annotation; |
ohair@286 | 37 | import java.lang.reflect.AnnotatedElement; |
ohair@286 | 38 | import java.util.ResourceBundle; |
ohair@286 | 39 | |
ohair@286 | 40 | /** |
ohair@286 | 41 | * {@link ManagedObjectManager} proxy class for {@link WSEndpointImpl} instances that could be used when Gmbal API calls |
ohair@286 | 42 | * need to be deferred. The proxy tries to defer a need of a real ManagedObjectManager instance to the time when any |
ohair@286 | 43 | * method from {@link ManagedObjectManager} is invoked on it. In this case a real instance of ManagedObjectManager is |
ohair@286 | 44 | * obtained from WSEndpointImpl and the method is rather invoked on this object. |
ohair@286 | 45 | */ |
ohair@286 | 46 | public class WSEndpointMOMProxy implements ManagedObjectManager { |
ohair@286 | 47 | |
ohair@286 | 48 | private final @NotNull |
ohair@286 | 49 | WSEndpointImpl wsEndpoint; |
ohair@286 | 50 | private ManagedObjectManager managedObjectManager; |
ohair@286 | 51 | |
ohair@286 | 52 | WSEndpointMOMProxy(@NotNull WSEndpointImpl wsEndpoint) { |
ohair@286 | 53 | this.wsEndpoint = wsEndpoint; |
ohair@286 | 54 | } |
ohair@286 | 55 | |
ohair@286 | 56 | /** |
ohair@286 | 57 | * Returns a real instance of {@link ManagedObjectManager} |
ohair@286 | 58 | * |
ohair@286 | 59 | * @return an ManagedObjectManager instance |
ohair@286 | 60 | */ |
ohair@286 | 61 | private ManagedObjectManager getManagedObjectManager() { |
ohair@286 | 62 | if (managedObjectManager == null) { |
ohair@286 | 63 | managedObjectManager = wsEndpoint.obtainManagedObjectManager(); |
ohair@286 | 64 | } |
ohair@286 | 65 | return managedObjectManager; |
ohair@286 | 66 | } |
ohair@286 | 67 | |
ohair@286 | 68 | void setManagedObjectManager(ManagedObjectManager managedObjectManager) { |
ohair@286 | 69 | this.managedObjectManager = managedObjectManager; |
ohair@286 | 70 | } |
ohair@286 | 71 | |
ohair@286 | 72 | /** |
ohair@286 | 73 | * Returns {@code true} if this proxy contains a reference to real ManagedObjectManager instance, {@code false} |
ohair@286 | 74 | * otherwise. |
ohair@286 | 75 | * |
ohair@286 | 76 | * @return {@code true} if ManagedObjectManager has been created, {@code false} otherwise. |
ohair@286 | 77 | */ |
ohair@286 | 78 | public boolean isInitialized() { |
ohair@286 | 79 | return this.managedObjectManager != null; |
ohair@286 | 80 | } |
ohair@286 | 81 | |
ohair@286 | 82 | public WSEndpointImpl getWsEndpoint() { |
ohair@286 | 83 | return wsEndpoint; |
ohair@286 | 84 | } |
ohair@286 | 85 | |
ohair@286 | 86 | public void suspendJMXRegistration() { |
ohair@286 | 87 | getManagedObjectManager().suspendJMXRegistration(); |
ohair@286 | 88 | } |
ohair@286 | 89 | |
ohair@286 | 90 | public void resumeJMXRegistration() { |
ohair@286 | 91 | getManagedObjectManager().resumeJMXRegistration(); |
ohair@286 | 92 | } |
ohair@286 | 93 | |
ohair@286 | 94 | public boolean isManagedObject(Object obj) { |
ohair@286 | 95 | return getManagedObjectManager().isManagedObject(obj); |
ohair@286 | 96 | } |
ohair@286 | 97 | |
ohair@286 | 98 | public GmbalMBean createRoot() { |
ohair@286 | 99 | return getManagedObjectManager().createRoot(); |
ohair@286 | 100 | } |
ohair@286 | 101 | |
ohair@286 | 102 | public GmbalMBean createRoot(Object root) { |
ohair@286 | 103 | return getManagedObjectManager().createRoot(root); |
ohair@286 | 104 | } |
ohair@286 | 105 | |
ohair@286 | 106 | public GmbalMBean createRoot(Object root, String name) { |
ohair@286 | 107 | return getManagedObjectManager().createRoot(root, name); |
ohair@286 | 108 | } |
ohair@286 | 109 | |
ohair@286 | 110 | public Object getRoot() { |
ohair@286 | 111 | return getManagedObjectManager().getRoot(); |
ohair@286 | 112 | } |
ohair@286 | 113 | |
ohair@286 | 114 | public GmbalMBean register(Object parent, Object obj, String name) { |
ohair@286 | 115 | return getManagedObjectManager().register(parent, obj, name); |
ohair@286 | 116 | } |
ohair@286 | 117 | |
ohair@286 | 118 | public GmbalMBean register(Object parent, Object obj) { |
ohair@286 | 119 | return getManagedObjectManager().register(parent, obj); |
ohair@286 | 120 | } |
ohair@286 | 121 | |
ohair@286 | 122 | public GmbalMBean registerAtRoot(Object obj, String name) { |
ohair@286 | 123 | return getManagedObjectManager().registerAtRoot(obj, name); |
ohair@286 | 124 | } |
ohair@286 | 125 | |
ohair@286 | 126 | public GmbalMBean registerAtRoot(Object obj) { |
ohair@286 | 127 | return getManagedObjectManager().registerAtRoot(obj); |
ohair@286 | 128 | } |
ohair@286 | 129 | |
ohair@286 | 130 | public void unregister(Object obj) { |
ohair@286 | 131 | getManagedObjectManager().unregister(obj); |
ohair@286 | 132 | } |
ohair@286 | 133 | |
ohair@286 | 134 | public ObjectName getObjectName(Object obj) { |
ohair@286 | 135 | return getManagedObjectManager().getObjectName(obj); |
ohair@286 | 136 | } |
ohair@286 | 137 | |
ohair@286 | 138 | public AMXClient getAMXClient(Object obj) { |
ohair@286 | 139 | return getManagedObjectManager().getAMXClient(obj); |
ohair@286 | 140 | } |
ohair@286 | 141 | |
ohair@286 | 142 | public Object getObject(ObjectName oname) { |
ohair@286 | 143 | return getManagedObjectManager().getObject(oname); |
ohair@286 | 144 | } |
ohair@286 | 145 | |
ohair@286 | 146 | public void stripPrefix(String... str) { |
ohair@286 | 147 | getManagedObjectManager().stripPrefix(str); |
ohair@286 | 148 | } |
ohair@286 | 149 | |
ohair@286 | 150 | public void stripPackagePrefix() { |
ohair@286 | 151 | getManagedObjectManager().stripPackagePrefix(); |
ohair@286 | 152 | } |
ohair@286 | 153 | |
ohair@286 | 154 | public String getDomain() { |
ohair@286 | 155 | return getManagedObjectManager().getDomain(); |
ohair@286 | 156 | } |
ohair@286 | 157 | |
ohair@286 | 158 | public void setMBeanServer(MBeanServer server) { |
ohair@286 | 159 | getManagedObjectManager().setMBeanServer(server); |
ohair@286 | 160 | } |
ohair@286 | 161 | |
ohair@286 | 162 | public MBeanServer getMBeanServer() { |
ohair@286 | 163 | return getManagedObjectManager().getMBeanServer(); |
ohair@286 | 164 | } |
ohair@286 | 165 | |
ohair@286 | 166 | public void setResourceBundle(ResourceBundle rb) { |
ohair@286 | 167 | getManagedObjectManager().setResourceBundle(rb); |
ohair@286 | 168 | } |
ohair@286 | 169 | |
ohair@286 | 170 | public ResourceBundle getResourceBundle() { |
ohair@286 | 171 | return getManagedObjectManager().getResourceBundle(); |
ohair@286 | 172 | } |
ohair@286 | 173 | |
ohair@286 | 174 | public void addAnnotation(AnnotatedElement element, Annotation annotation) { |
ohair@286 | 175 | getManagedObjectManager().addAnnotation(element, annotation); |
ohair@286 | 176 | } |
ohair@286 | 177 | |
ohair@286 | 178 | public void setRegistrationDebug(RegistrationDebugLevel level) { |
ohair@286 | 179 | getManagedObjectManager().setRegistrationDebug(level); |
ohair@286 | 180 | } |
ohair@286 | 181 | |
ohair@286 | 182 | public void setRuntimeDebug(boolean flag) { |
ohair@286 | 183 | getManagedObjectManager().setRuntimeDebug(flag); |
ohair@286 | 184 | } |
ohair@286 | 185 | |
ohair@286 | 186 | public void setTypelibDebug(int level) { |
ohair@286 | 187 | getManagedObjectManager().setTypelibDebug(level); |
ohair@286 | 188 | } |
ohair@286 | 189 | |
ohair@286 | 190 | public void setJMXRegistrationDebug(boolean flag) { |
ohair@286 | 191 | getManagedObjectManager().setJMXRegistrationDebug(flag); |
ohair@286 | 192 | } |
ohair@286 | 193 | |
ohair@286 | 194 | public String dumpSkeleton(Object obj) { |
ohair@286 | 195 | return getManagedObjectManager().dumpSkeleton(obj); |
ohair@286 | 196 | } |
ohair@286 | 197 | |
ohair@286 | 198 | public void suppressDuplicateRootReport(boolean suppressReport) { |
ohair@286 | 199 | getManagedObjectManager().suppressDuplicateRootReport(suppressReport); |
ohair@286 | 200 | } |
ohair@286 | 201 | |
ohair@286 | 202 | public void close() throws IOException { |
ohair@286 | 203 | getManagedObjectManager().close(); |
ohair@286 | 204 | } |
ohair@286 | 205 | |
ohair@286 | 206 | } |