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 TaskContext.java
Date Sun, 03 Mar 2002 07:30:38 GMT
donaldp     02/03/02 23:30:38

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer
                        ClassicConfigurer.java DefaultConfigurer.java
               proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/configurer
                        Configurer.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace
                        PropertyUtil.java
               proposal/myrmidon/src/java/org/apache/myrmidon/api
                        TaskContext.java
  Log:
  Merge Context back into TaskContext
  
  Revision  Changes    Path
  1.8       +12 -12    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/ClassicConfigurer.java
  
  Index: ClassicConfigurer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/ClassicConfigurer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ClassicConfigurer.java	1 Mar 2002 02:13:35 -0000	1.7
  +++ ClassicConfigurer.java	3 Mar 2002 07:30:38 -0000	1.8
  @@ -22,7 +22,7 @@
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.Serviceable;
  -import org.apache.myrmidon.api.Context;
  +import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.interfaces.configurer.Configurer;
   
  @@ -66,7 +66,7 @@
        */
       public void configure( final Object object,
                              final Configuration configuration,
  -                           final Context context )
  +                           final TaskContext context )
           throws ConfigurationException
       {
           if( DEBUG )
  @@ -157,7 +157,7 @@
       public void configure( final Object object,
                              final String name,
                              final String value,
  -                           final Context context )
  +                           final TaskContext context )
           throws ConfigurationException
       {
           configureAttribute( object, name, value, context );
  @@ -173,7 +173,7 @@
        */
       private void configureContent( final Object object,
                                      final String content,
  -                                   final Context context )
  +                                   final TaskContext context )
           throws ConfigurationException
       {
           setValue( object, "addContent", content, context );
  @@ -182,7 +182,7 @@
       private void configureAttribute( final Object object,
                                        final String name,
                                        final String value,
  -                                     final Context context )
  +                                     final TaskContext context )
           throws ConfigurationException
       {
           final String methodName = getMethodNameFor( name );
  @@ -192,7 +192,7 @@
       private void setValue( final Object object,
                              final String methodName,
                              final String value,
  -                           final Context context )
  +                           final TaskContext context )
           throws ConfigurationException
       {
           // OMFG the rest of this is soooooooooooooooooooooooooooooooo
  @@ -212,7 +212,7 @@
   
       private void setValue( final Object object,
                              final String value,
  -                           final Context context,
  +                           final TaskContext context,
                              final Method[] methods )
           throws ConfigurationException
       {
  @@ -232,7 +232,7 @@
       private void setValue( final Object object,
                              Object value,
                              final Method[] methods,
  -                           final Context context )
  +                           final TaskContext context )
           throws ConfigurationException
       {
           final Class sourceClass = value.getClass();
  @@ -254,7 +254,7 @@
       private boolean setValue( final Object object,
                                 final Object originalValue,
                                 final Method method,
  -                              final Context context )
  +                              final TaskContext context )
           throws ConfigurationException
       {
           Class parameterType = method.getParameterTypes()[ 0 ];
  @@ -433,7 +433,7 @@
   
       private void configureElement( final Object object,
                                      final Configuration configuration,
  -                                   final Context context )
  +                                   final TaskContext context )
           throws ConfigurationException
       {
           final String name = configuration.getName();
  @@ -468,7 +468,7 @@
       private void createElement( final Object object,
                                   final Method method,
                                   final Configuration configuration,
  -                                final Context context )
  +                                final TaskContext context )
           throws ConfigurationException
       {
           try
  @@ -490,7 +490,7 @@
       private void addElement( final Object object,
                                final Method method,
                                final Configuration configuration,
  -                             final Context context )
  +                             final TaskContext context )
           throws ConfigurationException
       {
           try
  
  
  
  1.35      +13 -13    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java
  
  Index: DefaultConfigurer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- DefaultConfigurer.java	1 Mar 2002 08:54:20 -0000	1.34
  +++ DefaultConfigurer.java	3 Mar 2002 07:30:38 -0000	1.35
  @@ -21,7 +21,7 @@
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.Serviceable;
  -import org.apache.myrmidon.api.Context;
  +import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.framework.DataType;
   import org.apache.myrmidon.interfaces.configurer.Configurer;
   import org.apache.myrmidon.interfaces.role.RoleInfo;
  @@ -33,7 +33,7 @@
    * Class used to configure tasks.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.34 $ $Date: 2002/03/01 08:54:20 $
  + * @version $Revision: 1.35 $ $Date: 2002/03/03 07:30:38 $
    * @ant:type type="configurer" name="default"
    */
   public class DefaultConfigurer
  @@ -79,7 +79,7 @@
        */
       public void configure( final Object object,
                              final Configuration configuration,
  -                           final Context context )
  +                           final TaskContext context )
           throws ConfigurationException
       {
           try
  @@ -110,7 +110,7 @@
        */
       private void configureObject( final Object object,
                                     final Configuration configuration,
  -                                  final Context context )
  +                                  final TaskContext context )
           throws Exception
       {
           if( object instanceof Configurable )
  @@ -220,7 +220,7 @@
       public void configure( final Object object,
                              final String name,
                              final String value,
  -                           final Context context )
  +                           final TaskContext context )
           throws ConfigurationException
       {
           // Locate the configurer for this object
  @@ -252,7 +252,7 @@
        */
       private void setContent( final ConfigurationState state,
                                final String content,
  -                             final Context context )
  +                             final TaskContext context )
           throws Exception
       {
           // Locate the content configurer
  @@ -271,7 +271,7 @@
        */
       private void configureElement( final ConfigurationState state,
                                      final Configuration element,
  -                                   final Context context )
  +                                   final TaskContext context )
           throws Exception
       {
           final String elementName = element.getName();
  @@ -292,7 +292,7 @@
        */
       private void configureInline( final ConfigurationState state,
                                     final Configuration element,
  -                                  final Context context )
  +                                  final TaskContext context )
           throws Exception
       {
           final String name = element.getName();
  @@ -314,7 +314,7 @@
        */
       private void configureReference( final ConfigurationState state,
                                        final Configuration element,
  -                                     final Context context )
  +                                     final TaskContext context )
           throws Exception
       {
   
  @@ -338,7 +338,7 @@
       private void setReference( final ConfigurationState state,
                                  final String refName,
                                  final String unresolvedId,
  -                               final Context context )
  +                               final TaskContext context )
           throws Exception
       {
           // Adjust the name
  @@ -384,7 +384,7 @@
       private void setAttribute( final ConfigurationState state,
                                  final String name,
                                  final String value,
  -                               final Context context )
  +                               final TaskContext context )
           throws Exception
       {
           if( name.toLowerCase().endsWith( "-ref" ) )
  @@ -407,7 +407,7 @@
       private void setValue( final PropertyConfigurer setter,
                              final ConfigurationState state,
                              final String value,
  -                           final Context context )
  +                           final TaskContext context )
           throws Exception
       {
           // Resolve property references in the attribute value
  @@ -445,7 +445,7 @@
        */
       private Object setupChild( final ConfigurationState state,
                                  final Configuration element,
  -                               final Context context,
  +                               final TaskContext context,
                                  final PropertyConfigurer childConfigurer )
           throws Exception
       {
  
  
  
  1.9       +4 -4      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/configurer/Configurer.java
  
  Index: Configurer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/configurer/Configurer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Configurer.java	1 Mar 2002 02:13:36 -0000	1.8
  +++ Configurer.java	3 Mar 2002 07:30:38 -0000	1.9
  @@ -9,13 +9,13 @@
   
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  -import org.apache.myrmidon.api.Context;
  +import org.apache.myrmidon.api.TaskContext;
   
   /**
    * Class used to configure tasks.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.8 $ $Date: 2002/03/01 02:13:36 $
  + * @version $Revision: 1.9 $ $Date: 2002/03/03 07:30:38 $
    * @ant:role shorthand="configurer"
    */
   public interface Configurer
  @@ -32,7 +32,7 @@
        * @param context the Context
        * @exception ConfigurationException if an error occurs
        */
  -    void configure( Object object, Configuration configuration, Context context )
  +    void configure( Object object, Configuration configuration, TaskContext context )
           throws ConfigurationException;
   
       /**
  @@ -46,6 +46,6 @@
        * @param context the Context
        * @exception ConfigurationException if an error occurs
        */
  -    void configure( Object object, String name, String value, Context context )
  +    void configure( Object object, String name, String value, TaskContext context )
           throws ConfigurationException;
   }
  
  
  
  1.2       +5 -5      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/PropertyUtil.java
  
  Index: PropertyUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/PropertyUtil.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PropertyUtil.java	25 Feb 2002 10:42:43 -0000	1.1
  +++ PropertyUtil.java	3 Mar 2002 07:30:38 -0000	1.2
  @@ -9,14 +9,14 @@
   
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.myrmidon.api.Context;
  +import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   
   /**
    * Utility class to evaluate properties.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.1 $ $Date: 2002/02/25 10:42:43 $
  + * @version $Revision: 1.2 $ $Date: 2002/03/03 07:30:38 $
    */
   public final class PropertyUtil
   {
  @@ -38,7 +38,7 @@
        * @exception TaskException if an error occurs
        */
       public static Object resolveProperty( final String property,
  -                                          final Context context,
  +                                          final TaskContext context,
                                             final boolean ignoreUndefined )
           throws TaskException
       {
  @@ -99,7 +99,7 @@
        * @exception TaskException if an error occurs
        */
       public static Object recursiveResolveProperty( final String property,
  -                                                   final Context context,
  +                                                   final TaskContext context,
                                                      final boolean ignoreUndefined )
           throws TaskException
       {
  @@ -219,7 +219,7 @@
        * @exception TaskException if an error occurs
        */
       private static Object resolveValue( final String key,
  -                                        final Context context,
  +                                        final TaskContext context,
                                           final boolean ignoreUndefined )
           throws TaskException
       {
  
  
  
  1.22      +28 -2     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java
  
  Index: TaskContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TaskContext.java	1 Mar 2002 10:34:20 -0000	1.21
  +++ TaskContext.java	3 Mar 2002 07:30:38 -0000	1.22
  @@ -8,6 +8,7 @@
   package org.apache.myrmidon.api;
   
   import java.io.File;
  +import java.util.Map;
   
   /**
    * This interface represents the <em>Context</em> in which Task is executed.
  @@ -16,10 +17,9 @@
    * Unlike other APIs the Logging is provided through another interface (LogEnabled).
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.21 $ $Date: 2002/03/01 10:34:20 $
  + * @version $Revision: 1.22 $ $Date: 2002/03/03 07:30:38 $
    */
   public interface TaskContext
  -    extends Context
   {
       //these are the names of properties that every TaskContext must contain
       String BASE_DIRECTORY = "myrmidon.base.directory";
  @@ -31,6 +31,32 @@
        * @return the name
        */
       String getName();
  +
  +    /**
  +     * Resolve a value according to the context.
  +     * This involves evaluating the string and replacing
  +     * ${} sequences with property values.
  +     *
  +     * @param value the value to resolve
  +     * @return the resolved value
  +     */
  +    Object resolveValue( String value )
  +        throws TaskException;
  +
  +    /**
  +     * Retrieve property for name.
  +     *
  +     * @param name the name of property
  +     * @return the value of property, or null if the property has no value.
  +     */
  +    Object getProperty( String name );
  +
  +    /**
  +     * Retrieve a copy of all the properties accessible via context.
  +     *
  +     * @return the map of all property names to values
  +     */
  +    Map getProperties();
   
       /**
        * Retrieve a service that is offered by the runtime.
  
  
  

--
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