Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 2091 invoked from network); 31 Jan 2006 06:27:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Jan 2006 06:27:52 -0000 Received: (qmail 36178 invoked by uid 500); 31 Jan 2006 06:27:51 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 36153 invoked by uid 500); 31 Jan 2006 06:27:50 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 36142 invoked by uid 500); 31 Jan 2006 06:27:50 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 36139 invoked by uid 99); 31 Jan 2006 06:27:50 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jan 2006 22:27:50 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 30 Jan 2006 22:27:49 -0800 Received: (qmail 2014 invoked by uid 65534); 31 Jan 2006 06:27:28 -0000 Message-ID: <20060131062728.2012.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r373739 - in /webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen: eclipse/ eclipse/ui/ eclipse/util/ resource/ Date: Tue, 31 Jan 2006 06:27:26 -0000 To: axis2-cvs@ws.apache.org From: ajith@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ajith Date: Mon Jan 30 22:27:11 2006 New Revision: 373739 URL: http://svn.apache.org/viewcvs?rev=373739&view=rev Log: Updated the Java2WSDL eclipse wizard. Now the eclipse plug-in support for Java2WSDL is complete. Added: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/ClassFileReader.java webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/NamespaceFinder.java Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java?rev=373739&r1=373738&r2=373739&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java (original) +++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java Mon Jan 30 22:27:11 2006 @@ -1,10 +1,9 @@ package org.apache.axis2.tool.codegen.eclipse; import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; import java.util.Map; -import java.util.Vector; -import org.apache.axis2.tool.codegen.Java2WSDLGenerator; import org.apache.axis2.tool.codegen.WSDL2JavaGenerator; import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin; import org.apache.axis2.tool.codegen.eclipse.ui.AbstractWizardPage; @@ -18,12 +17,14 @@ import org.apache.axis2.tool.codegen.eclipse.util.SettingsConstants; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationEngine; +import org.apache.axis2.wsdl.codegen.Java2WSDLCodegenEngine; +import org.apache.axis2.wsdl.util.CommandLineOption; +import org.apache.axis2.wsdl.util.CommandLineOptionConstants; import org.apache.wsdl.WSDLDescription; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.Wizard; @@ -36,7 +37,7 @@ * The main wizard for the codegen wizard */ -public class CodeGenWizard extends Wizard implements INewWizard { +public class CodeGenWizard extends Wizard implements INewWizard,CommandLineOptionConstants.Java2WSDLConstants { private ToolSelectionPage toolSelectionPage; private WSDLFileSelectionPage wsdlSelectionPage; @@ -55,7 +56,7 @@ // change // this - private ISelection selection; + @@ -144,7 +145,8 @@ case SettingsConstants.UNSPECIFIED_TYPE: break; //Do nothing default: - throw new RuntimeException("Invalid state!"); + throw new RuntimeException(CodegenWizardPlugin. + getResourceString("general.invalid.state")); } } catch (Exception e) { MessageDialog.openError(getShell(), @@ -259,14 +261,58 @@ * monitor.worked(amount) */ monitor.beginTask(CodegenWizardPlugin - .getResourceString("generator.generating"), 2); + .getResourceString("generator.generating"), 3); try { monitor.worked(1); - //TODO - fill here + //fill the option map + Map optionsMap = new HashMap(); + CommandLineOption option = new CommandLineOption( + CLASSNAME_OPTION,new String[]{javaSourceSelectionPage.getClassName()}); + optionsMap.put(CLASSNAME_OPTION,option); + + option = new CommandLineOption( + CLASSPATH_OPTION,javaSourceSelectionPage.getClassPathList()); + optionsMap.put(CLASSPATH_OPTION,option); + + option = new CommandLineOption( + TARGET_NAMESPACE_OPTION, + new String[]{java2wsdlOptionsPage.getTargetNamespace()}); + optionsMap.put(TARGET_NAMESPACE_OPTION,option); + + option = new CommandLineOption( + TARGET_NAMESPACE_PREFIX_OPTION, + new String[]{java2wsdlOptionsPage.getTargetNamespacePrefix()}); + optionsMap.put(TARGET_NAMESPACE_PREFIX_OPTION,option); + + option = new CommandLineOption( + SCHEMA_TARGET_NAMESPACE_OPTION, + new String[]{java2wsdlOptionsPage.getSchemaTargetNamespace()}); + optionsMap.put(SCHEMA_TARGET_NAMESPACE_OPTION,option); + + option = new CommandLineOption( + SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION, + new String[]{java2wsdlOptionsPage.getSchemaTargetNamespacePrefix()}); + optionsMap.put(SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION,option); + + option = new CommandLineOption( + OUTPUT_LOCATION_OPTION,new String[]{java2wsdlOutputLocationPage.getOutputLocation()}); + optionsMap.put(OUTPUT_LOCATION_OPTION,option); + + option = new CommandLineOption( + OUTPUT_FILENAME_OPTION,new String[]{java2wsdlOutputLocationPage.getOutputWSDLName()}); + optionsMap.put(OUTPUT_FILENAME_OPTION,option); + + + monitor.worked(1); + + new Java2WSDLCodegenEngine(optionsMap).generate(); + + monitor.worked(1); + } catch (Throwable e) { - throw new RuntimeException(e); + throw new RuntimeException(e); } monitor.done(); @@ -278,7 +324,8 @@ } catch (InvocationTargetException e1) { throw new RuntimeException(e1); } catch (InterruptedException e1) { - throw new RuntimeException("User Aborted!"); + throw new RuntimeException(CodegenWizardPlugin. + getResourceString("general.useraborted.state")); } catch (Exception e) { throw new RuntimeException(e); } @@ -292,7 +339,7 @@ * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) */ public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; + //do nothing } /** @@ -324,5 +371,9 @@ */ public void populateOptions(){ optionsPage.populateServiceAndPort(); + } + + public void setDefaultNamespaces(String fullyQualifiedClassName){ + java2wsdlOptionsPage.setNamespaceDefaults(fullyQualifiedClassName); } } Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java?rev=373739&r1=373738&r2=373739&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java (original) +++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java Mon Jan 30 22:27:11 2006 @@ -55,7 +55,7 @@ } protected void updateStatus(String message) { - setErrorMessage(message); + setErrorMessage(message); setPageComplete(message == null); } Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java?rev=373739&r1=373738&r2=373739&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java (original) +++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java Mon Jan 30 22:27:11 2006 @@ -17,7 +17,11 @@ +import java.util.ArrayList; +import java.util.Iterator; + import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin; +import org.apache.axis2.tool.codegen.eclipse.util.ClassFileReader; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; @@ -38,6 +42,7 @@ private Text javaClassNameBox; private List javaClasspathList; + private Label statusLabel; public JavaSourceSelectionPage() { super("page4"); @@ -45,7 +50,7 @@ protected void initializeDefaultSettings() { settings.put(JAVA_CLASS_NAME, ""); - settings.put(JAVA_CLASS_NAME, ""); + settings.put(JAVA_CLASS_PATH_ENTRIES, new String[]{}); } /* @@ -126,16 +131,49 @@ .getResourceString("page4.removeEntry.label")); removeEntryButton.addMouseListener(new MouseAdapter(){ public void mouseUp(MouseEvent e) { - //handle the remove click here + handleRemove(); } }); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; - gd.verticalSpan = 4; + gd.verticalSpan = 7; javaClasspathList = new List(container,SWT.READ_ONLY | SWT.BORDER); javaClasspathList.setLayoutData(gd); + javaClasspathList.setItems(settings.getArray(JAVA_CLASS_PATH_ENTRIES)); + gd = new GridData(GridData.FILL_HORIZONTAL); + Button tryLoadButton = new Button(container,SWT.PUSH); + tryLoadButton.setLayoutData(gd); + tryLoadButton.setText(CodegenWizardPlugin + .getResourceString("page4.tryLoad.label")); + tryLoadButton.addMouseListener(new MouseAdapter(){ + public void mouseUp(MouseEvent e) { + java.util.List errorListener = new ArrayList(); + if (!ClassFileReader.tryLoadingClass(getClassName(), + getClassPathList(), + errorListener)){ + Iterator it = errorListener.iterator(); + while(it.hasNext()){ + Object nextObject = it.next(); + String errorMessage = nextObject==null?CodegenWizardPlugin + .getResourceString("page4.unknownError.label"):nextObject.toString(); + updateStatus(errorMessage); + updateStatusTextField(false,errorMessage); + } + + }else{ + updateStatus(null); + updateStatusTextField(true,CodegenWizardPlugin + .getResourceString("page4.successLoading.label")); + } + } + }); + + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + statusLabel = new Label(container,SWT.NULL); + statusLabel.setLayoutData(gd); setPageComplete(false); @@ -157,8 +195,23 @@ String dirName = fileDialog.open(); if (dirName != null) { javaClasspathList.add(dirName); + updateListEntries(); } - + updateStatusTextField(false,""); + } + + + /** + * Pops up the file browse dialog box + * + */ + private void handleRemove() { + int[] selectionIndices = javaClasspathList.getSelectionIndices(); + for (int i=0;i : class file name --o : output file location --cp : list of classpath entries - (urls) --tn : target namespace --tp : target namespace prefix --stn : target namespace for schema --stp : target namespace prefix for schema --sn : service name --of : output file name for the WSDL -*/ + * Usage java2wsdl -cn : class file name -o : output file location -cp : list of classpath + * entries - (urls) -tn : target namespace -tp : target namespace prefix -stn : + * target namespace for schema -stp : target + * namespace prefix for schema -sn : service name -of : output file name for the WSDL + */ public class JavaWSDLOptionsPage extends AbstractWizardPage { - private Text targetNamespaceText; - private Text targetNamespacePrefixText; - private Text schemaTargetNamepaceText; - private Text schemaTargetNamespacePrefixText; - private Text serviceNameText; - - - //TODO need more here - - /* - * (non-Javadoc) - * - * @see org.apache.axis2.tool.codegen.eclipse.ui.AbstractWizardPage#initializeDefaultSettings() - */ - protected void initializeDefaultSettings() { - settings.put(PREF_JAVA_TARGET_NS,""); - settings.put(PREF_JAVA_TARGET_NS_PREF,""); - settings.put(PREF_JAVA_SCHEMA_TARGET_NS,""); - settings.put(PREF_JAVA_SCHEMA_TARGET_NS_PREF,""); - settings.put(PREF_JAVA_SERVICE_NAME,""); - - } - - /** - * @param pageName - */ - public JavaWSDLOptionsPage() { - super("page5"); - - } - - /* - * (non-Javadoc) - * - * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType() - */ - public int getPageType() { - return JAVA_2_WSDL_TYPE; - } - - /* - * (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 = 2; - layout.verticalSpacing = 9; - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - Label label = new Label(container, SWT.NULL); - label.setText(CodegenWizardPlugin - .getResourceString("page5.targetNamespace.label")); - - targetNamespaceText = new Text(container, SWT.BORDER | SWT.SINGLE); - targetNamespaceText.setLayoutData(gd); - targetNamespaceText.setText(settings.get(PREF_JAVA_TARGET_NS)); - targetNamespaceText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - settings.put(PREF_JAVA_TARGET_NS, targetNamespaceText.getText()); - //dialogChanged(); - } - }); - - label = new Label(container, SWT.NULL); - label.setText(CodegenWizardPlugin - .getResourceString("page5.targetNamespacePrefix.label")); - - gd = new GridData(GridData.FILL_HORIZONTAL); - targetNamespacePrefixText = new Text(container, SWT.BORDER); - targetNamespacePrefixText.setLayoutData(gd); - targetNamespacePrefixText.setText(settings.get(PREF_JAVA_TARGET_NS_PREF)); - targetNamespacePrefixText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - settings.put(PREF_JAVA_TARGET_NS_PREF, targetNamespacePrefixText.getText()); - //dialogChanged(); - } - }); - - label = new Label(container, SWT.NULL); - label.setText(CodegenWizardPlugin - .getResourceString("page5.schemaTargetNs.label")); - - gd = new GridData(GridData.FILL_HORIZONTAL); - schemaTargetNamepaceText = new Text(container, SWT.BORDER); - schemaTargetNamepaceText.setLayoutData(gd); - schemaTargetNamepaceText.setText(settings.get(PREF_JAVA_SCHEMA_TARGET_NS_PREF)); - schemaTargetNamepaceText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - settings.put(PREF_JAVA_SCHEMA_TARGET_NS_PREF, schemaTargetNamepaceText.getText()); - //dialogChanged(); - } - }); - - label = new Label(container, SWT.NULL); - label.setText(CodegenWizardPlugin - .getResourceString("page5.schemaTargetNsPrefix.label")); - - gd = new GridData(GridData.FILL_HORIZONTAL); - schemaTargetNamespacePrefixText = new Text(container, SWT.BORDER); - schemaTargetNamespacePrefixText.setLayoutData(gd); - schemaTargetNamespacePrefixText.setText(settings.get(PREF_JAVA_SCHEMA_TARGET_NS)); - schemaTargetNamespacePrefixText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - settings.put(PREF_JAVA_SCHEMA_TARGET_NS, schemaTargetNamespacePrefixText.getText()); - //dialogChanged(); - } - }); - - label = new Label(container, SWT.NULL); - label.setText(CodegenWizardPlugin - .getResourceString("page5.binding.label")); - - gd = new GridData(GridData.FILL_HORIZONTAL); - schemaTargetNamespacePrefixText = new Text(container, SWT.BORDER); - schemaTargetNamespacePrefixText.setLayoutData(gd); - schemaTargetNamespacePrefixText.setText(settings.get(PREF_JAVA_SCHEMA_TARGET_NS)); - schemaTargetNamespacePrefixText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - settings.put(PREF_JAVA_SCHEMA_TARGET_NS, schemaTargetNamespacePrefixText.getText()); - //dialogChanged(); - } - }); - - setControl(container); - - } - - - - - public String getTargetNamespace() { - return this.targetNamespacePrefixText.getText(); - } - - public String getTargetNamespacePrefix() { - return this.targetNamespaceText.getText(); - } - - public String getSchemaTargetNamespace() { - return this.schemaTargetNamepaceText.getText(); - } - - public String getSchemaTargetNamespacePrefix() { - return this.schemaTargetNamespacePrefixText.getText(); - } - - private String getServiceName(){ - return this.serviceNameText.getText(); - } - - - + private Text targetNamespaceText; + + private Text targetNamespacePrefixText; + + private Text schemaTargetNamepaceText; + + private Text schemaTargetNamespacePrefixText; + + private Text serviceNameText; + + // TODO need more here + + /* + * (non-Javadoc) + * + * @see org.apache.axis2.tool.codegen.eclipse.ui.AbstractWizardPage#initializeDefaultSettings() + */ + protected void initializeDefaultSettings() { + + + settings.put(PREF_JAVA_TARGET_NS,"" ); + settings.put(PREF_JAVA_TARGET_NS_PREF, ""); + settings.put(PREF_JAVA_SCHEMA_TARGET_NS, ""); + settings.put(PREF_JAVA_SCHEMA_TARGET_NS_PREF, ""); + settings.put(PREF_JAVA_SERVICE_NAME, ""); + + } + + + public void setNamespaceDefaults(String fullyQualifiedClassName){ + + targetNamespaceText.setText(NamespaceFinder.getTargetNamespaceFromClass(fullyQualifiedClassName)); + schemaTargetNamepaceText.setText(NamespaceFinder.getSchemaTargetNamespaceFromClass(fullyQualifiedClassName)); + + targetNamespacePrefixText.setText(NamespaceFinder.getDefaultNamespacePrefix()); + schemaTargetNamespacePrefixText.setText(NamespaceFinder.getDefaultSchemaNamespacePrefix()); + + serviceNameText.setText(fullyQualifiedClassName.replaceAll("\\.","_")); + } + /** + * @param pageName + */ + public JavaWSDLOptionsPage() { + super("page5"); + + } + + /* + * (non-Javadoc) + * + * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType() + */ + public int getPageType() { + return JAVA_2_WSDL_TYPE; + } + + /* + * (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 = 2; + layout.verticalSpacing = 9; + + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + Label label = new Label(container, SWT.NULL); + label.setText(CodegenWizardPlugin + .getResourceString("page5.targetNamespace.label")); + + targetNamespaceText = new Text(container, SWT.BORDER | SWT.SINGLE); + targetNamespaceText.setLayoutData(gd); + targetNamespaceText.setText(settings.get(PREF_JAVA_TARGET_NS)); + targetNamespaceText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + settings + .put(PREF_JAVA_TARGET_NS, targetNamespaceText.getText()); + // dialogChanged(); + } + }); + + label = new Label(container, SWT.NULL); + label.setText(CodegenWizardPlugin + .getResourceString("page5.targetNamespacePrefix.label")); + + gd = new GridData(GridData.FILL_HORIZONTAL); + targetNamespacePrefixText = new Text(container, SWT.BORDER); + targetNamespacePrefixText.setLayoutData(gd); + targetNamespacePrefixText.setText(settings + .get(PREF_JAVA_TARGET_NS_PREF)); + targetNamespacePrefixText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + settings.put(PREF_JAVA_TARGET_NS_PREF, + targetNamespacePrefixText.getText()); + // dialogChanged(); + } + }); + + label = new Label(container, SWT.NULL); + label.setText(CodegenWizardPlugin + .getResourceString("page5.schemaTargetNs.label")); + + gd = new GridData(GridData.FILL_HORIZONTAL); + schemaTargetNamepaceText = new Text(container, SWT.BORDER); + schemaTargetNamepaceText.setLayoutData(gd); + schemaTargetNamepaceText.setText(settings + .get(PREF_JAVA_SCHEMA_TARGET_NS_PREF)); + schemaTargetNamepaceText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + settings.put(PREF_JAVA_SCHEMA_TARGET_NS_PREF, + schemaTargetNamepaceText.getText()); + // dialogChanged(); + } + }); + + label = new Label(container, SWT.NULL); + label.setText(CodegenWizardPlugin + .getResourceString("page5.schemaTargetNsPrefix.label")); + + gd = new GridData(GridData.FILL_HORIZONTAL); + schemaTargetNamespacePrefixText = new Text(container, SWT.BORDER); + schemaTargetNamespacePrefixText.setLayoutData(gd); + schemaTargetNamespacePrefixText.setText(settings + .get(PREF_JAVA_SCHEMA_TARGET_NS)); + schemaTargetNamespacePrefixText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + settings.put(PREF_JAVA_SCHEMA_TARGET_NS, + schemaTargetNamespacePrefixText.getText()); + // dialogChanged(); + } + }); + + label = new Label(container, SWT.NULL); + label.setText(CodegenWizardPlugin + .getResourceString("page5.serviceName.label")); + + gd = new GridData(GridData.FILL_HORIZONTAL); + serviceNameText = new Text(container, SWT.BORDER); + serviceNameText.setLayoutData(gd); + serviceNameText.setText(settings + .get(PREF_JAVA_SCHEMA_TARGET_NS)); + serviceNameText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + settings.put(PREF_JAVA_SERVICE_NAME, + serviceNameText.getText()); + // dialogChanged(); + } + }); + + setControl(container); + + } + + public String getTargetNamespace() { + return this.targetNamespacePrefixText.getText(); + } + + public String getTargetNamespacePrefix() { + return this.targetNamespaceText.getText(); + } + + public String getSchemaTargetNamespace() { + return this.schemaTargetNamepaceText.getText(); + } + + public String getSchemaTargetNamespacePrefix() { + return this.schemaTargetNamespacePrefixText.getText(); + } + + public String getServiceName() { + return this.serviceNameText.getText(); + } + } Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java?rev=373739&r1=373738&r2=373739&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java (original) +++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java Mon Jan 30 22:27:11 2006 @@ -18,9 +18,13 @@ import java.io.File; import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Path; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; @@ -30,11 +34,13 @@ 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 JavaWSDLOutputLocationPage extends AbstractWizardPage { private Text outputFolderTextBox; private Text outputFileNameTextBox; + private Button locationSelectCheckBox; /** * @param pageName @@ -47,7 +53,8 @@ */ protected void initializeDefaultSettings() { settings.put(PREF_JAVA_OUTPUT_WSDL_LOCATION,System.getProperty("user.dir")); - settings.put(JAVA_OUTPUT_WSDL_NAME,"service.wsdl"); + settings.put(JAVA_OUTPUT_WSDL_NAME,"services.wsdl"); + settings.put(PREF_JAVA_OUTPUT_SELECTION,false); } @@ -64,15 +71,29 @@ 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; + //layout.verticalSpacing = 9; + container.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 3; + locationSelectCheckBox = new Button(container, SWT.CHECK); + locationSelectCheckBox.setText(CodegenWizardPlugin + .getResourceString("page6.selectOption.label")); + locationSelectCheckBox.setLayoutData(gd); + locationSelectCheckBox.addSelectionListener(new SelectionAdapter(){ + public void widgetSelected(SelectionEvent e) { + settings.put(PREF_JAVA_OUTPUT_SELECTION, + locationSelectCheckBox.getSelection()); + } + }); + + Label label = new Label(container, SWT.NULL); label.setText(CodegenWizardPlugin .getResourceString("page6.output.label")); - + + gd = new GridData(GridData.FILL_HORIZONTAL); outputFolderTextBox = new Text(container,SWT.BORDER); outputFolderTextBox.setLayoutData(gd); outputFolderTextBox.setText(settings.get(PREF_JAVA_OUTPUT_WSDL_LOCATION)); @@ -97,6 +118,7 @@ .getResourceString("page6.outputname.label")); gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; outputFileNameTextBox = new Text(container,SWT.BORDER); outputFileNameTextBox.setLayoutData(gd); outputFileNameTextBox.setText(settings.get(JAVA_OUTPUT_WSDL_NAME)); @@ -138,11 +160,36 @@ } private void handleBrowse(){ - DirectoryDialog fileDialog = new DirectoryDialog(this.getShell()); - String dirName = fileDialog.open(); - if (dirName != null) { - outputFolderTextBox.setText(dirName); - } + + boolean location = locationSelectCheckBox.getSelection(); + if (!location) { + DirectoryDialog dialog = new DirectoryDialog(this.getShell()); + String returnString = dialog.open(); + if (returnString != null) { + outputFolderTextBox.setText(returnString); + } + } else { + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + ContainerSelectionDialog dialog = new ContainerSelectionDialog( + getShell(), + root, + false, + CodegenWizardPlugin + .getResourceString("page3.containerbox.title")); + if (dialog.open() == ContainerSelectionDialog.OK) { + Object[] result = dialog.getResult(); + if (result.length == 1) { + Path path = ((Path) result[0]); + // append to the workspace path + if (root.exists(path)) { + outputFolderTextBox.setText(root.getLocation().append(path) + .toFile().getAbsolutePath()); + } + } + } + } + } Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java?rev=373739&r1=373738&r2=373739&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java (original) +++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java Mon Jan 30 22:27:11 2006 @@ -2,7 +2,6 @@ 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; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; @@ -24,7 +23,6 @@ private Text fileText; - private ISelection selection; /** Added: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/ClassFileReader.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/ClassFileReader.java?rev=373739&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/ClassFileReader.java (added) +++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/ClassFileReader.java Mon Jan 30 22:27:11 2006 @@ -0,0 +1,72 @@ +package org.apache.axis2.tool.codegen.eclipse.util; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.List; + +/** + * A utility class for reading/loading classes and + * extracting the information. + * + */ +public class ClassFileReader { + + /** + * try whether a given class can be loaded from the given location + * @param className + * @param classPathEntries + * @param errorListener + * @return + */ + public static boolean tryLoadingClass(String className, + String[] classPathEntries, List errorListener) { + //make a URL class loader from the entries + ClassLoader classLoader; + + if (classPathEntries.length > 0) { + URL[] urls = new URL[classPathEntries.length]; + + try { + for (int i = 0; i < classPathEntries.length; i++) { + String classPathEntry = classPathEntries[i]; + //this should be a file(or a URL) + if (classPathEntry.startsWith("http://")) { + urls[i] = new URL(classPathEntry); + } else { + urls[i] = new File(classPathEntry).toURL(); + } + } + } catch (MalformedURLException e) { + if (errorListener!=null){ + errorListener.add(e); + } + return false; + } + + classLoader = new URLClassLoader(urls); + + } else { + classLoader = Thread.currentThread().getContextClassLoader(); + } + + //try to load the class with the given name + + try { + Class clazz=classLoader.loadClass(className); + clazz.getMethods(); + + + } catch (Throwable t) { + if (errorListener!=null){ + errorListener.add(t); + } + return false; + } + + return true; + + } + +} Added: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/NamespaceFinder.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/NamespaceFinder.java?rev=373739&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/NamespaceFinder.java (added) +++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/NamespaceFinder.java Mon Jan 30 22:27:11 2006 @@ -0,0 +1,42 @@ +package org.apache.axis2.tool.codegen.eclipse.util; + +/** + * + * @author Ajith + * + */ +public class NamespaceFinder { + + private static String NS_PREFIX = "http://"; + private static String SCHEMA_NS_SUFFIX = "/types"; + private static String SCHEMA_NS_DEFAULT_PREFIX = "types"; + private static String NS_DEFAULT_PREFIX = "ns"; + + + public static String getTargetNamespaceFromClass(String fullyQualifiedClassName){ + //tokenize the className + String[] classNameParts = fullyQualifiedClassName.split("\\."); + //add the strings in reverse order to make + //the namespace + String nsUri = ""; + for(int i=classNameParts.length-1;i>=0;i--){ + nsUri = nsUri + classNameParts[i] + (i==0?"":"."); + } + + return NS_PREFIX + nsUri; + + + } + + public static String getSchemaTargetNamespaceFromClass(String fullyQualifiedClassName){ + return getTargetNamespaceFromClass(fullyQualifiedClassName) +SCHEMA_NS_SUFFIX; + } + + public static String getDefaultSchemaNamespacePrefix(){ + return SCHEMA_NS_DEFAULT_PREFIX; + } + + public static String getDefaultNamespacePrefix(){ + return NS_DEFAULT_PREFIX; + } +} Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java?rev=373739&r1=373738&r2=373739&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java (original) +++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java Mon Jan 30 22:27:11 2006 @@ -92,23 +92,22 @@ // ################################################################################## // Java source file selection page static final String JAVA_CLASS_NAME = "JAVA_CLASS_NAME"; - - static final String JAVA_CLASS_LOCATION_NAME = "JAVA_CLASS_LOCATION_NAME"; + static final String JAVA_CLASS_PATH_ENTRIES = "JAVA_CLASS_PATH_NAME"; // ################################################################################## // Java2wsdl options selection page - static final String PREF_JAVA_TARGET_NS = "INPUT_WSDL"; - - static final String PREF_JAVA_TARGET_NS_PREF = "LOCATION_URL"; - static final String PREF_JAVA_SCHEMA_TARGET_NS = "BINDING_NAME"; - static final String PREF_JAVA_SERVICE_NAME = "MODE_INDEX"; + static final String PREF_JAVA_TARGET_NS = "TARGET_NS"; + static final String PREF_JAVA_TARGET_NS_PREF = "TARGET_NS_PREF"; + static final String PREF_JAVA_SCHEMA_TARGET_NS = "SCHEMA_TARGET_NS"; + static final String PREF_JAVA_SERVICE_NAME = "SCHEMA_SERVICE"; static final String PREF_JAVA_STYLE_INDEX = "STYLE_INDEX"; - static final String PREF_JAVA_SCHEMA_TARGET_NS_PREF = "PORTYPE_NAME"; + static final String PREF_JAVA_SCHEMA_TARGET_NS_PREF = "SCHEMA_TARGET_NS_PREF"; // ################################################################################## //output page static final String JAVA_OUTPUT_WSDL_NAME = "OUTPUT_WSDL"; static final String PREF_JAVA_OUTPUT_WSDL_LOCATION = "OUTPUT_WSDL_LOCATION"; + static final String PREF_JAVA_OUTPUT_SELECTION = "OUTPUT_WSDL_LOCATION_SELECT"; // ################################################################################## // Page constants static final int WSDL_2_JAVA_TYPE = 1; Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties?rev=373739&r1=373738&r2=373739&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties (original) +++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties Mon Jan 30 22:27:11 2006 @@ -8,6 +8,8 @@ general.name=Axis2 Codegen Wizard general.browse=Browse... general.search=Search.. +general.invalid.state=Invalid state! +general.useraborted.state=User aborted! ############################################################################ # Initial tool selection page - Page0 # Tool selection @@ -73,13 +75,16 @@ page4.title=Java source selection page4.desc=Set the output project for the generated code #labels -page4.classpath.label=Java class file location +page4.classpath.label=Java Class path Entries. Select either folders or jar files page4.classname.label=Class name page4.addDir.label=Add Folder page4.addJar.label=Add Jar page4.removeEntry.label=Remove page4.error.invalidClassName=Fully qualified class name needs to be specified! page4.error.ClassNameNotTerminated=Class name is not properly terminated! +page4.tryLoad.label=Test Class Loading.. +page4.unknownError.label=Unknown error! +page4.successLoading.label=Class file can be loaded successfully ############################################################### #java2wsdl options = page 5 page5.name=page5 @@ -99,6 +104,7 @@ #### page6.output.label=Output Location page6.outputname.label=Output File Name +page6.selectOption.label=Browse Workspace projects only #Wizard generator.generating=Generating code... generator.readingWOM=Reading WSDL file...