You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/08/15 11:44:03 UTC
svn commit: r232780 [2/3] - in /webservices/axis/trunk/java/modules/tool:
conf/codegen/ conf/service/ src/org/apache/axis2/tool/codegen/
src/org/apache/axis2/tool/codegen/eclipse/
src/org/apache/axis2/tool/codegen/eclipse/plugin/ src/org/apache/axis2/t...
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java Mon Aug 15 02:39:26 2005
@@ -11,11 +11,11 @@
* specific language governing permissions and limitations under the License.
*/
-package org.apache.axis.tool.codegen.eclipse.ui;
+package org.apache.axis2.tool.codegen.eclipse.ui;
-import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
-import org.apache.axis.tool.codegen.eclipse.util.UIConstants;
-import org.apache.axis.wsdl.util.URLProcessor;
+import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.apache.axis2.tool.codegen.eclipse.util.UIConstants;
+import org.apache.axis2.wsdl.util.URLProcessor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -23,343 +23,381 @@
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
/**
* Options Page lets the user change general settings on the code generation. It is used in the CodegenWizardPlugin,
* CodeGenWizard.
+ *
*/
-public class OptionsPage extends AbstractWizardPage implements UIConstants {
-
- /**
- * Selection list for target languages
- */
- private Combo languageSelectionComboBox;
-
- /**
- * A radio button to enable/disable code generation for synchronous and asynchronous calls.
- */
- private Button syncAndAsyncRadioButton;
-
- /**
- * A radio button to choose "synchronous only" code generation
- */
- private Button syncOnlyRadioButton;
-
- /**
- * A radio button to choose "asynchronous only" code generation
- */
- private Button asyncOnlyRadioButton;
-
- /**
- * Label holding the full qualified package name for generated code
- */
- private Text packageText;
-
- /**
- * Checkbox to enable server-side skeleton code generation. If enabled, generates an empty implementation of the
- * service
- */
- private Button serverSideCheckBoxButton;
-
- /**
- * Checkbox to enable the generation of test case classes for the generated implementation of the webservice.
- */
- private Button testCaseCheckBoxButton;
-
- /**
- * Checkbox to enable the generation of a default server.xml configuration file
- */
- private Button serverXMLCheckBoxButton;
-
-
- /**
- * Creates the page and initialize some settings
- */
- public OptionsPage() {
- super("page2");
-
- }
-
- /**
- * Sets the default values for the Options page
- *
- * @param settings2 the settings store to save the values to
- */
- protected void initializeDefaultSettings() {
- settings.put(PREF_CHECK_GENERATE_SERVERCONFIG, false);
- settings.put(PREF_CHECK_GENERATE_SERVERSIDE, false);
- settings.put(PREF_CHECK_GENERATE_TESTCASE, false);
- settings.put(PREF_LANGUAGE_INDEX, 0);
- settings.put(PREF_PACKAGE_NAME, "org.example.webservice");
- settings.put(PREF_RADIO_ASYNC_ONLY, false);
- settings.put(PREF_RADIO_SYNC_AND_ASYNC, true);
- settings.put(PREF_RADIO_SYNC_ONLY, false);
- }
-
- /*
- * (non-Javadoc)
- *
- * @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 = 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);
- languageSelectionComboBox.select(settings.getInt(PREF_LANGUAGE_INDEX));
- languageSelectionComboBox.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- settings.put(PREF_LANGUAGE_INDEX,
- languageSelectionComboBox.getSelectionIndex());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- syncAndAsyncRadioButton = new Button(container, SWT.RADIO);
- syncAndAsyncRadioButton.setText(
- CodegenWizardPlugin.getResourceString(
- "page2.syncAsync.caption"));
- syncAndAsyncRadioButton.setSelection(
- settings.getBoolean(PREF_RADIO_SYNC_AND_ASYNC));
- syncAndAsyncRadioButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- settings.put(PREF_RADIO_SYNC_AND_ASYNC,
- syncAndAsyncRadioButton.getSelection());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- syncOnlyRadioButton = new Button(container, SWT.RADIO);
- syncOnlyRadioButton.setText(
- CodegenWizardPlugin.getResourceString("page2.sync.caption"));
- syncOnlyRadioButton.setSelection(
- settings.getBoolean(PREF_RADIO_SYNC_ONLY));
- syncOnlyRadioButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- settings.put(PREF_RADIO_SYNC_ONLY,
- syncOnlyRadioButton.getSelection());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- asyncOnlyRadioButton = new Button(container, SWT.RADIO);
- asyncOnlyRadioButton.setText(org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin
- .getResourceString("page2.async.caption"));
- asyncOnlyRadioButton.setSelection(
- settings.getBoolean(PREF_RADIO_ASYNC_ONLY));
- asyncOnlyRadioButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- settings.put(PREF_RADIO_ASYNC_ONLY,
- asyncOnlyRadioButton.getSelection());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- 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);
- String packageName;
- String storedPackageName = settings.get(PREF_PACKAGE_NAME);
- if (storedPackageName.equals("")) {
- packageName = URLProcessor.getNameSpaceFromURL("");
- } else {
- packageName = storedPackageName;
- }
- packageText.setText(packageName); // get this text from the URLProcessor
- packageText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- settings.put(PREF_PACKAGE_NAME, packageText.getText());
- }
- });
-
-
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- testCaseCheckBoxButton = new Button(container, SWT.CHECK);
- testCaseCheckBoxButton.setLayoutData(gd);
- testCaseCheckBoxButton.setText(
- org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin
- .getResourceString("page2.testcase.caption"));
- testCaseCheckBoxButton.setSelection(
- settings.getBoolean(PREF_CHECK_GENERATE_TESTCASE));
- testCaseCheckBoxButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- settings.put(PREF_CHECK_GENERATE_TESTCASE,
- testCaseCheckBoxButton.getEnabled());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- serverSideCheckBoxButton = new Button(container, SWT.CHECK);
- serverSideCheckBoxButton.setText(
- CodegenWizardPlugin.getResourceString(
- "page2.serverside.caption"));
- serverSideCheckBoxButton.setSelection(
- settings.getBoolean(PREF_CHECK_GENERATE_SERVERSIDE));
- serverSideCheckBoxButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- handleServersideSelection();
- settings.put(PREF_CHECK_GENERATE_SERVERSIDE,
- serverSideCheckBoxButton.getEnabled());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- serverXMLCheckBoxButton = new Button(container, SWT.CHECK);
- serverXMLCheckBoxButton.setSelection(
- settings.getBoolean(PREF_CHECK_GENERATE_SERVERCONFIG));
- serverXMLCheckBoxButton.setText(
- CodegenWizardPlugin.getResourceString(
- "page2.serviceXML.caption"));
- serverXMLCheckBoxButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- settings.put(PREF_CHECK_GENERATE_SERVERCONFIG,
- serverXMLCheckBoxButton.getEnabled());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- /*
- * Check the state of server-side selection, so we can enable/disable
- * the serverXML checkbox button.
- */
- handleServersideSelection();
-
-
- setControl(container);
- setPageComplete(true);
-
- }
-
- /**
- * Fill the combo with proper language names
- */
- private void fillLanguageCombo() {
-
- languageSelectionComboBox.add(JAVA);
- languageSelectionComboBox.add(C_SHARP);
- languageSelectionComboBox.add(C_PLUS_PLUS);
-
- languageSelectionComboBox.select(0);
- }
-
- /**
- * Validates the status of the server-side checkbox, and enables/disables
- * the generation checkbox for XML configuration file
- */
- private void handleServersideSelection() {
- if (this.serverSideCheckBoxButton.getSelection()) {
- this.serverXMLCheckBoxButton.setEnabled(true);
- } else {
- this.serverXMLCheckBoxButton.setEnabled(false);
- }
- }
-
- /**
- * Get the selected language
- *
- * @return a string containing the name of the target language
- */
- public String getSelectedLanguage() {
- return languageSelectionComboBox.getItem(
- languageSelectionComboBox.getSelectionIndex());
- }
-
- /**
- * the async only status
- *
- * @return true if "Generate asynchronous code only" is checked
- */
- public boolean isAsyncOnlyOn() {
- return asyncOnlyRadioButton.getSelection();
- }
-
- /**
- * the sync only status
- *
- * @return true if "Generate synchronous code only" is checked
- */
- public boolean isSyncOnlyOn() {
- return syncOnlyRadioButton.getSelection();
- }
-
- /**
- * return the package name
- *
- * @return a string containing the package name to use for code generation
- */
- public String getPackageName() {
- return this.packageText.getText();
- }
-
- /**
- * The serverside status
- *
- * @return true if "Generate Server-Side" is checked
- */
- public boolean isServerside() {
- return this.serverSideCheckBoxButton.getSelection();
- }
-
- /**
- * @return true if "Generate XML configuration file" is checked
- */
- public boolean isServerXML() {
- if (this.serverXMLCheckBoxButton.isEnabled())
- return this.serverXMLCheckBoxButton.getSelection();
- else
- return false;
- }
-
- /**
- * @return true if "Generate test case" is checked
- */
- public boolean isGenerateTestCase() {
- return this.testCaseCheckBoxButton.getSelection();
- }
-
-
+public class OptionsPage extends AbstractWizardPage implements UIConstants
+{
+
+ /**
+ * Selection list for target languages
+ */
+ private Combo languageSelectionComboBox;
+
+ /**
+ * A radio button to enable/disable code generation for synchronous and asynchronous calls.
+ */
+ private Button syncAndAsyncRadioButton;
+
+ /**
+ * A radio button to choose "synchronous only" code generation
+ */
+ private Button syncOnlyRadioButton;
+
+ /**
+ * A radio button to choose "asynchronous only" code generation
+ */
+ private Button asyncOnlyRadioButton;
+
+ /**
+ * Label holding the full qualified package name for generated code
+ */
+ private Text packageText;
+
+ /**
+ * Checkbox to enable server-side skeleton code generation. If enabled, generates an empty implementation of the
+ * service
+ */
+ private Button serverSideCheckBoxButton;
+
+ /**
+ * Checkbox to enable the generation of test case classes for the generated implementation of the webservice.
+ */
+ private Button testCaseCheckBoxButton;
+
+ /**
+ * Checkbox to enable the generation of a default server.xml configuration file
+ */
+ private Button serverXMLCheckBoxButton;
+ private Button enableDataBindingButton;
+ private Combo databindingTypeCombo;
+
+ /**
+ * Creates the page and initialize some settings
+ */
+ public OptionsPage()
+ {
+ super("page2");
+
+ }
+
+ /**
+ * Sets the default values for the Options page
+ *
+ * @param settings2 the settings store to save the values to
+ */
+ protected void initializeDefaultSettings()
+ {
+ settings.put(PREF_CHECK_GENERATE_SERVERCONFIG, false);
+ settings.put(PREF_CHECK_GENERATE_SERVERSIDE, false);
+ settings.put(PREF_CHECK_GENERATE_TESTCASE, false);
+ settings.put(PREF_LANGUAGE_INDEX, 0);
+ settings.put(PREF_PACKAGE_NAME, "org.example.webservice");
+ settings.put(PREF_RADIO_ASYNC_ONLY, false);
+ settings.put(PREF_RADIO_SYNC_AND_ASYNC, true);
+ settings.put(PREF_RADIO_SYNC_ONLY, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @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 = 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);
+ languageSelectionComboBox.select(settings.getInt(PREF_LANGUAGE_INDEX));
+ languageSelectionComboBox.addSelectionListener(new SelectionListener()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ settings.put(PREF_LANGUAGE_INDEX, languageSelectionComboBox.getSelectionIndex());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
+ });
+
+ syncAndAsyncRadioButton = new Button(container, SWT.RADIO);
+ syncAndAsyncRadioButton.setText(CodegenWizardPlugin.getResourceString("page2.syncAsync.caption"));
+ syncAndAsyncRadioButton.setSelection(settings.getBoolean(PREF_RADIO_SYNC_AND_ASYNC));
+ syncAndAsyncRadioButton.addSelectionListener(new SelectionListener()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ settings.put(PREF_RADIO_SYNC_AND_ASYNC, syncAndAsyncRadioButton.getSelection());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
+ });
+
+ syncOnlyRadioButton = new Button(container, SWT.RADIO);
+ syncOnlyRadioButton.setText(CodegenWizardPlugin.getResourceString("page2.sync.caption"));
+ syncOnlyRadioButton.setSelection(settings.getBoolean(PREF_RADIO_SYNC_ONLY));
+ syncOnlyRadioButton.addSelectionListener(new SelectionListener()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ settings.put(PREF_RADIO_SYNC_ONLY, syncOnlyRadioButton.getSelection());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
+ });
+
+ asyncOnlyRadioButton = new Button(container, SWT.RADIO);
+ asyncOnlyRadioButton.setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+ .getResourceString("page2.async.caption"));
+ asyncOnlyRadioButton.setSelection(settings.getBoolean(PREF_RADIO_ASYNC_ONLY));
+ asyncOnlyRadioButton.addSelectionListener(new SelectionListener()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ settings.put(PREF_RADIO_ASYNC_ONLY, asyncOnlyRadioButton.getSelection());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
+ });
+
+ 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);
+ String packageName;
+ String storedPackageName = settings.get(PREF_PACKAGE_NAME);
+ if (storedPackageName.equals(""))
+ {
+ packageName = URLProcessor.getNameSpaceFromURL("");
+ }
+ else
+ {
+ packageName = storedPackageName;
+ }
+ packageText.setText(packageName); // get this text from the URLProcessor
+ packageText.addModifyListener(new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ settings.put(PREF_PACKAGE_NAME, packageText.getText());
+ }
+ });
+
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ testCaseCheckBoxButton = new Button(container, SWT.CHECK);
+ testCaseCheckBoxButton.setLayoutData(gd);
+ testCaseCheckBoxButton.setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+ .getResourceString("page2.testcase.caption"));
+ testCaseCheckBoxButton.setSelection(settings.getBoolean(PREF_CHECK_GENERATE_TESTCASE));
+ testCaseCheckBoxButton.addSelectionListener(new SelectionListener()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ settings.put(PREF_CHECK_GENERATE_TESTCASE, testCaseCheckBoxButton.getEnabled());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
+ });
+
+ serverSideCheckBoxButton = new Button(container, SWT.CHECK);
+ serverSideCheckBoxButton.setText(CodegenWizardPlugin.getResourceString("page2.serverside.caption"));
+ serverSideCheckBoxButton.setSelection(settings.getBoolean(PREF_CHECK_GENERATE_SERVERSIDE));
+ serverSideCheckBoxButton.addSelectionListener(new SelectionListener()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ handleServersideSelection();
+ settings.put(PREF_CHECK_GENERATE_SERVERSIDE, serverSideCheckBoxButton.getEnabled());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
+ });
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ serverXMLCheckBoxButton = new Button(container, SWT.CHECK);
+ serverXMLCheckBoxButton.setLayoutData(gd);
+ serverXMLCheckBoxButton.setSelection(settings.getBoolean(PREF_CHECK_GENERATE_SERVERCONFIG));
+ serverXMLCheckBoxButton.setText(CodegenWizardPlugin.getResourceString("page2.serviceXML.caption"));
+ serverXMLCheckBoxButton.addSelectionListener(new SelectionListener()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ settings.put(PREF_CHECK_GENERATE_SERVERCONFIG, serverXMLCheckBoxButton.getEnabled());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
+ });
+
+ enableDataBindingButton = new Button(container, SWT.CHECK);
+ enableDataBindingButton.setText(CodegenWizardPlugin.getResourceString("page2.databindingCheck.caption"));
+ //this button is disabled
+ enableDataBindingButton.setEnabled(false);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ databindingTypeCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
+ databindingTypeCombo.setLayoutData(gd);
+ //this combo is also disabled
+ databindingTypeCombo.setEnabled(false);
+ /*
+ * Check the state of server-side selection, so we can enable/disable
+ * the serverXML checkbox button.
+ */
+ handleServersideSelection();
+
+
+ setControl(container);
+ setPageComplete(true);
+
+ }
+
+ /**
+ * Fill the combo with proper language names
+ *
+ */
+ private void fillLanguageCombo()
+ {
+
+ languageSelectionComboBox.add(JAVA);
+ languageSelectionComboBox.add(C_SHARP);
+ languageSelectionComboBox.add(C_PLUS_PLUS);
+
+ languageSelectionComboBox.select(0);
+ }
+
+ /**
+ * Validates the status of the server-side checkbox, and enables/disables
+ * the generation checkbox for XML configuration file
+ */
+ private void handleServersideSelection()
+ {
+ if (this.serverSideCheckBoxButton.getSelection())
+ {
+ this.serverXMLCheckBoxButton.setEnabled(true);
+ }
+ else
+ {
+ this.serverXMLCheckBoxButton.setEnabled(false);
+ }
+ }
+
+ /**
+ * Get the selected language
+ *
+ * @return a string containing the name of the target language
+ */
+ public String getSelectedLanguage()
+ {
+ return languageSelectionComboBox.getItem(languageSelectionComboBox.getSelectionIndex());
+ }
+
+ /**
+ * the async only status
+ *
+ * @return true if "Generate asynchronous code only" is checked
+ */
+ public boolean isAsyncOnlyOn()
+ {
+ return asyncOnlyRadioButton.getSelection();
+ }
+
+ /**
+ * the sync only status
+ *
+ * @return true if "Generate synchronous code only" is checked
+ */
+ public boolean isSyncOnlyOn()
+ {
+ return syncOnlyRadioButton.getSelection();
+ }
+
+ /**
+ * return the package name
+ *
+ * @return a string containing the package name to use for code generation
+ */
+ public String getPackageName()
+ {
+ return this.packageText.getText();
+ }
+
+ /**
+ * The serverside status
+ *
+ * @return true if "Generate Server-Side" is checked
+ */
+ public boolean isServerside()
+ {
+ return this.serverSideCheckBoxButton.getSelection();
+ }
+
+ /**
+ *
+ * @return true if "Generate XML configuration file" is checked
+ */
+ public boolean isServerXML()
+ {
+ if (this.serverXMLCheckBoxButton.isEnabled())
+ return this.serverXMLCheckBoxButton.getSelection();
+ else
+ return false;
+ }
+
+ /**
+ *
+ * @return true if "Generate test case" is checked
+ */
+ public boolean isGenerateTestCase()
+ {
+ return this.testCaseCheckBoxButton.getSelection();
+ }
+
+
/* (non-Javadoc)
- * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+ * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
*/
public int getPageType() {
- return WSDL_2_JAVA_TYPE;
+ return WSDL_2_JAVA_TYPE;
}
}
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java Mon Aug 15 02:39:26 2005
@@ -14,7 +14,7 @@
* the License.
*/
-package org.apache.axis.tool.codegen.eclipse.ui;
+package org.apache.axis2.tool.codegen.eclipse.ui;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
@@ -25,18 +25,22 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
public class OutputPage extends AbstractWizardPage {
-
+
private Text outputLocation;
private Button browseButton;
private Button locationSelectCheckBox;
-
+
/**
*
*/
@@ -67,8 +71,8 @@
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
Label label = new Label(container, SWT.NULL);
label
- .setText(org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin
- .getResourceString("page3.output.caption"));
+ .setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+ .getResourceString("page3.output.caption"));
outputLocation = new Text(container, SWT.BORDER);
outputLocation.setLayoutData(gd);
@@ -82,8 +86,8 @@
browseButton = new Button(container, SWT.PUSH);
browseButton
- .setText(org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin
- .getResourceString("page3.outselection.browse"));
+ .setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+ .getResourceString("page3.outselection.browse"));
browseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleBrowse();
@@ -98,8 +102,8 @@
/*
* Update the buttons, in case this was restored from an earlier setting
*/
- if (restoredFromPreviousSettings) {
- handleModifyEvent();
+ if (restoredFromPreviousSettings){
+ handleModifyEvent();
}
}
@@ -114,21 +118,23 @@
/**
* Worker method for handling modifications to the textbox
+ *
*/
private void handleModifyEvent() {
String text = this.outputLocation.getText();
if ((text == null) || (text.trim().equals(""))) {
- updateStatus(org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+ updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
.getResourceString("page3.error.nolocation"));
return;
}
updateStatus(null);
}
-
+
/**
* Handle the browse button events: opens a dialog where the user can choose
* an external directory location
+ *
*/
private void handleBrowse() {
boolean location = false;// locationSelectCheckBox.getSelection();
@@ -143,8 +149,8 @@
getShell(),
ResourcesPlugin.getWorkspace().getRoot(),
false,
- org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin
- .getResourceString("page3.containerbox.title"));
+ org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+ .getResourceString("page3.containerbox.title"));
if (dialog.open() == ContainerSelectionDialog.OK) {
Object[] result = dialog.getResult();
if (result.length == 1) {
@@ -157,7 +163,7 @@
/*
* (non-Javadoc)
*
- * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+ * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
*/
public int getPageType() {
return WSDL_2_JAVA_TYPE;
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/ToolSelectionPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/ToolSelectionPage.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/ToolSelectionPage.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/ToolSelectionPage.java Mon Aug 15 02:39:26 2005
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.axis.tool.codegen.eclipse.ui;
+package org.apache.axis2.tool.codegen.eclipse.ui;
-import org.apache.axis.tool.codegen.eclipse.CodeGenWizard;
-import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.apache.axis2.tool.codegen.eclipse.CodeGenWizard;
+import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -28,20 +28,19 @@
/**
* @author Ajith
- * <p/>
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
*/
public class ToolSelectionPage extends AbstractWizardPage {
-
+
private Button java2WSDLRadioButton;
private Button wsdl2JavaRadioButton;
-
public ToolSelectionPage() {
super("page0");
-
+
}
-
+
/**
* Creates a default value for the settings on this page
*/
@@ -53,8 +52,8 @@
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
- public void createControl(Composite parent) {
-
+public void createControl(Composite parent) {
+
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
@@ -62,64 +61,62 @@
layout.verticalSpacing = 9;
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
-
+
Label label = new Label(container, SWT.NULL);
- label.setText(
- CodegenWizardPlugin.getResourceString("page0.options.desc"));
-
- wsdl2JavaRadioButton = new Button(container, SWT.RADIO);
- wsdl2JavaRadioButton.setText(
- CodegenWizardPlugin.getResourceString(
- "page0.wsdl2java.caption"));
- wsdl2JavaRadioButton.setToolTipText(
- CodegenWizardPlugin.getResourceString("page0.wsdl2java.desc"));
- wsdl2JavaRadioButton.setSelection(
- settings.getBoolean(PREF_TOOL_SELECTION_WSDL2JAVA));
- wsdl2JavaRadioButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleCheckboxSelection();
- }
+ label.setText(CodegenWizardPlugin.getResourceString("page0.options.desc"));
+
+ wsdl2JavaRadioButton = new Button(container,SWT.RADIO);
+ wsdl2JavaRadioButton.setText(CodegenWizardPlugin.getResourceString("page0.wsdl2java.caption"));
+ wsdl2JavaRadioButton.setToolTipText(CodegenWizardPlugin.getResourceString("page0.wsdl2java.desc"));
+ wsdl2JavaRadioButton.setSelection(settings.getBoolean(PREF_TOOL_SELECTION_WSDL2JAVA));
+ wsdl2JavaRadioButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e)
+ {
+ handleCheckboxSelection();
+ }
});
-
- java2WSDLRadioButton = new Button(container, SWT.RADIO);
- java2WSDLRadioButton.setText(
- CodegenWizardPlugin.getResourceString(
- "page0.java2wsdl.caption"));
- java2WSDLRadioButton.setToolTipText(
- CodegenWizardPlugin.getResourceString("page0.java2wsdl.desc"));
- java2WSDLRadioButton.setSelection(
- settings.getBoolean(PREF_TOOL_SELECTION_JAVA2WSDL));
- java2WSDLRadioButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleCheckboxSelection();
- }
+
+ java2WSDLRadioButton = new Button(container,SWT.RADIO);
+ java2WSDLRadioButton.setText(CodegenWizardPlugin.getResourceString("page0.java2wsdl.caption"));
+ java2WSDLRadioButton.setToolTipText(CodegenWizardPlugin.getResourceString("page0.java2wsdl.desc"));
+ java2WSDLRadioButton.setSelection(settings.getBoolean(PREF_TOOL_SELECTION_JAVA2WSDL));
+ java2WSDLRadioButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e)
+ {
+ handleCheckboxSelection();
+ }
});
-
+
+ ///////////////////////////////////////
+ /// The java2WSDL is disabled ///
+ java2WSDLRadioButton.setEnabled(false);
+ //////////////////////////////////////
+
handleCheckboxSelection();
setControl(container);
}
- private void handleCheckboxSelection() {
- CodeGenWizard wizard = (CodeGenWizard) this.getWizard();
- if (wsdl2JavaRadioButton.getSelection()) {
- settings.put(PREF_TOOL_SELECTION_WSDL2JAVA, true);
- settings.put(PREF_TOOL_SELECTION_JAVA2WSDL, false);
- wizard.setSelectedWizardType(WSDL_2_JAVA_TYPE);
- } else if (java2WSDLRadioButton.getSelection()) {
- settings.put(PREF_TOOL_SELECTION_WSDL2JAVA, false);
- settings.put(PREF_TOOL_SELECTION_JAVA2WSDL, true);
- wizard.setSelectedWizardType(JAVA_2_WSDL_TYPE);
- }
- }
-
-
+ private void handleCheckboxSelection(){
+ CodeGenWizard wizard = (CodeGenWizard)this.getWizard();
+ if (wsdl2JavaRadioButton.getSelection()){
+ settings.put(PREF_TOOL_SELECTION_WSDL2JAVA,true);
+ settings.put(PREF_TOOL_SELECTION_JAVA2WSDL,false);
+ wizard.setSelectedWizardType(WSDL_2_JAVA_TYPE);
+ }else if (java2WSDLRadioButton.getSelection()){
+ settings.put(PREF_TOOL_SELECTION_WSDL2JAVA,false);
+ settings.put(PREF_TOOL_SELECTION_JAVA2WSDL,true);
+ wizard.setSelectedWizardType(JAVA_2_WSDL_TYPE);
+ }
+ }
+
+
/* (non-Javadoc)
- * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+ * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
*/
public int getPageType() {
- return UNSPECIFIED_TYPE;
+ return UNSPECIFIED_TYPE;
}
-
-
+
+
}
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java Mon Aug 15 02:39:26 2005
@@ -1,6 +1,6 @@
-package org.apache.axis.tool.codegen.eclipse.ui;
+package org.apache.axis2.tool.codegen.eclipse.ui;
-import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
@@ -10,7 +10,11 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
/**
* The first page of the code generator wizrad. Asks for the WSDL file Name
@@ -22,13 +26,14 @@
private ISelection selection;
-
+
/**
+ *
* @param pageName
*/
public WSDLFileSelectionPage() {
super("page1");
-
+
}
@@ -74,7 +79,7 @@
handleBrowse();
}
});
-
+
setPageComplete(false);
setControl(container);
@@ -82,7 +87,7 @@
* Validate this dialog, because we could have got valid values from the
* settings already.
*/
- if (restoredFromPreviousSettings) {
+ if (restoredFromPreviousSettings){
dialogChanged();
}
}
@@ -101,7 +106,7 @@
}
if (!fileName.matches(".*\\.wsdl")) {
- updateStatus(org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+ updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
.getResourceString("page1.error.wrongextension"));
return;
}
@@ -112,10 +117,11 @@
/**
* Pops up the file browse dialog box
+ *
*/
private void handleBrowse() {
FileDialog fileDialog = new FileDialog(this.getShell());
- fileDialog.setFilterExtensions(new String[]{"*.wsdl"});
+ fileDialog.setFilterExtensions(new String[] { "*.wsdl" });
String fileName = fileDialog.open();
if (fileName != null) {
fileText.setText(fileName);
@@ -123,10 +129,10 @@
}
-
+
/**
* Get the file name
- *
+ *
* @return
*/
public String getFileName() {
@@ -136,7 +142,7 @@
/*
* (non-Javadoc)
*
- * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+ * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
*/
public int getPageType() {
return WSDL_2_JAVA_TYPE;
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java Mon Aug 15 02:39:26 2005
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.axis.tool.codegen.eclipse.util;
+package org.apache.axis2.tool.codegen.eclipse.util;
public interface SettingsConstants {
@@ -35,6 +35,7 @@
// Output selection page
/**
* The key to store the output location in the settings
+ *
*/
static final String PREF_OUTPUT_LOCATION = "PREF_OUTPUT_LOCATION";
@@ -84,36 +85,36 @@
static final String JAVA_CLASS_NAME = "JAVA_CLASS_NAME";
static final String JAVA_CLASS_LOCATION_NAME = "JAVA_CLASS_LOCATION_NAME";
-
+
// ##################################################################################
// Java2wsdl options selection page
static final String PREF_JAVA_INPUT_WSDL_NAME = "INPUT_WSDL";
-
+
static final String PREF_JAVA_LOCATION = "LOCATION_URL";
static final String PREF_JAVA_BINDING_NAME = "BINDING_NAME";
static final String PREF_JAVA_MODE_INDEX = "MODE_INDEX";
static final String PREF_JAVA_STYLE_INDEX = "STYLE_INDEX";
static final String PREF_JAVA_PORTYPE_NAME = "PORTYPE_NAME";
-
+
// ##################################################################################
//output page
static final String JAVA_OUTPUT_WSDL_NAME = "OUTPUT_WSDL";
static final String PREF_JAVA_OUTPUT_WSDL_LOCATION = "OUTPUT_WSDL_LOCATION";
// ##################################################################################
// Page constants
- static final int WSDL_2_JAVA_TYPE = 1;
- static final int JAVA_2_WSDL_TYPE = 2;
- static final int UNSPECIFIED_TYPE = 3;
-
+ static final int WSDL_2_JAVA_TYPE = 1;
+ static final int JAVA_2_WSDL_TYPE = 2;
+ static final int UNSPECIFIED_TYPE = 3;
+
// ##################################################################################
// WSDL Mode constants
- static final String WSDL_ALL = "All";
- static final String WSDL_INTERFACE_ONLY = "Interface only";
- static final String WSDL_IMPLEMENTATION_ONLY = "Implementation only";
-
- // ###########################################################
- static final String WSDL_STYLE_DOCUMENT = "Document";
- static final String WSDL_STYLE_RPC = "rpc";
- static final String WSDL_STYLE_WRAPPED = "wrapped";
-
+ static final String WSDL_ALL = "All";
+ static final String WSDL_INTERFACE_ONLY = "Interface only";
+ static final String WSDL_IMPLEMENTATION_ONLY = "Implementation only";
+
+ // ###########################################################
+ static final String WSDL_STYLE_DOCUMENT="Document";
+ static final String WSDL_STYLE_RPC="rpc";
+ static final String WSDL_STYLE_WRAPPED="wrapped";
+
}
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/UIConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/UIConstants.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/UIConstants.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/UIConstants.java Mon Aug 15 02:39:26 2005
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.axis.tool.codegen.eclipse.util;
+package org.apache.axis2.tool.codegen.eclipse.util;
public interface UIConstants {
- public static final String JAVA = "Java";
- public static final String C_SHARP = "C#";
- public static final String C_PLUS_PLUS = "C++";
+ public static final String JAVA = "Java" ;
+ public static final String C_SHARP = "C#" ;
+ public static final String C_PLUS_PLUS = "C++" ;
}
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties Mon Aug 15 02:39:26 2005
@@ -47,6 +47,7 @@
page2.serverside.caption=Generate serverside code
page2.serviceXML.caption=Generate a default server.xml
page2.testcase.caption=Generate a test case
+page2.databindingCheck.caption=Enable Databinding
#######################################################################
#Output location selection - Page3
page3.name=page3
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ClassFileHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ClassFileHandler.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ClassFileHandler.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ClassFileHandler.java Mon Aug 15 02:39:26 2005
@@ -1,6 +1,4 @@
-package org.apache.axis.tool.core;
-
-import sun.misc.URLClassPath;
+package org.apache.axis2.tool.core;
import java.io.File;
import java.io.IOException;
@@ -10,6 +8,7 @@
import java.util.ArrayList;
import java.util.Enumeration;
+import sun.misc.URLClassPath;
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -25,15 +24,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
public class ClassFileHandler {
/**
+ * @deprecated
+ * This needs to be written in a functional manner
* @param location
* @return
* @throws IOException
- * @deprecated This needs to be written in a functional manner
*/
//todo see whether this is possible
public ArrayList getClassesAtLocation(String location) throws IOException {
@@ -45,16 +44,14 @@
Enumeration enum = classLoader.getResources("");
while (enum.hasMoreElements()) {
- Object o = enum.nextElement();
+ Object o = enum.nextElement();
System.out.println("o = " + o);
}
return null;
}
- public ArrayList getMethodNamesFromClass(String classFileName,
- String location) throws IOException,
- ClassNotFoundException {
+ public ArrayList getMethodNamesFromClass(String classFileName,String location) throws IOException, ClassNotFoundException{
ArrayList returnList = new ArrayList();
File fileEndpoint = new File(location);
if (!fileEndpoint.exists())
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/FileCopier.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/FileCopier.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/FileCopier.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/FileCopier.java Mon Aug 15 02:39:26 2005
@@ -1,11 +1,11 @@
-package org.apache.axis.tool.core;
+package org.apache.axis2.tool.core;
+
+import java.io.File;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Copy;
import org.apache.tools.ant.types.FileSet;
-import java.io.File;
-
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -22,7 +22,7 @@
* limitations under the License.
*/
-public class FileCopier extends Copy {
+public class FileCopier extends Copy{
public FileCopier() {
this.setProject(new Project());
this.getProject().init();
@@ -31,7 +31,7 @@
this.setOwningTarget(new org.apache.tools.ant.Target());
}
- public void copyFiles(File sourceFile, File destinationDirectory) {
+ public void copyFiles(File sourceFile,File destinationDirectory,String filter){
this.filesets.clear();
@@ -40,7 +40,12 @@
else {
FileSet fileset = new FileSet();
fileset.setDir(sourceFile);
- fileset.setIncludes("*/**");
+ if (filter!=null){
+ if (filter.matches("\\.\\w*")){
+ fileset.setIncludes("*/**/*"+filter);
+ }
+ }
+
this.addFileset(fileset);
}
this.setTodir(destinationDirectory);
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/JarFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/JarFileWriter.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/JarFileWriter.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/JarFileWriter.java Mon Aug 15 02:39:26 2005
@@ -1,11 +1,11 @@
-package org.apache.axis.tool.core;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Jar;
+package org.apache.axis2.tool.core;
import java.io.File;
import java.io.IOException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Jar;
+
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -21,8 +21,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-public class JarFileWriter extends Jar {
+public class JarFileWriter extends Jar{
public JarFileWriter() {
@@ -33,19 +32,16 @@
this.setOwningTarget(new org.apache.tools.ant.Target());
}
- public void writeJarFile(File outputFolder,
- String outputFileName,
- File inputFileFolder) throws IOException,
- Exception {
+ public void writeJarFile(File outputFolder,String outputFileName,File inputFileFolder) throws IOException,Exception {
- if (!outputFolder.exists()) {
+ if (!outputFolder.exists()){
outputFolder.mkdir(); //create the output path
- } else {
+ }else{
if (!outputFolder.isDirectory())
return;
}
- File targetFile = new File(outputFolder, outputFileName);
+ File targetFile = new File(outputFolder,outputFileName);
this.setBasedir(inputFileFolder);
this.setDestFile(targetFile);
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ServiceFileCreator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ServiceFileCreator.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ServiceFileCreator.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ServiceFileCreator.java Mon Aug 15 02:39:26 2005
@@ -1,9 +1,17 @@
-package org.apache.axis.tool.core;
+package org.apache.axis2.tool.core;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileWriter;
+import java.io.IOException;
import java.util.ArrayList;
+import org.apache.axis2.wsdl.codegen.writer.ClassWriter;
+import org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter;
+import org.apache.crimson.tree.XmlDocument;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -21,43 +29,61 @@
*/
public class ServiceFileCreator {
- public File createServiceFile(String providerClassName,
- String serviceClass,
- ArrayList methodList) throws Exception {
-
+
+ public File createServiceFile(String serviceName,String implementationClassName,ArrayList methodList) throws Exception {
+
+ String currentUserDir = System.getProperty("user.dir");
+ String fileName = "service.xml";
+
+ ClassWriter serviceXmlWriter = new ServiceXMLWriter(currentUserDir);
+ writeClass(getServiceModel(serviceName,implementationClassName,methodList),serviceXmlWriter,fileName);
- String content = this.getFileString(providerClassName,
- serviceClass,
- methodList);
- File serviceFile = new File("service.xml");
+ return new File(currentUserDir + File.separator + fileName);
- FileWriter fileWriter = new FileWriter(serviceFile);
- fileWriter.write(content);
- fileWriter.flush();
- return serviceFile;
}
- private String getFileString(String providerClassName,
- String serviceClass,
- ArrayList methodList) {
- String str = "<service provider=\"" +
- providerClassName + "\" >" +
- " <java:implementation class=\"" +
- serviceClass + "\" " +
- "xmlns:java=\"http://ws.apache.org/axis2/deployment/java\"/>\n";
- for (int i = 0; i < methodList.size(); i++) {
- str = str + " <operation name=\"" +
- methodList.get(i).toString() +
- "\" qname=\"" +
- methodList.get(i).toString() +
- "\" >\n";
-
+ private XmlDocument getServiceModel(String serviceName,String className,ArrayList methods){
+ XmlDocument doc = new XmlDocument();
+ Element rootElement = doc.createElement("interface");
+ addAttribute(doc,"package","", rootElement);
+ addAttribute(doc,"name",className,rootElement);
+ addAttribute(doc,"servicename",serviceName,rootElement);
+ Element methodElement = null;
+ int size = methods.size();
+ for(int i=0;i<size;i++){
+ methodElement = doc.createElement("method");
+ addAttribute(doc,"name",methods.get(i).toString(),methodElement);
+ rootElement.appendChild(methodElement);
}
- str = str + "</service>";
- return str;
+ doc.appendChild(rootElement);
+ return doc;
+ }
+
+ private void addAttribute(XmlDocument document,String AttribName, String attribValue, Element element){
+ Attr attribute = document.createAttribute(AttribName);
+ attribute.setValue(attribValue);
+ element.setAttributeNode(attribute);
+ }
+
+ /**
+ * A resusable method for the implementation of interface and implementation writing
+ * @param model
+ * @param writer
+ * @throws IOException
+ * @throws Exception
+ */
+ private void writeClass(XmlDocument model,ClassWriter writer,String fileName) throws IOException,Exception {
+ ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
+ model.write(memoryStream);
+ writer.loadTemplate();
+ writer.createOutFile(null,
+ fileName);
+ writer.writeOutFile(new ByteArrayInputStream(memoryStream.toByteArray()));
}
+
+
}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/ClassFileSelectionBean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/ClassFileSelectionBean.java?rev=232780&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/ClassFileSelectionBean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/ClassFileSelectionBean.java Mon Aug 15 02:39:26 2005
@@ -0,0 +1,44 @@
+package org.apache.axis2.tool.service.bean;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ClassFileSelectionBean {
+ private String fileLocation;
+ private String filter;
+
+ public String getFileLocation() {
+ return fileLocation;
+ }
+
+ public void setFileLocation(String fileLocation) {
+ this.fileLocation = fileLocation;
+ }
+
+
+ /**
+ * @return Returns the filter.
+ */
+ public String getFilter() {
+ return filter;
+ }
+ /**
+ * @param filter The filter to set.
+ */
+ public void setFilter(String filter) {
+ this.filter = filter;
+ }
+}
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/Page2Bean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/Page2Bean.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/Page2Bean.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/Page2Bean.java Mon Aug 15 02:39:26 2005
@@ -1,4 +1,4 @@
-package org.apache.axis.tool.service.bean;
+package org.apache.axis2.tool.service.bean;
import java.util.ArrayList;
@@ -27,7 +27,21 @@
private String providerClassName;
private ArrayList selectedMethodNames;
-
+ private String serviceName;
+
+
+ /**
+ * @return Returns the serviceName.
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+ /**
+ * @param serviceName The serviceName to set.
+ */
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
public String getProviderClassName() {
return providerClassName;
}
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/Page3Bean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/Page3Bean.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/Page3Bean.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/Page3Bean.java Mon Aug 15 02:39:26 2005
@@ -1,4 +1,4 @@
-package org.apache.axis.tool.service.bean;
+package org.apache.axis2.tool.service.bean;
/*
* Copyright 2004,2005 The Apache Software Foundation.
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WSDLAutoGenerateOptionBean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WSDLAutoGenerateOptionBean.java?rev=232780&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WSDLAutoGenerateOptionBean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WSDLAutoGenerateOptionBean.java Mon Aug 15 02:39:26 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.tool.service.bean;
+
+import java.util.Vector;
+
+
+public class WSDLAutoGenerateOptionBean {
+ //rest of the parameters are taken from other
+ //beans
+ private String classFileName;
+ private String style;
+ private String outputFileName;
+ private Vector listOfMethods;
+
+
+ /**
+ * @return Returns the outputFileName.
+ */
+ public String getOutputFileName() {
+ return outputFileName;
+ }
+ /**
+ * @param outputFileName The outputFileName to set.
+ */
+ public void setOutputFileName(String outputFileName) {
+ this.outputFileName = outputFileName;
+ }
+ /**
+ * @return Returns the classFileName.
+ */
+ public String getClassFileName() {
+ return classFileName;
+ }
+ /**
+ * @param classFileName The classFileName to set.
+ */
+ public void setClassFileName(String classFileName) {
+ this.classFileName = classFileName;
+ }
+ /**
+ * @return Returns the style.
+ */
+ public String getStyle() {
+ return style;
+ }
+ /**
+ * @param style The style to set.
+ */
+ public void setStyle(String style) {
+ this.style = style;
+ }
+
+ /**
+ * @return Returns the listOfMethods.
+ */
+ public Vector getListOfMethods() {
+ return listOfMethods;
+ }
+ /**
+ * @param listOfMethods The listOfMethods to set.
+ */
+ public void setListOfMethods(Vector listOfMethods) {
+ this.listOfMethods = listOfMethods;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WSDLFileLocationBean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WSDLFileLocationBean.java?rev=232780&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WSDLFileLocationBean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WSDLFileLocationBean.java Mon Aug 15 02:39:26 2005
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.tool.service.bean;
+
+public class WSDLFileLocationBean {
+
+ private String WSDLFileName;
+ private boolean manual;
+ private boolean skip;
+
+
+
+ /**
+ * @return Returns the skip.
+ */
+ public boolean isSkip() {
+ return skip;
+ }
+ /**
+ * @param skip The skip to set.
+ */
+ public void setSkip(boolean skip) {
+ this.skip = skip;
+ }
+ /**
+ * @return Returns the manual.
+ */
+ public boolean isManual() {
+ return manual;
+ }
+ /**
+ * @param manual The manual to set.
+ */
+ public void setManual(boolean manual) {
+ this.manual = manual;
+ }
+ /**
+ * @return Returns the wSDLFileName.
+ */
+ public String getWSDLFileName() {
+ return WSDLFileName;
+ }
+ /**
+ * @param fileName The wSDLFileName to set.
+ */
+ public void setWSDLFileName(String fileName) {
+ WSDLFileName = fileName;
+ }
+}
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WizardBean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WizardBean.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WizardBean.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/bean/WizardBean.java Mon Aug 15 02:39:26 2005
@@ -1,4 +1,4 @@
-package org.apache.axis.tool.service.bean;
+package org.apache.axis2.tool.service.bean;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -17,16 +17,30 @@
*/
public class WizardBean {
- private Page1Bean page1bean;
+ private ClassFileSelectionBean classFileBean;
+ private WSDLFileLocationBean wsdlBean;
private Page2Bean page2bean;
private Page3Bean page3bean;
- public Page1Bean getPage1bean() {
- return page1bean;
+
+ /**
+ * @return Returns the wsdlBean.
+ */
+ public WSDLFileLocationBean getWsdlBean() {
+ return wsdlBean;
+ }
+ /**
+ * @param wsdlBean The wsdlBean to set.
+ */
+ public void setWsdlBean(WSDLFileLocationBean wsdlBean) {
+ this.wsdlBean = wsdlBean;
+ }
+ public ClassFileSelectionBean getPage1bean() {
+ return classFileBean;
}
- public void setPage1bean(Page1Bean page1bean) {
- this.page1bean = page1bean;
+ public void setPage1bean(ClassFileSelectionBean page1bean) {
+ this.classFileBean = page1bean;
}
public Page2Bean getPage2bean() {
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/control/Controller.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/control/Controller.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/control/Controller.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/control/Controller.java Mon Aug 15 02:39:26 2005
@@ -1,13 +1,14 @@
-package org.apache.axis.tool.service.control;
+package org.apache.axis2.tool.service.control;
-import org.apache.axis.tool.core.ClassFileHandler;
-import org.apache.axis.tool.core.FileCopier;
-import org.apache.axis.tool.core.JarFileWriter;
-import org.apache.axis.tool.core.ServiceFileCreator;
-import org.apache.axis.tool.service.bean.Page1Bean;
-import org.apache.axis.tool.service.bean.Page2Bean;
-import org.apache.axis.tool.service.bean.Page3Bean;
-import org.apache.axis.tool.service.bean.WizardBean;
+import org.apache.axis2.tool.core.ClassFileHandler;
+import org.apache.axis2.tool.core.FileCopier;
+import org.apache.axis2.tool.core.JarFileWriter;
+import org.apache.axis2.tool.core.ServiceFileCreator;
+import org.apache.axis2.tool.service.bean.ClassFileSelectionBean;
+import org.apache.axis2.tool.service.bean.Page2Bean;
+import org.apache.axis2.tool.service.bean.Page3Bean;
+import org.apache.axis2.tool.service.bean.WSDLFileLocationBean;
+import org.apache.axis2.tool.service.bean.WizardBean;
import java.io.File;
import java.io.IOException;
@@ -54,15 +55,18 @@
public void process(WizardBean bean) throws ProcessException, Exception {
- Page1Bean page1Bean = bean.getPage1bean();
+ ClassFileSelectionBean page1Bean = bean.getPage1bean();
+ WSDLFileLocationBean wsdlBean = bean.getWsdlBean();
Page2Bean page2Bean = bean.getPage2bean();
Page3Bean page3Bean = bean.getPage3bean();
File serviceFile = null;
+ File wsdlFile = null;
File classFileFolder = null;
File outputFolder = null;
String outputFileName = null;
boolean isServiceCreated = false;
+ boolean isWSDLAvailable = false;
//see if the class file location is valid
classFileFolder = new File(page1Bean.getFileLocation());
@@ -96,6 +100,18 @@
isServiceCreated = true;
}
+ //see if the WSDL file is available
+ if (!wsdlBean.isSkip()){
+ wsdlFile = new File(wsdlBean.getWSDLFileName());
+ if (!wsdlFile.exists()) {
+ throw new ProcessException(
+ "Specified WSDL file is missing!");
+ }else{
+ isWSDLAvailable = true;
+ }
+ }
+
+
outputFolder = new File(page3Bean.getOutputFolderName());
outputFileName = page3Bean.getOutputFileName();
if (!outputFileName.toLowerCase().endsWith(".jar")) {
@@ -111,9 +127,11 @@
File metaInfFolder = new File(tempFileFolder, "META-INF");
metaInfFolder.mkdir();
- new FileCopier().copyFiles(classFileFolder, tempFileFolder);
- new FileCopier().copyFiles(serviceFile, metaInfFolder);
-
+ new FileCopier().copyFiles(classFileFolder, tempFileFolder,null);
+ new FileCopier().copyFiles(serviceFile, metaInfFolder,null);
+ if (isWSDLAvailable){
+ new FileCopier().copyFiles(wsdlFile, metaInfFolder,null);
+ }
//jar the temp directory. the output folder will be created if missing
new JarFileWriter().writeJarFile(outputFolder,
outputFileName,
@@ -121,12 +139,27 @@
} catch (Exception e) {
throw new ProcessException(e);
} finally {
- tempFileFolder.delete();
- if (isServiceCreated)
+ deleteDir(tempFileFolder);
+ if (isServiceCreated)
serviceFile.delete();
}
+ }
+
+ private boolean deleteDir(File dir) {
+ if (dir.isDirectory()) {
+ String[] children = dir.list();
+ for (int i=0; i<children.length; i++) {
+ boolean success = deleteDir(new File(dir, children[i]));
+ if (!success) {
+ return false;
+ }
+ }
+ }
+
+ // The directory is now empty so delete it
+ return dir.delete();
}
}
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/control/ProcessException.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/control/ProcessException.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/control/ProcessException.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/control/ProcessException.java Mon Aug 15 02:39:26 2005
@@ -1,4 +1,4 @@
-package org.apache.axis.tool.service.control;
+package org.apache.axis2.tool.service.control;
/*
* Copyright 2004,2005 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/plugin/ServiceArchiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/plugin/ServiceArchiver.java?rev=232780&r1=232779&r2=232780&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/plugin/ServiceArchiver.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/plugin/ServiceArchiver.java Mon Aug 15 02:39:26 2005
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.axis.tool.service.eclipse.plugin;
+package org.apache.axis2.tool.service.eclipse.plugin;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -41,7 +41,7 @@
try {
resourceBundle =
ResourceBundle.getBundle(
- "org.apache.axis.tool.service.resource.ServiceResources");
+ "org.apache.axis2.tool.service.resource.ServiceResources");
} catch (MissingResourceException x) {
resourceBundle = null;
}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/ui/AbstractServiceWizardPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/ui/AbstractServiceWizardPage.java?rev=232780&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/ui/AbstractServiceWizardPage.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/ui/AbstractServiceWizardPage.java Mon Aug 15 02:39:26 2005
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.tool.service.eclipse.ui;
+
+
+import org.apache.axis2.tool.service.eclipse.plugin.ServiceArchiver;
+import org.apache.axis2.tool.service.eclipse.util.SettingsConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.wizard.WizardPage;
+
+
+public abstract class AbstractServiceWizardPage extends WizardPage implements SettingsConstants{
+ protected IDialogSettings settings;
+ protected boolean restoredFromPreviousSettings = false;
+
+ public AbstractServiceWizardPage(String pageName){
+ super(pageName+".name");
+ init(pageName);
+ }
+
+ protected void init(String pageName){
+ setTitle(ServiceArchiver.getResourceString(pageName+".title"));
+ setDescription(ServiceArchiver.getResourceString(pageName+".desc"));
+ setImageDescriptor(ServiceArchiver.getWizardImageDescriptor());
+
+ /*
+ * Get the settings for this page. If there is no section in the
+ * Plugin's settings for this OptionsPage, create a new section
+ */
+ IDialogSettings rootSettings = ServiceArchiver.getDefault()
+ .getDialogSettings();
+ IDialogSettings section = rootSettings.getSection(this.getClass()
+ .getName());
+ if (section == null) {
+ settings = rootSettings.addNewSection(this.getClass().getName());
+ restoredFromPreviousSettings = false;
+ initializeDefaultSettings();
+ } else {
+ restoredFromPreviousSettings=true;
+ settings = section;
+ }
+ }
+
+ protected void updateStatus(String message) {
+ setErrorMessage(message);
+ setPageComplete(message == null);
+ }
+
+ protected abstract void initializeDefaultSettings();
+
+ //Default implementation
+ public boolean isSkipNext(){
+ return false;
+ }
+
+ //public abstract WizardBean getBean();
+
+
+
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/ui/ClassFileLocationPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/ui/ClassFileLocationPage.java?rev=232780&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/ui/ClassFileLocationPage.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis2/tool/service/eclipse/ui/ClassFileLocationPage.java Mon Aug 15 02:39:26 2005
@@ -0,0 +1,142 @@
+/**
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.axis2.tool.service.eclipse.ui;
+
+
+import org.apache.axis2.tool.service.bean.ClassFileSelectionBean;
+import org.apache.axis2.tool.service.eclipse.plugin.ServiceArchiver;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+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;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+
+public class ClassFileLocationPage extends AbstractServiceWizardPage{
+
+ private Text classFileLocationText;
+ private Button filterByClassFilesCheckBox;
+
+
+ public ClassFileLocationPage(){
+ super("page1");
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.tool.service.eclipse.ui.AbstractServiceWizardPage#initializeDefaultSettings()
+ */
+ protected void initializeDefaultSettings() {
+ settings.put(PREF_CLASS_FILE_LOCATION,System.getProperty("user.dir"));
+ settings.put(PREF_FILTER_BY_CLASSES,true);
+
+ }
+ /* (non-Javadoc)
+ * @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();
+ layout.numColumns=3;
+ layout.verticalSpacing = 9;
+
+ container.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ Label lable = new Label(container,SWT.NULL);
+ lable.setText(ServiceArchiver.getResourceString("page1.fileLocationLabel"));
+
+ classFileLocationText = new Text(container,SWT.BORDER);
+ classFileLocationText.setLayoutData(gd);
+ classFileLocationText.setText(settings.get(PREF_CLASS_FILE_LOCATION));
+ classFileLocationText.addModifyListener(new ModifyListener(){
+ public void modifyText(ModifyEvent e){
+ handleModify();
+ }
+ });
+
+ Button browseButton = new Button(container,SWT.PUSH);
+ browseButton.setText(ServiceArchiver.getResourceString("general.browse"));
+ browseButton.addMouseListener(new MouseAdapter(){
+ public void mouseUp(MouseEvent e) {
+ handleBrowse();
+ }
+ });
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ filterByClassFilesCheckBox = new Button(container,SWT.CHECK);
+ filterByClassFilesCheckBox.setLayoutData(gd);
+ filterByClassFilesCheckBox.setText(ServiceArchiver.getResourceString("page1.filter.caption"));
+ filterByClassFilesCheckBox.setSelection(settings.getBoolean(PREF_FILTER_BY_CLASSES));
+ filterByClassFilesCheckBox.addSelectionListener(new SelectionListener(){
+ public void widgetSelected(SelectionEvent e){
+ settings.put(PREF_FILTER_BY_CLASSES,filterByClassFilesCheckBox.getSelection());
+ }
+ public void widgetDefaultSelected(SelectionEvent e){}
+ });
+
+
+ setControl(container);
+ //call the handle modify method if the setttings are restored
+
+ if (restoredFromPreviousSettings){
+ handleModify();
+ }
+ }
+
+
+ private void handleBrowse(){
+ DirectoryDialog dirDialog = new DirectoryDialog(this.getShell());
+ dirDialog.setMessage(ServiceArchiver.getResourceString("page1.filedialogTitle"));
+ String returnText = dirDialog.open();
+ if (returnText!=null){
+ this.classFileLocationText.setText(returnText);
+ }
+ }
+
+ private void handleModify(){
+ String classLocationText = this.classFileLocationText.getText().trim();
+ settings.put(PREF_CLASS_FILE_LOCATION,classLocationText);
+ if ("".equals(classLocationText)){
+ updateStatus("page1.error.filemissing");
+ }else{
+ updateStatus(null);
+ }
+ }
+
+ public String getClassFileLocation(){
+ return classFileLocationText.getText();
+ }
+
+ public ClassFileSelectionBean getBean(){
+ ClassFileSelectionBean pageBean = new ClassFileSelectionBean();
+ pageBean.setFileLocation(this.classFileLocationText.getText());
+ if (filterByClassFilesCheckBox.getSelection()){
+ pageBean.setFilter(".class");
+ }
+ return pageBean;
+ }
+}