Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 59713 invoked from network); 27 May 2005 05:49:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 May 2005 05:49:05 -0000 Received: (qmail 24764 invoked by uid 500); 27 May 2005 05:49:02 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 24707 invoked by uid 500); 27 May 2005 05:49:02 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 24694 invoked by uid 99); 27 May 2005 05:49:01 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 26 May 2005 22:49:00 -0700 Received: (qmail 59687 invoked by uid 65534); 27 May 2005 05:48:59 -0000 Message-ID: <20050527054859.59686.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r178757 - in /webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen: eclipse/CodeGenWizard.java eclipse/pages/OptionsPage.java eclipse/pages/OutputPage.java eclipse/pages/WSDLFileSelectionPage.java resources/Codegen.properties Date: Fri, 27 May 2005 05:48:58 -0000 To: axis-cvs@ws.apache.org From: ajith@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ajith Date: Thu May 26 22:48:57 2005 New Revision: 178757 URL: http://svn.apache.org/viewcvs?rev=3D178757&view=3Drev Log: improved the code slightly to include test case generation and skeleton gen= eration Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/CodeGenWizard.java webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/pages/OptionsPage.java webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/pages/OutputPage.java webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/pages/WSDLFileSelectionPage.java webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/resources/Codegen.properties Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool= /codegen/eclipse/CodeGenWizard.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool= /src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java?rev=3D178757&r= 1=3D178756&r2=3D178757&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/CodeGenWizard.java (original) +++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/CodeGenWizard.java Thu May 26 22:48:57 2005 @@ -28,7 +28,7 @@ import org.eclipse.ui.IWorkbenchWizard; =20 /** - * The main wizard for the codegen wizard + * The main wizard for the codegen wizard */ =20 public class CodeGenWizard extends Wizard implements INewWizard { @@ -40,12 +40,16 @@ =20 private ISelection selection; =20 + private boolean canFinish =3D false; + /** * Constructor for CodeGenWizard. */ public CodeGenWizard() { super(); setNeedsProgressMonitor(true); + this.setWindowTitle(CodegenWizardPlugin + .getResourceString("general.name")); } =20 /** @@ -59,6 +63,7 @@ addPage(page2); page3 =3D new OutputPage(); addPage(page3); + } =20 /** @@ -68,19 +73,17 @@ public boolean performFinish() { =20 try { - // getContainer().run(true, false, op); + // getContainer().run(true, false, op); doFinish(); } catch (Exception e) { e.printStackTrace(); MessageDialog.openError(getShell(), CodegenWizardPlugin - .getResourceString("general.Error"), e - .getMessage()); + .getResourceString("general.Error"), e.getMessage()); return false; } - MessageDialog.openInformation(this.getShell(), - CodegenWizardPlugin.getResourceString("genearal.name"), - CodegenWizardPlugin.getResourceString("wizard.success") - ); + MessageDialog.openInformation(this.getShell(), CodegenWizardPlugin + .getResourceString("general.name"), CodegenWizardPlugin + .getResourceString("wizard.success")); return true; } =20 @@ -89,9 +92,8 @@ */ =20 private void doFinish() { - + =20 try { - =20 WSDLDescription wom =3D this.getWOM(page1.getFileName()); Map optionsMap =3D fillOptionMap(); CodeGenConfiguration codegenConfig =3D new CodeGenConfiguratio= n(wom, @@ -101,23 +103,19 @@ throw new RuntimeException(e); } =20 - }=20 + } =20 /** * =20 */ private Map fillOptionMap() { Map optionMap =3D new HashMap(); - =20 + optionMap.put(CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION, new CommandLineOption( CommandLineOptionConstants.WSDL_LOCATION_URI_OPTIO= N, getStringArray(page1.getFileName()))); - =20 - optionMap.put(CommandLineOptionConstants.ADVANCED_CODEGEN_OPTION, - new CommandLineOption( - CommandLineOptionConstants.ADVANCED_CODEGEN_OPTION, - new String[0])); + if (page2.isAsyncOnlyOn()) { optionMap .put( @@ -147,12 +145,33 @@ new CommandLineOption( CommandLineOptionConstants.OUTPUT_LOCATION_OPTION, getStringArray(page3.getOutputLocation()))); + if (page2.isServerside()) { + optionMap.put(CommandLineOptionConstants.SERVER_SIDE_CODE_OPTI= ON, + new CommandLineOption( + CommandLineOptionConstants.SERVER_SIDE_CODE_OP= TION, + new String[0])); + + if (page2.isServerXML()) { + optionMap + .put( + CommandLineOptionConstants.GENERATE_SERVIC= E_DESCRIPTION_OPTION, + new CommandLineOption( + CommandLineOptionConstants.GENERAT= E_SERVICE_DESCRIPTION_OPTION, + new String[0])); + } + } + if (page2.isGenerateTestCase()){ + optionMap + .put( + CommandLineOptionConstants.GENERATE_TEST_CASE_OPTION, + new CommandLineOption( + CommandLineOptionConstants.GENERATE_TEST_CASE_= OPTION, + new String[0]));=20 + } //System.out.println(page3.getOutputLocation()); return optionMap; } =20 - =20 - private String mapLanguagesWithCombo(String UILangValue) { if (UIConstants.JAVA.equals(UILangValue)) { return CommandLineOptionConstants.LanguageNames.JAVA; @@ -180,10 +199,10 @@ InputStream in =3D new FileInputStream(new File(wsdlLocation)); return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).buil= d(in); } - =20 - private String[] getStringArray(String value){ + + private String[] getStringArray(String value) { String[] values =3D new String[1]; - values[0]=3Dvalue; + values[0] =3D value; return values; } } Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool= /codegen/eclipse/pages/OptionsPage.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool= /src/org/apache/axis/tool/codegen/eclipse/pages/OptionsPage.java?rev=3D1787= 57&r1=3D178756&r2=3D178757&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/pages/OptionsPage.java (original) +++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/pages/OptionsPage.java Thu May 26 22:48:57 2005 @@ -17,8 +17,11 @@ =20 import org.apache.axis.tool.codegen.eclipse.CodegenWizardPlugin; import org.apache.axis.tool.codegen.eclipse.util.UIConstants; +import org.apache.axis.wsdl.util.URLProcessor; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -28,23 +31,32 @@ import org.eclipse.swt.widgets.Text; =20 public class OptionsPage extends WizardPage implements UIConstants { - =20 + private Combo languageSelectionComboBox; + + private Button syncAndAsyncRadioButton; + private Button syncOnlyRadioButton; + private Button asyncOnlyRadioButton; + private Text packageText; + private Button serverSideCheckBoxButton; =20 + private Button testCaseCheckBoxButton; + + private Button serverXMLCheckBoxButton; + /** - * @param - * + * @param pageName */ public OptionsPage() { super(CodegenWizardPlugin.getResourceString("page2.name")); - setTitle(CodegenWizardPlugin.getResourceString("page2.title")); - setDescription(CodegenWizardPlugin.getResourceString("page2.desc")); - setImageDescriptor(CodegenWizardPlugin.getWizardImageDescriptor()); - =20 + setTitle(CodegenWizardPlugin.getResourceString("page2.title")); + setDescription(CodegenWizardPlugin.getResourceString("page2.desc")= ); + setImageDescriptor(CodegenWizardPlugin.getWizardImageDescriptor())= ; + } =20 /* @@ -53,95 +65,156 @@ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclips= e=2Eswt.widgets.Composite) */ public void createControl(Composite parent) { - =20 + Composite container =3D new Composite(parent, SWT.NULL); - GridLayout layout =3D new GridLayout(); - container.setLayout(layout); - layout.numColumns =3D 2; - layout.verticalSpacing =3D 9; - - GridData gd =3D new GridData(GridData.FILL_HORIZONTAL); - Label label =3D new Label(container, SWT.NULL); - label.setText(CodegenWizardPlugin.getResourceString("page2.language.capt= ion")); - - languageSelectionComboBox =3D new Combo(container, SWT.DROP_DOWN |SWT.BO= RDER |SWT.READ_ONLY); - //fill the combo - this.fillLanguageCombo(); - =09 - languageSelectionComboBox.setLayoutData(gd); - syncOnlyRadioButton =3D new Button(container,SWT.RADIO); - syncOnlyRadioButton.setText(CodegenWizardPlugin.getResourceString("page2= .sync.caption")); - =09 - asyncOnlyRadioButton =3D new Button(container,SWT.RADIO); - asyncOnlyRadioButton.setText(CodegenWizardPlugin.getResourceString("page= 2=2Easync.caption")); - =09 - =09 - label =3D new Label(container, SWT.NULL); - label.setText(CodegenWizardPlugin.getResourceString("page2.package.capti= on")); - =09 - packageText =3D new Text(container,SWT.BORDER); - gd =3D new GridData(GridData.FILL_HORIZONTAL); - packageText.setLayoutData(gd); - packageText.setText("default");//get this text from the URLProcessor - =09 - serverSideCheckBoxButton =3D new Button(container,SWT.CHECK); - serverSideCheckBoxButton.setText(CodegenWizardPlugin.getResourceString("= page2.serverside.caption")); - =09 - setControl(container); - setPageComplete(true); + GridLayout layout =3D new GridLayout(); + container.setLayout(layout); + layout.numColumns =3D 3; + layout.verticalSpacing =3D 9; + + GridData gd =3D new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan =3D 2; + + Label label =3D new Label(container, SWT.NULL); + label.setText(CodegenWizardPlugin + .getResourceString("page2.language.caption")); + + languageSelectionComboBox =3D new Combo(container, SWT.DROP_DOWN + | SWT.BORDER | SWT.READ_ONLY); + //fill the combo + this.fillLanguageCombo(); + languageSelectionComboBox.setLayoutData(gd); + + syncAndAsyncRadioButton =3D new Button(container, SWT.RADIO); + syncAndAsyncRadioButton.setText(CodegenWizardPlugin + .getResourceString("page2.syncAsync.caption")); + syncAndAsyncRadioButton.setSelection(true); + + syncOnlyRadioButton =3D new Button(container, SWT.RADIO); + syncOnlyRadioButton.setText(CodegenWizardPlugin + .getResourceString("page2.sync.caption")); + + asyncOnlyRadioButton =3D new Button(container, SWT.RADIO); + asyncOnlyRadioButton.setText(CodegenWizardPlugin + .getResourceString("page2.async.caption")); + + label =3D new Label(container, SWT.NULL); + label.setText(CodegenWizardPlugin + .getResourceString("page2.package.caption")); + + packageText =3D new Text(container, SWT.BORDER); + gd =3D new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan =3D 2; + + packageText.setLayoutData(gd); + packageText.setText(URLProcessor.getNameSpaceFromURL(""));//get th= is text from the URLProcessor + =20 + =20 + gd =3D new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan =3D 3; + testCaseCheckBoxButton =3D new Button(container, SWT.CHECK); + testCaseCheckBoxButton.setLayoutData(gd); + testCaseCheckBoxButton.setText(CodegenWizardPlugin + .getResourceString("page2.testcase.caption")); + =20 + =20 + =20 + =20 + serverSideCheckBoxButton =3D new Button(container, SWT.CHECK); + serverSideCheckBoxButton.setText(CodegenWizardPlugin + .getResourceString("page2.serverside.caption")); + serverSideCheckBoxButton.addSelectionListener(new SelectionListene= r() { + public void widgetSelected(SelectionEvent e) { + handleServersideSelection(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + + serverXMLCheckBoxButton =3D new Button(container, SWT.CHECK); + serverXMLCheckBoxButton.setText(CodegenWizardPlugin + .getResourceString("page2.serviceXML.caption")); + serverXMLCheckBoxButton.setEnabled(false); + + setControl(container); + setPageComplete(true); =20 } - =20 + /** * Fill the combo with proper language names - * + * =20 */ - private void fillLanguageCombo(){ - =20 + private void fillLanguageCombo() { + languageSelectionComboBox.add(JAVA); languageSelectionComboBox.add(C_SHARP); languageSelectionComboBox.add(C_PLUS_PLUS); - =20 + languageSelectionComboBox.setText(languageSelectionComboBox.getIte= m(0)); } - =20 + + private void handleServersideSelection() { + if (this.serverSideCheckBoxButton.getSelection()) { + this.serverXMLCheckBoxButton.setEnabled(true); + } else { + this.serverXMLCheckBoxButton.setEnabled(false); + } + } + /** * Get the selected language + *=20 * @return */ - public String getSelectedLanguage(){ - return languageSelectionComboBox.getItem(languageSelectionComboBox= .getSelectionIndex()); + public String getSelectedLanguage() { + return languageSelectionComboBox.getItem(languageSelectionComboBox + .getSelectionIndex()); } =20 /** * the async only status + *=20 * @return */ - public boolean isAsyncOnlyOn(){ + public boolean isAsyncOnlyOn() { return asyncOnlyRadioButton.getSelection(); } - =20 + /** * the sync only status + *=20 * @return */ - public boolean isSyncOnlyOn(){ + public boolean isSyncOnlyOn() { return syncOnlyRadioButton.getSelection(); } - =20 + /** * return the package name + *=20 * @return */ - public String getPackageName(){ - return this.packageText.getText(); + public String getPackageName() { + return this.packageText.getText(); } - =20 + /** * The serverside status * @return */ - public boolean isServerside(){ + public boolean isServerside() { return this.serverSideCheckBoxButton.getSelection(); + } + + public boolean isServerXML() { + if (this.serverXMLCheckBoxButton.isEnabled()) + return this.serverXMLCheckBoxButton.getSelection(); + else + return false; + } + public boolean isGenerateTestCase(){ + return this.testCaseCheckBoxButton.getSelection(); } } Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool= /codegen/eclipse/pages/OutputPage.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool= /src/org/apache/axis/tool/codegen/eclipse/pages/OutputPage.java?rev=3D17875= 7&r1=3D178756&r2=3D178757&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/pages/OutputPage.java (original) +++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/pages/OutputPage.java Thu May 26 22:48:57 2005 @@ -46,6 +46,8 @@ setTitle(CodegenWizardPlugin.getResourceString("page3.title")); setDescription(CodegenWizardPlugin.getResourceString("page3.desc")= ); setImageDescriptor(CodegenWizardPlugin.getWizardImageDescriptor())= ; + //set the page complete status to false at initilaization + setPageComplete(false); =20 } =20 @@ -86,7 +88,7 @@ // locationSelectCheckBox.setText("Workspace projects only"); =20 setControl(container); - this.setPageComplete(true); + =20 =20 } =20 Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool= /codegen/eclipse/pages/WSDLFileSelectionPage.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool= /src/org/apache/axis/tool/codegen/eclipse/pages/WSDLFileSelectionPage.java?= rev=3D178757&r1=3D178756&r2=3D178757&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/pages/WSDLFileSelectionPage.java (original) +++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/eclipse/pages/WSDLFileSelectionPage.java Thu May 26 22:48:57 2005 @@ -37,6 +37,8 @@ setDescription(CodegenWizardPlugin.getResourceString("page1.desc")); this.selection =3D selection; setImageDescriptor(CodegenWizardPlugin.getWizardImageDescriptor()); + //set the page complete status to false at initiation=20 + setPageComplete(false); } =20 /** @@ -85,16 +87,13 @@ return; } =20 - int dotLoc =3D fileName.lastIndexOf('.'); - =09 - if (dotLoc !=3D -1) { - String ext =3D fileName.substring(dotLoc + 1); - if (ext.equalsIgnoreCase("wsdl") =3D=3D false) { - updateStatus(CodegenWizardPlugin.getResourceString("File extension mus= t be wsdl")); + if (!fileName.matches(".*\\.wsdl")){ + updateStatus(CodegenWizardPlugin.getResourceString("page1.error.wronge= xtension")); return; - } - } =20 + } + =20 updateStatus(null); + =20 } =09 /** Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool= /codegen/resources/Codegen.properties URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool= /src/org/apache/axis/tool/codegen/resources/Codegen.properties?rev=3D178757= &r1=3D178756&r2=3D178757&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/resources/Codegen.properties (original) +++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codeg= en/resources/Codegen.properties Thu May 26 22:48:57 2005 @@ -4,7 +4,7 @@ ## #General general.Error=3DError -genearal.name=3DAxis2 Codegen Wizard +general.name=3DAxis2 Codegen Wizard ##########################################################################= ## #WSDL selection page - Page1 #WSDL selection page name @@ -25,10 +25,13 @@ page2.desc=3DSet the options for the code generator #labels page2.language.caption=3DSelect the output language +page2.syncAsync.caption=3DGenerate both sync and async page2.sync.caption=3DGenerate sync style only page2.async.caption=3DGenerate async style only page2.package.caption=3DSet the package name page2.serverside.caption=3DGenerate serverside code +page2.serviceXML.caption=3DGenerate a default server.xml +page2.testcase.caption=3DGenerate a test case #######################################################################=20 #Output location selection - Page3 =20 page3.name=3DAxis2 Code generation wizard @@ -37,7 +40,7 @@ #lables page3.output.caption=3DOutput path page3.outselection.browse=3DBrowse... -page3.containerbox.title=3D"Select new file container" +page3.containerbox.title=3DSelect new file container #errors page3.error.nolocation=3Doutput location needs to be specified #