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: JOnASGeneratorFactory.java 5401 2004-09-09 16:12:37Z sauthieg $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas_ws.wsgen.generator.axis.wsdl2java;
25:
26: import javax.wsdl.Definition;
27: import javax.wsdl.Service;
28:
29: import org.apache.axis.wsdl.gen.Generator;
30: import org.apache.axis.wsdl.gen.NoopGenerator;
31: import org.apache.axis.wsdl.symbolTable.ServiceEntry;
32: import org.apache.axis.wsdl.symbolTable.SymbolTable;
33: import org.apache.axis.wsdl.toJava.Emitter;
34: import org.apache.axis.wsdl.toJava.JavaDefinitionWriter;
35: import org.apache.axis.wsdl.toJava.JavaGeneratorFactory;
36:
37: /**
38: * <code>JOnASGeneratorFactory</code> returns our own JOnASServiceWriter in WSDL2Java process.
39: *
40: * @author Guillaume Sauthier
41: */
42: public class JOnASGeneratorFactory extends JavaGeneratorFactory {
43:
44: /**
45: * Constructs a new JOnASGeneratorFactory associated with a given
46: * JOnASEmitter
47: * @param emitter the JOnASEmitter
48: */
49: public JOnASGeneratorFactory(Emitter emitter) {
50: super (emitter);
51: }
52:
53: /**
54: * Method addDefinitionGenerators
55: */
56: protected void addDefinitionGenerators() {
57: addGenerator(Definition.class, JavaDefinitionWriter.class); // for
58: // faults
59: } // addDefinitionGenerators
60:
61: /**
62: * @param service wsdl:service instance
63: * @param symbolTable SymbolTable
64: * @return Returns the JOnASServiceWriter when encoutering Service in
65: * SymbolTable
66: */
67: public Generator getGenerator(Service service,
68: SymbolTable symbolTable) {
69: if (include(service.getQName())) {
70: Generator writer = new JOnASServiceWriter(emitter, service,
71: symbolTable);
72: ServiceEntry sEntry = symbolTable.getServiceEntry(service
73: .getQName());
74: serviceWriters.addStuff(writer, sEntry, symbolTable);
75: return serviceWriters;
76: } else {
77: return new NoopGenerator();
78: }
79: } // getGenerator
80:
81: /**
82: * Method getGenerator
83: *
84: * @param type TypeEntry
85: * @param symbolTable SymbolTable
86: * @return a NoopGenerator (we don't need Types at this time, should be already generated)
87: */
88: /*
89: public Generator getGenerator(TypeEntry type, SymbolTable symbolTable) {
90: return new NoopGenerator();
91: } // getGenerator
92: */
93: }
|