Author: Grid.Qian
Date: 2011-05-16 03:31:25 -0400 (Mon, 16 May 2011)
New Revision: 31324
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
Log:
JBIDE-7922: WSDL should be read once
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2011-05-15
09:00:37 UTC (rev 31323)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2011-05-16
07:31:25 UTC (rev 31324)
@@ -6,9 +6,6 @@
import java.util.Map;
import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import org.eclipse.core.commands.ExecutionException;
@@ -177,22 +174,16 @@
protected String[] getServiceNameFromWSDL() {
String[] names = new String[2];
- try {
- WSDLFactory factory = WSDLFactory.newInstance();
- WSDLReader wsdlReader = factory.newWSDLReader();
- Definition def = wsdlReader.readWSDL(model.getWsdlURI());
- Map<?, ?> services = def.getServices();
- if (services != null) {
- QName[] a = new QName[services.keySet().size()];
- if (a != null && a.length > 0) {
- services.keySet().toArray(a);
- names[0] = a[0].getLocalPart();
- }
+ Definition def = model.getWsdlDefinition();
+ Map<?, ?> services = def.getServices();
+ if (services != null) {
+ QName[] a = new QName[services.keySet().size()];
+ if (a != null && a.length > 0) {
+ services.keySet().toArray(a);
+ names[0] = a[0].getLocalPart();
}
- names[1] = def.getTargetNamespace();
- } catch (WSDLException e) {
- e.printStackTrace();
}
+ names[1] = def.getTargetNamespace();
return names;
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java 2011-05-15
09:00:37 UTC (rev 31323)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java 2011-05-16
07:31:25 UTC (rev 31324)
@@ -11,6 +11,9 @@
package org.jboss.tools.ws.creation.core.commands;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
@@ -69,8 +72,14 @@
model.setTarget(JBossWSCreationCoreMessages.Value_Target_0);
if (scenario == WebServiceScenario.CLIENT) {
model.setWsdlURI(wsClient.getWebServiceClientInfo().getWsdlURL());
+ Definition definition = null;
+ try {
+ definition = JBossWSCreationUtils.readWSDL(model.getWsdlURI());
+ } catch (WSDLException e) {
+ return StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Read_WSDL);
+ }
+ model.setWsdlDefinition(definition);
model.setCustomPackage(""); //$NON-NLS-1$
-
}
return Status.OK_STATUS;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2011-05-15
09:00:37 UTC (rev 31323)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2011-05-16
07:31:25 UTC (rev 31324)
@@ -1,5 +1,8 @@
package org.jboss.tools.ws.creation.core.commands;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
@@ -51,6 +54,13 @@
model.setTarget(JBossWSCreationCoreMessages.Value_Target_0);
if (scenario == WebServiceScenario.TOPDOWN) {
model.setWsdlURI(ws.getWebServiceInfo().getWsdlURL());
+ Definition definition = null;
+ try {
+ definition = JBossWSCreationUtils.readWSDL(model.getWsdlURI());
+ } catch (WSDLException e) {
+ return StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Read_WSDL);
+ }
+ model.setWsdlDefinition(definition);
model.setCustomPackage(""); //$NON-NLS-1$
} else {
model.addServiceClasses(ws.getWebServiceInfo().getImplURL());
@@ -60,7 +70,6 @@
}
public ServiceModel getWebServiceDataModel() {
-
return model;
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java 2011-05-15
09:00:37 UTC (rev 31323)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java 2011-05-16
07:31:25 UTC (rev 31324)
@@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.List;
+import javax.wsdl.Definition;
+
public class ServiceModel {
private String webProjectName;
@@ -22,6 +24,7 @@
private String applicationClassName;
private String applicationName;
private String javaSourceFolder;
+ private Definition wsdlDefinition;
public int getWsScenario() {
return wsScenario;
@@ -176,4 +179,13 @@
public void setJavaSourceFolder(String javaSourceFolder) {
this.javaSourceFolder = javaSourceFolder;
}
+
+
+ public Definition getWsdlDefinition() {
+ return wsdlDefinition;
+ }
+
+ public void setWsdlDefinition(Definition wsdlDefinition) {
+ this.wsdlDefinition = wsdlDefinition;
+ }
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2011-05-15
09:00:37 UTC (rev 31323)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2011-05-16
07:31:25 UTC (rev 31324)
@@ -40,6 +40,7 @@
Error_No_Package=The service implementation selected does not follow Java naming
conventions. This may result in not being able to generate your WebService.
Error_JBossWS_GenerateWizard_WSName_Same=The Web Service Name has been used in the
web.xml of the web project. Do you want to overwrite it?
Error_JBossWS_GenerateWizard_WSImpl_Overwrite=The Web Service implementation classes have
been there. Do you want to overwrite them?
+Error_Read_WSDL=Can't read the WSDL file from the URI
RestEasyLibUtils_Error_UnableToFindRuntimeForProject=Unable to find runtime associated
with selected project.
RSMergeWebXMLCommand_REST_App_Exists=Rest Application exists with same name
RSMergeWebXMLCommand_REST_Servlet_Exists=RestEasy servlet already exists.
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2011-05-15
09:00:37 UTC (rev 31323)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2011-05-16
07:31:25 UTC (rev 31324)
@@ -46,6 +46,7 @@
public static String Error_Message_No_Runtime_Specified;
public static String Error_JBossWS_GenerateWizard_WSName_Same;
public static String Error_JBossWS_GenerateWizard_WSImpl_Overwrite;
+ public static String Error_Read_WSDL;
public static String RestEasyLibUtils_Error_UnableToFindRuntimeForProject;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2011-05-15
09:00:37 UTC (rev 31323)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2011-05-16
07:31:25 UTC (rev 31324)
@@ -29,6 +29,11 @@
import java.util.List;
import java.util.Locale;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -597,5 +602,12 @@
}
return path;
}
+
+ public static Definition readWSDL(String wsdlURL) throws WSDLException{
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader wsdlReader = factory.newWSDLReader();
+ Definition def = wsdlReader.readWSDL(wsdlURL);
+ return def;
+ }
}
Show replies by date