01: /*
02: * Copyright 2001-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package samples.integrationGuide.example2;
17:
18: import org.apache.axis.wsdl.symbolTable.SymbolTable;
19: import org.apache.axis.wsdl.toJava.Emitter;
20: import org.apache.axis.wsdl.toJava.JavaWriter;
21:
22: import javax.wsdl.Definition;
23: import java.io.IOException;
24: import java.io.PrintWriter;
25:
26: public class MyDeployWriter extends JavaWriter {
27:
28: private String filename;
29:
30: public MyDeployWriter(Emitter emitter, Definition definition,
31: SymbolTable symbolTable) {
32: super (emitter, "deploy");
33:
34: // Create the fully-qualified file name
35: String dir = emitter.getNamespaces().getAsDir(
36: definition.getTargetNamespace());
37: filename = dir + "deploy.useless";
38: } // ctor
39:
40: public void generate() throws IOException {
41: if (emitter.isServerSide()) {
42: super .generate();
43: }
44: } // generate
45:
46: protected String getFileName() {
47: return filename;
48: } // getFileName
49:
50: /**
51: * Override the common JavaWriter header to a no-op.
52: */
53: protected void writeFileHeader(PrintWriter pw) throws IOException {
54: } // writeFileHeader
55:
56: /**
57: * Write the service list file.
58: */
59: protected void writeFileBody(PrintWriter pw) throws IOException {
60: MyEmitter myEmitter = (MyEmitter) emitter;
61: if (myEmitter.getSong() == MyEmitter.RUM) {
62: pw.println("Yo! Ho! Ho! And a bottle of rum.");
63: } else if (myEmitter.getSong() == MyEmitter.WORK) {
64: pw.println("Hi ho! Hi ho! It's off to work we go.");
65: } else {
66: pw.println("Feelings... Nothing more than feelings...");
67: }
68: } // writeFileBody
69: } // class MyDeployWriter
|