1/*
2 * Copyright (c) 1997, 2013, 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
26package com.sun.xml.internal.ws.server;
27
28import com.sun.istack.internal.NotNull;
29import com.sun.xml.internal.ws.api.BindingID;
30import com.sun.xml.internal.ws.api.WSFeatureList;
31import com.sun.xml.internal.ws.api.EndpointAddress;
32import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
33import com.sun.xml.internal.ws.api.server.*;
34import com.sun.xml.internal.ws.transport.http.HttpAdapter;
35import com.sun.xml.internal.ws.util.RuntimeVersion;
36import com.sun.org.glassfish.gmbal.AMXMetadata;
37import com.sun.org.glassfish.gmbal.Description;
38import com.sun.org.glassfish.gmbal.ManagedAttribute;
39import com.sun.org.glassfish.gmbal.ManagedObject;
40import java.net.URL;
41import javax.xml.namespace.QName;
42import java.util.*;
43
44/**
45 * @author Harold Carr
46 */
47@ManagedObject
48@Description("Metro Web Service endpoint")
49@AMXMetadata(type="WSEndpoint")
50public final class MonitorRootService extends MonitorBase {
51
52    private final WSEndpoint endpoint;
53
54    MonitorRootService(final WSEndpoint endpoint) {
55        this.endpoint = endpoint;
56    }
57
58    //
59    // Items from WSEndpoint
60    //
61
62    @ManagedAttribute
63    @Description("Policy associated with Endpoint")
64    public String policy() {
65        return endpoint.getPolicyMap() != null ?
66               endpoint.getPolicyMap().toString() : null;
67    }
68
69    @ManagedAttribute
70    @Description("Container")
71    public @NotNull Container container() {
72        return endpoint.getContainer();
73    }
74
75
76    @ManagedAttribute
77    @Description("Port name")
78    public @NotNull QName portName() {
79        return endpoint.getPortName();
80    }
81
82    @ManagedAttribute
83    @Description("Service name")
84    public @NotNull QName serviceName() {
85        return endpoint.getServiceName();
86    }
87
88    //
89    // Items from WSBinding
90    //
91
92    @ManagedAttribute
93    @Description("Binding SOAP Version")
94    public String soapVersionHttpBindingId() {
95        return endpoint.getBinding().getSOAPVersion().httpBindingId;
96    }
97
98    @ManagedAttribute
99    @Description("Binding Addressing Version")
100    public AddressingVersion addressingVersion() {
101        return endpoint.getBinding().getAddressingVersion();
102    }
103
104    @ManagedAttribute
105    @Description("Binding Identifier")
106    public @NotNull BindingID bindingID() {
107        return endpoint.getBinding().getBindingId();
108    }
109
110    @ManagedAttribute
111    @Description("Binding features")
112    public @NotNull WSFeatureList features() {
113        return endpoint.getBinding().getFeatures();
114    }
115
116    //
117    // Items from WSDLPort
118    //
119
120    @ManagedAttribute
121    @Description("WSDLPort bound port type")
122    public QName wsdlPortTypeName() {
123        return endpoint.getPort() != null ?
124               endpoint.getPort().getBinding().getPortTypeName() : null;
125    }
126
127    @ManagedAttribute
128    @Description("Endpoint address")
129    public EndpointAddress wsdlEndpointAddress() {
130        return endpoint.getPort() != null ?
131               endpoint.getPort().getAddress() : null;
132    }
133
134    //
135    // Items from ServiceDefinition
136    //
137
138    @ManagedAttribute
139    @Description("Documents referenced")
140    public Set<String> serviceDefinitionImports() {
141        return endpoint.getServiceDefinition() != null ?
142               endpoint.getServiceDefinition().getPrimary().getImports() : null;
143    }
144
145    @ManagedAttribute
146    @Description("System ID where document is taken from")
147    public URL serviceDefinitionURL() {
148        return endpoint.getServiceDefinition() != null ?
149               endpoint.getServiceDefinition().getPrimary().getURL() : null;
150    }
151
152    //
153    // Items from SEIModel
154    //
155
156    @ManagedAttribute
157    @Description("SEI model WSDL location")
158    public String seiModelWSDLLocation() {
159        return endpoint.getSEIModel() != null ?
160               endpoint.getSEIModel().getWSDLLocation() : null;
161    }
162
163    //
164    // Items from RuntimeVersion
165    //
166
167    @ManagedAttribute
168    @Description("JAX-WS runtime version")
169    public String jaxwsRuntimeVersion() {
170        return RuntimeVersion.VERSION.toString();
171    }
172
173    //
174    // Items from HttpAdapter
175    //
176
177    @ManagedAttribute
178    @Description("If true: show what goes across HTTP transport")
179    public boolean dumpHTTPMessages() { return HttpAdapter.dump; }
180
181
182    @ManagedAttribute
183    @Description("Show what goes across HTTP transport")
184    public void dumpHTTPMessages(final boolean x) { HttpAdapter.setDump(x); }
185
186}
187
188// End of file.
189