Author: dennyxu
Date: 2008-05-05 05:28:52 -0400 (Mon, 05 May 2008)
New Revision: 7976
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboos/tools/ws/creation/core/commands/BindingFilesValidationCommand.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboos/tools/ws/creation/core/commands/WSDL2JavaCommnad.java
Log:
add binding files validation command
fix wsdl2java command to make it run with Windows OS
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2008-05-05
09:28:41 UTC (rev 7975)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2008-05-05
09:28:52 UTC (rev 7976)
@@ -17,7 +17,8 @@
org.eclipse.wst.command.env.core,
org.eclipse.wst.command.env,
org.eclipse.jst.ws.axis2.consumption.core,
- org.apache.ant
+ org.apache.ant,
+ org.apache.xerces
Eclipse-LazyStart: true
Export-Package: org.jboos.tools.ws.creation.core,
org.jboos.tools.ws.creation.core.commands,
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboos/tools/ws/creation/core/commands/BindingFilesValidationCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboos/tools/ws/creation/core/commands/BindingFilesValidationCommand.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboos/tools/ws/creation/core/commands/BindingFilesValidationCommand.java 2008-05-05
09:28:52 UTC (rev 7976)
@@ -0,0 +1,63 @@
+package org.jboos.tools.ws.creation.core.commands;
+
+import java.io.IOException;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.jboos.tools.ws.creation.core.data.ServiceModel;
+import org.jboos.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+public class BindingFilesValidationCommand extends AbstractDataModelOperation{
+
+ private ServiceModel model;
+
+
+ public BindingFilesValidationCommand(ServiceModel model){
+ this.model = model;
+ }
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ IStatus status = Status.OK_STATUS;
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+
+ // Create the XMLReader to be used to check for errors.
+ XMLReader reader = null;
+ try {
+ SAXParser parser = spf.newSAXParser();
+ reader = parser.getXMLReader();
+ } catch (Exception e) {
+ //if no SAXParserFactory implementation is available, break this command
+ return Status.OK_STATUS;
+ }
+
+
+ // Use the XMLReader to parse the entire file.
+ try {
+ InputSource is = new InputSource("");
+ reader.parse(is);
+ } catch (SAXException e) {
+ /*status = StatusUtils.errorStatus(
+ JBossWSCreationCoreMessages
+ new String[]{e.getLocalizedMessage()}), e);*/
+ } catch (IOException e) {
+ System.err.println(e);
+ System.exit(1);
+ }
+ return null;
+ }
+
+
+}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboos/tools/ws/creation/core/commands/WSDL2JavaCommnad.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboos/tools/ws/creation/core/commands/WSDL2JavaCommnad.java 2008-05-05
09:28:41 UTC (rev 7975)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboos/tools/ws/creation/core/commands/WSDL2JavaCommnad.java 2008-05-05
09:28:52 UTC (rev 7976)
@@ -6,6 +6,8 @@
import java.io.LineNumberReader;
import java.util.List;
+import javax.xml.parsers.SAXParserFactory;
+
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
@@ -35,29 +37,38 @@
String commandLocation = runtimeLocation + Path.SEPARATOR + "bin";
String command = "sh wsconsume.sh ";
if(System.getProperty("os.name").toLowerCase().indexOf("win") >=
0){
- command = "cmd wsconsume.bat";
+ command = "cmd.exe /c wsconsume.bat ";
}
String args = getCommandlineArgs();
command += " -k " + args + " " + model.getWsdlURI();
try {
-
- InputStreamReader ir = new InputStreamReader(Runtime.getRuntime().exec(command, null,
new File(commandLocation)).getInputStream());
+ Runtime rt = Runtime.getRuntime();
+ Process proc = rt.exec(command, null, new File(commandLocation));
+ InputStreamReader ir = new InputStreamReader(proc.getErrorStream());
LineNumberReader input = new LineNumberReader(ir);
String str = input.readLine();
+ StringBuffer result = new StringBuffer();
while(str != null){
System.out.println(str);
+ result.append(str).append("\t\r");
str = input.readLine();
+
}
-
+ proc.waitFor();
+ System.out.print(result);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
-
+ SAXParserFactory spf = SAXParserFactory.newInstance();
refreshProject(model.getWebProjectName(), monitor);
+
return Status.OK_STATUS;
}
Show replies by date