KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ws > wsgen > generator > ews > wsdltoj2ee > writer > JOnASEWSServiceWriter


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2005 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: JOnASEWSServiceWriter.java,v 1.2 2005/05/27 15:01:22 sauthieg Exp $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.jonas_ws.wsgen.generator.ews.wsdltoj2ee.writer;
26
27 import javax.wsdl.Service;
28 import org.apache.axis.wsdl.symbolTable.ServiceEntry;
29 import org.apache.axis.wsdl.symbolTable.SymbolTable;
30 import org.apache.axis.wsdl.toJava.Emitter;
31 import org.apache.axis.wsdl.toJava.JavaServiceWriter;
32 import org.objectweb.jonas_ws.wsgen.generator.ews.wsdltoj2ee.emitter.JOnASWSEmitter;
33
34 /**
35  * This is JOnASWsdl2java's Service Writer. It writes the following files, as
36  * appropriate: <serviceName>.java, <serviceName>Locator.java.
37  */

38 public class JOnASEWSServiceWriter extends JavaServiceWriter {
39
40     /**
41      * Constructor.
42      * @param emitter JOnASEmitter
43      * @param service Service
44      * @param symbolTable SymbolTable
45      */

46     public JOnASEWSServiceWriter(Emitter emitter, Service service, SymbolTable symbolTable) {
47         super(emitter, service, symbolTable);
48     } // ctor
49

50     /**
51      * setGenerators
52      * Logic to set the generators that are based on the Service.
53      * This logic was moved from the constructor so extended interfaces
54      * can more effectively use the hooks.
55      */

56     protected void setGenerators() {
57         ServiceEntry sEntry = symbolTable.getServiceEntry(service.getQName());
58
59         if (sEntry.isReferenced()) {
60             serviceIfaceWriter = null;
61             testCaseWriter = null;
62             // Write service interface if :
63
// - class is not available
64
// - emitter is not a J2eeEmitter (for backward compliance)
65
if (emitter instanceof JOnASWSEmitter) {
66                 ClassLoader JavaDoc cl = ((JOnASWSEmitter) emitter).getClassLoader();
67                 String JavaDoc className = sEntry.getName();
68                 try {
69                     cl.loadClass(className);
70                 } catch (ClassNotFoundException JavaDoc cnfe) {
71                     // class not available, generate it
72
serviceIfaceWriter = new JOnASEWSServiceIntfWriter(emitter, sEntry, symbolTable);
73                 }
74             }
75
76             // overwrite Axis Writer
77
serviceImplWriter = new JOnASEWSServiceImplWriter(emitter, sEntry, symbolTable);
78         }
79     }
80 } // class JOnASServiceWriter
81
Popular Tags