axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
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 GMT
Author: ajith
Date: Thu May 26 22:48:57 2005
New Revision: 178757

URL: http://svn.apache.org/viewcvs?rev=178757&view=rev
Log:
improved the code slightly to include test case generation and skeleton generation

Modified:
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OptionsPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OutputPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/WSDLFileSelectionPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/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=178757&r1=178756&r2=178757&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java
(original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java
Thu May 26 22:48:57 2005
@@ -28,7 +28,7 @@
 import org.eclipse.ui.IWorkbenchWizard;
 
 /**
- *  The main wizard for the codegen wizard
+ * The main wizard for the codegen wizard
  */
 
 public class CodeGenWizard extends Wizard implements INewWizard {
@@ -40,12 +40,16 @@
 
     private ISelection selection;
 
+    private boolean canFinish = false;
+
     /**
      * Constructor for CodeGenWizard.
      */
     public CodeGenWizard() {
         super();
         setNeedsProgressMonitor(true);
+        this.setWindowTitle(CodegenWizardPlugin
+                .getResourceString("general.name"));
     }
 
     /**
@@ -59,6 +63,7 @@
         addPage(page2);
         page3 = new OutputPage();
         addPage(page3);
+
     }
 
     /**
@@ -68,19 +73,17 @@
     public boolean performFinish() {
 
         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;
     }
 
@@ -89,9 +92,8 @@
      */
 
     private void doFinish() {
-
+  
         try {
-                   
             WSDLDescription wom = this.getWOM(page1.getFileName());
             Map optionsMap = fillOptionMap();
             CodeGenConfiguration codegenConfig = new CodeGenConfiguration(wom,
@@ -101,23 +103,19 @@
             throw new RuntimeException(e);
         }
 
-    } 
+    }
 
     /**
      *  
      */
     private Map fillOptionMap() {
         Map optionMap = new HashMap();
-        
+
         optionMap.put(CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
                 new CommandLineOption(
                         CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
                         getStringArray(page1.getFileName())));
-        
-        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_OPTION,
+                    new CommandLineOption(
+                            CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION,
+                            new String[0]));
+
+            if (page2.isServerXML()) {
+                optionMap
+                        .put(
+                                CommandLineOptionConstants.GENERATE_SERVICE_DESCRIPTION_OPTION,
+                                new CommandLineOption(
+                                        CommandLineOptionConstants.GENERATE_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])); 
+        }
         //System.out.println(page3.getOutputLocation());
         return optionMap;
     }
 
-   
-
     private String mapLanguagesWithCombo(String UILangValue) {
         if (UIConstants.JAVA.equals(UILangValue)) {
             return CommandLineOptionConstants.LanguageNames.JAVA;
@@ -180,10 +199,10 @@
         InputStream in = new FileInputStream(new File(wsdlLocation));
         return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in);
     }
-    
-    private String[] getStringArray(String value){
+
+    private String[] getStringArray(String value) {
         String[] values = new String[1];
-        values[0]=value;
+        values[0] = 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=178757&r1=178756&r2=178757&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OptionsPage.java
(original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OptionsPage.java
Thu May 26 22:48:57 2005
@@ -17,8 +17,11 @@
 
 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;
 
 public class OptionsPage extends WizardPage implements UIConstants {
-    
+
     private Combo languageSelectionComboBox;
+
+    private Button syncAndAsyncRadioButton;
+
     private Button syncOnlyRadioButton;
+
     private Button asyncOnlyRadioButton;
+
     private Text packageText;
+
     private Button serverSideCheckBoxButton;
     
+    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());
-        
+        setTitle(CodegenWizardPlugin.getResourceString("page2.title"));
+        setDescription(CodegenWizardPlugin.getResourceString("page2.desc"));
+        setImageDescriptor(CodegenWizardPlugin.getWizardImageDescriptor());
+
     }
 
     /*
@@ -53,95 +65,156 @@
      * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
      */
     public void createControl(Composite parent) {
-        
+
         Composite container = new Composite(parent, SWT.NULL);
-		GridLayout layout = new GridLayout();
-		container.setLayout(layout);
-		layout.numColumns = 2;
-		layout.verticalSpacing = 9;
-
-		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
-		Label label = new Label(container, SWT.NULL);
-		label.setText(CodegenWizardPlugin.getResourceString("page2.language.caption"));
-
-		languageSelectionComboBox = new Combo(container, SWT.DROP_DOWN |SWT.BORDER |SWT.READ_ONLY);
-		//fill the combo
-		this.fillLanguageCombo();
-		
-		languageSelectionComboBox.setLayoutData(gd);
-		syncOnlyRadioButton = new Button(container,SWT.RADIO);
-		syncOnlyRadioButton.setText(CodegenWizardPlugin.getResourceString("page2.sync.caption"));
-		
-		asyncOnlyRadioButton = new Button(container,SWT.RADIO);
-		asyncOnlyRadioButton.setText(CodegenWizardPlugin.getResourceString("page2.async.caption"));
-		
-		
-		label = new Label(container, SWT.NULL);
-		label.setText(CodegenWizardPlugin.getResourceString("page2.package.caption"));
-		
-		packageText = new Text(container,SWT.BORDER);
-		gd = new GridData(GridData.FILL_HORIZONTAL);
-		packageText.setLayoutData(gd);
-		packageText.setText("default");//get this text from the URLProcessor
-		
-		serverSideCheckBoxButton = new Button(container,SWT.CHECK);
-		serverSideCheckBoxButton.setText(CodegenWizardPlugin.getResourceString("page2.serverside.caption"));
-		
-		setControl(container);
-		setPageComplete(true);
+        GridLayout layout = new GridLayout();
+        container.setLayout(layout);
+        layout.numColumns = 3;
+        layout.verticalSpacing = 9;
+
+        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 2;
+
+        Label label = new Label(container, SWT.NULL);
+        label.setText(CodegenWizardPlugin
+                .getResourceString("page2.language.caption"));
+
+        languageSelectionComboBox = new Combo(container, SWT.DROP_DOWN
+                | SWT.BORDER | SWT.READ_ONLY);
+        //fill the combo
+        this.fillLanguageCombo();
+        languageSelectionComboBox.setLayoutData(gd);
+
+        syncAndAsyncRadioButton = new Button(container, SWT.RADIO);
+        syncAndAsyncRadioButton.setText(CodegenWizardPlugin
+                .getResourceString("page2.syncAsync.caption"));
+        syncAndAsyncRadioButton.setSelection(true);
+
+        syncOnlyRadioButton = new Button(container, SWT.RADIO);
+        syncOnlyRadioButton.setText(CodegenWizardPlugin
+                .getResourceString("page2.sync.caption"));
+
+        asyncOnlyRadioButton = new Button(container, SWT.RADIO);
+        asyncOnlyRadioButton.setText(CodegenWizardPlugin
+                .getResourceString("page2.async.caption"));
+
+        label = new Label(container, SWT.NULL);
+        label.setText(CodegenWizardPlugin
+                .getResourceString("page2.package.caption"));
+
+        packageText = new Text(container, SWT.BORDER);
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 2;
+
+        packageText.setLayoutData(gd);
+        packageText.setText(URLProcessor.getNameSpaceFromURL(""));//get this text from the
URLProcessor
+        
+        
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 3;
+        testCaseCheckBoxButton = new Button(container, SWT.CHECK);
+        testCaseCheckBoxButton.setLayoutData(gd);
+        testCaseCheckBoxButton.setText(CodegenWizardPlugin
+                .getResourceString("page2.testcase.caption"));
+        
+        
+        
+        
+        serverSideCheckBoxButton = new Button(container, SWT.CHECK);
+        serverSideCheckBoxButton.setText(CodegenWizardPlugin
+                .getResourceString("page2.serverside.caption"));
+        serverSideCheckBoxButton.addSelectionListener(new SelectionListener() {
+            public void widgetSelected(SelectionEvent e) {
+                handleServersideSelection();
+            }
+
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+        });
+
+        serverXMLCheckBoxButton = new Button(container, SWT.CHECK);
+        serverXMLCheckBoxButton.setText(CodegenWizardPlugin
+                .getResourceString("page2.serviceXML.caption"));
+        serverXMLCheckBoxButton.setEnabled(false);
+
+        setControl(container);
+        setPageComplete(true);
 
     }
-    
+
     /**
      * Fill the combo with proper language names
-     *
+     *  
      */
-    private void fillLanguageCombo(){
-        
+    private void fillLanguageCombo() {
+
         languageSelectionComboBox.add(JAVA);
         languageSelectionComboBox.add(C_SHARP);
         languageSelectionComboBox.add(C_PLUS_PLUS);
-        
+
         languageSelectionComboBox.setText(languageSelectionComboBox.getItem(0));
     }
-    
+
+    private void handleServersideSelection() {
+        if (this.serverSideCheckBoxButton.getSelection()) {
+            this.serverXMLCheckBoxButton.setEnabled(true);
+        } else {
+            this.serverXMLCheckBoxButton.setEnabled(false);
+        }
+    }
+
     /**
      * Get the selected language
+     * 
      * @return
      */
-    public String getSelectedLanguage(){
-        return languageSelectionComboBox.getItem(languageSelectionComboBox.getSelectionIndex());
+    public String getSelectedLanguage() {
+        return languageSelectionComboBox.getItem(languageSelectionComboBox
+                .getSelectionIndex());
     }
 
     /**
      * the async only status
+     * 
      * @return
      */
-    public boolean isAsyncOnlyOn(){
+    public boolean isAsyncOnlyOn() {
         return asyncOnlyRadioButton.getSelection();
     }
-    
+
     /**
      * the sync only status
+     * 
      * @return
      */
-    public boolean isSyncOnlyOn(){
+    public boolean isSyncOnlyOn() {
         return syncOnlyRadioButton.getSelection();
     }
-    
+
     /**
      * return the package name
+     * 
      * @return
      */
-    public String getPackageName(){
-       return this.packageText.getText();
+    public String getPackageName() {
+        return this.packageText.getText();
     }
-    
+
     /**
      * 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=178757&r1=178756&r2=178757&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OutputPage.java
(original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/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);
 
     }
 
@@ -86,7 +88,7 @@
 //        locationSelectCheckBox.setText("Workspace projects only");
 
         setControl(container);
-        this.setPageComplete(true);
+        
 
     }
     

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=178757&r1=178756&r2=178757&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/WSDLFileSelectionPage.java
(original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/WSDLFileSelectionPage.java
Thu May 26 22:48:57 2005
@@ -37,6 +37,8 @@
 		setDescription(CodegenWizardPlugin.getResourceString("page1.desc"));
 		this.selection = selection;
 		setImageDescriptor(CodegenWizardPlugin.getWizardImageDescriptor());
+		//set the page complete status to false at initiation 
+		setPageComplete(false);
 	}
 
 	/**
@@ -85,16 +87,13 @@
 			return;
 		}
 	    
-		int dotLoc = fileName.lastIndexOf('.');
-		
-		if (dotLoc != -1) {
-			String ext = fileName.substring(dotLoc + 1);
-			if (ext.equalsIgnoreCase("wsdl") == false) {
-				updateStatus(CodegenWizardPlugin.getResourceString("File extension must be wsdl"));
+		if (!fileName.matches(".*\\.wsdl")){
+				updateStatus(CodegenWizardPlugin.getResourceString("page1.error.wrongextension"));
 				return;
-			}
-		}  
+		 }
+		 
 	    updateStatus(null);
+	    
 	}
 	
 	/**

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=178757&r1=178756&r2=178757&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/resources/Codegen.properties
(original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/resources/Codegen.properties
Thu May 26 22:48:57 2005
@@ -4,7 +4,7 @@
 ##
 #General
 general.Error=Error
-genearal.name=Axis2 Codegen Wizard
+general.name=Axis2 Codegen Wizard
 ############################################################################
 #WSDL selection page - Page1
 #WSDL selection page name
@@ -25,10 +25,13 @@
 page2.desc=Set the options for the code generator
 #labels
 page2.language.caption=Select the output language
+page2.syncAsync.caption=Generate both sync and async
 page2.sync.caption=Generate sync style only
 page2.async.caption=Generate async style only
 page2.package.caption=Set the package name
 page2.serverside.caption=Generate serverside code
+page2.serviceXML.caption=Generate a default server.xml
+page2.testcase.caption=Generate a test case
 ####################################################################### 
 #Output location selection - Page3  
 page3.name=Axis2 Code generation wizard
@@ -37,7 +40,7 @@
 #lables
 page3.output.caption=Output path
 page3.outselection.browse=Browse...
-page3.containerbox.title="Select new file container"
+page3.containerbox.title=Select new file container
 #errors
 page3.error.nolocation=output location needs to be specified
 #



Mime
View raw message