dion        2002/06/12 09:38:56

  Modified:    src/java/org/apache/maven/jelly AntBuildTag.java
                        JellyAntProject.java
               src/java/org/apache/maven/build PropertyResolver.java
  Log:
  Allow loading of properties from a file
  
  Revision  Changes    Path
  1.7       +1 -1      
jakarta-turbine-maven/src/java/org/apache/maven/jelly/AntBuildTag.java
  
  Index: AntBuildTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jelly/AntBuildTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AntBuildTag.java  10 Jun 2002 15:43:58 -0000      1.6
  +++ AntBuildTag.java  12 Jun 2002 16:38:56 -0000      1.7
  @@ -306,7 +306,7 @@
                                      JellyAntProject newProject)
       {
   
  -        newProject.setJexlContext( project.getJexlContext() );
  +        newProject.setContext( project.getContext() );
   
           System.err.println( "########## initializeProject()" );
           Vector listeners = project.getBuildListeners();
  
  
  
  1.5       +3 -2      
jakarta-turbine-maven/src/java/org/apache/maven/jelly/JellyAntProject.java
  
  Index: JellyAntProject.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jelly/JellyAntProject.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JellyAntProject.java      12 Jun 2002 15:38:05 -0000      1.4
  +++ JellyAntProject.java      12 Jun 2002 16:38:56 -0000      1.5
  @@ -7,9 +7,9 @@
   import org.apache.commons.jelly.expression.Expression;
   import org.apache.commons.jelly.expression.ExpressionFactory;
   import org.apache.commons.jelly.expression.jexl.JexlExpressionFactory;
  -
   import org.apache.commons.logging.LogFactory;
   import org.apache.commons.logging.Log;
  +import org.apache.tools.ant.taskdefs.Property;
   
   import java.util.Hashtable;
   
  @@ -50,6 +50,7 @@
       public JellyAntProject(JellyContext context)
       {
           setContext(context);
  +        super.addTaskDefinition("property", Property.class);
       }
   
       /** 
  
  
  
  1.5       +17 -7     
jakarta-turbine-maven/src/java/org/apache/maven/build/PropertyResolver.java
  
  Index: PropertyResolver.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/build/PropertyResolver.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PropertyResolver.java     12 Jun 2002 15:28:58 -0000      1.4
  +++ PropertyResolver.java     12 Jun 2002 16:38:56 -0000      1.5
  @@ -55,7 +55,13 @@
    *
    * ====================================================================
    */
  +
   import java.io.File;
  +import java.io.FileInputStream;
  +import java.io.FileNotFoundException;
  +import java.io.IOException;
  +import java.util.Iterator;
  +import java.util.Properties;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -92,13 +98,17 @@
        * @see java.util.Properties
        * @see org.apache.tools.ant.taskdefs.Property
        */
  -    public void addPropertiesFromFile(String fileName)
  +    public void addPropertiesFromFile(String fileName) throws 
  +        FileNotFoundException, IOException
       {
  -        Property property = (Property)resolver.createTask("property");
  -        property.setDescription("PropertyResolver.addPropertiesFromFile");
  -        property.setFile(new File(fileName));
  -        property.setProject(resolver);
  -        property.execute();
  +        Properties props = new Properties();
  +        props.load(new FileInputStream(fileName));
  +        String key = null;
  +        for(Iterator i = props.keySet().iterator(); i.hasNext();)
  +        {
  +            key = (String)i.next();
  +            setProperty(key,  props.get(key));
  +        }
       }
       
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to