You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@mad.scientist.com on 2000/07/12 09:13:53 UTC

Task Names vs Class Names ?

Hi,

would it be possible to log the name that the task is given
in buildfile rather than the name of class. Ie currently if
taskdef defines fred as FredTheImpl the logger will output 

[FredTheImpl] saids something

rather than

[fred] saids something

This would also be useful when you are creating tasks to do
work in other tasks. (ie I am delegating a lot of tasks to
underlying exec). So instead of outputing

mytask:
[Exec] some output.

I could output

mytask:
[mytask] some output.

To do this all that is needed is to add accessor/mutator for
name property in Task class. Then change part in
Project.createTask to read

    if( o instanceof Task ) {
               task=(Task)o;
               task.setName( taskType ); //added line ....
            } else {

Then change the log to do 
event.getTask().getName()

instead of 

event.getTask().getClass().getName()

Cheers,

Pete

*--------------------------------------------------*
| Latrobe University,     |                        |
| Bundoora, Australia     | Does the name 'Pavlov' |
| Office: PW220           |    ring a bell ?       |
| Ex: 2503                |                        |
*--------------------------------------------------*


RE: Task Names vs Class Names ?

Posted by Conor MacNeill <co...@m64.com>.
> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@bost.de]
> Sent: Wednesday, 12 July 2000 21:20
> To: ant-dev@jakarta.apache.org
> Subject: Re: Task Names vs Class Names ?
> 
> Yup, going to add that as well. 
> 
> Add a taskType property (with setter, no getter?) and set this in
> Project.createTask as well as taskName, ignore setTaskType in
> IntrospectionHelper but allow setTaskName to be passed through,
> effectively adding a taskname attribute to all tasks, right?
> 

+1 


Re: Task Names vs Class Names ?

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "CM" == Conor MacNeill <co...@cognet.com.au> writes:

 CM> <java taskname="junit" ...>

Then you won't like my patch 8^). You'll have to remove setTaskName
from the list of excluded methods in IntrospectionHelper to make this
succeede again.

 CM> Now that usage would probably interfere with your requirement
 CM> where you want to know the tasktype. Perhaps we need to be able
 CM> to tell a task the tasktype is was invoked with as well as a
 CM> taskname for logging, the taskname defaulting to the tasktype by
 CM> default.

Yup, going to add that as well. 

Add a taskType property (with setter, no getter?) and set this in
Project.createTask as well as taskName, ignore setTaskType in
IntrospectionHelper but allow setTaskName to be passed through,
effectively adding a taskname attribute to all tasks, right?

Stefan

RE: Task Names vs Class Names ?

Posted by Conor MacNeill <co...@cognet.com.au>.
Stefan,

I think you are talking about something a little different from Peter. I
actually included the capability to give a task a name in my multithreading
patch posted a while ago. When you are running multiple instances of the
java task (Junit and Weblogic server), it is important to distinguish which
one is saying what. It allowed me to have

<java taskname="junit" ...>

Now that usage would probably interfere with your requirement where you want
to know the tasktype. Perhaps we need to be able to tell a task the tasktype
is was invoked with as well as a taskname for logging, the taskname
defaulting to the tasktype by default.

Conor



--
Conor MacNeill
Home: conor@m64.com
Work: conor@cortexebusiness.com.au
Web:  www.cortexebusiness.com.au


> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@bost.de]
> Sent: Wednesday, 12 July 2000 17:26
> To: ant-dev@jakarta.apache.org
> Subject: Re: Task Names vs Class Names ?
>
>
> Hi Pete,
>
> I've been thinking about a similar change to Task - but for a
> different reason. I'd like to make unzip and unjar alternative names
> for expand and let Expand (the class) emit a deprecation warning if it
> has been called as "expand".
>
> I'm going to look into this sometime soon.
>
> Stefan
>


Re: Task Names vs Class Names ?

Posted by Stefan Bodewig <bo...@bost.de>.
Hi Pete,

I've been thinking about a similar change to Task - but for a
different reason. I'd like to make unzip and unjar alternative names
for expand and let Expand (the class) emit a deprecation warning if it
has been called as "expand".

I'm going to look into this sometime soon.

Stefan