@@ -8,6 +8,7 @@
package org.apache.myrmidon.aspects;
package org.apache.myrmidon.aspects;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.log.Logger;
import org.apache.log.Logger;
import org.apache.myrmidon.api.Task;
import org.apache.myrmidon.api.Task;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.TaskException;
@@ -21,25 +22,42 @@ import org.apache.myrmidon.api.TaskException;
public abstract class AbstractAspectHandler
public abstract class AbstractAspectHandler
implements AspectHandler
implements AspectHandler
{
{
public Configuration preCreate( final Configuration configuration )
private Parameters m_aspectParameters;
private Configuration[] m_aspectElements;
private Task m_task;
private Logger m_logger;
private Configuration m_taskModel;
public Configuration preCreate( final Configuration taskModel )
throws TaskException
{
return taskModel;
}
public void aspect( final Parameters parameters, final Configuration[] elements )
throws TaskException
throws TaskException
{
{
return configuration;
m_aspectParameters = parameters;
m_aspectElements = elements;
}
}
public void postCreate( final Task task )
public void postCreate( final Task task )
throws TaskException
throws TaskException
{
{
m_task = task;
}
}
public void preLoggable( final Logger logger )
public void preLoggable( final Logger logger )
throws TaskException
throws TaskException
{
{
m_logger = logger;
}
}
public void preConfigure()
public void preConfigure( final Configuration taskModel )
throws TaskException
throws TaskException
{
{
m_taskModel = taskModel;
}
}
public void preExecute()
public void preExecute()
@@ -50,11 +68,47 @@ public abstract class AbstractAspectHandler
public void preDestroy()
public void preDestroy()
throws TaskException
throws TaskException
{
{
reset();
}
}
public boolean error( final TaskException te )
public boolean error( final TaskException te )
throws TaskException
throws TaskException
{
{
reset();
return false;
return false;
}
}
protected void reset()
{
m_aspectParameters = null;
m_aspectElements = null;
m_task = null;
m_logger = null;
m_taskModel = null;
}
protected final Configuration getTaskModel()
{
return m_taskModel;
}
protected final Task getTask()
{
return m_task;
}
protected final Logger getLogger()
{
return m_logger;
}
protected final Configuration[] getAspectElements()
{
return m_aspectElements;
}
protected final Parameters getAspectParameters()
{
return m_aspectParameters;
}
}
}