diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java
index 8ab26f0df..7e9572d17 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java
@@ -10,11 +10,11 @@ package org.apache.myrmidon.listeners;
import org.apache.avalon.framework.ExceptionUtil;
/**
- * Default listener that emulates the old ant listener notifications.
+ * Classic listener that emulates the default ant1.x listener notifications.
*
* @author Peter Donald
*/
-public class ClassicProjectListener
+public final class ClassicProjectListener
extends AbstractProjectListener
{
private String m_prefix;
@@ -22,29 +22,11 @@ public class ClassicProjectListener
/**
* Notify listener of targetStarted event.
*
- * @param targetName the name of target
+ * @param target the name of target
*/
- public void targetStarted( final String targetName )
+ public void targetStarted( final String target )
{
- output( targetName + ":\n" );
- }
-
- /**
- * Notify listener of taskStarted event.
- *
- * @param taskName the name of task
- */
- public void taskStarted( final String taskName )
- {
- setPrefix( taskName );
- }
-
- /**
- * Notify listener of taskFinished event.
- */
- public void taskFinished()
- {
- setPrefix( null );
+ output( target + ":\n" );
}
/**
@@ -74,21 +56,16 @@ public class ClassicProjectListener
*
* @param data the data
*/
- protected void output( final String data )
+ private void output( final String data )
{
- if( null != getPrefix() )
- System.out.println( "\t[" + getPrefix() + "] " + data );
+ final String task = getTask();
+ if( null != task )
+ {
+ System.out.println( "\t[" + task + "] " + data );
+ }
else
+ {
System.out.println( data );
- }
-
- protected final String getPrefix()
- {
- return m_prefix;
- }
-
- protected final void setPrefix( final String prefix )
- {
- m_prefix = prefix;
+ }
}
}
diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java
index 23568e5d0..406f524a7 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java
@@ -14,38 +14,20 @@ import org.apache.avalon.framework.ExceptionUtil;
*
* @author Peter Donald
*/
-public class DefaultProjectListener
+public final class DefaultProjectListener
extends AbstractProjectListener
{
- private String m_prefix;
- private String m_targetName;
+ private boolean m_targetOutput;
/**
* Notify listener of targetStarted event.
*
- * @param targetName the name of target
+ * @param target the name of target
*/
- public void targetStarted( final String targetName )
+ public void targetStarted( final String target )
{
- m_targetName = targetName;
- }
-
- /**
- * Notify listener of taskStarted event.
- *
- * @param taskName the name of task
- */
- public void taskStarted( final String taskName )
- {
- setPrefix( taskName );
- }
-
- /**
- * Notify listener of taskFinished event.
- */
- public void taskFinished()
- {
- setPrefix( null );
+ super.targetStarted( target );
+ m_targetOutput = false;
}
/**
@@ -53,7 +35,7 @@ public class DefaultProjectListener
*
* @param message the message
*/
- public void log( String message )
+ public void log( final String message )
{
output( message );
}
@@ -64,7 +46,7 @@ public class DefaultProjectListener
* @param message the message
* @param throwable the throwable
*/
- public void log( String message, Throwable throwable )
+ public void log( final String message, final Throwable throwable )
{
output( message + "\n" + ExceptionUtil.printStackTrace( throwable, 5, true ) );
}
@@ -75,27 +57,22 @@ public class DefaultProjectListener
*
* @param data the data
*/
- protected void output( final String data )
+ private void output( final String data )
{
- if( null != m_targetName )
+ if( !m_targetOutput )
{
- System.out.println( m_targetName + ":\n" );
- m_targetName = null;
+ System.out.println( getTarget() + ":\n" );
+ m_targetOutput = true;
}
- if( null != getPrefix() )
- System.out.println( "\t[" + getPrefix() + "] " + data );
+ final String task = getTask();
+ if( null != task )
+ {
+ System.out.println( "\t[" + task + "] " + data );
+ }
else
+ {
System.out.println( data );
- }
-
- protected final String getPrefix()
- {
- return m_prefix;
- }
-
- protected final void setPrefix( final String prefix )
- {
- m_prefix = prefix;
+ }
}
}