01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999-2004 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: JOnASServiceWriter.java 6069 2005-01-11 15:22:31Z sauthieg $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas_ws.wsgen.generator.axis.wsdl2java;
25:
26: import javax.wsdl.Service;
27:
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:
33: import org.objectweb.jonas_ws.wsgen.generator.ews.wsdltoj2ee.emitter.JOnASWSEmitter;
34:
35: /**
36: * This is JOnASWsdl2java's Service Writer. It writes the following files, as
37: * appropriate: <serviceName>.java, <serviceName>Locator.java.
38: */
39: public class JOnASServiceWriter extends JavaServiceWriter {
40:
41: /**
42: * Constructor.
43: * @param emitter JOnASEmitter
44: * @param service Service
45: * @param symbolTable SymbolTable
46: */
47: public JOnASServiceWriter(Emitter emitter, Service service,
48: SymbolTable symbolTable) {
49: super (emitter, service, symbolTable);
50: ServiceEntry sEntry = symbolTable.getServiceEntry(service
51: .getQName());
52:
53: if (sEntry.isReferenced()) {
54: serviceIfaceWriter = null;
55: // Write service interface if :
56: // - class is not available
57: // - emitter is not a J2eeEmitter (for backward compliance)
58: if (emitter instanceof JOnASWSEmitter) {
59: ClassLoader cl = ((JOnASWSEmitter) emitter)
60: .getClassLoader();
61: String className = sEntry.getName();
62: try {
63: cl.loadClass(className);
64: } catch (ClassNotFoundException cnfe) {
65: // class not available, generate it
66: serviceIfaceWriter = new JOnASInterfaceServiceImplWriter(
67: emitter, sEntry, symbolTable);
68: }
69: }
70:
71: // overwrite Axis Writer
72: serviceImplWriter = new JOnASServiceImplWriter(emitter,
73: sEntry, symbolTable);
74: }
75: } // ctor
76:
77: } // class JOnASServiceWriter
|