KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > tool > codegen > eclipse > ui > JavaWSDLOptionsPage


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.eclipse.ui;
17
18 import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
19 import org.apache.axis.wsdl.fromJava.Emitter;
20 import org.eclipse.swt.SWT;
21 import org.eclipse.swt.events.ModifyEvent;
22 import org.eclipse.swt.events.ModifyListener;
23 import org.eclipse.swt.events.SelectionEvent;
24 import org.eclipse.swt.events.SelectionListener;
25 import org.eclipse.swt.layout.GridData;
26 import org.eclipse.swt.layout.GridLayout;
27 import org.eclipse.swt.widgets.Combo;
28 import org.eclipse.swt.widgets.Composite;
29 import org.eclipse.swt.widgets.Label;
30 import org.eclipse.swt.widgets.Text;
31
32 /**
33  * -I, --input <argument>input WSDL filename -o, --output <argument>output
34  * WSDL filename -l, --location <argument>service location url -P,
35  * --portTypeName <argument>portType name (obtained from class-of-portType if
36  * not specif ied) -b, --bindingName <argument>binding name (--servicePortName
37  * value + "SOAPBinding" if not specified) -S, --serviceElementName <argument>
38  * service element name (defaults to --servicePortName value + "Service") -s,
39  * --servicePortName <argument>service port name (obtained from --location if
40  * not specified ) -n, --namespace <argument>target namespace -p, --PkgtoNS
41  * <argument>= <value>package=namespace, name value pairs -m, --methods
42  * <argument>space or comma separated list of methods to export -a, --all look
43  * for allowed methods in inherited class -w, --outputWsdlMode <argument>output
44  * WSDL mode: All, Interface, Implementation -L, --locationImport <argument>
45  * location of interface wsdl -N, --namespaceImpl <argument>target namespace
46  * for implementation wsdl -O, --outputImpl <argument>output Implementation
47  * WSDL filename, setting this causes --o utputWsdlMode to be ignored -i,
48  * --implClass <argument>optional class that contains implementation of methods
49  * in cl ass-of-portType. The debug information in the class is used to obtain
50  * the method parameter names, which are used to set the WSDL part names. -x,
51  * --exclude <argument>space or comma separated list of methods not to export
52  * -c, --stopClasses <argument>space or comma separated list of class names
53  * which will stop inheritance search if --all switch is given -T,
54  * --typeMappingVersion <argument>indicate 1.1 or 1.2. The default is 1.1 (SOAP
55  * 1.1 JAX-RPC c ompliant 1.2 indicates SOAP 1.1 encoded.) -A, --soapAction
56  * <argument>value of the operation's soapAction field. Values are DEFAUL T,
57  * OPERATION or NONE. OPERATION forces soapAction to the nam e of the operation.
58  * DEFAULT causes the soapAction to be set according to the operation's meta
59  * data (usually ""). NONE forces the soapAction to "". The default is DEFAULT.
60  * -y, --style <argument>The style of binding in the WSDL, either DOCUMENT,
61  * RPC, or W RAPPED. -u, --use <argument>The use of items in the binding,
62  * either LITERAL or ENCODED -e, --extraClasses <argument>A space or comma
63  * separated list of class names to be added t o the type section. -C,
64  * --importSchema A file or URL to an XML Schema that should be physically imp
65  * orted into the generated WSDL -X, --classpath additional classpath elements
66  */

67 public class JavaWSDLOptionsPage extends AbstractWizardPage {
68
69     private Text inputWSDLNameTextBox;
70
71     private Text serviceLocationURLTextBox;
72
73     private Text portTypeNameTextBox;
74
75     private Text bindingTextBox;
76
77     private Combo modeSelectionCombo;
78     
79     private Combo styleSelectionCombo;
80
81
82     //TODO need more here
83

84     /*
85      * (non-Javadoc)
86      *
87      * @see org.apache.axis.tool.codegen.eclipse.ui.AbstractWizardPage#initializeDefaultSettings()
88      */

89     protected void initializeDefaultSettings() {
90        settings.put(PREF_JAVA_INPUT_WSDL_NAME,"");
91        settings.put(PREF_JAVA_LOCATION,"http://localhost:8080");
92        settings.put(PREF_JAVA_BINDING_NAME,"");
93        settings.put(PREF_JAVA_PORTYPE_NAME,"");
94        settings.put(PREF_JAVA_MODE_INDEX,0);
95        settings.put(PREF_JAVA_STYLE_INDEX,0);
96     }
97
98     /**
99      * @param pageName
100      */

101     public JavaWSDLOptionsPage() {
102         super("page5");
103
104     }
105
106     /*
107      * (non-Javadoc)
108      *
109      * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
110      */

111     public int getPageType() {
112         return JAVA_2_WSDL_TYPE;
113     }
114
115     /*
116      * (non-Javadoc)
117      *
118      * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
119      */

120     public void createControl(Composite parent) {
121         Composite container = new Composite(parent, SWT.NULL);
122         GridLayout layout = new GridLayout();
123         container.setLayout(layout);
124         layout.numColumns = 2;
125         layout.verticalSpacing = 9;
126
127         GridData gd = new GridData(GridData.FILL_HORIZONTAL);
128         Label label = new Label(container, SWT.NULL);
129         label.setText(CodegenWizardPlugin
130                 .getResourceString("page5.inputwsdl.label"));
131
132         inputWSDLNameTextBox = new Text(container, SWT.BORDER | SWT.SINGLE);
133         inputWSDLNameTextBox.setLayoutData(gd);
134         inputWSDLNameTextBox.setText(settings.get(PREF_JAVA_INPUT_WSDL_NAME));
135         inputWSDLNameTextBox.addModifyListener(new ModifyListener() {
136             public void modifyText(ModifyEvent e) {
137                 settings.put(PREF_JAVA_INPUT_WSDL_NAME, inputWSDLNameTextBox.getText());
138                 //dialogChanged();
139
}
140         });
141
142         label = new Label(container, SWT.NULL);
143         label.setText(CodegenWizardPlugin
144                 .getResourceString("page5.servicelocation.label"));
145
146         gd = new GridData(GridData.FILL_HORIZONTAL);
147         serviceLocationURLTextBox = new Text(container, SWT.BORDER);
148         serviceLocationURLTextBox.setLayoutData(gd);
149         serviceLocationURLTextBox.setText(settings.get(PREF_JAVA_LOCATION));
150         serviceLocationURLTextBox.addModifyListener(new ModifyListener() {
151             public void modifyText(ModifyEvent e) {
152                 settings.put(PREF_JAVA_LOCATION, serviceLocationURLTextBox.getText());
153                 //dialogChanged();
154
}
155         });
156         
157         label = new Label(container, SWT.NULL);
158         label.setText(CodegenWizardPlugin
159                 .getResourceString("page5.binding.label"));
160
161         gd = new GridData(GridData.FILL_HORIZONTAL);
162         bindingTextBox = new Text(container, SWT.BORDER);
163         bindingTextBox.setLayoutData(gd);
164         bindingTextBox.setText(settings.get(PREF_JAVA_BINDING_NAME));
165         bindingTextBox.addModifyListener(new ModifyListener() {
166             public void modifyText(ModifyEvent e) {
167                 settings.put(PREF_JAVA_BINDING_NAME, bindingTextBox.getText());
168                 //dialogChanged();
169
}
170         });
171         
172         label = new Label(container, SWT.NULL);
173         label.setText(CodegenWizardPlugin
174                 .getResourceString("page5.porttype.label"));
175
176         gd = new GridData(GridData.FILL_HORIZONTAL);
177         portTypeNameTextBox = new Text(container, SWT.BORDER);
178         portTypeNameTextBox.setLayoutData(gd);
179         portTypeNameTextBox.setText(settings.get(PREF_JAVA_PORTYPE_NAME));
180         portTypeNameTextBox.addModifyListener(new ModifyListener() {
181             public void modifyText(ModifyEvent e) {
182                 settings.put(PREF_JAVA_PORTYPE_NAME, portTypeNameTextBox.getText());
183                 //dialogChanged();
184
}
185         });
186
187         // #####################################################
188
label = new Label(container, SWT.NULL);
189         label
190                 .setText(CodegenWizardPlugin
191                         .getResourceString("page5.mode.label"));
192
193         gd = new GridData(GridData.FILL_HORIZONTAL);
194         modeSelectionCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
195         modeSelectionCombo.setLayoutData(gd);
196        // modeSelectionCombo.
197
populateModeCombo();
198         modeSelectionCombo.addSelectionListener(new SelectionListener(){
199             public void widgetSelected(SelectionEvent e){
200                 settings.put(PREF_JAVA_MODE_INDEX,modeSelectionCombo.getSelectionIndex());
201             }
202             public void widgetDefaultSelected(SelectionEvent e){}
203         });
204         
205         // #####################################################
206
label = new Label(container, SWT.NULL);
207         label
208                 .setText(CodegenWizardPlugin
209                         .getResourceString("page5.style.label"));
210
211         gd = new GridData(GridData.FILL_HORIZONTAL);
212         styleSelectionCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
213         styleSelectionCombo.setLayoutData(gd);
214         populateStyleCombo();
215         styleSelectionCombo.addSelectionListener(new SelectionListener(){
216             public void widgetSelected(SelectionEvent e){
217                 settings.put(PREF_JAVA_STYLE_INDEX,styleSelectionCombo.getSelectionIndex());
218             }
219             public void widgetDefaultSelected(SelectionEvent e){}
220         });
221         
222         
223         setControl(container);
224
225     }
226
227     private void populateModeCombo() {
228         modeSelectionCombo.add(WSDL_ALL);
229         modeSelectionCombo.add(WSDL_INTERFACE_ONLY);
230         modeSelectionCombo.add(WSDL_IMPLEMENTATION_ONLY);
231
232         modeSelectionCombo.select(settings.getInt(PREF_JAVA_MODE_INDEX));
233     }
234
235     private void populateStyleCombo() {
236         styleSelectionCombo.add(WSDL_STYLE_DOCUMENT);
237         styleSelectionCombo.add(WSDL_STYLE_RPC);
238         styleSelectionCombo.add(WSDL_STYLE_WRAPPED);
239
240         styleSelectionCombo.select(settings.getInt(PREF_JAVA_STYLE_INDEX));
241     }
242     public int getMode(){
243         String JavaDoc selectedOption = modeSelectionCombo.getItem(modeSelectionCombo.getSelectionIndex());
244         if (WSDL_ALL.equals(selectedOption)){
245             return Emitter.MODE_ALL;
246         }else if (WSDL_INTERFACE_ONLY.equals(selectedOption)){
247             return Emitter.MODE_INTERFACE;
248         }else if (WSDL_IMPLEMENTATION_ONLY.equals(selectedOption)){
249             return Emitter.MODE_IMPLEMENTATION;
250         }else{
251             throw new RuntimeException JavaDoc("Unknown Exception");
252         }
253     }
254     
255
256     
257     public String JavaDoc getStyle(){
258         return this.styleSelectionCombo.getItem(styleSelectionCombo.getSelectionIndex()).toUpperCase();
259     }
260     public String JavaDoc getLocationURL() {
261         return this.serviceLocationURLTextBox.getText();
262     }
263
264     public String JavaDoc getInputWSDLName() {
265         return this.inputWSDLNameTextBox.getText();
266     }
267
268     public String JavaDoc getPortypeName() {
269         return this.portTypeNameTextBox.getText();
270     }
271
272     public String JavaDoc getBindingName() {
273         return this.bindingTextBox.getText();
274     }
275     
276    private String JavaDoc getgetClassFileLocation(){
277        return null;
278    }
279     
280    
281  
282 }
283
Popular Tags