src/share/jaxws_classes/com/sun/xml/internal/ws/server/WSEndpointMOMProxy.java

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

mercurial