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/components/model Condition.java DefaultTarget.java Target.java
Date Sat, 02 Jun 2001 08:46:12 GMT
donaldp     01/06/02 01:46:12

  Modified:    proposal/myrmidon/src/java/org/apache/ant/modules/basic
                        Pattern.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/builder
                        DefaultProjectBuilder.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/manager
                        DefaultProjectManager.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/model
                        DefaultTarget.java Target.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/components/model
                        Condition.java
  Removed:     proposal/myrmidon/src/java/org/apache/ant/util
                        Condition.java
  Log:
  Moved Condition to be part of project model.
  
  Revision  Changes    Path
  1.4       +8 -8      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/Pattern.java
  
  Index: Pattern.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/Pattern.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Pattern.java	2001/05/29 12:06:07	1.3
  +++ Pattern.java	2001/06/02 08:46:11	1.4
  @@ -7,20 +7,20 @@
    */
   package org.apache.ant.modules.basic;
   
  -import org.apache.myrmidon.api.TaskException;
   import org.apache.ant.tasklet.DataType;
  -import org.apache.ant.util.Condition;
  +import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.components.model.Condition;
   
   /**
    * Basic data type for holding patterns.
  - * 
  + *
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
    */
   public class Pattern
       implements DataType
   {
  -    protected String         m_name;
  -    protected Condition      m_condition;
  +    private String         m_name;
  +    private Condition      m_condition;
   
       /**
        * Retrieve name (aka value) of pattern.
  @@ -31,7 +31,7 @@
       {
           return m_name;
       }
  -    
  +
       /**
        * Get condition associated with pattern if any.
        *
  @@ -41,7 +41,7 @@
       {
           return m_condition;
       }
  -    
  +
       /**
        * Setter method for name/value of pattern.
        * Conforms to ant setter patterns
  @@ -85,7 +85,7 @@
        *
        * @exception TaskException if an error occurs
        */
  -    protected void verifyConditionNull()
  +    private void verifyConditionNull()
           throws TaskException
       {
           if( null != m_condition )
  
  
  
  1.5       +1 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultProjectBuilder.java	2001/05/29 12:06:18	1.4
  +++ DefaultProjectBuilder.java	2001/06/02 08:46:12	1.5
  @@ -9,7 +9,6 @@
   
   import java.io.File;
   import java.io.IOException;
  -import org.apache.ant.util.Condition;
   import org.apache.avalon.framework.ExceptionUtil;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  @@ -17,6 +16,7 @@
   import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.log.Logger;
   import org.apache.myrmidon.api.TaskContext;
  +import org.apache.myrmidon.components.model.Condition;
   import org.apache.myrmidon.components.model.DefaultProject;
   import org.apache.myrmidon.components.model.DefaultTarget;
   import org.apache.myrmidon.components.model.Project;
  
  
  
  1.5       +1 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/manager/DefaultProjectManager.java
  
  Index: DefaultProjectManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/manager/DefaultProjectManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultProjectManager.java	2001/05/31 17:20:19	1.4
  +++ DefaultProjectManager.java	2001/06/02 08:46:12	1.5
  @@ -8,7 +8,6 @@
   package org.apache.myrmidon.components.manager;
   
   import java.util.ArrayList;
  -import org.apache.ant.util.Condition;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.component.ComponentException;
  @@ -23,6 +22,7 @@
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.components.executor.Executor;
  +import org.apache.myrmidon.components.model.Condition;
   import org.apache.myrmidon.components.model.Project;
   import org.apache.myrmidon.components.model.Target;
   import org.apache.myrmidon.listeners.ProjectListener;
  
  
  
  1.2       +0 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultTarget.java
  
  Index: DefaultTarget.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultTarget.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultTarget.java	2001/05/29 07:39:29	1.1
  +++ DefaultTarget.java	2001/06/02 08:46:12	1.2
  @@ -8,7 +8,6 @@
   package org.apache.myrmidon.components.model;
   
   import java.util.ArrayList;
  -import org.apache.ant.util.Condition;
   import org.apache.avalon.framework.configuration.Configuration;
   
   /**
  
  
  
  1.3       +0 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Target.java
  
  Index: Target.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Target.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Target.java	2001/05/31 17:20:25	1.2
  +++ Target.java	2001/06/02 08:46:12	1.3
  @@ -7,7 +7,6 @@
    */
   package org.apache.myrmidon.components.model;
   
  -import org.apache.ant.util.Condition;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.configuration.Configuration;
   
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Condition.java
  
  Index: Condition.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.myrmidon.components.model;
  
  import org.apache.avalon.excalibur.property.PropertyException;
  import org.apache.avalon.excalibur.property.PropertyUtil;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.myrmidon.api.TaskException;
  
  /**
   * Class representing a condition.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class Condition
      implements Component
  {
      private String            m_condition;
      private boolean           m_isIfCondition; 
  
      public Condition( final boolean isIfCondition, final String condition )
      {
          m_isIfCondition = isIfCondition;
          m_condition = condition;
      }
  
      public String getCondition()
      {
          return m_condition;
      }
  
      public boolean isIfCondition()
      {
          return m_isIfCondition;
      }
  
      public boolean evaluate( final Context context )
          throws TaskException
      {
          boolean result = false;
  
          try
          {
              final Object resolved =
                  PropertyUtil.resolveProperty( getCondition(), context, false );
  
              if( null != resolved )
              {
                  final Object object = context.get( resolved );
                  //TODO: Do more than just check for presence????????????
  
                  //true as object present
                  result = true;
              }
          }
          catch( final ContextException ce )
          {
              result = false;
          }
          catch( final PropertyException pe )
          {
              throw new TaskException( "Error resolving " + m_condition, pe );
          }
  
          if( !m_isIfCondition )
          {
              result = !result;
          }
  
          return result;
      }
  }
  
  
  
  
  

Mime
View raw message