|
Lines 1-25
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2004 IBM Corporation and others. |
2 |
* Copyright (c) 2004, 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 |
10 |
* yyyymmdd bug Email and other contact information |
| 11 |
* -------- -------- ----------------------------------------------------------- |
11 |
* -------- -------- ----------------------------------------------------------- |
| 12 |
* 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner |
12 |
* 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner |
|
|
13 |
* 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner |
| 13 |
*******************************************************************************/ |
14 |
*******************************************************************************/ |
| 14 |
package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; |
15 |
package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; |
| 15 |
|
16 |
|
| 16 |
import org.eclipse.core.commands.ExecutionException; |
17 |
import org.eclipse.core.commands.ExecutionException; |
|
|
18 |
import org.eclipse.core.resources.IProject; |
| 17 |
import org.eclipse.core.runtime.IAdaptable; |
19 |
import org.eclipse.core.runtime.IAdaptable; |
| 18 |
import org.eclipse.core.runtime.IProgressMonitor; |
20 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 19 |
import org.eclipse.core.runtime.IStatus; |
21 |
import org.eclipse.core.runtime.IStatus; |
| 20 |
import org.eclipse.core.runtime.Status; |
22 |
import org.eclipse.core.runtime.Status; |
|
|
23 |
import org.eclipse.jem.util.emf.workbench.ProjectUtilities; |
| 21 |
import org.eclipse.jst.ws.internal.common.ServerUtils; |
24 |
import org.eclipse.jst.ws.internal.common.ServerUtils; |
| 22 |
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; |
25 |
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; |
|
|
26 |
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor; |
| 23 |
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; |
27 |
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; |
| 24 |
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; |
28 |
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; |
| 25 |
import org.eclipse.osgi.util.NLS; |
29 |
import org.eclipse.osgi.util.NLS; |
|
Lines 33-38
Link Here
|
| 33 |
|
37 |
|
| 34 |
public class ServerExtensionDefaultingCommand extends AbstractDataModelOperation |
38 |
public class ServerExtensionDefaultingCommand extends AbstractDataModelOperation |
| 35 |
{ |
39 |
{ |
|
|
40 |
private Boolean deployService; |
| 36 |
private Boolean installService; |
41 |
private Boolean installService; |
| 37 |
private Boolean startService; |
42 |
private Boolean startService; |
| 38 |
private Boolean testService; |
43 |
private Boolean testService; |
|
Lines 171-176
Link Here
|
| 171 |
} |
176 |
} |
| 172 |
|
177 |
|
| 173 |
/** |
178 |
/** |
|
|
179 |
* @return Returns the deployService. |
| 180 |
*/ |
| 181 |
public Boolean getDeployService() |
| 182 |
{ |
| 183 |
return deployService; |
| 184 |
} |
| 185 |
|
| 186 |
/** |
| 174 |
* @return Returns the installService. |
187 |
* @return Returns the installService. |
| 175 |
*/ |
188 |
*/ |
| 176 |
public Boolean getInstallService() |
189 |
public Boolean getInstallService() |
|
Lines 296-301
Link Here
|
| 296 |
//when the user clicks Finish prior to page 3 of the wizard. |
309 |
//when the user clicks Finish prior to page 3 of the wizard. |
| 297 |
|
310 |
|
| 298 |
IStatus status = Status.OK_STATUS; |
311 |
IStatus status = Status.OK_STATUS; |
|
|
312 |
|
| 313 |
//default deployService to true. It will get set to false later if there is no |
| 314 |
//server type selected. |
| 315 |
deployService = Boolean.TRUE; |
| 316 |
|
| 299 |
String scenario = ConsumptionUIMessages.MSG_SERVICE_SUB; |
317 |
String scenario = ConsumptionUIMessages.MSG_SERVICE_SUB; |
| 300 |
|
318 |
|
| 301 |
//Ensure server and runtime are non-null |
319 |
//Ensure server and runtime are non-null |
|
Lines 311-338
Link Here
|
| 311 |
|
329 |
|
| 312 |
if( serverId == null || serverId.length()==0) |
330 |
if( serverId == null || serverId.length()==0) |
| 313 |
{ |
331 |
{ |
| 314 |
status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER, new String[]{ scenario } ) ); |
332 |
//Popup and error if the selected service project does not exist. |
| 315 |
env.getStatusHandler().reportError(status); |
333 |
IProject serviceProject = ProjectUtilities.getProject(serviceProjectName_); |
| 316 |
} |
334 |
if (!serviceProject.exists()) |
| 317 |
|
335 |
{ |
| 318 |
//ensure the server, runtime, and type are compatible |
336 |
String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); |
| 319 |
if (!WebServiceRuntimeExtensionUtils2.isServerRuntimeTypeSupported(serverId, runtimeId, typeId)) |
337 |
status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_ERROR_NO_SERVER_RUNTIME, new String[]{ runtimeLabel } ) ); |
| 320 |
{ |
338 |
env.getStatusHandler().reportError(status); |
| 321 |
String serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId); |
339 |
} |
| 322 |
String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); |
340 |
else |
| 323 |
status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, new String[]{ serverLabel, runtimeLabel } ) ); |
341 |
{ |
| 324 |
env.getStatusHandler().reportError(status); |
342 |
|
|
|
343 |
RuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getRuntimeById(runtimeId); |
| 344 |
if (desc.getServerRequired()) |
| 345 |
{ |
| 346 |
status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER, new String[] { scenario })); |
| 347 |
env.getStatusHandler().reportError(status); |
| 348 |
} |
| 349 |
else |
| 350 |
{ |
| 351 |
// No server has been selected and the selected Web service runtime |
| 352 |
// does not require a server. Set deploy, install, run, and test to false. |
| 353 |
deployService = Boolean.FALSE; |
| 354 |
installService = Boolean.FALSE; |
| 355 |
startService = Boolean.FALSE; |
| 356 |
testService = Boolean.FALSE; |
| 357 |
} |
| 358 |
} |
| 325 |
} |
359 |
} |
| 326 |
|
360 |
|
| 327 |
//Determine if the selected server type has only stub runtimes associated with it. |
361 |
//If the server is non-null, ensure the server, runtime, and type are compatible |
| 328 |
//If so, set install, run, and test to false in the context. |
362 |
if (serverId != null && serverId.length() > 0) |
| 329 |
IRuntime nonStubRuntime = ServerUtils.getNonStubRuntime(serverId); |
|
|
| 330 |
if (nonStubRuntime == null) |
| 331 |
{ |
363 |
{ |
| 332 |
installService = Boolean.FALSE; |
364 |
if (!WebServiceRuntimeExtensionUtils2.isServerRuntimeTypeSupported(serverId, runtimeId, typeId)) |
| 333 |
startService = Boolean.FALSE; |
365 |
{ |
| 334 |
testService = Boolean.FALSE; |
366 |
String serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId); |
|
|
367 |
String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); |
| 368 |
status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, new String[] { serverLabel, |
| 369 |
runtimeLabel })); |
| 370 |
env.getStatusHandler().reportError(status); |
| 371 |
} |
| 372 |
|
| 373 |
// Determine if the selected server type has only stub runtimes associated |
| 374 |
// with it. |
| 375 |
// If so, set install, run, and test to false in the context. |
| 376 |
IRuntime nonStubRuntime = ServerUtils.getNonStubRuntime(serverId); |
| 377 |
if (nonStubRuntime == null) |
| 378 |
{ |
| 379 |
installService = Boolean.FALSE; |
| 380 |
startService = Boolean.FALSE; |
| 381 |
testService = Boolean.FALSE; |
| 382 |
} |
| 335 |
} |
383 |
} |
|
|
384 |
|
| 336 |
return status; |
385 |
return status; |
| 337 |
} |
386 |
} |
| 338 |
} |
387 |
} |