KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > wsm > processor > apt > WebServiceMetadataViewer


1 package org.apache.beehive.wsm.processor.apt;
2
3 /*
4  * Copyright 2004 The Apache Software Foundation
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * $Header:$
19  */

20
21 import java.util.Collection JavaDoc;
22
23 import org.apache.beehive.wsm.model.BeehiveWsSOAPBindingInfo;
24 import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
25 import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
26 import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
27
28 public class WebServiceMetadataViewer {
29
30     // adhock. assume Metadata is not nested more than 5 times. :p
31
private static String JavaDoc[] TABS = new String JavaDoc[]{
32         "",
33         " ",
34         " ",
35         " ",
36         " ",
37         " "
38     };
39
40     public static void print(BeehiveWsTypeMetadata webServiceTYPEMetadata) {
41         print(0, webServiceTYPEMetadata);
42     }
43
44     public static void print(int tab, BeehiveWsTypeMetadata webServiceTYPEMetadata) {
45         print(tab, "<TYPE > > >WebServiceTYPEMetadata");
46         print(tab, "wsName", webServiceTYPEMetadata.getWsName());
47         print(tab, "wsServiceName", webServiceTYPEMetadata.getWsServiceName());
48         print(tab, "wsWsdlLocation", webServiceTYPEMetadata.getWsWsdlLocation());
49         print(tab, "wsTargetNamespace", webServiceTYPEMetadata.getWsTargetNamespace());
50         print(tab, "wsEndpointInterface", webServiceTYPEMetadata.getWsEndpointInterface());
51         print(tab, "hcFileName", webServiceTYPEMetadata.getHcFileName());
52         print(tab, "hcName", webServiceTYPEMetadata.getHcName());
53         //print( tab, "siRunAs" , webServiceTYPEMetadata.getSiRunAs() );
54
// print(tab, "serviceImplementationBean", webServiceTYPEMetadata.getServiceImplementationBean());
55
print("");
56         tab++;
57         print(tab, webServiceTYPEMetadata.getMethods());
58         print(tab, webServiceTYPEMetadata.getSoapBinding());
59     }
60
61     public static void print(Collection JavaDoc collection) {
62         print(0, collection);
63     }
64
65     public static void print(int tab, Collection JavaDoc collection) {
66         if (collection == null)
67             return;
68         for (Object JavaDoc element : collection) {
69             if (element instanceof BeehiveWsTypeMetadata) {
70                 print(tab, (BeehiveWsTypeMetadata) element);
71             } else if (element instanceof BeehiveWsMethodMetadata) {
72                 print(tab, (BeehiveWsMethodMetadata) element);
73             } else if (element instanceof BeehiveWsParameterMetadata) {
74                 print(tab, (BeehiveWsParameterMetadata) element);
75             }
76         }
77     }
78
79     public static void print(BeehiveWsMethodMetadata webServiceMETHODMetadata) {
80         print(0, webServiceMETHODMetadata);
81     }
82
83     public static void print(int tab, BeehiveWsMethodMetadata webServiceMETHODMetadata) {
84         if (webServiceMETHODMetadata == null)
85             return;
86         print(tab, "<METHOD > > > > > >WebServiceMETHODMetadata");
87         print(tab, "wmOperationName", webServiceMETHODMetadata.getWmOperationName());
88         print(tab, "wmAction", webServiceMETHODMetadata.getWmAction());
89         print(tab, "oneway", webServiceMETHODMetadata.isOneWay() ? "true" : "false");
90         print(tab, "wrName", webServiceMETHODMetadata.getWrName());
91         print(tab, "javaMethodName", webServiceMETHODMetadata.getJavaMethodName());
92         print(tab, "javaReturnType", webServiceMETHODMetadata.getJavaReturnType());
93
94         //print( tab, "DwRequestElement");
95
//print( tab, webServiceMETHODMetadata.getDwRequestElement() );
96
//print( tab, webServiceMETHODMetadata.getDwResponseElement() );
97

98         //print( tab, "DwResponseElement");
99
//print( tab, webServiceMETHODMetadata.getSoapBinding() );
100

101         print("");
102         tab++;
103         print(tab, webServiceMETHODMetadata.getParams());
104     }
105
106     public static void print(BeehiveWsParameterMetadata webServicePARAMETERMetadata) {
107         print(0, webServicePARAMETERMetadata);
108     }
109
110     public static void print(int tab, BeehiveWsParameterMetadata webServicePARAMETERMetadata) {
111         if (webServicePARAMETERMetadata == null)
112             return;
113         print(tab, "<PARAM > > > > > > > > >WebServicePARAMETERMetadata");
114         print(tab, "wpName", webServicePARAMETERMetadata.getWpName());
115         print(tab, "wpMode", webServicePARAMETERMetadata.getWpMode());
116         print(tab, "wpHeader", webServicePARAMETERMetadata.isWpHeader() ? "true" : "false");
117         print(tab, "javaType", webServicePARAMETERMetadata.getJavaType());
118         //print( "defaultName", webServicePARAMETERMetadata.getDefaultName());
119

120         print("");
121     }
122
123     public static void print(BeehiveWsSOAPBindingInfo soapBindingInfo) {
124         print(0, soapBindingInfo);
125     }
126
127     public static void print(int tab, BeehiveWsSOAPBindingInfo soapBindingInfo) {
128         if (soapBindingInfo == null)
129             return;
130         print(tab, ">SOAPBindingInfo");
131         print(tab, "style", soapBindingInfo.getStyle());
132         print(tab, "use", soapBindingInfo.getUse());
133         print(tab, "style", soapBindingInfo.getParameterStyle());
134     }
135
136
137
138     public static void print(int tab, String JavaDoc msg, Object JavaDoc data) {
139         print(tab, msg + " : " + data);
140     }
141
142     public static void print(int tab, String JavaDoc msg) {
143         print(TABS[tab] + msg);
144     }
145
146     public static void print(String JavaDoc msg) {
147         System.out.println(msg);
148     }
149
150 }
151
Popular Tags