01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999-2005 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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 6860 2005-05-27 15:01:25Z sauthieg $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas_ws.wsgen.generator.ews.wsdltoj2ee.writer;
25:
26: import javax.wsdl.Service;
27: import org.apache.axis.wsdl.symbolTable.ServiceEntry;
28: import org.apache.axis.wsdl.symbolTable.SymbolTable;
29: import org.apache.axis.wsdl.toJava.Emitter;
30: import org.apache.axis.wsdl.toJava.JavaServiceWriter;
31: import org.objectweb.jonas_ws.wsgen.generator.ews.wsdltoj2ee.emitter.JOnASWSEmitter;
32:
33: /**
34: * This is JOnASWsdl2java's Service Writer. It writes the following files, as
35: * appropriate: <serviceName>.java, <serviceName>Locator.java.
36: */
37: public class JOnASEWSServiceWriter extends JavaServiceWriter {
38:
39: /**
40: * Constructor.
41: * @param emitter JOnASEmitter
42: * @param service Service
43: * @param symbolTable SymbolTable
44: */
45: public JOnASEWSServiceWriter(Emitter emitter, Service service,
46: 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
58: .getQName());
59:
60: if (sEntry.isReferenced()) {
61: serviceIfaceWriter = null;
62: testCaseWriter = null;
63: // Write service interface if :
64: // - class is not available
65: // - emitter is not a J2eeEmitter (for backward compliance)
66: if (emitter instanceof JOnASWSEmitter) {
67: ClassLoader cl = ((JOnASWSEmitter) emitter)
68: .getClassLoader();
69: String className = sEntry.getName();
70: try {
71: cl.loadClass(className);
72: } catch (ClassNotFoundException cnfe) {
73: // class not available, generate it
74: serviceIfaceWriter = new JOnASEWSServiceIntfWriter(
75: emitter, sEntry, symbolTable);
76: }
77: }
78:
79: // overwrite Axis Writer
80: serviceImplWriter = new JOnASEWSServiceImplWriter(emitter,
81: sEntry, symbolTable);
82: }
83: }
84: } // class JOnASServiceWriter
|