KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > client > handler > WebServiceEndpointConverterHandler


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.client.handler;
24
25 import java.lang.reflect.Method JavaDoc;
26
27 import java.util.Map JavaDoc;
28
29 import java.io.Serializable JavaDoc;
30 import java.io.IOException JavaDoc;
31
32 import javax.management.ObjectName JavaDoc;
33
34 import com.sun.appserv.management.client.ConnectionSource;
35
36 import com.sun.appserv.management.util.misc.TypeCast;
37
38 import com.sun.appserv.management.ext.wsmgmt.WebServiceSupport;
39 import com.sun.appserv.management.ext.wsmgmt.MessageTrace;
40
41 import com.sun.appserv.management.ext.wsmgmt.MessageTrace;
42
43
44 /**
45     Specialized handler for {@link com.sun.appserv.management.ext.logging.Logging}.
46  */

47 final class WebServiceEndpointConverterHandler extends ConverterHandler
48 {
49         public
50     WebServiceEndpointConverterHandler(
51         final ConnectionSource connectionSource,
52         final ObjectName JavaDoc proxiedMBeanObjectName )
53         throws IOException JavaDoc
54     {
55         super( connectionSource, proxiedMBeanObjectName );
56     }
57     
58     /**
59         Optionally, transform any result.
60      */

61         protected Object JavaDoc
62     convertResult(
63         final Method JavaDoc method,
64         final Object JavaDoc resultIn )
65     {
66         Object JavaDoc resultOut = resultIn;
67         
68         if ( method.getName().equals( "getMessagesInHistory" ) )
69         {
70             final Map JavaDoc<String JavaDoc,Serializable JavaDoc>[] maps = TypeCast.asArray( resultIn );
71             
72             final MessageTrace[] traces = new MessageTrace[ maps.length ];
73             for( int i = 0; i < traces.length; ++i )
74             {
75                 traces[ i ] = WebServiceSupport.mapToMessageTrace( maps[i] );
76             }
77             
78             resultOut = traces;
79         }
80         
81         return resultOut;
82     }
83 }
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Popular Tags