KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > wsdl > gen > NoopFactory


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis.wsdl.gen;
17
18 import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
19 import org.apache.axis.encoding.TypeMapping;
20 import org.apache.axis.utils.JavaUtils;
21 import org.apache.axis.wsdl.symbolTable.BaseTypeMapping;
22 import org.apache.axis.wsdl.symbolTable.SymbolTable;
23 import org.apache.axis.wsdl.symbolTable.TypeEntry;
24
25 import javax.wsdl.Binding;
26 import javax.wsdl.Definition;
27 import javax.wsdl.Message;
28 import javax.wsdl.PortType;
29 import javax.wsdl.Service;
30 import javax.xml.namespace.QName JavaDoc;
31
32 /**
33  * This factory returns a bunch of NoopGenerators
34  */

35 public class NoopFactory implements GeneratorFactory {
36
37     /**
38      * Method generatorPass
39      *
40      * @param def
41      * @param symbolTable
42      */

43     public void generatorPass(Definition def,
44                               SymbolTable symbolTable) {
45     } // generatorPass
46

47     /**
48      * Method getGenerator
49      *
50      * @param message
51      * @param symbolTable
52      * @return
53      */

54     public Generator getGenerator(Message message, SymbolTable symbolTable) {
55         return new NoopGenerator();
56     } // getGenerator
57

58     /**
59      * Method getGenerator
60      *
61      * @param portType
62      * @param symbolTable
63      * @return
64      */

65     public Generator getGenerator(PortType portType, SymbolTable symbolTable) {
66         return new NoopGenerator();
67     } // getGenerator
68

69     /**
70      * Method getGenerator
71      *
72      * @param binding
73      * @param symbolTable
74      * @return
75      */

76     public Generator getGenerator(Binding binding, SymbolTable symbolTable) {
77         return new NoopGenerator();
78     } // getGenerator
79

80     /**
81      * Method getGenerator
82      *
83      * @param service
84      * @param symbolTable
85      * @return
86      */

87     public Generator getGenerator(Service service, SymbolTable symbolTable) {
88         return new NoopGenerator();
89     } // getGenerator
90

91     /**
92      * Method getGenerator
93      *
94      * @param type
95      * @param symbolTable
96      * @return
97      */

98     public Generator getGenerator(TypeEntry type, SymbolTable symbolTable) {
99         return new NoopGenerator();
100     } // getGenerator
101

102     /**
103      * Method getGenerator
104      *
105      * @param definition
106      * @param symbolTable
107      * @return
108      */

109     public Generator getGenerator(Definition definition,
110                                   SymbolTable symbolTable) {
111         return new NoopGenerator();
112     } // getGenerator
113

114     /** Field btm */
115     private BaseTypeMapping btm = null;
116
117     /**
118      * Method setBaseTypeMapping
119      *
120      * @param btm
121      */

122     public void setBaseTypeMapping(BaseTypeMapping btm) {
123         this.btm = btm;
124     } // setBaseTypeMapping
125

126     /**
127      * Method getBaseTypeMapping
128      *
129      * @return
130      */

131     public BaseTypeMapping getBaseTypeMapping() {
132
133         if (btm == null) {
134             btm = new BaseTypeMapping() {
135
136                 TypeMapping defaultTM =
137                         DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
138
139                 public String JavaDoc getBaseName(QName JavaDoc qNameIn) {
140
141                     javax.xml.namespace.QName JavaDoc qName =
142                             new javax.xml.namespace.QName JavaDoc(qNameIn.getNamespaceURI(),
143                                     qNameIn.getLocalPart());
144                     Class JavaDoc cls =
145                             defaultTM.getClassForQName(qName);
146
147                     if (cls == null) {
148                         return null;
149                     } else {
150
151                         // RJB NOTE: Javaism - bad bad bad
152
return JavaUtils.getTextClassName(cls.getName());
153                     }
154                 }
155             };
156         }
157
158         return btm;
159     } // getBaseTypeMapping
160
} // class NoopFactory
161
Popular Tags