ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/aspects AbstractAspectHandler.java
Date Tue, 05 Jun 2001 04:35:56 GMT
donaldp     01/06/04 21:35:56

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/aspects
                        AbstractAspectHandler.java
  Log:
  Made preConfigure take taskModel as parameter. This is because original taskModel may have
been modified.
  
  Cached all relevent parameters in instance variables. Access parameters via helper methods.
Call reset() to clear all variables.
  
  Revision  Changes    Path
  1.2       +57 -3     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AbstractAspectHandler.java
  
  Index: AbstractAspectHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AbstractAspectHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractAspectHandler.java	2001/06/04 12:38:18	1.1
  +++ AbstractAspectHandler.java	2001/06/05 04:35:55	1.2
  @@ -8,6 +8,7 @@
   package org.apache.myrmidon.aspects;
   
   import org.apache.avalon.framework.configuration.Configuration;
  +import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.log.Logger;
   import org.apache.myrmidon.api.Task;
   import org.apache.myrmidon.api.TaskException;
  @@ -21,25 +22,42 @@
   public abstract class AbstractAspectHandler
       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
       {
  -        return configuration;
  +        m_aspectParameters = parameters;
  +        m_aspectElements = elements;
       }
   
       public void postCreate( final Task task )
           throws TaskException
       {
  +        m_task = task;
       }
   
       public void preLoggable( final Logger logger )
           throws TaskException
       {
  +        m_logger = logger;
       }
   
  -    public void preConfigure()
  +    public void preConfigure( final Configuration taskModel )
           throws TaskException
       {
  +        m_taskModel = taskModel;
       }
   
       public void preExecute()
  @@ -50,11 +68,47 @@
       public void preDestroy()
           throws TaskException
       {
  +        reset();
       }
   
       public boolean error( final TaskException te )
           throws TaskException
       {
  +        reset();
           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;
       }
   }
  
  
  

Mime
View raw message