Author: Grid.Qian
Date: 2011-06-07 03:09:48 -0400 (Tue, 07 Jun 2011)
New Revision: 31870
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaHelpOptionCommand.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
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/commands/Java2WSCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.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
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/RestEasyLibUtils.java
Log:
JBIDE-8490: add more options for wsdl2java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2011-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -10,7 +10,6 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
@@ -21,7 +20,6 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.osgi.util.NLS;
@@ -56,14 +54,14 @@
monitor.subTask(JBossWSCreationCoreMessages.Progress_Message_Generating);
IStatus status = Status.OK_STATUS;
- IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(model.getWebProjectName());
+ IProject project = model.getJavaProject().getProject();
JBossWSCreationCorePlugin.getDefault().setGenerateTime(System.currentTimeMillis());
try {
String runtimeLocation = JBossWSCreationUtils.getJBossWSRuntimeLocation(project);
String commandLocation = runtimeLocation + Path.SEPARATOR+ "bin";
//$NON-NLS-1$
IPath path = new Path(commandLocation);
List<String> command = new ArrayList<String>();
- String[] env = getEnvironmentVariables(project);
+ String[] env = getEnvironmentVariables(model.getJavaProject());
if (System.getProperty("os.name").toLowerCase().indexOf("win")
>= 0) { //$NON-NLS-1$ //$NON-NLS-2$
command.add("cmd.exe"); //$NON-NLS-1$
command.add("/c"); //$NON-NLS-1$
@@ -78,7 +76,7 @@
return
StatusUtils.errorStatus(NLS.bind(JBossWSCreationCoreMessages.Error_Message_Command_File_Not_Found,
new String[] { path.toOSString() }));
}
addCommandlineArgs(command);
- addCommonArgs(command, project);
+ addCommonArgs(command, model.getJavaProject());
Process proc = DebugPlugin.exec(command.toArray(new String[command.size()]), new
File(commandLocation), env);
StringBuffer errorResult = new StringBuffer();
@@ -125,7 +123,7 @@
}
return status;
} finally {
- refreshProject(model.getWebProjectName(), monitor);
+ refreshProject(model.getJavaProject(), monitor);
monitor.done();
}
@@ -134,11 +132,10 @@
// SET JAVA_HOME environment variable to the location of java runtime of the
// project if the user
// doesn't set the env variable
- private String[] getEnvironmentVariables(IProject project) {
+ protected String[] getEnvironmentVariables(IJavaProject javaProject) {
String[] env = null;
String javaHome = System.getenv(JAVA_HOME);
if (javaHome == null || !(new File(javaHome).exists())) {
- IJavaProject javaProject = JavaCore.create(project);
if (javaProject == null || !javaProject.exists())
return null;
try {
@@ -155,9 +152,8 @@
return env;
}
- private void addCommonArgs(List<String> command, IProject project) throws
Exception {
- String projectRoot =
JBossWSCreationUtils.getProjectRoot(model.getWebProjectName()).toOSString();
- IJavaProject javaProject = JavaCore.create(project);
+ protected void addCommonArgs(List<String> command, IJavaProject javaProject)
throws Exception {
+ String projectRoot = model.getJavaProject().getProject().getLocation().toOSString();
command.add("-k"); //$NON-NLS-1$
command.add("-s"); //$NON-NLS-1$
command.add(JBossWSCreationUtils.getCustomSrcLocation(model.getJavaSourceFolder()));
@@ -165,12 +161,19 @@
StringBuffer opDir = new StringBuffer();
opDir.append(projectRoot).append(Path.SEPARATOR).append(javaProject.getOutputLocation().removeFirstSegments(1).toOSString());
command.add(opDir.toString());
+ if (model.getAddOptions() != null &&
!"".equals(model.getAddOptions())) { //$NON-NLS-1$
+ String str = model.getAddOptions().trim();
+ String[] strArray = str.split(" +"); //$NON-NLS-1$
+ for (int i=0 ; i<strArray.length; i++) {
+ command.add(strArray[i]);
+ }
+ }
if (model.getWsdlURI() != null) {
command.add(model.getWsdlURI());
}
}
- private void convertInputStreamToString(final StringBuffer result,
+ protected void convertInputStreamToString(final StringBuffer result,
final InputStream input) {
Thread thread = new Thread() {
public void run() {
@@ -192,9 +195,9 @@
thread.start();
}
- private void refreshProject(String project, IProgressMonitor monitor) {
+ protected void refreshProject(IJavaProject project, IProgressMonitor monitor) {
try {
- JBossWSCreationUtils.getProjectByName(project).refreshLocal(2,monitor);
+ project.getProject().refreshLocal(2,monitor);
} catch (CoreException e) {
e.printStackTrace();
JBossWSCreationCorePlugin.getDefault().logError(e);
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2011-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -16,10 +16,8 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
@@ -68,15 +66,7 @@
throws ExecutionException {
argsNum = 0;
IStatus status = Status.OK_STATUS;
- IJavaProject project = null;
- try {
- project = JBossWSCreationUtils.getJavaProjectByName(model
- .getWebProjectName());
- } catch (JavaModelException e) {
- JBossWSCreationCorePlugin.getDefault().logError(e);
- return StatusUtils
- .errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
- }
+ IJavaProject project = model.getJavaProject();
// find web service client classes
List<ICompilationUnit> clientUnits = JBossWSCreationUtils
@@ -177,13 +167,7 @@
String className, boolean isInterface, String interfaceName,
IJavaProject javaProject) {
try {
- IPath srcPath = new Path(
- JBossWSCreationUtils.getCustomSrcLocation(model.getJavaSourceFolder()));
- srcPath = javaProject.getPath().append(
- srcPath.makeRelativeTo(javaProject.getProject()
- .getLocation()));
- IPackageFragmentRoot root = javaProject
- .findPackageFragmentRoot(srcPath);
+ IPackageFragmentRoot root = JBossWSCreationUtils.getPackageFragmentRoot(javaProject,
model.getJavaSourceFolder());
if (packageName == null) {
packageName = ""; //$NON-NLS-1$
}
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-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -1,30 +1,23 @@
package org.jboss.tools.ws.creation.core.commands;
-import java.io.File;
import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
@@ -42,7 +35,6 @@
import org.eclipse.jdt.core.dom.PackageDeclaration;
import org.eclipse.jdt.core.dom.ParameterizedType;
import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.QualifiedName;
import org.eclipse.jdt.core.dom.ReturnStatement;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
@@ -74,67 +66,76 @@
private static final String ANNOTATION_PROPERTY_SERVICE_NAME = "serviceName";
//$NON-NLS-1$
private static final String ANNOTATION_PROPERTY_ENDPOINT_INTERFACE =
"endpointInterface"; //$NON-NLS-1$
private static final String ANNOTATION_PROPERTY_TNS = "targetNamespace";
//$NON-NLS-1$
+ private static final String IMPL_PACKAGE = ".impl"; //$NON-NLS-1$
+ public static final String LINE_SEPARATOR =
System.getProperty("line.separator"); //$NON-NLS-1$
private ServiceModel model;
- private IWorkspaceRoot fWorkspaceRoot;
- private IProject project;
+ private IJavaProject project;
private String packageName;
+ private String serviceName;
+ private String targetNamespace;
public ImplementationClassCreationCommand(ServiceModel model) {
this.model = model;
- fWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
-
}
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
+
+ IStatus status = Status.OK_STATUS;
// if the user does not check the generate implementation class button,
// do nothing
if (!model.isGenImplementation()) {
- return Status.OK_STATUS;
+ return status;
}
-
- IStatus status = Status.OK_STATUS;
- project = JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName());
+
+ project = model.getJavaProject();
+ packageName = model.getCustomPackage();
+ List<ICompilationUnit> portTypeUnits = JBossWSCreationUtils
+ .findJavaUnitsByAnnotation(project,
JBossWSCreationCoreMessages.Webservice_Annotation, packageName);
+ if (portTypeUnits.size() == 0 ) {
+ return status;
+ }
+
+ packageName = portTypeUnits.get(0).getParent().getElementName() + IMPL_PACKAGE;
+ IPackageFragment pack = null;
try {
-
- IJavaProject javaPrj = JavaCore.create(project);
- List<ICompilationUnit> serviceUnits = JBossWSCreationUtils
- .findJavaUnitsByAnnotation(javaPrj,
- JBossWSCreationCoreMessages.Webservice_Annotation,
- model.getCustomPackage());
-
- packageName = model.getCustomPackage();
- boolean noPackageName = false;
- if ("".equals(packageName)) { //$NON-NLS-1$
- noPackageName = true;
- }
- boolean isCheck = true;
- for (ICompilationUnit service : serviceUnits) {
- if (!service.findPrimaryType().isInterface()) {
+ pack = createImplPackage(packageName);
+ } catch (JavaModelException e1) {
+ status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_Failed_to_Generate_Implementation,e1);
+ return status;
+ }
+ Service service = model.getService();
+ serviceName = service.getQName().getLocalPart();
+ targetNamespace = model.getWsdlDefinition().getTargetNamespace();
+ Iterator<?> iter = service.getPorts().values().iterator();
+ List<String> ptList = new LinkedList<String>();
+ while (iter.hasNext()) {
+ Port port = (Port) iter.next();
+ ptList.add(port.getBinding().getPortType().getQName().getLocalPart().toLowerCase());
+ }
+
+ boolean isOverWrite = false;
+ try {
+ for (ICompilationUnit portType : portTypeUnits) {
+ if (!portType.findPrimaryType().isInterface()) {
continue;
}
- if (noPackageName) {
- packageName = service.getParent().getElementName();
+ String clsName = getClassName(portType.getElementName());
+ String implClsName = getImplClassName(clsName);
+ if (!ptList.contains(clsName.toLowerCase())) {
+ continue;
+ }
+ if (!isOverWrite && findImplClass(implClsName)) {
+ if (!isOverwriteClass()) {
+ break;
+ }
+ isOverWrite = true;
}
- String implClsName = getImplClassName(getClassName(service
- .getElementName()));
- if (isCheck) {
- if (findImplClass(implClsName)) {
- isCheck = false;
- if (!isOverwriteClass()) {
- break;
- }
- }
- }
- generateImplClass(service);
- model.addServiceClasses(getImplPackageName()
- + "." + implClsName); //$NON-NLS-1$
+ generateImplClass(portType, pack, clsName, implClsName);
+ model.addServiceClasses(new
StringBuffer(packageName).append(".").append(implClsName).toString());
//$NON-NLS-1$
}
-
} catch (CoreException e) {
status = StatusUtils
.errorStatus(
@@ -151,79 +152,28 @@
return status;
}
- private boolean isOverwriteClass() throws JavaModelException {
- boolean b = MessageDialog
- .openConfirm(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getShell(),
- JBossWSCreationCoreMessages.Confirm_Override_ImplClass,
- JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSImpl_Overwrite);
- return b;
- }
-
- private boolean findImplClass(String claName) throws JavaModelException {
- boolean b = false;
- IPackageFragmentRoot root = getPackageFragmentRoot();
- String implPackageName = getImplPackageName();
- IPackageFragment pack = root.getPackageFragment(implPackageName);
- if (pack.getCompilationUnit(claName + ".java").exists()) { //$NON-NLS-1$
- b = true;
- }
- return b;
- }
-
- protected String[] getServiceNameFromWSDL() {
- String[] names = new String[2];
- 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();
- return names;
- }
-
@SuppressWarnings("unchecked")
- protected void generateImplClass(ICompilationUnit service)
+ protected void generateImplClass(ICompilationUnit portType, IPackageFragment pack,
String ptCls, String clsName)
throws CoreException, BadLocationException {
ASTParser astp = ASTParser.newParser(AST.JLS3);
astp.setKind(ASTParser.K_COMPILATION_UNIT);
- astp.setSource(service);
+ astp.setSource(portType);
CompilationUnit cu = (CompilationUnit) astp.createAST(null);
- IPackageFragment pack = getImplPakcage();
-
- String className = getClassName(service.getElementName());
-
- String implFileName = getJavaFileName(className);
-
- String[] names = getServiceNameFromWSDL();
-
- String serviceName = names[0];
-
- String targetNamespace = names[1];
-
- ICompilationUnit icu = pack.createCompilationUnit(implFileName,
- "", true, null); //$NON-NLS-1$
+ String implFileName = getJavaFileName(clsName);
+ ICompilationUnit icu = pack.createCompilationUnit(implFileName,"", true,
null); //$NON-NLS-1$
+
// create a working copy with a new owner
-
icu.becomeWorkingCopy(null);
-
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(icu);
parser.setResolveBindings(false);
parser.setFocalPosition(0);
-
CompilationUnit implCu = (CompilationUnit) parser.createAST(null);
AST ast = implCu.getAST();
// creation of a Document and ASTRewrite
String source = icu.getBuffer().getContents();
Document document = new Document(source);
-
implCu.recordModifications();
// start to add content into implementation class
@@ -234,25 +184,23 @@
implCu.setPackage(implPackage);
// add imports for implementation class
- addImportsToImplementationClass(implCu, cu, className);
+ addImportsToImplementationClass(implCu, cu, ptCls);
// add class declaration
TypeDeclaration type = ast.newTypeDeclaration();
type.setInterface(false);
// add WebService annotation
- String endpoint = getServiceInterfaceFullName(className);
+ String endpoint = getPortTypeFullName(portType.getParent().getElementName(), ptCls);
NormalAnnotation ann = null;
if (serviceName != null) {
ann = createAnnotation(ast, serviceName, endpoint, targetNamespace);
} else {
- ann = createAnnotation(ast, className, endpoint, targetNamespace);
+ ann = createAnnotation(ast, clsName, endpoint, targetNamespace);
}
type.modifiers().add(ann);
- type.modifiers().add(
- ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
- type.setName(ast.newSimpleName(getImplClassName(className)));
- type.superInterfaceTypes().add(
- ast.newSimpleType(ast.newName(className)));
+ type.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
+ type.setName(ast.newSimpleName(clsName));
+ type.superInterfaceTypes().add(ast.newSimpleType(ast.newName(ptCls)));
// add Logger variable declaration
// createLoggerField(ast, type, portTypeName);
@@ -268,7 +216,6 @@
methods[i]);
type.bodyDeclarations().add(newMethod);
}
-
implCu.types().add(type);
// try to save the Java file
@@ -288,20 +235,8 @@
return packageName;
}
- private IPackageFragmentRoot getPackageFragmentRoot()
- throws JavaModelException {
- String str = model.getWebProjectName() + File.separator
- + getSourceFolderPath(project);
- IPath path = new Path(str);
- IResource res = fWorkspaceRoot.findMember(path);
- IJavaProject javaPrj = JavaCore.create(project);
- return javaPrj.getPackageFragmentRoot(res);
-
- }
-
private String getJavaFileName(String className) {
-
- return getImplClassName(className) + DEFAULT_CU_SUFFIX;
+ return className + DEFAULT_CU_SUFFIX;
}
private String getImplClassName(String className) {
@@ -313,20 +248,7 @@
return clsName;
}
- private IPackageFragment getImplPakcage() throws JavaModelException {
- IPackageFragmentRoot root = getPackageFragmentRoot();
- String implPackageName = getImplPackageName();
- IPackageFragment pack = root.getPackageFragment(implPackageName);
-
- if (!pack.exists()) {
- String packName = pack.getElementName();
- pack = root.createPackageFragment(packName, true, null);
- }
-
- return pack;
- }
-
- private String getServiceInterfaceFullName(String className) {
+ private String getPortTypeFullName(String packageName, String className) {
return packageName + "." + className; //$NON-NLS-1$
}
@@ -345,11 +267,8 @@
// import port type interface
ImportDeclaration importDec = implAST.newImportDeclaration();
- QualifiedName portTypeImport = implAST.newQualifiedName(
- implAST.newName(serviceCU.getPackage().getName()
- .getFullyQualifiedName()),
- implAST.newSimpleName(serviceName));
- importDec.setName(portTypeImport);
+ importDec.setName(implAST.newName(serviceCU.getPackage().getName().toString()));
+ importDec.setOnDemand(true);
implCU.imports().add(importDec);
// importDec = implAST.newImportDeclaration();
// importDec.setName(implAST.newName(LOGGER_CLASS_FULLNAME));
@@ -515,7 +434,32 @@
return null;
}
+
+ private IPackageFragment createImplPackage(String implPackage) throws JavaModelException
{
+ IPackageFragmentRoot root = JBossWSCreationUtils.getPackageFragmentRoot(project,
model.getJavaSourceFolder());
+ return root.createPackageFragment(implPackage,false, null);
+ }
+
+ private boolean isOverwriteClass() throws JavaModelException {
+ boolean b = MessageDialog
+ .openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ JBossWSCreationCoreMessages.Confirm_Override_ImplClass,
+ JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSImpl_Overwrite);
+ return b;
+ }
+
+ private boolean findImplClass(String claName) throws JavaModelException {
+ boolean b = false;
+ IPackageFragmentRoot root = JBossWSCreationUtils.getPackageFragmentRoot(project,
model.getJavaSourceFolder());
+ String implPackageName = getImplPackageName();
+ IPackageFragment pack = root.getPackageFragment(implPackageName);
+ if (pack.getCompilationUnit(claName + ".java").exists()) { //$NON-NLS-1$
+ b = true;
+ }
+ return b;
+ }
+
protected List<ImportDeclaration> getImportsWithoutJaxwsAnnotation(
CompilationUnit cu) {
List<ImportDeclaration> importList = new ArrayList<ImportDeclaration>();
@@ -532,11 +476,4 @@
return importList;
}
- private IPath getSourceFolderPath(IProject project)
- throws JavaModelException {
- IPath path = new Path(
- JBossWSCreationUtils.getCustomSrcLocation(model.getJavaSourceFolder()));
- return path.makeRelativeTo(project.getProject().getLocation());
- }
-
}
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-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -11,6 +11,8 @@
package org.jboss.tools.ws.creation.core.commands;
+import java.util.List;
+
import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
@@ -21,6 +23,9 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
@@ -50,11 +55,11 @@
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
+ IJavaProject project = null;
try {
- String location = JBossWSCreationUtils
- .getJBossWSRuntimeLocation(JBossWSCreationUtils
- .getProjectByName(model.getWebProjectName()));
+ project =
JavaCore.create(JBossWSCreationUtils.getProjectByName(model.getWebProjectName()));
+ model.setJavaProject(project);
+ String location =
JBossWSCreationUtils.getJBossWSRuntimeLocation(project.getProject());
if (location.equals("")) { //$NON-NLS-1$
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_WS_Location);
@@ -70,6 +75,18 @@
.errorStatus(JBossWSCreationCoreMessages.Error_WS_Location);
}
model.setTarget(JBossWSCreationCoreMessages.Value_Target_0);
+ try {
+ List<String> list =
JBossWSCreationUtils.getJavaProjectSrcFolder(project.getProject());
+ if (list != null && list.size() > 0) {
+ model.setSrcList(list);
+ model.setJavaSourceFolder(list.get(0));
+ } else {
+ return
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_No_SourceFolder);
+ }
+ } catch (JavaModelException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
if (scenario == WebServiceScenario.CLIENT) {
model.setWsdlURI(wsClient.getWebServiceClientInfo().getWsdlURL());
Definition definition = null;
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-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -1,5 +1,7 @@
package org.jboss.tools.ws.creation.core.commands;
+import java.util.List;
+
import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
@@ -10,6 +12,9 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.ws.internal.wsrt.IWebService;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
@@ -34,8 +39,10 @@
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
+ IJavaProject project = null;
try {
+ project =
JavaCore.create(JBossWSCreationUtils.getProjectByName(model.getWebProjectName()));
+ model.setJavaProject(project);
String location =
JBossWSCreationUtils.getJBossWSRuntimeLocation(JBossWSCreationUtils.getProjectByName(model.getWebProjectName()));
if (location.equals("")) { //$NON-NLS-1$
return StatusUtils
@@ -52,6 +59,18 @@
.errorStatus(JBossWSCreationCoreMessages.Error_WS_Location);
}
model.setTarget(JBossWSCreationCoreMessages.Value_Target_0);
+ try {
+ List<String> list =
JBossWSCreationUtils.getJavaProjectSrcFolder(project.getProject());
+ if (list != null && list.size() > 0) {
+ model.setSrcList(list);
+ model.setJavaSourceFolder(list.get(0));
+ } else {
+ return
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_No_SourceFolder);
+ }
+ } catch (JavaModelException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
if (scenario == WebServiceScenario.TOPDOWN) {
model.setWsdlURI(ws.getWebServiceInfo().getWsdlURL());
Definition definition = null;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/Java2WSCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/Java2WSCommand.java 2011-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/Java2WSCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -18,12 +18,10 @@
import java.util.jar.Manifest;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.utils.ClasspathParser;
-import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
/**
* @author Grid Qian
@@ -49,13 +47,8 @@
@Override
protected void addCommandlineArgs(List<String> command) throws IOException {
-
- String projectName = model.getWebProjectName();
- String projectRoot = JBossWSCreationUtils.getProjectRoot(projectName)
- .toOSString();
-
- IProject iProject = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(projectName);
+ String projectRoot = model.getJavaProject().getProject().getLocation().toOSString();
+ IProject iProject = model.getJavaProject().getProject();
if (model.isGenWSDL()) {
command.add("-w"); //$NON-NLS-1$
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2011-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -21,6 +21,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jst.j2ee.model.IModelProvider;
import org.eclipse.jst.j2ee.model.ModelProviderManager;
@@ -53,6 +54,7 @@
private ServiceModel model;
IStatus status;
+ private IJavaProject project;
private static String WEB_XML = "web.xml"; //$NON-NLS-1$
public MergeWebXMLCommand(ServiceModel model) {
@@ -73,17 +75,16 @@
for (int i = 0; i < serviceClasses.size(); i++) {
servletDescriptors[i] = getServletDescriptor(serviceClasses.get(i));
}
- IProject pro = JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName());
- if (!hasWebXML(pro)) {
- IVirtualComponent vc = ComponentCore.createComponent(pro);
+ project = model.getJavaProject();
+ if (!hasWebXML(project.getProject())) {
+ IVirtualComponent vc = ComponentCore.createComponent(project.getProject());
IDataModel model = DataModelFactory
.createDataModel(new WebCreateDeploymentFilesDataModelProvider());
model.setProperty(
ICreateDeploymentFilesDataModelProperties.GENERATE_DD, vc);
model.setProperty(
ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT,
- pro);
+ project.getProject());
IDataModelOperation op = model.getDefaultOperation();
try {
op.execute(new NullProgressMonitor(), null);
@@ -96,37 +97,28 @@
}
private void mergeWebXML(final ServletDescriptor[] servletDescriptors) {
- final IModelProvider provider = ModelProviderManager
- .getModelProvider(JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName()));
+ final IModelProvider provider =
ModelProviderManager.getModelProvider(project.getProject());
provider.modify(new Runnable() {
public void run() {
Object object = provider.getModelObject();
if (object instanceof WebApp) {
WebApp webApp = (WebApp) object;
for (int i = 0; i < servletDescriptors.length; i++) {
- addjeeServlet(JBossWSCreationUtils
- .getProjectByName(model.getWebProjectName()),
- servletDescriptors[i], webApp);
+ addjeeServlet(servletDescriptors[i], webApp);
}
}
if (object instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
org.eclipse.jst.j2ee.webapplication.WebApp webApp =
(org.eclipse.jst.j2ee.webapplication.WebApp) object;
for (int i = 0; i < servletDescriptors.length; i++) {
- addServlet(JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName()), servletDescriptors[i],
- webApp);
+ addServlet(servletDescriptors[i],webApp);
}
}
}
-
}, null);
}
@SuppressWarnings("unchecked")
- protected void addServlet(IProject projectByName,
- ServletDescriptor servletDescriptor,
- org.eclipse.jst.j2ee.webapplication.WebApp webapp) {
+ protected void addServlet(ServletDescriptor servletDescriptor,
org.eclipse.jst.j2ee.webapplication.WebApp webapp) {
@SuppressWarnings("rawtypes")
List theServlets = webapp.getServlets();
boolean b = false;
@@ -193,8 +185,7 @@
}
}
- public void addjeeServlet(IProject webProject,
- ServletDescriptor servletDescriptor, WebApp webapp) {
+ public void addjeeServlet(ServletDescriptor servletDescriptor, WebApp webapp) {
@SuppressWarnings("rawtypes")
List theServlets = webapp.getServlets();
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java 2011-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -23,11 +23,8 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import
org.jboss.tools.ws.core.classpath.JBossWSRuntimeClassPathInitializer.JBossWSRuntimeClasspathContainer;
-import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
-import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
/**
* @author Grid Qian
@@ -51,14 +48,7 @@
public IStatus executeOverride(IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS;
- IJavaProject project = null;
- try {
- project = JBossWSCreationUtils.getJavaProjectByName(model
- .getWebProjectName());
- } catch (JavaModelException e) {
- JBossWSCreationCorePlugin.getDefault().logError(e);
- return
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
- }
+ IJavaProject project = model.getJavaProject();
status = removeClassPath(project);
return status;
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceCreationCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceCreationCommand.java 2011-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceCreationCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -14,10 +14,8 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
public class ServiceCreationCommand extends AbstractDataModelOperation {
@@ -39,15 +37,7 @@
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- IJavaProject project = null;
- try {
- project = JBossWSCreationUtils.getJavaProjectByName(model
- .getWebProjectName());
- } catch (JavaModelException e) {
- JBossWSCreationCorePlugin.getDefault().logError(e);
- return StatusUtils
- .errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
- }
+ IJavaProject project = model.getJavaProject();
// find the class, make sure it's in the project and open if we find it
if (model.getServiceClasses() != null && model.getServiceClasses().size() == 1)
{
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java 2011-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -12,12 +12,9 @@
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
public class ServiceSampleCreationCommand extends AbstractDataModelOperation {
@@ -39,15 +36,7 @@
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- IJavaProject project = null;
- try {
- project = JBossWSCreationUtils.getJavaProjectByName(model
- .getWebProjectName());
- } catch (JavaModelException e) {
- JBossWSCreationCorePlugin.getDefault().logError(e);
- return StatusUtils
- .errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
- }
+ IJavaProject project = model.getJavaProject();
ICompilationUnit createdClass =
createJavaClass(model.getCustomPackage(), JBossWSCreationUtils
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java 2011-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -24,7 +24,6 @@
import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
-import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
/**
* @author Grid Qian
@@ -42,10 +41,8 @@
throws ExecutionException {
String implClass = model.getServiceClasses().get(0);
- String project = model.getWebProjectName();
try {
- IType type = JBossWSCreationUtils.getJavaProjectByName(project)
- .findType(implClass);
+ IType type = model.getJavaProject().findType(implClass);
if (type != null) {
if(!type.getPackageFragment().exists()||
type.getPackageFragment().isDefaultPackage()){
return StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_No_Package);
@@ -63,13 +60,13 @@
} else {
return StatusUtils.errorStatus(NLS.bind(
JBossWSCreationCoreMessages.Error_No_Class,
- new String[] { implClass, project }));
+ new String[] { implClass, model.getJavaProject().getProject().getName() }));
}
} catch (JavaModelException e) {
JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(NLS.bind(
JBossWSCreationCoreMessages.Error_No_Class, new String[] {
- implClass, project }));
+ implClass, model.getJavaProject().getProject().getName() }));
}
return Status.OK_STATUS;
}
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaHelpOptionCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaHelpOptionCommand.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaHelpOptionCommand.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -0,0 +1,115 @@
+package org.jboss.tools.ws.creation.core.commands;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
+import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
+
+public class WSDL2JavaHelpOptionCommand extends WSDL2JavaCommand {
+
+ private String helpOptions;
+ private Thread thread;
+
+ public WSDL2JavaHelpOptionCommand(ServiceModel model){
+ super(model);
+ }
+ protected void addCommandlineArgs(List<String> command) {
+ command.add("-h"); //$NON-NLS-1$
+ }
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ IStatus status = Status.OK_STATUS;
+ IProject project = model.getJavaProject().getProject();
+ String runtimeLocation;
+ try {
+ runtimeLocation = JBossWSCreationUtils.getJBossWSRuntimeLocation(project);
+ } catch (CoreException e1) {
+ return StatusUtils.errorStatus(e1);
+ }
+ String commandLocation = runtimeLocation + Path.SEPARATOR+ "bin";
//$NON-NLS-1$
+ IPath path = new Path(commandLocation);
+ List<String> command = new ArrayList<String>();
+ String[] env = getEnvironmentVariables(model.getJavaProject());
+ if (System.getProperty("os.name").toLowerCase().indexOf("win")
>= 0) { //$NON-NLS-1$ //$NON-NLS-2$
+ command.add("cmd.exe"); //$NON-NLS-1$
+ command.add("/c"); //$NON-NLS-1$
+ command.add(getCommandLineFileName_win());
+ path = path.append(getCommandLineFileName_win());
+ } else {
+ command.add("sh"); //$NON-NLS-1$
+ command.add(getCommandLineFileName_linux());
+ path = path.append(getCommandLineFileName_linux());
+ }
+ if (!path.toFile().getAbsoluteFile().exists()) {
+ return
StatusUtils.errorStatus(NLS.bind(JBossWSCreationCoreMessages.Error_Message_Command_File_Not_Found,
new String[] { path.toOSString() }));
+ }
+ addCommandlineArgs(command);
+ Process proc = null;
+ try {
+ proc = DebugPlugin.exec(command.toArray(new String[command.size()]), new
File(commandLocation), env);
+ } catch (CoreException e) {
+ return StatusUtils.errorStatus(e);
+ }
+ convertInputStreamToString(proc.getInputStream());
+ return status;
+ }
+
+ public void convertInputStreamToString(final InputStream input) {
+ final StringBuffer result = new StringBuffer();
+ thread = new Thread() {
+ public void run() {
+ try {
+ InputStreamReader ir = new InputStreamReader(input);
+ LineNumberReader reader = new LineNumberReader(ir);
+ String str;
+ str = reader.readLine();
+ boolean boo = false;
+ while (str != null) {
+ if (!boo && !"options:".equals(str.toLowerCase().trim())) {
//$NON-NLS-1$
+ str = reader.readLine();
+ continue;
+ }
+ if (!boo) {
+ boo = true;
+ }
+ if (JBossWSCreationUtils.isOptions(str)) {
+ str = str.replaceAll(" +", " "); //$NON-NLS-1$
//$NON-NLS-2$
+ result.append(str).append("\n"); //$NON-NLS-1$
+ }
+ str = reader.readLine();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ helpOptions = result.toString();
+ }
+ };
+ thread.start();
+ }
+ public Thread getThread() {
+ return thread;
+ }
+
+ public String getHelpOptions() {
+ return helpOptions;
+ }
+}
Property changes on:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaHelpOptionCommand.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -4,7 +4,10 @@
import java.util.List;
import javax.wsdl.Definition;
+import javax.wsdl.Service;
+import org.eclipse.jdt.core.IJavaProject;
+
public class ServiceModel {
private String webProjectName;
@@ -25,6 +28,10 @@
private String applicationName;
private String javaSourceFolder;
private Definition wsdlDefinition;
+ private IJavaProject project;
+ private Service service;
+ private String addOptions;
+ private List<String> srcList;
public int getWsScenario() {
return wsScenario;
@@ -188,4 +195,37 @@
public void setWsdlDefinition(Definition wsdlDefinition) {
this.wsdlDefinition = wsdlDefinition;
}
+
+ public IJavaProject getJavaProject() {
+ return project;
+ }
+
+ public void setJavaProject(IJavaProject project) {
+ this.project = project;
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ public String getAddOptions() {
+ return addOptions;
+ }
+
+ public void setAddOptions(String addOptions) {
+ this.addOptions = addOptions;
+ }
+
+ public List<String> getSrcList() {
+ return srcList;
+ }
+
+ public void setSrcList(List<String> srcList) {
+ this.srcList = srcList;
+ }
+
}
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-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2011-06-07
07:09:48 UTC (rev 31870)
@@ -2,6 +2,7 @@
AddRestEasyJarsCommand_RestEasy_JARS_Not_Found=Cannot find RestEasy JARs.
Value_Target_0=2.0
Value_Target_1=2.1
+Value_Target_2=2.2
Separator_Java=/
WebserviceClient_Annotation=WebServiceClient
Webservice_Annotation=WebService
@@ -15,24 +16,42 @@
Label_Custom_Package_Name=Package name
Label_Catalog_File=Catalog file
-Label_Button_Text_Seletion= &Add
+Label_Add_Button= &Add
Label_Generate_Impelemtation=Generate default Web Service Implementation classes
Label_Generate_WSDL=Generate WSDL file
Label_Binding_File=Binding files
Label_JaxWS_Target=JAX-WS specification
Label_Update_Webxml=Update the default Web.xml
Label_EnableSOAP12_Binding_Extension=Enable binding extension support (Only available for
JBossWS 3.0 or later)
-Label_Button_Text_Remove=Remove
+Label_Remove_Button=&Remove
Progress_Message_Generating=Generating Web Service resources...
Client_Sample_Run_Over= Call Over!
-Label_SourceFolder_Name=Source Folder:
+Label_Servlet_Name=Web Service
+Label_SourceFolder_Name=Source Folder
+Label_Service_Name=WSDL Service
+Label_Implcls_Name=Impl Class
+Label_AdditionalOption_Name=Additional Options
+Label_Help_Button=Help...
+Label__Browse_Button=Browse...
+Tooltip_AdditionalOption=The senior options for the generating process.(Only for senior
user, make sure your input is right)
+Tooltip_Servlet=The Web Service name used in web.xml
+Tooltip_Implcls=The Web Service implementation class Name
+Tooltip_Service=Specify one Service to generate codes. The service display
format(ServiceName#Service.Port, Service.Port...)
Tooltip_SourceFolder=Specify the source folder into which the generated code files are
written
+Tooltip_JaxWS_Target=Specify the JAX-WS Target Version
+Tooltip_Custom_Package=The package name that contains the generated codes
+Tooltip_Catalog_File=The catalog file used by the generating process
+Tooltip_BindingFile=The binding files used by the generating process
Error_Message_Invalid_Binding_File={0} is not a valid JAX-WS or JAXB binding file
Error_Message_Failed_To_Generate_Code=Failed to Generate Web Service code, please check
the log for more details
Error_Message_Failed_to_Generate_Implementation=Failed to generate implementation class
Error_Message_Command_File_Not_Found=The command file: "{0}" does not exist,
please check the JBoss Web Service runtime setting to make sure the location of JBoss Web
Service runtime is valid.
Error_Message_No_Runtime_Specified=No JBoss Web Service runtime has been specified.
+Error_Message_No_SourceFolder=No Source Folder is found in the Project
+Error_Message_No_Service=No correct Service in the WSDL file
+Error_Message_No_ServicePort=No ports in the Service
+Error_Message_No_ServletName=The Web Service Name isn't valid
Error_No_Annotation=This class has no required JAXWS Annotation!
Error_No_Class= The class {0} cannot be loaded via project {1}.Check that the project
contains the class, or that the class is loadable according to the Java Build Path of the
project.
Error_WS_Location=The JBoss WS Runtime Location is NULL. Please set the location on JBoss
WS preferences page.
@@ -46,4 +65,6 @@
RSMergeWebXMLCommand_REST_Servlet_Exists=RestEasy servlet already exists.
RSMergeWebXMLCommand_REST_Servlet_Mapping_Exists=RestEasy servlet mapping already
exists.
Confirm_Override_Servlet=Confirm Web Service Name Overwrite
-Confirm_Override_ImplClass=Confirm Web Service Implementation classes Overwrite
\ No newline at end of file
+Confirm_Override_ImplClass=Confirm Web Service Implementation classes Overwrite
+AdditionalOption_Dialog_Title=Web Service Generation Options
+No_Message_AdditionalOptions_Dialog=No senior options can be used.
\ No newline at end of file
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-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -9,6 +9,7 @@
public static String Value_Target_0;
public static String Value_Target_1;
+ public static String Value_Target_2;
public static String Separator_Java;
public static String WebserviceClient_Annotation;
public static String Webservice_Annotation;
@@ -21,23 +22,41 @@
public static String Label_Custom_Package_Name;
public static String Label_Catalog_File;
- public static String Label_Button_Text_Seletion;
+ public static String Label_Add_Button;
public static String Label_Binding_File;
public static String Label_Generate_Impelemtation;
public static String Label_Generate_WSDL;
public static String Label_JaxWS_Target;
public static String Label_Update_Webxml;
public static String Label_EnableSOAP12_Binding_Extension;
- public static String Label_Button_Text_Remove;
+ public static String Label_Remove_Button;
+ public static String Label__Browse_Button;
public static String Progress_Message_Generating;
public static String Client_Sample_Run_Over;
public static String Label_SourceFolder_Name;
+ public static String Label_Service_Name;
+ public static String Label_Implcls_Name;
+ public static String Label_Servlet_Name;
+ public static String Label_AdditionalOption_Name;
+ public static String Label_Help_Button;
+ public static String Tooltip_AdditionalOption;
+ public static String Tooltip_Implcls;
+ public static String Tooltip_Servlet;
+ public static String Tooltip_Service;
public static String Tooltip_SourceFolder;
+ public static String Tooltip_JaxWS_Target;
+ public static String Tooltip_Custom_Package;
+ public static String Tooltip_Catalog_File;
+ public static String Tooltip_BindingFile;
public static String Error_Message_Invalid_Binding_File;
public static String Error_Message_Failed_To_Generate_Code;
public static String Error_Message_Failed_to_Generate_Implementation;
public static String Error_Message_Command_File_Not_Found;
+ public static String Error_Message_No_SourceFolder;
+ public static String Error_Message_No_Service;
+ public static String Error_Message_No_ServletName;
+ public static String Error_Message_No_ServicePort;
public static String Error_No_Annotation;
public static String Error_No_Class;
public static String Error_No_Package;
@@ -55,6 +74,8 @@
public static String RSMergeWebXMLCommand_REST_Servlet_Exists;
public static String RSMergeWebXMLCommand_REST_Servlet_Mapping_Exists;
+ public static String AdditionalOption_Dialog_Title;
+ public static String No_Message_AdditionalOptions_Dialog;
public static String Confirm_Override_Servlet;
public static String Confirm_Override_ImplClass;
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-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -430,6 +430,22 @@
}
return src;
}
+
+ public static List<String> getJavaProjectSrcFolder(IProject project) throws
JavaModelException{
+ IPackageFragmentRoot[] packageFragmentRoots = JavaCore.create(
+ project).getAllPackageFragmentRoots();
+ if (packageFragmentRoots != null && packageFragmentRoots.length > 0) {
+ List<String> list = new ArrayList<String>();
+ for (int i = 0; i < packageFragmentRoots.length; i++) {
+ IPackageFragmentRoot packageFragmentRoot = packageFragmentRoots[i];
+ if (packageFragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE) {
+ list.add(packageFragmentRoot.getResource().getFullPath().toOSString());
+ }
+ }
+ return list;
+ }
+ return null;
+ }
public static IResource[] getJavaSourceRoots(IJavaProject javaProject)
throws JavaModelException {
@@ -609,5 +625,26 @@
Definition def = wsdlReader.readWSDL(wsdlURL);
return def;
}
+
+ public static boolean isOptions(String str) {
+ String[] isUsed = {
+ "-k", "-s", "-o", "-p", "-b",
"-c", "-t", "-e", "-v", "-h",
"-w" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$ //$NON-NLS-5$
//$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
+ boolean boo = true;
+ for (int i = 0; i < isUsed.length; i++) {
+ if (str.trim().startsWith(isUsed[i])) {
+ boo = false;
+ break;
+ }
+ }
+ return boo;
+ }
+
+ public static IPackageFragmentRoot getPackageFragmentRoot(IJavaProject project, String
src) throws JavaModelException {
+ IPath path = new Path(JBossWSCreationUtils.getCustomSrcLocation(src));
+ String str = project.getProject().getName() + File.separator +
path.makeRelativeTo(project.getProject().getLocation());
+ IPath path1 = new Path(str);
+ IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path1);
+ return project.getPackageFragmentRoot(res);
+ }
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/RestEasyLibUtils.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/RestEasyLibUtils.java 2011-06-07
07:08:56 UTC (rev 31869)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/RestEasyLibUtils.java 2011-06-07
07:09:48 UTC (rev 31870)
@@ -29,7 +29,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
/**