|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
JavaAddressingServiceIfaceImplWriter.java | 0% | 0% | 0% | 0% |
|
1 |
/*
|
|
2 |
* Copyright 1999-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
package org.apache.axis.message.addressing.tools.wsdl;
|
|
19 |
|
|
20 |
import org.apache.axis.utils.JavaUtils;
|
|
21 |
import org.apache.axis.utils.Messages;
|
|
22 |
import org.apache.axis.utils.WSDLUtils;
|
|
23 |
import org.apache.axis.wsdl.symbolTable.BindingEntry;
|
|
24 |
import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
|
|
25 |
import org.apache.axis.wsdl.symbolTable.ServiceEntry;
|
|
26 |
import org.apache.axis.wsdl.symbolTable.SymbolTable;
|
|
27 |
import org.apache.axis.wsdl.toJava.Emitter;
|
|
28 |
import org.apache.axis.wsdl.toJava.JavaBindingWriter;
|
|
29 |
import org.apache.axis.wsdl.toJava.JavaClassWriter;
|
|
30 |
import org.apache.axis.wsdl.toJava.Utils;
|
|
31 |
|
|
32 |
import javax.wsdl.Binding;
|
|
33 |
import javax.wsdl.Port;
|
|
34 |
import javax.wsdl.Service;
|
|
35 |
|
|
36 |
import java.io.IOException;
|
|
37 |
import java.io.PrintWriter;
|
|
38 |
|
|
39 |
import java.net.MalformedURLException;
|
|
40 |
import java.net.URL;
|
|
41 |
|
|
42 |
import java.util.Iterator;
|
|
43 |
import java.util.Map;
|
|
44 |
import java.util.Vector;
|
|
45 |
|
|
46 |
/**
|
|
47 |
*
|
|
48 |
* @author Jarek Gawor (gawor@mcs.anl.gov)
|
|
49 |
*/
|
|
50 |
public class JavaAddressingServiceIfaceImplWriter |
|
51 |
extends JavaClassWriter {
|
|
52 |
|
|
53 |
private ServiceEntry sEntry;
|
|
54 |
private SymbolTable symbolTable;
|
|
55 |
|
|
56 | 0 |
protected JavaAddressingServiceIfaceImplWriter(
|
57 |
Emitter emitter, |
|
58 |
ServiceEntry sEntry, |
|
59 |
SymbolTable symbolTable |
|
60 |
) { |
|
61 | 0 |
super(emitter, sEntry.getName() + "Addressing", "service"); |
62 | 0 |
this.sEntry = sEntry;
|
63 | 0 |
this.symbolTable = symbolTable;
|
64 |
} |
|
65 |
|
|
66 |
// ctor
|
|
67 | 0 |
protected String getExtendsText() {
|
68 | 0 |
return "extends " + this.sEntry.getName(); |
69 |
} |
|
70 |
|
|
71 | 0 |
protected String getClassText() {
|
72 | 0 |
return "interface "; |
73 |
} |
|
74 |
|
|
75 |
/**
|
|
76 |
* Returns "implements <serviceInterface>".
|
|
77 |
*/
|
|
78 | 0 |
protected String getImplementsText() {
|
79 | 0 |
return " "; |
80 |
} |
|
81 |
|
|
82 |
/**
|
|
83 |
* Write the body of the service file.
|
|
84 |
*/
|
|
85 | 0 |
protected void writeFileBody(PrintWriter pw) throws IOException { |
86 | 0 |
Service service = sEntry.getService(); |
87 |
|
|
88 |
// get ports
|
|
89 | 0 |
Map portMap = service.getPorts(); |
90 | 0 |
Iterator portIterator = portMap.values().iterator(); |
91 |
|
|
92 |
// write a get method for each of the ports with a SOAP binding
|
|
93 | 0 |
while (portIterator.hasNext()) {
|
94 | 0 |
Port p = (Port) portIterator.next(); |
95 | 0 |
Binding binding = p.getBinding(); |
96 |
|
|
97 | 0 |
if (binding == null) { |
98 | 0 |
throw new IOException( |
99 |
Messages.getMessage( |
|
100 |
"emitFailNoBinding01", new String[] { p.getName() } |
|
101 |
) |
|
102 |
); |
|
103 |
} |
|
104 |
|
|
105 | 0 |
BindingEntry bEntry = |
106 |
symbolTable.getBindingEntry(binding.getQName()); |
|
107 |
|
|
108 | 0 |
if (bEntry == null) { |
109 | 0 |
throw new IOException( |
110 |
Messages.getMessage( |
|
111 |
"emitFailNoBindingEntry01",
|
|
112 |
new String[] { binding.getQName().toString() }
|
|
113 |
) |
|
114 |
); |
|
115 |
} |
|
116 |
|
|
117 | 0 |
PortTypeEntry ptEntry = |
118 |
symbolTable.getPortTypeEntry(binding.getPortType().getQName()); |
|
119 |
|
|
120 | 0 |
if (ptEntry == null) { |
121 | 0 |
throw new IOException( |
122 |
Messages.getMessage( |
|
123 |
"emitFailNoPortType01",
|
|
124 |
new String[] { binding.getPortType().getQName()
|
|
125 |
.toString() } |
|
126 |
) |
|
127 |
); |
|
128 |
} |
|
129 |
|
|
130 |
// If this isn't an SOAP binding, skip it
|
|
131 | 0 |
if (bEntry.getBindingType() != BindingEntry.TYPE_SOAP) {
|
132 | 0 |
continue;
|
133 |
} |
|
134 |
|
|
135 | 0 |
String portName = p.getName(); |
136 |
|
|
137 | 0 |
if (!JavaUtils.isJavaId(portName)) {
|
138 | 0 |
portName = Utils.xmlNameToJavaClass(portName); |
139 |
} |
|
140 |
|
|
141 | 0 |
String stubClass = bEntry.getName() + "Stub";
|
142 |
|
|
143 | 0 |
String bindingType = |
144 |
(String) bEntry.getDynamicVar(JavaBindingWriter.INTERFACE_NAME); |
|
145 |
|
|
146 | 0 |
pw.println( |
147 |
" public " + bindingType + " get" + portName + |
|
148 |
"(org.apache.axis.message.addressing.EndpointReferenceType reference) " +
|
|
149 |
"throws javax.xml.rpc.ServiceException;"
|
|
150 |
); |
|
151 | 0 |
pw.println(); |
152 |
} |
|
153 |
|
|
154 | 0 |
pw.println(); |
155 |
} |
|
156 |
// writeFileBody
|
|
157 |
} |
|
158 |
|
|
159 |
|
|
160 |
// class JavaServiceImplWriter
|
|
161 |
|
|