|
Lines 34-39
Link Here
|
| 34 |
import org.eclipse.wst.command.internal.env.core.data.Transformer; |
34 |
import org.eclipse.wst.command.internal.env.core.data.Transformer; |
| 35 |
import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; |
35 |
import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; |
| 36 |
import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment; |
36 |
import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment; |
|
|
37 |
import org.eclipse.wst.command.internal.env.plugin.EnvPlugin; |
| 37 |
import org.eclipse.wst.common.environment.ILog; |
38 |
import org.eclipse.wst.common.environment.ILog; |
| 38 |
import org.eclipse.wst.common.environment.IStatusHandler; |
39 |
import org.eclipse.wst.common.environment.IStatusHandler; |
| 39 |
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; |
40 |
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; |
|
Lines 53-59
Link Here
|
| 53 |
private Hashtable operationDataRecord_ = new Hashtable(); |
54 |
private Hashtable operationDataRecord_ = new Hashtable(); |
| 54 |
private boolean mappingComplete_; |
55 |
private boolean mappingComplete_; |
| 55 |
private ClassEntry classEntry; |
56 |
private ClassEntry classEntry; |
| 56 |
|
57 |
|
| 57 |
// extensionPoint names and namespace |
58 |
// extensionPoint names and namespace |
| 58 |
private static String MAPPER_EXT_PT = "antDataMapping"; //$NON-NLS-1$ |
59 |
private static String MAPPER_EXT_PT = "antDataMapping"; //$NON-NLS-1$ |
| 59 |
private static String SCENARIO_EXT_PT = "antScenario"; //$NON-NLS-1$ |
60 |
private static String SCENARIO_EXT_PT = "antScenario"; //$NON-NLS-1$ |
|
Lines 64-74
Link Here
|
| 64 |
private static final String MAPPER_KEY_ATTRIBUTE= "key"; //$NON-NLS-1$ |
65 |
private static final String MAPPER_KEY_ATTRIBUTE= "key"; //$NON-NLS-1$ |
| 65 |
private static final String MAPPER_PROPERTY_ATTRIBUTE= "property"; //$NON-NLS-1$ |
66 |
private static final String MAPPER_PROPERTY_ATTRIBUTE= "property"; //$NON-NLS-1$ |
| 66 |
private static final String MAPPER_TRANSFORM_ATTRIBUTE= "transform"; //$NON-NLS-1$ |
67 |
private static final String MAPPER_TRANSFORM_ATTRIBUTE= "transform"; //$NON-NLS-1$ |
|
|
68 |
private static final String MAPPER_REQUIRED_ATTRIBUTE= "required"; //$NON-NLS-1$ |
| 67 |
|
69 |
|
| 68 |
// antScenario extension point attributes |
70 |
// antScenario extension point attributes |
| 69 |
private static final String SCENARIO_TYPE_ATTRIBUTE = "scenarioType"; //$NON-NLS-1$ |
71 |
private static final String SCENARIO_TYPE_ATTRIBUTE = "ScenarioType"; //$NON-NLS-1$ |
| 70 |
private static final String SCENARIO_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ |
72 |
private static final String SCENARIO_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ |
| 71 |
|
73 |
|
|
|
74 |
// name of property for listing information |
| 75 |
private static final String VERBOSE_PROPERTY = "Verbose"; //$NON-NLS-1$ |
| 76 |
|
| 72 |
private AntController controller_; |
77 |
private AntController controller_; |
| 73 |
|
78 |
|
| 74 |
public AntEnvironment(AntController controller, ResourceContext context, IStatusHandler handler, Hashtable properties) |
79 |
public AntEnvironment(AntController controller, ResourceContext context, IStatusHandler handler, Hashtable properties) |
|
Lines 78-88
Link Here
|
| 78 |
controller_ = controller; |
83 |
controller_ = controller; |
| 79 |
} |
84 |
} |
| 80 |
|
85 |
|
|
|
86 |
public boolean verbose() |
| 87 |
{ |
| 88 |
String verbose=getProperty(VERBOSE_PROPERTY); |
| 89 |
|
| 90 |
if (verbose != null) |
| 91 |
{ |
| 92 |
verbose = verbose.toLowerCase(); |
| 93 |
if (verbose.equals("true")) |
| 94 |
return true; |
| 95 |
} |
| 96 |
return false; |
| 97 |
} |
| 98 |
|
| 81 |
// returns String since the property table built by Ant is property value pairs where the value is a String |
99 |
// returns String since the property table built by Ant is property value pairs where the value is a String |
| 82 |
private String getProperty(String key) |
100 |
private String getProperty(String key) |
| 83 |
{ |
101 |
{ |
| 84 |
Object property = antProperties_.get(key); |
102 |
Object property = antProperties_.get(key); |
| 85 |
if (property != null) |
103 |
if (property != null && (!property.toString().equals(""))) |
| 86 |
return property.toString().trim(); |
104 |
return property.toString().trim(); |
| 87 |
return null; |
105 |
return null; |
| 88 |
} |
106 |
} |
|
Lines 209-215
Link Here
|
| 209 |
catch (CoreException cex) { |
227 |
catch (CoreException cex) { |
| 210 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5092, cex.getMessage(), cex); |
228 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5092, cex.getMessage(), cex); |
| 211 |
getStatusHandler().reportError(errorStatus); |
229 |
getStatusHandler().reportError(errorStatus); |
| 212 |
getLog().log(ILog.ERROR, "ws_ant", 5092, this, "getMappingExtensions", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERR_ANT_DATA_TRANSFORM, key, transform)); |
230 |
getLog().log(ILog.ERROR, "ws_ant", 5092, this, "getMappingExtensions", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_DATA_TRANSFORM, key, transform)); |
| 213 |
throw new CoreException(errorStatus); |
231 |
throw new CoreException(errorStatus); |
| 214 |
} |
232 |
} |
| 215 |
|
233 |
|
|
Lines 244-250
Link Here
|
| 244 |
holder.value_ = value; |
262 |
holder.value_ = value; |
| 245 |
dataTable.put(property, holder); |
263 |
dataTable.put(property, holder); |
| 246 |
} |
264 |
} |
| 247 |
} |
265 |
} |
|
|
266 |
else if(ce.getAttribute(MAPPER_REQUIRED_ATTRIBUTE)!=null && ce.getAttribute(MAPPER_REQUIRED_ATTRIBUTE).equals("true")) |
| 267 |
{ |
| 268 |
String msg = EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_REQUIRED_PROPERTY, key.toString()); |
| 269 |
Status statusObj = new Status(IStatus.ERROR, |
| 270 |
EnvPlugin.ID, |
| 271 |
IStatus.ERROR, |
| 272 |
msg, |
| 273 |
null); |
| 274 |
getStatusHandler().reportError(statusObj); |
| 275 |
getLog().log(ILog.ERROR, "ws_ant", 9999, this, "getMappingExtensions", msg); |
| 276 |
} |
| 277 |
else if (verbose()) |
| 278 |
{ |
| 279 |
String msg = EnvironmentMessages.bind(EnvironmentMessages.MSG_INFO_ANT__PROPERTY_DEFAULT, key.toString()); |
| 280 |
Status statusObj = new Status(IStatus.INFO, |
| 281 |
EnvPlugin.ID, |
| 282 |
IStatus.INFO, |
| 283 |
msg, |
| 284 |
null); |
| 285 |
getStatusHandler().reportInfo(statusObj); |
| 286 |
getLog().log(ILog.INFO, "ws_ant", 9999, this, "getMappingExtensions", msg); |
| 287 |
} |
| 248 |
} |
288 |
} |
| 249 |
} |
289 |
} |
| 250 |
return dataTable.elements(); |
290 |
return dataTable.elements(); |
|
Lines 279-285
Link Here
|
| 279 |
catch (Exception exc) |
319 |
catch (Exception exc) |
| 280 |
{ |
320 |
{ |
| 281 |
getStatusHandler().reportError(new Status(Status.ERROR, "ws_ant", 5093, exc.getMessage(), exc)); |
321 |
getStatusHandler().reportError(new Status(Status.ERROR, "ws_ant", 5093, exc.getMessage(), exc)); |
| 282 |
getLog().log(ILog.ERROR, "ws_ant", 5093, this, "transformAndSet", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERR_ANT_DATA_TRANSFORM, mapping.key_, mapping.transform_)); |
322 |
getLog().log(ILog.ERROR, "ws_ant", 5093, this, "transformAndSet", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_DATA_TRANSFORM, mapping.key_, mapping.transform_)); |
| 283 |
throw new IllegalArgumentException(exc.getMessage()); |
323 |
throw new IllegalArgumentException(exc.getMessage()); |
| 284 |
} |
324 |
} |
| 285 |
} |
325 |
} |
|
Lines 372-378
Link Here
|
| 372 |
catch(Exception cex){ |
412 |
catch(Exception cex){ |
| 373 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5094, cex.getMessage(), cex); |
413 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5094, cex.getMessage(), cex); |
| 374 |
getStatusHandler().reportError(errorStatus); |
414 |
getStatusHandler().reportError(errorStatus); |
| 375 |
getLog().log(ILog.ERROR, "ws_ant", 5094, this, "callSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERR_ANT_CALL_SETTER, setterMethodName)); |
415 |
getLog().log(ILog.ERROR, "ws_ant", 5094, this, "callSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, setterMethodName)); |
| 376 |
throw new CoreException(errorStatus); |
416 |
throw new CoreException(errorStatus); |
| 377 |
} |
417 |
} |
| 378 |
} |
418 |
} |
|
Lines 435-441
Link Here
|
| 435 |
catch(Exception e){ |
475 |
catch(Exception e){ |
| 436 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5095, e.getMessage(), e); |
476 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5095, e.getMessage(), e); |
| 437 |
getStatusHandler().reportError(errorStatus); |
477 |
getStatusHandler().reportError(errorStatus); |
| 438 |
getLog().log(ILog.ERROR, "ws_ant", 5095, this, "callPrimitiveSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERR_ANT_CALL_SETTER, element.getName())); |
478 |
getLog().log(ILog.ERROR, "ws_ant", 5095, this, "callPrimitiveSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, element.getName())); |
| 439 |
throw new CoreException(errorStatus); |
479 |
throw new CoreException(errorStatus); |
| 440 |
} |
480 |
} |
| 441 |
} |
481 |
} |
|
Lines 464-470
Link Here
|
| 464 |
{ |
504 |
{ |
| 465 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5096, exc.getMessage(), exc); |
505 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5096, exc.getMessage(), exc); |
| 466 |
getStatusHandler().reportError(errorStatus); |
506 |
getStatusHandler().reportError(errorStatus); |
| 467 |
getLog().log(ILog.ERROR, "ws_ant", 5096, this, "callSetterConstructor", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERR_ANT_CALL_SETTER, element.getName())); |
507 |
getLog().log(ILog.ERROR, "ws_ant", 5096, this, "callSetterConstructor", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, element.getName())); |
| 468 |
throw new CoreException(errorStatus); |
508 |
throw new CoreException(errorStatus); |
| 469 |
} |
509 |
} |
| 470 |
} |
510 |
} |
|
Lines 507-513
Link Here
|
| 507 |
{ |
547 |
{ |
| 508 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5097, exception.getMessage(), exception); |
548 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5097, exception.getMessage(), exception); |
| 509 |
getStatusHandler().reportError(errorStatus); |
549 |
getStatusHandler().reportError(errorStatus); |
| 510 |
getLog().log(ILog.ERROR, "ws_ant", 5097, this, "getRootCommandFragment", EnvironmentMessages.MSG_ERR_ANT_CMD_FRAGMENT); |
550 |
getLog().log(ILog.ERROR, "ws_ant", 5097, this, "getRootCommandFragment", EnvironmentMessages.MSG_ERROR_ANT_CMD_FRAGMENT); |
| 511 |
} |
551 |
} |
| 512 |
} |
552 |
} |
| 513 |
} |
553 |
} |