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-myrmidon/container/src/java/org/apache/myrmidon/interfaces/property PropertyStore.java
Date Sun, 28 Apr 2002 06:06:13 GMT
donaldp     02/04/27 23:06:13

  Modified:    api/src/java/org/apache/myrmidon/api TaskContext.java
               container/src/java/org/apache/myrmidon/components/property
                        DefaultPropertyStore.java MapPropertyStore.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultExecutionFrame.java DefaultTaskContext.java
               container/src/java/org/apache/myrmidon/interfaces/property
                        PropertyStore.java
  Log:
  Removed the TaskContext.NAME property as it was not really
  a property anyway and there was all sorts of special case
  magic to get it to behave like a property.
  
  Revision  Changes    Path
  1.31      +1 -6      jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/TaskContext.java
  
  Index: TaskContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/TaskContext.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- TaskContext.java	23 Apr 2002 06:55:39 -0000	1.30
  +++ TaskContext.java	28 Apr 2002 06:06:12 -0000	1.31
  @@ -16,7 +16,7 @@
    * path between the container and the Task.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.30 $ $Date: 2002/04/23 06:55:39 $
  + * @version $Revision: 1.31 $ $Date: 2002/04/28 06:06:12 $
    *
    * @todo Add some additional standard properties.
    */
  @@ -28,11 +28,6 @@
        * The name of the base directory property.  This property must be present.
        */
       String BASE_DIRECTORY = "myrmidon.base.directory";
  -
  -    /**
  -     * The name of the task name property.  This property must be present.
  -     */
  -    String NAME = "myrmidon.task.name";
   
       /**
        * The name of the container description.  This is an optional property.
  
  
  
  1.2       +6 -35     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/DefaultPropertyStore.java
  
  Index: DefaultPropertyStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/DefaultPropertyStore.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultPropertyStore.java	28 Apr 2002 05:51:00 -0000	1.1
  +++ DefaultPropertyStore.java	28 Apr 2002 06:06:12 -0000	1.2
  @@ -26,12 +26,11 @@
    * <ul>
    *   <li>The property names must pass DefaultNameValidator checks</li>
    *   <li>The store is mutable</li>
  - *   <li>If the key is TaskContext.NAME then value must be a string.</li>
    *   <li>If the key is TaskContext.BASE_DIRECTORY then value must be a key.</li>
    * </ul>
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.1 $ $Date: 2002/04/28 05:51:00 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/28 06:06:12 $
    * @see org.apache.myrmidon.interfaces.property.PropertyStore
    */
   public class DefaultPropertyStore
  @@ -61,7 +60,7 @@
        */
       public DefaultPropertyStore()
       {
  -        this( "", null, null );
  +        this( null, null );
       }
   
       /**
  @@ -70,8 +69,7 @@
        * @param parent the parent PropertyStore (may be null).
        * @param validator the validator to use to check property names (may be null).
        */
  -    public DefaultPropertyStore( final String name,
  -                                 final PropertyStore parent,
  +    public DefaultPropertyStore( final PropertyStore parent,
                                    final NameValidator validator )
       {
           m_parent = parent;
  @@ -83,8 +81,6 @@
           }
   
           m_validator = candidateValidator;
  -
  -        m_contextData.put( TaskContext.NAME, name );
       }
   
       /**
  @@ -102,7 +98,7 @@
           checkPropertyName( name );
           checkPropertyValid( name, value );
   
  -        if ( value == null )
  +        if( value == null )
           {
               m_contextData.remove( name );
           }
  @@ -182,28 +178,11 @@
        * store may choose to be unscoped and just return a
        * reference to itself.
        *
  -     * @param name the name of child store
        * @return the child store
        */
  -    public PropertyStore createChildStore( final String name )
  +    public PropertyStore createChildStore()
       {
  -        // Build the name for the new store
  -        final String thisName = (String)m_contextData.get( TaskContext.NAME );
  -        final String newName;
  -        if( name == null || name.length() == 0 )
  -        {
  -            newName = thisName;
  -        }
  -        else if( thisName.length() == 0 )
  -        {
  -            newName = name;
  -        }
  -        else
  -        {
  -            newName = thisName + "." + name;
  -        }
  -
  -        return new DefaultPropertyStore( newName, this, m_validator );
  +        return new DefaultPropertyStore( this, m_validator );
       }
   
       /**
  @@ -239,14 +218,6 @@
                   REZ.getString( "bad-property.error",
                                  TaskContext.BASE_DIRECTORY,
                                  File.class.getName() );
  -            throw new TaskException( message );
  -        }
  -        else if( TaskContext.NAME.equals( name ) && !( value instanceof String
) )
  -        {
  -            final String message =
  -                REZ.getString( "bad-property.error",
  -                               TaskContext.NAME,
  -                               String.class.getName() );
               throw new TaskException( message );
           }
       }
  
  
  
  1.2       +3 -4      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/MapPropertyStore.java
  
  Index: MapPropertyStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/MapPropertyStore.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MapPropertyStore.java	28 Apr 2002 05:51:00 -0000	1.1
  +++ MapPropertyStore.java	28 Apr 2002 06:06:12 -0000	1.2
  @@ -18,7 +18,7 @@
    * A simple unscoped, unsynchronized property store which is backed by a Map.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/04/28 05:51:00 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/28 06:06:12 $
    */
   public class MapPropertyStore
       implements PropertyStore
  @@ -103,15 +103,14 @@
       }
   
       /**
  -     * Return a child PropertyStore with specified name.
  +     * Return a child PropertyStore.
        * This is to allow support for scoped stores. However a
        * store may choose to be unscoped and just return a
        * reference to itself.
        *
  -     * @param name the name of child store
        * @return the child store
        */
  -    public PropertyStore createChildStore( String name )
  +    public PropertyStore createChildStore()
       {
           return this;
       }
  
  
  
  1.8       +2 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultExecutionFrame.java
  
  Index: DefaultExecutionFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultExecutionFrame.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultExecutionFrame.java	23 Apr 2002 07:41:14 -0000	1.7
  +++ DefaultExecutionFrame.java	28 Apr 2002 06:06:13 -0000	1.8
  @@ -18,7 +18,7 @@
    * Frames in which tasks are executed.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.7 $ $Date: 2002/04/23 07:41:14 $
  + * @version $Revision: 1.8 $ $Date: 2002/04/28 06:06:13 $
    */
   public class DefaultExecutionFrame
       implements ExecutionFrame
  @@ -126,7 +126,7 @@
           final String newName = m_name + "/" + name;
           final Logger logger = m_logger.getChildLogger( name );
           final PropertyStore propertyStore =
  -            m_propertyStore.createChildStore( name );
  +            m_propertyStore.createChildStore();
           final DefaultServiceManager serviceManager =
               new DefaultServiceManager( m_serviceManager );
   
  
  
  
  1.42      +6 -13     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java
  
  Index: DefaultTaskContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- DefaultTaskContext.java	25 Apr 2002 10:10:58 -0000	1.41
  +++ DefaultTaskContext.java	28 Apr 2002 06:06:13 -0000	1.42
  @@ -28,7 +28,7 @@
    * Default implementation of TaskContext.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.41 $ $Date: 2002/04/25 10:10:58 $
  + * @version $Revision: 1.42 $ $Date: 2002/04/28 06:06:13 $
    */
   public class DefaultTaskContext
       implements TaskContext
  @@ -197,21 +197,14 @@
        */
       public Object getProperty( final String name )
       {
  -        if( TaskContext.NAME.equals( name ) )
  +        try
           {
  -            return getName();
  +            final PropertyStore store = m_frame.getPropertyStore();
  +            return store.getProperty( name );
           }
  -        else
  +        catch( final TaskException te )
           {
  -            try
  -            {
  -                final PropertyStore store = m_frame.getPropertyStore();
  -                return store.getProperty( name );
  -            }
  -            catch( final TaskException te )
  -            {
  -                return null;
  -            }
  +            return null;
           }
       }
   
  
  
  
  1.3       +3 -4      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/property/PropertyStore.java
  
  Index: PropertyStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/property/PropertyStore.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PropertyStore.java	23 Apr 2002 02:05:55 -0000	1.2
  +++ PropertyStore.java	28 Apr 2002 06:06:13 -0000	1.3
  @@ -23,7 +23,7 @@
    * </ul>
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.2 $ $Date: 2002/04/23 02:05:55 $
  + * @version $Revision: 1.3 $ $Date: 2002/04/28 06:06:13 $
    */
   public interface PropertyStore
   {
  @@ -72,13 +72,12 @@
           throws TaskException;
   
       /**
  -     * Return a child PropertyStore with specified name.
  +     * Return a child PropertyStore.
        * This is to allow support for scoped stores. However a
        * store may choose to be unscoped and just return a
        * reference to itself.
        *
  -     * @param name the name of child store
        * @return the child store
        */
  -    PropertyStore createChildStore( String name );
  +    PropertyStore createChildStore();
   }
  
  
  

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