|
Lines 1-16
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2003, 2004 IBM Corporation and others. |
2 |
* Copyright (c) 2003, 2006 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* yyyymmdd bug Email and other contact information |
| 11 |
* -------- -------- ----------------------------------------------------------- |
| 12 |
* 20060216 115144 pmoogk@ca.ibm.com - Peter Moogk |
| 10 |
*******************************************************************************/ |
13 |
*******************************************************************************/ |
| 11 |
package org.eclipse.jst.ws.internal.axis.consumption.ui.command; |
14 |
package org.eclipse.jst.ws.internal.axis.consumption.ui.command; |
| 12 |
|
15 |
|
| 13 |
|
|
|
| 14 |
import org.eclipse.core.resources.IFolder; |
16 |
import org.eclipse.core.resources.IFolder; |
| 15 |
import org.eclipse.core.resources.IProject; |
17 |
import org.eclipse.core.resources.IProject; |
| 16 |
import org.eclipse.core.resources.IResource; |
18 |
import org.eclipse.core.resources.IResource; |
|
Lines 18-23
Link Here
|
| 18 |
import org.eclipse.core.runtime.IPath; |
20 |
import org.eclipse.core.runtime.IPath; |
| 19 |
import org.eclipse.core.runtime.IProgressMonitor; |
21 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 20 |
import org.eclipse.core.runtime.IStatus; |
22 |
import org.eclipse.core.runtime.IStatus; |
|
|
23 |
import org.eclipse.core.runtime.Path; |
| 21 |
import org.eclipse.core.runtime.Status; |
24 |
import org.eclipse.core.runtime.Status; |
| 22 |
import org.eclipse.jdt.core.IJavaProject; |
25 |
import org.eclipse.jdt.core.IJavaProject; |
| 23 |
import org.eclipse.jdt.core.JavaCore; |
26 |
import org.eclipse.jdt.core.JavaCore; |
|
Lines 31-157
Link Here
|
| 31 |
import org.eclipse.wst.common.environment.IEnvironment; |
34 |
import org.eclipse.wst.common.environment.IEnvironment; |
| 32 |
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; |
35 |
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; |
| 33 |
|
36 |
|
|
|
37 |
public class DefaultsForClientJavaWSDLCommand extends AbstractDataModelOperation |
| 38 |
{ |
| 39 |
private JavaWSDLParameter javaWSDLParam_; |
| 40 |
private IProject proxyProject_; |
| 41 |
private String WSDLServiceURL_; |
| 42 |
private String WSDLServicePathname_; |
| 43 |
private String outputFolder_; |
| 34 |
|
44 |
|
| 35 |
public class DefaultsForClientJavaWSDLCommand extends AbstractDataModelOperation { |
45 |
public DefaultsForClientJavaWSDLCommand() |
| 36 |
|
46 |
{ |
| 37 |
private JavaWSDLParameter javaWSDLParam_; |
|
|
| 38 |
private IProject proxyProject_; |
| 39 |
private String WSDLServiceURL_; |
| 40 |
private String WSDLServicePathname_; |
| 41 |
|
| 42 |
public DefaultsForClientJavaWSDLCommand( ) { |
| 43 |
} |
47 |
} |
| 44 |
|
48 |
|
| 45 |
public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) |
49 |
public IStatus execute(IProgressMonitor monitor, IAdaptable adaptable) |
| 46 |
{ |
50 |
{ |
| 47 |
IEnvironment environment = getEnvironment(); |
51 |
IEnvironment environment = getEnvironment(); |
| 48 |
IStatus status; |
52 |
IStatus status; |
| 49 |
if (javaWSDLParam_ == null) { |
53 |
|
| 50 |
status = StatusUtils.errorStatus( |
54 |
if( outputFolder_ == null ) |
| 51 |
AxisConsumptionCoreMessages.MSG_ERROR_JAVA_WSDL_PARAM_NOT_SET); |
55 |
{ |
|
|
56 |
IPath[] paths = ResourceUtils.getAllJavaSourceLocations(proxyProject_); |
| 57 |
outputFolder_ = paths[0].toString(); |
| 58 |
} |
| 59 |
|
| 60 |
if (javaWSDLParam_ == null) |
| 61 |
{ |
| 62 |
status = StatusUtils |
| 63 |
.errorStatus(AxisConsumptionCoreMessages.MSG_ERROR_JAVA_WSDL_PARAM_NOT_SET); |
| 52 |
environment.getStatusHandler().reportError(status); |
64 |
environment.getStatusHandler().reportError(status); |
| 53 |
return status; |
65 |
return status; |
| 54 |
} |
66 |
} |
| 55 |
|
|
|
| 56 |
javaWSDLParam_.setMetaInfOnly(false); |
67 |
javaWSDLParam_.setMetaInfOnly(false); |
| 57 |
javaWSDLParam_.setServerSide(JavaWSDLParameter.SERVER_SIDE_NONE); |
68 |
javaWSDLParam_.setServerSide(JavaWSDLParameter.SERVER_SIDE_NONE); |
| 58 |
|
69 |
ModuleCoreNature mn = ModuleCoreNature.getModuleCoreNature(proxyProject_); |
| 59 |
ModuleCoreNature mn = ModuleCoreNature.getModuleCoreNature(proxyProject_); |
70 |
if (mn != null) |
| 60 |
if (mn!=null) |
71 |
{ |
| 61 |
{ |
72 |
IPath webModuleServerRoot = ResourceUtils.getJavaSourceLocation(proxyProject_); |
| 62 |
IPath webModuleServerRoot = ResourceUtils.getJavaSourceLocation(proxyProject_ ); |
73 |
// String output = PlatformUtils.getPlatformURL(webModuleServerRoot); |
| 63 |
//String output = PlatformUtils.getPlatformURL(webModuleServerRoot); |
74 |
String output = ResourceUtils.findResource(webModuleServerRoot).getLocation().toString(); |
| 64 |
String output = ResourceUtils.findResource(webModuleServerRoot).getLocation().toString(); |
75 |
// String output = |
| 65 |
// String output = ResourceUtils.getWorkspaceRoot().getFolder(webModuleServerRoot).getLocation().toString(); |
76 |
// ResourceUtils.getWorkspaceRoot().getFolder(webModuleServerRoot).getLocation().toString(); |
| 66 |
javaWSDLParam_.setJavaOutput(output); |
77 |
IPath javaOutput = ResourceUtils.findResource( new Path( outputFolder_ )).getLocation(); |
| 67 |
|
78 |
javaWSDLParam_.setJavaOutput(javaOutput.toString()); |
| 68 |
|
79 |
|
| 69 |
IFolder webModuleContainer = ResourceUtils.getWebComponentServerRoot(proxyProject_); |
80 |
IFolder webModuleContainer = ResourceUtils.getWebComponentServerRoot(proxyProject_); |
| 70 |
if (webModuleContainer !=null) |
81 |
if (webModuleContainer != null) |
| 71 |
{ |
82 |
{ |
| 72 |
IPath webModulePath = webModuleContainer.getFullPath(); |
83 |
IPath webModulePath = webModuleContainer.getFullPath(); |
| 73 |
//output = PlatformUtils.getPlatformURL(webModulePath); |
84 |
// output = PlatformUtils.getPlatformURL(webModulePath); |
| 74 |
IResource res = ResourceUtils.findResource(webModulePath); |
85 |
IResource res = ResourceUtils.findResource(webModulePath); |
| 75 |
if (res!=null){ |
86 |
if (res != null) |
| 76 |
output = res.getLocation().toString(); |
87 |
{ |
| 77 |
} |
88 |
output = res.getLocation().toString(); |
| 78 |
javaWSDLParam_.setOutput(output); |
89 |
} |
| 79 |
} |
|
|
| 80 |
} |
| 81 |
else |
| 82 |
{ |
| 83 |
//Check if it's a plain old Java project |
| 84 |
IJavaProject javaProject = null; |
| 85 |
|
| 86 |
javaProject = JavaCore.create(proxyProject_); |
| 87 |
if (javaProject != null) |
| 88 |
{ |
| 89 |
IPath webModuleServerRoot = ResourceUtils.getJavaSourceLocation(proxyProject_); |
| 90 |
String output = ResourceUtils.findResource(webModuleServerRoot).getLocation().toString(); |
| 91 |
javaWSDLParam_.setJavaOutput(output); |
| 92 |
javaWSDLParam_.setOutput(output); |
90 |
javaWSDLParam_.setOutput(output); |
| 93 |
} |
91 |
} |
| 94 |
else |
92 |
} |
| 95 |
{ |
93 |
else |
| 96 |
//Not familiar with this kind of project |
94 |
{ |
| 97 |
status = StatusUtils.errorStatus( AxisConsumptionUIMessages.MSG_WARN_NO_JAVA_NATURE); |
95 |
// Check if it's a plain old Java project |
| 98 |
environment.getStatusHandler().reportError(status); |
96 |
IJavaProject javaProject = null; |
| 99 |
return status; |
97 |
javaProject = JavaCore.create(proxyProject_); |
| 100 |
|
98 |
if (javaProject != null) |
| 101 |
} |
99 |
{ |
| 102 |
} |
100 |
IPath output = ResourceUtils.findResource( new Path( outputFolder_ )).getLocation(); |
| 103 |
|
101 |
javaWSDLParam_.setJavaOutput(output.toString()); |
| 104 |
|
102 |
javaWSDLParam_.setOutput(output.toString()); |
| 105 |
|
103 |
} |
| 106 |
if (WSDLServicePathname_ == null) { |
104 |
else |
| 107 |
|
105 |
{ |
| 108 |
if (WSDLServiceURL_ == null) { |
106 |
// Not familiar with this kind of project |
| 109 |
status = StatusUtils.errorStatus( |
107 |
status = StatusUtils.errorStatus(AxisConsumptionUIMessages.MSG_WARN_NO_JAVA_NATURE); |
| 110 |
AxisConsumptionUIMessages.MSG_ERROR_WSDL_LOCATION_NOT_SET); |
108 |
environment.getStatusHandler().reportError(status); |
|
|
109 |
return status; |
| 110 |
} |
| 111 |
} |
| 112 |
if (WSDLServicePathname_ == null) |
| 113 |
{ |
| 114 |
if (WSDLServiceURL_ == null) |
| 115 |
{ |
| 116 |
status = StatusUtils.errorStatus(AxisConsumptionUIMessages.MSG_ERROR_WSDL_LOCATION_NOT_SET); |
| 111 |
environment.getStatusHandler().reportError(status); |
117 |
environment.getStatusHandler().reportError(status); |
| 112 |
return status; |
118 |
return status; |
| 113 |
} |
119 |
} |
| 114 |
} else { |
120 |
} |
|
|
121 |
else |
| 122 |
{ |
| 115 |
WSDLServiceURL_ = PlatformUtils.getFileFromPlatform(WSDLServicePathname_); |
123 |
WSDLServiceURL_ = PlatformUtils.getFileFromPlatform(WSDLServicePathname_); |
| 116 |
} |
124 |
} |
| 117 |
|
|
|
| 118 |
javaWSDLParam_.setInputWsdlLocation(WSDLServiceURL_); |
125 |
javaWSDLParam_.setInputWsdlLocation(WSDLServiceURL_); |
| 119 |
|
|
|
| 120 |
return Status.OK_STATUS; |
126 |
return Status.OK_STATUS; |
| 121 |
} |
127 |
} |
| 122 |
|
128 |
|
| 123 |
/** |
129 |
/** |
| 124 |
* Returns the javaWSDLParam. |
130 |
* Returns the javaWSDLParam. |
|
|
131 |
* |
| 125 |
* @return JavaWSDLParameter |
132 |
* @return JavaWSDLParameter |
| 126 |
*/ |
133 |
*/ |
| 127 |
public JavaWSDLParameter getJavaWSDLParam() { |
134 |
public JavaWSDLParameter getJavaWSDLParam() |
|
|
135 |
{ |
| 128 |
return javaWSDLParam_; |
136 |
return javaWSDLParam_; |
| 129 |
} |
137 |
} |
| 130 |
|
138 |
|
| 131 |
/** |
139 |
/** |
| 132 |
* Sets the javaWSDLParam. |
140 |
* Sets the javaWSDLParam. |
| 133 |
* @param javaWSDLParam The javaWSDLParam to set |
141 |
* |
|
|
142 |
* @param javaWSDLParam |
| 143 |
* The javaWSDLParam to set |
| 134 |
*/ |
144 |
*/ |
| 135 |
public void setJavaWSDLParam(JavaWSDLParameter javaWSDLParam) { |
145 |
public void setJavaWSDLParam(JavaWSDLParameter javaWSDLParam) |
|
|
146 |
{ |
| 136 |
this.javaWSDLParam_ = javaWSDLParam; |
147 |
this.javaWSDLParam_ = javaWSDLParam; |
| 137 |
} |
148 |
} |
| 138 |
|
149 |
|
| 139 |
/** |
150 |
/** |
| 140 |
* @param proxyProject_ The proxyProject_ to set. |
151 |
* @param proxyProject_ |
|
|
152 |
* The proxyProject_ to set. |
| 141 |
*/ |
153 |
*/ |
| 142 |
public void setProxyProject(IProject proxyProject) { |
154 |
public void setProxyProject(IProject proxyProject) |
|
|
155 |
{ |
| 143 |
this.proxyProject_ = proxyProject; |
156 |
this.proxyProject_ = proxyProject; |
| 144 |
} |
157 |
} |
|
|
158 |
|
| 145 |
/** |
159 |
/** |
| 146 |
* @param serviceURL_ The wSDLServiceURL_ to set. |
160 |
* @param serviceURL_ |
|
|
161 |
* The wSDLServiceURL_ to set. |
| 147 |
*/ |
162 |
*/ |
| 148 |
public void setWSDLServiceURL(String serviceURL) { |
163 |
public void setWSDLServiceURL(String serviceURL) |
|
|
164 |
{ |
| 149 |
WSDLServiceURL_ = serviceURL; |
165 |
WSDLServiceURL_ = serviceURL; |
| 150 |
} |
166 |
} |
|
|
167 |
|
| 151 |
/** |
168 |
/** |
| 152 |
* @param servicePathname_ The wSDLServicePathname_ to set. |
169 |
* @param servicePathname_ |
|
|
170 |
* The wSDLServicePathname_ to set. |
| 153 |
*/ |
171 |
*/ |
| 154 |
public void setWSDLServicePathname(String servicePathname) { |
172 |
public void setWSDLServicePathname(String servicePathname) |
|
|
173 |
{ |
| 155 |
WSDLServicePathname_ = servicePathname; |
174 |
WSDLServicePathname_ = servicePathname; |
| 156 |
} |
175 |
} |
|
|
176 |
|
| 177 |
public String getOutputFolder() |
| 178 |
{ |
| 179 |
return outputFolder_; |
| 180 |
} |
| 181 |
|
| 182 |
public void setOutputFolder(String outputFolder) |
| 183 |
{ |
| 184 |
outputFolder_ = outputFolder; |
| 185 |
} |
| 157 |
} |
186 |
} |