View Javadoc

1   /*
2    *  Copyright (c) 2008 Rodrigo Ruiz
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  package org.apache.axis.message.addressing.tools.wsdl;
17  
18  import org.apache.axis.wsdl.gen.Generator;
19  import org.apache.axis.wsdl.symbolTable.ServiceEntry;
20  import org.apache.axis.wsdl.symbolTable.SymbolTable;
21  import org.apache.axis.wsdl.toJava.Emitter;
22  import org.apache.axis.wsdl.toJava.JavaServiceWriter;
23  
24  import javax.wsdl.Service;
25  import java.io.IOException;
26  
27  /**
28   * Service writer.
29   *
30   * @author Jarek Gawor
31   * @version $Revision: 14 $
32   */
33  public class JavaAddressingServiceWriter extends JavaServiceWriter {
34  
35    /**
36     * Implementation writer.
37     */
38    protected Generator gridServiceImplWriter = null;
39  
40    /**
41     * Interface writer.
42     */
43    protected Generator gridServiceIfaceImplWriter = null;
44  
45    /**
46     * Constructor.
47     *
48     * @param emitter     Emitter instance
49     * @param service     Service to generate code for
50     * @param symbolTable Symbol table
51     */
52    public JavaAddressingServiceWriter(Emitter emitter, Service service,
53        SymbolTable symbolTable) {
54      super(emitter, service, symbolTable);
55  
56      ServiceEntry sEntry = symbolTable.getServiceEntry(service.getQName());
57  
58      if (sEntry.isReferenced()) {
59        gridServiceImplWriter = new JavaAddressingServiceImplWriter(emitter, sEntry,
60            symbolTable);
61        gridServiceIfaceImplWriter = new JavaAddressingServiceIfaceImplWriter(emitter,
62            sEntry, symbolTable);
63      }
64    }
65  
66    /**
67     * {@inheritDoc}
68     */
69    public void generate() throws IOException {
70      super.generate();
71  
72      if (gridServiceImplWriter != null) {
73        gridServiceImplWriter.generate();
74      }
75  
76      if (gridServiceIfaceImplWriter != null) {
77        gridServiceIfaceImplWriter.generate();
78      }
79    }
80  }