KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > ext > wsmgmt > MessageTraceImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.appserv.management.ext.wsmgmt;
24
25 import java.util.Map JavaDoc;
26 import java.util.HashMap JavaDoc;
27 import java.io.Serializable JavaDoc;
28
29 import com.sun.appserv.management.base.XTypes;
30 import com.sun.appserv.management.base.MapCapable;
31 import com.sun.appserv.management.base.MapCapableBase;
32
33 /**
34  * Provides details of a SOAP invocation.
35  *
36  * @since AppServer 9.0
37  */

38 public final class MessageTraceImpl extends MapCapableBase
39     implements MessageTrace {
40
41     /**
42      * Constructor
43      */

44     public MessageTraceImpl(
45         final Map JavaDoc<String JavaDoc,Serializable JavaDoc> m,
46         final String JavaDoc className) {
47         super(m, className);
48     }
49
50     /**
51      * Constructor
52      *
53      * @param id Message ID
54      */

55     public MessageTraceImpl(String JavaDoc id, String JavaDoc className) {
56         super(null, className);
57         putField(MESSAGE_ID,id );
58     }
59
60     /**
61      * Constructor
62      *
63      * @param id Message ID
64      */

65     public MessageTraceImpl(String JavaDoc id) {
66         super( null, MessageTrace.CLASS_NAME);
67         putField(MESSAGE_ID,id );
68     }
69
70     protected boolean validate() {
71         return (true);
72     }
73
74     /**
75      * Returns the total size in bytes of the request content. This is
76      * SOAP content size including body and headers.
77      *
78      * @return SOAP request content size in bytes
79      */

80     public int getRequestSize() {
81          return getInteger(REQUEST_SIZE).intValue();
82     }
83
84     public void setRequestSize(int reqSize) {
85         putField(REQUEST_SIZE, new Integer JavaDoc(reqSize));
86     }
87
88     /**
89      * Returns the total size in bytes of the response content. This is
90      * SOAP content size including body and headers.
91      *
92      * @return SOAP response content size in bytes
93      */

94     public int getResponseSize() {
95          return getInteger(RESPONSE_SIZE).intValue();
96     }
97
98     public void setResponseSize(int resSize) {
99         putField(RESPONSE_SIZE, new Integer JavaDoc(resSize));
100     }
101
102     /**
103      * Returns the SOAP request content. This contains SOAP body and headers.
104      *
105      * @return SOAP request content
106      */

107     public String JavaDoc getRequestContent() {
108          return getString(REQUEST_CONTENT);
109     }
110
111     public void setRequestContent(String JavaDoc reqContent) {
112         putField(REQUEST_CONTENT, reqContent);
113     }
114
115     /**
116      * Returns the SOAP response content. This contains SOAP body and headers.
117      *
118      * @return SOAP response content
119      */

120     public String JavaDoc getResponseContent() {
121          return getString(RESPONSE_CONTENT);
122     }
123
124     public void setResponseContent(String JavaDoc resContent) {
125         putField(RESPONSE_CONTENT, resContent);
126     }
127
128     /**
129      * Returns the transport type. Known types are "HTTP", "JMS" and "SNMP".
130      *
131      * @return transport type
132      */

133     public String JavaDoc getTransportType() {
134          return getString(TRANSPORT_TYPE);
135     }
136
137     public void setTransportType(String JavaDoc transport) {
138         putField(TRANSPORT_TYPE, transport);
139     }
140
141     /**
142      * Returns the comma separated list of HTTP request header names and its
143      * values. Null if transport type is not HTTP.
144      *
145      * @return HTTP request headers
146      */

147     public String JavaDoc getHTTPRequestHeaders() {
148          return getString(HTTP_REQUEST_HEADERS);
149     }
150
151     public void setHTTPRequestHeaders(String JavaDoc reqHeaders) {
152          putField(HTTP_REQUEST_HEADERS, reqHeaders);
153     }
154
155     /**
156      * Returns the comma separated list of HTTP response header names and its
157      * values. Null if transport type is not HTTP.
158      *
159      * @return HTTP response headers
160      */

161     public String JavaDoc getHTTPResponseHeaders() {
162          return getString(HTTP_RESPONSE_HEADERS);
163     }
164
165     public void setHTTPResponseHeaders(String JavaDoc resHeaders) {
166          putField(HTTP_RESPONSE_HEADERS, resHeaders);
167     }
168
169     /**
170      * Returns the IP address or host name of the client machine.
171      *
172      * @return IP address or host name of client
173      */

174     public String JavaDoc getClientHost() {
175          return getString(CLIENT_HOST);
176     }
177
178     public void setClientHost(String JavaDoc clientHost) {
179          putField(CLIENT_HOST,clientHost );
180     }
181
182     /**
183      * Returns the caller principal name.
184      *
185      * @return caller principal name
186      */

187     public String JavaDoc getPrincipalName() {
188          return getString(PRINCIPAL_NAME);
189     }
190
191     public void setPrincipalName(String JavaDoc principal) {
192         putField(PRINCIPAL_NAME, principal);
193     }
194
195     /**
196      * Returns the response time in milli seconds for this web service
197      * operation.
198      *
199      * @return reponse time in milli seconds
200      */

201     public long getResponseTime() {
202          return new Long JavaDoc(getString(RESPONSE_TIME)).longValue();
203     }
204
205     public void setResponseTime(long resTime) {
206         putField(RESPONSE_TIME, new Long JavaDoc(resTime).toString());
207     }
208
209     /**
210      * Returns the fault code.
211      *
212      * @return fault code for this web service or null
213      */

214     public String JavaDoc getFaultCode() {
215         return getString(FAULT_CODE);
216     }
217
218     public void setFaultCode(String JavaDoc faultCode) {
219         putField(FAULT_CODE, faultCode);
220     }
221
222     /**
223      * Returns the fault string.
224      *
225      * @return fault string for this web service or null
226      */

227     public String JavaDoc getFaultString() {
228         return getString(FAULT_STRING);
229     }
230
231     public void setFaultString(String JavaDoc faultString) {
232         putField(FAULT_STRING, faultString);
233     }
234
235     /**
236      * Returns the fault actor.
237      *
238      * @return fault actor for this web service
239      */

240     public String JavaDoc getFaultActor() {
241         return getString(FAULT_ACTOR);
242     }
243
244     public void setFaultActor(String JavaDoc faultActor) {
245         putField(FAULT_ACTOR,faultActor );
246     }
247
248     /**
249      * Returns the message id.
250      *
251      * @return message id
252      */

253     public String JavaDoc getMessageID() {
254         return getString(MESSAGE_ID);
255     }
256
257     /**
258      * Returns the name of the application.
259      *
260      * @return application name
261      */

262     public String JavaDoc getApplicationID() {
263         return getString(APPLICATION_ID);
264     }
265
266     public void setApplicationID(String JavaDoc id) {
267         putField(APPLICATION_ID,id );
268     }
269
270     /**
271      * Returns the fully qualified name of the webservice endpoint
272      */

273     public String JavaDoc getEndpointName() {
274         return getString(ENDPOINT_NAME);
275     }
276
277     public void setEndpointName(String JavaDoc name) {
278          putField(ENDPOINT_NAME, name);
279     }
280
281     /**
282      * Returns the time stamp when the SOAP message was received.
283      *
284      * @return the time stamp when the SOAP message was received
285      */

286     public long getTimestamp() {
287          return new Long JavaDoc(getString(TIME_STAMP)).longValue();
288     }
289
290     /**
291      * Returns if during this web service invocation call flow was enabled or
292      * not
293      *
294      * @return true, if during this web service invocation call flow was
295      * enabled otherwise flase.
296      */

297     public boolean isCallFlowEnabled() {
298         return new Boolean JavaDoc(getString(CALL_FLOW_ENABLED)).booleanValue();
299     }
300
301     /**
302      * Returns if during this web service invocation call flow was enabled or
303      * not
304      */

305     public void setCallFlowEnabled(boolean enabled) {
306         putField(CALL_FLOW_ENABLED, new Boolean JavaDoc(enabled).toString());
307     }
308
309     /**
310      * Returns the time stamp when the SOAP message was received.
311      *
312      * @param ts the time stamp when the SOAP message was received
313      */

314     public void setTimeStamp(long ts) {
315          putField(TIME_STAMP, new Long JavaDoc(ts).toString());
316     }
317
318     /** Request Size */
319     static final String JavaDoc REQUEST_SIZE = "RequestSize";
320
321     /** Response Size */
322     static final String JavaDoc RESPONSE_SIZE = "ResponseSize";
323
324     /** Response Content */
325     static final String JavaDoc RESPONSE_CONTENT = "ResponseContent";
326
327     /** Request Content */
328     static final String JavaDoc REQUEST_CONTENT = "RequestContent";
329
330     /** Transport Type */
331     static final String JavaDoc TRANSPORT_TYPE = "TransportType";
332
333     /** HTTP Request Headers */
334     static final String JavaDoc HTTP_REQUEST_HEADERS = "HTTPRequestHeaders";
335
336     /** HTTP Response Headers */
337     static final String JavaDoc HTTP_RESPONSE_HEADERS = "HTTPResponseHeaders";
338
339     /** Client Host */
340     static final String JavaDoc CLIENT_HOST = "ClientHost";
341
342     /** Principal Name */
343     static final String JavaDoc PRINCIPAL_NAME = "PrincipalName";
344
345     /** Response Time */
346     static final String JavaDoc RESPONSE_TIME = "ResponseTime";
347
348     /** Fault Code */
349     static final String JavaDoc FAULT_CODE = "FaultCode";
350
351     /** Fault String */
352     static final String JavaDoc FAULT_STRING = "FaultString";
353
354     /** Fault Actor */
355     static final String JavaDoc FAULT_ACTOR = "FaultActor";
356
357     /** Message ID */
358     static final String JavaDoc MESSAGE_ID = "MessageID";
359
360     /** Application ID */
361     static final String JavaDoc APPLICATION_ID = "ApplicationID";
362
363     /** Endpoint Name */
364     static final String JavaDoc ENDPOINT_NAME = "EndpointName";
365
366     /** Time Stamp */
367     static final String JavaDoc TIME_STAMP = "Timestamp";
368
369     /** CallFlow Enabled */
370     static final String JavaDoc CALL_FLOW_ENABLED = "CallFlowEnabled";
371 }
372
Popular Tags