-----Original Message----- From: Stefan Bodewig [mailto:[EMAIL PROTECTED]
On 18 Feb 2005, <[EMAIL PROTECTED]> wrote:
I'm tempted to retrofit Task.bindToOwner back to the 1.6.x codebase, for the benefit of third party tasks; same for the extra constructors for exec and java. Thoughts?
If you only port bindToOwner and the new constructors, but not all the points of invocation then you can't do much harm.
FWIW, just one nit about bindToOwner(), but a bit late since I saw the commit like everyone else.
sorry, I did it while I was offline for a week.
I would have reversed Steve's bindee.bindToOwner(owner) logic into owner.configureHelper(helper), which then allows configureHelper to be protected. It's basically the same, but avoids the public method which then anyone can call on any task, and it's closer to the code I posted a few times, and that I'll post again below.
I hadnt see that; like your location fixup though.
the reason I stuck in the task, is it lets a task add its own bindToOwner implementation, to do extra binding. If you put it in the parent, then the bound task doesnt get a look in.
Make sense?
Note also that my code init()s the helper task too, and that I was always calling configureTask() in the parent task own init(). --DD
/** * Configures a helper task to be used within another task. * * @param parent the parent (custom) task using the helper task. * @param helper the helper task to configure for use. * @return the configured helper task for call chaining. */ public static Task configureTask(Task parent, Task helper) { // Make helper share attributes of the parent helper.setProject(parent.getProject()); helper.setTaskName(parent.getTaskName()); helper.setOwningTarget(parent.getOwningTarget());
// Copy location for better troubleshooting of subtask Location location = parent.getLocation(); if (location == null) { location = Location.UNKNOWN_LOCATION; } helper.setLocation(location);
// Initialize (and return) the helper helper.init(); return helper; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]