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 NameValidator.java
Date Fri, 03 May 2002 09:26:14 GMT
donaldp     02/05/03 02:26:13

  Modified:    antlib/src/java/org/apache/antlib/project
                        Resources.properties TargetTask.java
               container/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               container/src/java/org/apache/myrmidon/interfaces/property
                        NameValidator.java
  Log:
  Introduce the start of a name validation service.
  
  Revision  Changes    Path
  1.3       +1 -0      jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/Resources.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Resources.properties	3 May 2002 06:56:10 -0000	1.2
  +++ Resources.properties	3 May 2002 09:26:13 -0000	1.3
  @@ -1,6 +1,7 @@
   target.no-name.error=Target does not specify the name attribute.
   target.exec.notice=Executing target: "{0}".
   target.task-exec.notice=Executing task: "{0}".
  +target.bad-name.error=Target "{0}" has a invalid name (Reason: {1}).
   
   typelib.missing-library.error=Missing library attribute from typelib statement.
   typelib.missing-name.error=Specified role ("{0}") but missing name from typelib statement.
  
  
  
  1.2       +17 -1     jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/TargetTask.java
  
  Index: TargetTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/TargetTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TargetTask.java	2 May 2002 08:43:33 -0000	1.1
  +++ TargetTask.java	3 May 2002 09:26:13 -0000	1.2
  @@ -14,12 +14,13 @@
   import org.apache.myrmidon.api.metadata.ModelElement;
   import org.apache.myrmidon.framework.AbstractContainerTask;
   import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.property.NameValidator;
   
   /**
    * A simple task to task to execute a group of tasks.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.1 $ $Date: 2002/05/02 08:43:33 $
  + * @version $Revision: 1.2 $ $Date: 2002/05/03 09:26:13 $
    * @ant.task name="target"
    */
   public class TargetTask
  @@ -74,6 +75,21 @@
               final String message =
                   REZ.getString( "target.no-name.error" );
               throw new TaskException( message );
  +        }
  +
  +        final NameValidator validator =
  +            (NameValidator)getService( NameValidator.class );
  +        try
  +        {
  +            validator.validate( m_name );
  +        }
  +        catch( final Exception e )
  +        {
  +            final String message =
  +                REZ.getString( "target.bad-name.error",
  +                               m_name,
  +                               e );
  +            throw new TaskException( message, e );
           }
   
           if( getContext().isInfoEnabled() )
  
  
  
  1.59      +5 -1      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java
  
  Index: DefaultEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- DefaultEmbeddor.java	3 May 2002 06:56:10 -0000	1.58
  +++ DefaultEmbeddor.java	3 May 2002 09:26:13 -0000	1.59
  @@ -50,6 +50,7 @@
   import org.apache.myrmidon.interfaces.oldmodel.Project;
   import org.apache.myrmidon.interfaces.property.PropertyResolver;
   import org.apache.myrmidon.interfaces.property.PropertyStore;
  +import org.apache.myrmidon.interfaces.property.NameValidator;
   import org.apache.myrmidon.interfaces.role.RoleManager;
   import org.apache.myrmidon.interfaces.role.RoleRegistry;
   import org.apache.myrmidon.interfaces.service.MultiSourceServiceManager;
  @@ -63,7 +64,7 @@
    * Instantiate this to embed inside other applications.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.58 $ $Date: 2002/05/03 06:56:10 $
  + * @version $Revision: 1.59 $ $Date: 2002/05/03 09:26:13 $
    */
   public class DefaultEmbeddor
       extends AbstractLogEnabled
  @@ -295,6 +296,9 @@
           createComponent( Executor.ROLE,
                            Executor.class,
                            PREFIX + "executor.DefaultExecutor" );
  +        createComponent( NameValidator.ROLE,
  +                         NameValidator.class,
  +                         PREFIX + "property.DefaultNameValidator" );
           createComponent( PropertyResolver.ROLE,
                            PropertyResolver.class,
                            PREFIX + "property.DefaultPropertyResolver" );
  
  
  
  1.2       +3 -1      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/property/NameValidator.java
  
  Index: NameValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/property/NameValidator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NameValidator.java	2 May 2002 08:59:12 -0000	1.1
  +++ NameValidator.java	3 May 2002 09:26:13 -0000	1.2
  @@ -11,10 +11,12 @@
    * Determines the validity of names used in projects.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.1 $ $Date: 2002/05/02 08:59:12 $
  + * @version $Revision: 1.2 $ $Date: 2002/05/03 09:26:13 $
    */
   public interface NameValidator
   {
  +    String ROLE = NameValidator.class.getName();
  +
       /**
        * Validates the supplied name, failing if it is not.
        *
  
  
  

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