>I analyse a DOPE_task written for our project.
>In one of the setters an application is started.
>I have other setters that must start before this setter,
>because they have some attributes für the application.
>In what sequence the setters are executed?
IMHO not a good idea ...
What if the application is required for two attributes? Do you start them
twice?
>I guess in the sewuence I wrote them into ma call inside my Antfile.
Not sure if there is a guaranteed sequence ... order from the buildfile sounds
reasonable as this should be the order a parser works. But in Ant there is a
step between strict xml parsing and the real objects: UnknownObject and its
transformation into real objects.
>(I dont think this was a good idea to strat an application in
>a setter that needs more than one attribute.
>If possible I will change this...)
In my own tasks I have three phases:
1. build the datastructure (attributes, nested elements, text)
2. check precondition (could use oata.TaskConfigurationChecker)
3. execution
I would try to start the application in step#3
Jan
public void execute() throws BuildException {
checkConfiguration();
doExecute();
}
protected void checkConfiguration() throws BuildException {
TaskConfigurationChecker checker = new TaskConfigurationChecker(this);
checker.assertConfig(
srcdir != null,
"Attribute 'srcdir' must be set.
);
checker.assertConfig(
srcdir.exists(),
"Srcdir (" + srcdir + ") must exist."
);
if (someComplexCondition()) {
fail("Complex condition failed.");
}
checker.checkErrors();
}
protected void doExecute() throws BuildException {
try {
if (attributeA != null || attributeB != null) {
startApplication();
}
} catch (Exception e) {
throw new BuildException(e, getLocation());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]