Author: Grid.Qian
Date: 2008-11-14 01:49:46 -0500 (Fri, 14 Nov 2008)
New Revision: 11780
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/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java
Log:
JBIDE-3173:Can not load class when generate Web Service code using JBossWS as web service
runtime
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-11-14
06:49:16 UTC (rev 11779)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2008-11-14
06:49:46 UTC (rev 11780)
@@ -30,7 +30,9 @@
org.eclipse.wst.common.project.facet.core,
org.eclipse.wst.server.core,
org.jboss.tools.common,
- org.jboss.ide.eclipse.as.classpath.core;bundle-version="1.0.0"
+ org.jboss.ide.eclipse.as.classpath.core;bundle-version="1.0.0",
+ org.eclipse.jst.server.core;bundle-version="1.1.0",
+ org.eclipse.jdt;bundle-version="3.4.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.ws.creation.core,
org.jboss.tools.ws.creation.core.commands,
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java 2008-11-14
06:49:16 UTC (rev 11779)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java 2008-11-14
06:49:46 UTC (rev 11780)
@@ -11,23 +11,39 @@
package org.jboss.tools.ws.creation.core.commands;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.JavaProject;
+import org.eclipse.jst.server.core.internal.RuntimeClasspathContainer;
+import
org.jboss.tools.ws.core.classpath.JBossWSRuntimeClassPathInitializer.JBossWSRuntimeClasspathContainer;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
/**
* @author Grid Qian
*/
+@SuppressWarnings("restriction")
public class WSProviderInvokeCommand extends AbstractGenerateCodeCommand {
- private static String WSPROVIDER_FILE_NAME_LINUX = "wsprovide.sh";
+ private static String WSPROVIDER_FILE_NAME_LINUX = "wsprovide.sh";
private static String WSPROVIDER_FILE_NAME_WIN = "wsprovide.bat";
-
+ private static String SEPERATOR_WIN = ";";
+ private static String SEPERATOR_LINUX = ":";
+ private String seperator;
+
public WSProviderInvokeCommand(ServiceModel model) {
super(model);
}
-
@Override
protected String getCommandLineFileName_linux() {
return WSPROVIDER_FILE_NAME_LINUX;
@@ -40,28 +56,81 @@
@Override
protected String getCommandlineArgs() {
- String commandLine;
+ if (System.getProperty("os.name").toLowerCase().indexOf("win")
>= 0) {
+ seperator = SEPERATOR_WIN;
+ } else {
+ seperator = SEPERATOR_LINUX;
+ }
+ StringBuffer commandLine = new StringBuffer();
String project = model.getWebProjectName();
String projectRoot = JBossWSCreationUtils.getProjectRoot(project)
.toOSString();
- commandLine = "-s " + projectRoot + Path.SEPARATOR + "src";
+ IProject iProject = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(project);
+ IJavaProject javaProject = JavaCore.create(iProject);
+
+ commandLine.append(" -s ").append(projectRoot).append(Path.SEPARATOR)
+ .append("src");
+
+ try {
+ commandLine.append(" -c ").append("\"");
+
+ commandLine.append(projectRoot).append(Path.SEPARATOR).append(
+ javaProject.getOutputLocation().removeFirstSegments(1)
+ .toOSString()).append(seperator);
+ commandLine.append(getClasspathEntries(javaProject)).append("\" ");
+ commandLine.append(" -o ").append(projectRoot).append(
+ Path.SEPARATOR).append(
+ javaProject.getOutputLocation().removeFirstSegments(1)
+ .toOSString());
+ } catch (JavaModelException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
if (model.isGenWSDL()) {
- commandLine += " -w ";
+ commandLine.append(" -w ");
}
+ commandLine.append(" -r ").append(projectRoot).append(Path.SEPARATOR)
+ .append("WebContent").append(Path.SEPARATOR).append("wsdl ");
+ commandLine.append(model.getServiceClasses().get(0));
- commandLine += " -o " + projectRoot + Path.SEPARATOR
- + "build/classes/ ";
+ return commandLine.toString();
- commandLine += " -r " + projectRoot + Path.SEPARATOR +
"WebContent"
- + Path.SEPARATOR + "wsdl ";
+ }
- commandLine += " -c " + projectRoot + Path.SEPARATOR
- + "build/classes/ ";
+ private String getClasspathEntries(IJavaProject javaProject) {
+ IClasspathEntry[] iniEntries = null;
+ List<IClasspathEntry> pathList = new ArrayList<IClasspathEntry>();
+ IClasspathEntry[] resolvedEntries = null;
+ try {
+ iniEntries = javaProject.getRawClasspath();
+ for (IClasspathEntry entry : iniEntries) {
+ IClasspathContainer container = JavaCore.getClasspathContainer(
+ entry.getPath(), javaProject);
+ if (!(container instanceof JBossWSRuntimeClasspathContainer)) {
+ if (!(container instanceof RuntimeClasspathContainer && container
+ .getDescription().contains("JBoss"))) {
+ pathList.add(entry);
+ }
+ }
+ }
+ resolvedEntries = ((JavaProject) javaProject)
+ .resolveClasspath(pathList
+ .toArray(new IClasspathEntry[pathList.size()]));
+ } catch (JavaModelException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ StringBuffer path = new StringBuffer();
+ for (IClasspathEntry entry : resolvedEntries) {
+ if (entry.getEntryKind() == 3 || entry.getEntryKind() == 2) {
+ // path.append(workspaceRoot);
+ continue;
+ }
+ path.append(entry.getPath().toOSString()).append(seperator);
+ }
+ return path.toString();
- commandLine += model.getServiceClasses().get(0);
-
- return commandLine;
-
}
}
Show replies by date