KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > tool > codegen > Java2WSDLGenerator


1 /*
2  * Copyright 2004,2005 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.tool.codegen;
17
18
19 import java.util.Vector JavaDoc;
20
21 import org.apache.axis.utils.ClassUtils;
22 import org.apache.axis.wsdl.fromJava.Emitter;
23
24 /**
25  * @author Ajith
26  *
27  * TODO To change the template for this generated type comment go to Window -
28  * Preferences - Java - Code Style - Code Templates
29  */

30 public class Java2WSDLGenerator {
31
32     public void emit(String JavaDoc classPath,
33             String JavaDoc implementationClassName,
34             String JavaDoc serviceLocationUrl,
35             String JavaDoc inputWsdlName,
36             String JavaDoc bindingName,
37             String JavaDoc portypeName,
38             String JavaDoc style,
39             String JavaDoc outputFileName,
40             int mode,
41             Vector JavaDoc listOfIncludedMethods) throws Throwable JavaDoc{
42         try {
43
44             ClassUtils.setDefaultClassLoader(ClassUtils.createClassLoader(
45                     classPath, this.getClass().getClassLoader()));
46
47             // Instantiate the emitter
48
Emitter emitter = new Emitter();
49
50             //implementation class
51
emitter.setCls(implementationClassName);
52
53             //service location
54
if (serviceLocationUrl !=null && !serviceLocationUrl.trim().equals(""))
55                 emitter.setLocationUrl(serviceLocationUrl);
56             
57             //input wsdl
58
if (inputWsdlName != null && !inputWsdlName.trim().equals(""))
59                 emitter.setInputWSDL(inputWsdlName);
60             
61             //portype name
62
if (portypeName!=null && !portypeName.trim().equals(""))
63                 emitter.setPortTypeName(portypeName);
64             
65             //Style
66
if (style!=null && !style.trim().equals(""))
67                 emitter.setStyle(style);
68             if (listOfIncludedMethods!=null)
69                 emitter.setAllowedMethods(listOfIncludedMethods);
70             
71             if (mode!= Emitter.MODE_ALL &&
72                     mode!= Emitter.MODE_IMPLEMENTATION &&
73                     mode!= Emitter.MODE_INTERFACE)
74                 mode = Emitter.MODE_ALL; // Default to all in unknown case
75

76            emitter.emit(outputFileName,mode);
77
78         } catch (Throwable JavaDoc t) {
79             throw t;
80
81         }
82     }
83 }
84
Popular Tags