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/api AbstractTask.java
Date Sun, 16 Dec 2001 05:25:20 GMT
donaldp     01/12/15 21:25:20

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/api
                        AbstractTask.java
  Log:
  Add utility methods that directly delegate to the context to do work.
  
  Revision  Changes    Path
  1.7       +57 -2     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java
  
  Index: AbstractTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractTask.java	2001/11/26 11:35:51	1.6
  +++ AbstractTask.java	2001/12/16 05:25:20	1.7
  @@ -7,9 +7,11 @@
    */
   package org.apache.myrmidon.api;
   
  +import java.io.File;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.context.Context;
  +import org.apache.avalon.framework.context.ContextException;
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   
  @@ -23,7 +25,7 @@
       implements Task, Contextualizable, Initializable, Disposable
   {
       ///Variable to hold context for use by sub-classes
  -    private TaskContext            m_context;
  +    private TaskContext m_context;
   
       /**
        * Retrieve context from container.
  @@ -46,7 +48,7 @@
       }
   
       /**
  -     * Execute task. 
  +     * Execute task.
        * This method is called to perform actual work associated with task.
        * It is called after Task has been Configured and Initialized and before
        * beig Disposed (If task implements appropriate interfaces).
  @@ -74,5 +76,58 @@
       protected final TaskContext getContext()
       {
           return m_context;
  +    }
  +
  +    protected final JavaVersion getJavaVersion()
  +    {
  +        return getContext().getJavaVersion();
  +    }
  +
  +    protected final Object get( final Object key )
  +        throws ContextException
  +    {
  +        return getContext().get( key );
  +    }
  +
  +    //Will be made protected in the future
  +    public final String getName()
  +    {
  +        return getContext().getName();
  +    }
  +
  +    protected final File getBaseDirectory()
  +    {
  +        return getContext().getBaseDirectory();
  +    }
  +
  +    protected final File resolveFile( final String filename )
  +        throws TaskException
  +    {
  +        return getContext().resolveFile( filename );
  +    }
  +
  +    protected final Object getProperty( final String name )
  +    {
  +        return getContext().getProperty( name );
  +    }
  +
  +    protected final void setProperty( final String name, final Object value )
  +        throws TaskException
  +    {
  +        getContext().setProperty( name, value );
  +    }
  +
  +    protected final void setProperty( final String name,
  +                             final Object value,
  +                             final TaskContext.ScopeEnum scope )
  +        throws TaskException
  +    {
  +        getContext().setProperty( name, value, scope );
  +    }
  +
  +    protected final TaskContext createSubContext( final String name )
  +        throws TaskException
  +    {
  +        return getContext().createSubContext( name );
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message