KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ws > wsgen > generator > axis > wsdl2java > JOnASServiceWriter


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2004 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: JOnASServiceWriter.java,v 1.4 2005/01/11 15:22:31 sauthieg Exp $
23  * --------------------------------------------------------------------------
24  */

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

40 public class JOnASServiceWriter extends JavaServiceWriter {
41
42     /**
43      * Constructor.
44      * @param emitter JOnASEmitter
45      * @param service Service
46      * @param symbolTable SymbolTable
47      */

48     public JOnASServiceWriter(Emitter emitter, Service service, SymbolTable symbolTable) {
49         super(emitter, service, symbolTable);
50         ServiceEntry sEntry = symbolTable.getServiceEntry(service.getQName());
51
52         if (sEntry.isReferenced()) {
53             serviceIfaceWriter = null;
54             // Write service interface if :
55
// - class is not available
56
// - emitter is not a J2eeEmitter (for backward compliance)
57
if (emitter instanceof JOnASWSEmitter) {
58                 ClassLoader JavaDoc cl = ((JOnASWSEmitter) emitter).getClassLoader();
59                 String JavaDoc className = sEntry.getName();
60                 try {
61                     cl.loadClass(className);
62                 } catch (ClassNotFoundException JavaDoc cnfe) {
63                     // class not available, generate it
64
serviceIfaceWriter = new JOnASInterfaceServiceImplWriter(emitter, sEntry, symbolTable);
65                 }
66             }
67
68             // overwrite Axis Writer
69
serviceImplWriter = new JOnASServiceImplWriter(emitter, sEntry, symbolTable);
70         }
71     } // ctor
72

73 } // class JOnASServiceWriter
74
Popular Tags