Browse Source

Refactor AbstractProjectListener so that it retains state regarding current task and current target

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270466 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
7cb0319029
1 changed files with 33 additions and 3 deletions
  1. +33
    -3
      proposal/myrmidon/src/java/org/apache/myrmidon/listeners/AbstractProjectListener.java

+ 33
- 3
proposal/myrmidon/src/java/org/apache/myrmidon/listeners/AbstractProjectListener.java View File

@@ -15,6 +15,16 @@ package org.apache.myrmidon.listeners;
public abstract class AbstractProjectListener public abstract class AbstractProjectListener
implements ProjectListener implements ProjectListener
{ {
/**
* This contains the name of the current target.
*/
private String m_target;

/**
* This contains the name of the current task.
*/
private String m_task;

/** /**
* Notify listener of projectStarted event. * Notify listener of projectStarted event.
*/ */
@@ -34,8 +44,9 @@ public abstract class AbstractProjectListener
* *
* @param targetName the name of target * @param targetName the name of target
*/ */
public void targetStarted( final String targetName )
public void targetStarted( final String target )
{ {
m_target = target;
} }


/** /**
@@ -43,15 +54,17 @@ public abstract class AbstractProjectListener
*/ */
public void targetFinished() public void targetFinished()
{ {
m_target = null;
} }


/** /**
* Notify listener of taskStarted event. * Notify listener of taskStarted event.
* *
* @param taskName the name of task
* @param task the name of task
*/ */
public void taskStarted( final String taskName )
public void taskStarted( final String task )
{ {
m_task = task;
} }


/** /**
@@ -59,6 +72,7 @@ public abstract class AbstractProjectListener
*/ */
public void taskFinished() public void taskFinished()
{ {
m_task = null;
} }


/** /**
@@ -79,4 +93,20 @@ public abstract class AbstractProjectListener
public void log( String message, Throwable throwable ) public void log( String message, Throwable throwable )
{ {
} }

/**
* Utility method to get the name of current target.
*/
protected final String getTarget()
{
return m_target;
}

/**
* Utility method to get the name of current task.
*/
protected final String getTask()
{
return m_task;
}
} }

Loading…
Cancel
Save