|
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$ |
| 67 |
|
68 |
private static final String MAPPER_REQUIRED_ATTRIBUTE= "required"; //$NON-NLS-1$ |
|
|
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 |
// Ant property IDs |
| 75 |
private static final String VERBOSE_PROPERTY = "Verbose"; //$NON-NLS-1$ |
| 76 |
private static final String SCENARIO_TYPE_PROPERTY = "ScenarioType"; //$NON-NLS-1$ |
| 77 |
|
| 72 |
private AntController controller_; |
78 |
private AntController controller_; |
| 73 |
|
79 |
|
| 74 |
public AntEnvironment(AntController controller, ResourceContext context, IStatusHandler handler, Hashtable properties) |
80 |
public AntEnvironment(AntController controller, ResourceContext context, IStatusHandler handler, Hashtable properties) |
|
Lines 78-88
Link Here
|
| 78 |
controller_ = controller; |
84 |
controller_ = controller; |
| 79 |
} |
85 |
} |
| 80 |
|
86 |
|
|
|
87 |
public boolean verbose() |
| 88 |
{ |
| 89 |
String verbose=getProperty(VERBOSE_PROPERTY); |
| 90 |
|
| 91 |
if (verbose != null) |
| 92 |
{ |
| 93 |
verbose = verbose.toLowerCase(); |
| 94 |
if (verbose.equals("true")) |
| 95 |
return true; |
| 96 |
} |
| 97 |
return false; |
| 98 |
} |
| 99 |
|
| 81 |
// returns String since the property table built by Ant is property value pairs where the value is a String |
100 |
// 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) |
101 |
private String getProperty(String key) |
| 83 |
{ |
102 |
{ |
| 84 |
Object property = antProperties_.get(key); |
103 |
Object property = antProperties_.get(key); |
| 85 |
if (property != null) |
104 |
if (property != null && (!property.toString().equals(""))) |
| 86 |
return property.toString().trim(); |
105 |
return property.toString().trim(); |
| 87 |
return null; |
106 |
return null; |
| 88 |
} |
107 |
} |
|
Lines 209-215
Link Here
|
| 209 |
catch (CoreException cex) { |
228 |
catch (CoreException cex) { |
| 210 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5092, cex.getMessage(), cex); |
229 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5092, cex.getMessage(), cex); |
| 211 |
getStatusHandler().reportError(errorStatus); |
230 |
getStatusHandler().reportError(errorStatus); |
| 212 |
getLog().log(ILog.ERROR, "ws_ant", 5092, this, "getMappingExtensions", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERR_ANT_DATA_TRANSFORM, key, transform)); |
231 |
getLog().log(ILog.ERROR, "ws_ant", 5092, this, "getMappingExtensions", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_DATA_TRANSFORM, key, transform)); |
| 213 |
throw new CoreException(errorStatus); |
232 |
throw new CoreException(errorStatus); |
| 214 |
} |
233 |
} |
| 215 |
|
234 |
|
|
Lines 244-250
Link Here
|
| 244 |
holder.value_ = value; |
263 |
holder.value_ = value; |
| 245 |
dataTable.put(property, holder); |
264 |
dataTable.put(property, holder); |
| 246 |
} |
265 |
} |
| 247 |
} |
266 |
} |
|
|
267 |
else if(ce.getAttribute(MAPPER_REQUIRED_ATTRIBUTE)!=null && ce.getAttribute(MAPPER_REQUIRED_ATTRIBUTE).equals("true")) |
| 268 |
{ |
| 269 |
String msg = EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_REQUIRED_PROPERTY, key.toString()); |
| 270 |
Status statusObj = new Status(IStatus.ERROR, |
| 271 |
EnvPlugin.ID, |
| 272 |
IStatus.ERROR, |
| 273 |
msg, |
| 274 |
null); |
| 275 |
getStatusHandler().reportError(statusObj); |
| 276 |
getLog().log(ILog.ERROR, "ws_ant", 9999, this, "getMappingExtensions", msg); |
| 277 |
} |
| 278 |
else if (verbose()) |
| 279 |
{ |
| 280 |
String msg = EnvironmentMessages.bind(EnvironmentMessages.MSG_INFO_ANT__PROPERTY_DEFAULT, key.toString()); |
| 281 |
Status statusObj = new Status(IStatus.INFO, |
| 282 |
EnvPlugin.ID, |
| 283 |
IStatus.INFO, |
| 284 |
msg, |
| 285 |
null); |
| 286 |
getStatusHandler().reportInfo(statusObj); |
| 287 |
getLog().log(ILog.INFO, "ws_ant", 9999, this, "getMappingExtensions", msg); |
| 288 |
} |
| 248 |
} |
289 |
} |
| 249 |
} |
290 |
} |
| 250 |
return dataTable.elements(); |
291 |
return dataTable.elements(); |
|
Lines 279-285
Link Here
|
| 279 |
catch (Exception exc) |
320 |
catch (Exception exc) |
| 280 |
{ |
321 |
{ |
| 281 |
getStatusHandler().reportError(new Status(Status.ERROR, "ws_ant", 5093, exc.getMessage(), exc)); |
322 |
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_)); |
323 |
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()); |
324 |
throw new IllegalArgumentException(exc.getMessage()); |
| 284 |
} |
325 |
} |
| 285 |
} |
326 |
} |
|
Lines 372-378
Link Here
|
| 372 |
catch(Exception cex){ |
413 |
catch(Exception cex){ |
| 373 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5094, cex.getMessage(), cex); |
414 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5094, cex.getMessage(), cex); |
| 374 |
getStatusHandler().reportError(errorStatus); |
415 |
getStatusHandler().reportError(errorStatus); |
| 375 |
getLog().log(ILog.ERROR, "ws_ant", 5094, this, "callSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERR_ANT_CALL_SETTER, setterMethodName)); |
416 |
getLog().log(ILog.ERROR, "ws_ant", 5094, this, "callSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, setterMethodName)); |
| 376 |
throw new CoreException(errorStatus); |
417 |
throw new CoreException(errorStatus); |
| 377 |
} |
418 |
} |
| 378 |
} |
419 |
} |
|
Lines 435-441
Link Here
|
| 435 |
catch(Exception e){ |
476 |
catch(Exception e){ |
| 436 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5095, e.getMessage(), e); |
477 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5095, e.getMessage(), e); |
| 437 |
getStatusHandler().reportError(errorStatus); |
478 |
getStatusHandler().reportError(errorStatus); |
| 438 |
getLog().log(ILog.ERROR, "ws_ant", 5095, this, "callPrimitiveSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERR_ANT_CALL_SETTER, element.getName())); |
479 |
getLog().log(ILog.ERROR, "ws_ant", 5095, this, "callPrimitiveSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, element.getName())); |
| 439 |
throw new CoreException(errorStatus); |
480 |
throw new CoreException(errorStatus); |
| 440 |
} |
481 |
} |
| 441 |
} |
482 |
} |
|
Lines 464-470
Link Here
|
| 464 |
{ |
505 |
{ |
| 465 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5096, exc.getMessage(), exc); |
506 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5096, exc.getMessage(), exc); |
| 466 |
getStatusHandler().reportError(errorStatus); |
507 |
getStatusHandler().reportError(errorStatus); |
| 467 |
getLog().log(ILog.ERROR, "ws_ant", 5096, this, "callSetterConstructor", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERR_ANT_CALL_SETTER, element.getName())); |
508 |
getLog().log(ILog.ERROR, "ws_ant", 5096, this, "callSetterConstructor", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, element.getName())); |
| 468 |
throw new CoreException(errorStatus); |
509 |
throw new CoreException(errorStatus); |
| 469 |
} |
510 |
} |
| 470 |
} |
511 |
} |
|
Lines 483-489
Link Here
|
| 483 |
{ |
524 |
{ |
| 484 |
|
525 |
|
| 485 |
//look up the commandFragment in the scenarioRegistry extension point with an ID corresponding to the scenario property in the propertytable |
526 |
//look up the commandFragment in the scenarioRegistry extension point with an ID corresponding to the scenario property in the propertytable |
| 486 |
String scenarioProperty = (String)getProperty(SCENARIO_TYPE_ATTRIBUTE); |
527 |
String scenarioProperty = (String)getProperty(SCENARIO_TYPE_PROPERTY); |
| 487 |
IExtensionRegistry reg = Platform.getExtensionRegistry(); |
528 |
IExtensionRegistry reg = Platform.getExtensionRegistry(); |
| 488 |
IExtensionPoint extPt = reg.getExtensionPoint(EXT_PT_NAMESPACE, SCENARIO_EXT_PT); |
529 |
IExtensionPoint extPt = reg.getExtensionPoint(EXT_PT_NAMESPACE, SCENARIO_EXT_PT); |
| 489 |
|
530 |
|
|
Lines 507-513
Link Here
|
| 507 |
{ |
548 |
{ |
| 508 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5097, exception.getMessage(), exception); |
549 |
Status errorStatus = new Status(Status.ERROR, "ws_ant", 5097, exception.getMessage(), exception); |
| 509 |
getStatusHandler().reportError(errorStatus); |
550 |
getStatusHandler().reportError(errorStatus); |
| 510 |
getLog().log(ILog.ERROR, "ws_ant", 5097, this, "getRootCommandFragment", EnvironmentMessages.MSG_ERR_ANT_CMD_FRAGMENT); |
551 |
getLog().log(ILog.ERROR, "ws_ant", 5097, this, "getRootCommandFragment", EnvironmentMessages.MSG_ERROR_ANT_CMD_FRAGMENT); |
| 511 |
} |
552 |
} |
| 512 |
} |
553 |
} |
| 513 |
} |
554 |
} |