ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional JXPath.java JXPathSet.java JexlProperties.java VelocityProperties.java
Date Fri, 11 Oct 2002 18:07:08 GMT
costin      2002/10/11 11:07:08

  Modified:    proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional
                        JXPath.java JXPathSet.java JexlProperties.java
                        VelocityProperties.java
  Log:
  Various fixes
  
  Revision  Changes    Path
  1.4       +22 -2     jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/JXPath.java
  
  Index: JXPath.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/JXPath.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JXPath.java	30 Aug 2002 23:27:36 -0000	1.3
  +++ JXPath.java	11 Oct 2002 18:07:08 -0000	1.4
  @@ -77,8 +77,16 @@
       
       public JXPath() {
       }
  +
  +    public JXPathContext getJXPathContext() {
  +        return jxpathCtx;
  +    }
       
  -    public Object getProperty( Project p, String ns, String name ) {
  +    public boolean setProperty( Object c, String ns, String name, Object v ) {
  +        return false;
  +    }
  +    
  +    public Object getProperty( Object p, String ns, String name ) {
           if( ! name.startsWith(PREFIX) )
               return null;
           name=name.substring( PREFIX.length() );
  @@ -105,13 +113,25 @@
           
           return result;
       }
  -    
  +
  +    // testing
  +    String foo;
  +    public void setFoo( String s ) {
  +        System.out.println("Set foo " + s );
  +        foo=s;
  +    }
  +
  +    public String getFoo() {
  +        return foo;
  +    }
       
       public void execute() {
           JXPathIntrospector.registerDynamicClass(Hashtable.class, JXPathHashtableHandler.class);
   
           PropertyHelper phelper=PropertyHelper.getPropertyHelper( project );
           phelper.addPropertyInterceptor( this );
  +
  +        project.addReference( "jxpathTask", this );
           
           jxpathCtx=JXPathContext.newContext( project );
           
  
  
  
  1.2       +11 -5     jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/JXPathSet.java
  
  Index: JXPathSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/JXPathSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JXPathSet.java	30 Aug 2002 23:11:02 -0000	1.1
  +++ JXPathSet.java	11 Oct 2002 18:07:08 -0000	1.2
  @@ -71,12 +71,10 @@
    */
   public class JXPathSet extends Task {
   
  -    JXPathContext jxpathCtx;
       String path;
  -    String value;
  +    String valueString;
       String refId;
       
  -    
       public JXPathSet() {
       }
   
  @@ -99,12 +97,20 @@
       /** Set the value to be used.
        */
       public void setValue( String s ) {
  -        this.value=s;
  +        this.valueString=s;
       }
   
       public void execute() {
  -        jxpathCtx=JXPathContext.newContext( project );
  +        JXPathContext jxpathCtx;
  +        JXPath jxpathTask=(JXPath)project.getReference( "jxpathTask" );
  +        jxpathCtx=jxpathTask.getJXPathContext();
   
  +        Object value=null;
  +        if( refId!=null )
  +            value=project.getReference( refId );
  +        if( value==null )
  +            value=valueString;
           
  +        jxpathCtx.setValue( path, value );
       }    
   }
  
  
  
  1.2       +5 -1      jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/JexlProperties.java
  
  Index: JexlProperties.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/JexlProperties.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JexlProperties.java	30 Aug 2002 23:11:02 -0000	1.1
  +++ JexlProperties.java	11 Oct 2002 18:07:08 -0000	1.2
  @@ -74,7 +74,11 @@
       public JexlProperties() {
       }
       
  -    public Object getProperty( Project p, String ns, String name ) {
  +    public boolean setProperty( Object ctx, String ns, String name, Object value ) {
  +        return false;
  +    }
  +
  +    public Object getProperty( Object p, String ns, String name ) {
           if( ! name.startsWith(PREFIX) )
               return null;
           try {
  
  
  
  1.2       +10 -3     jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/VelocityProperties.java
  
  Index: VelocityProperties.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/VelocityProperties.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VelocityProperties.java	30 Aug 2002 23:11:02 -0000	1.1
  +++ VelocityProperties.java	11 Oct 2002 18:07:08 -0000	1.2
  @@ -76,8 +76,12 @@
       
       public VelocityProperties() {
       }
  +
  +    public boolean setProperty( Object c, String ns, String name, Object v ) {
  +        return false;
  +    }
       
  -    public Object getProperty( Project p, String ns, String name ) {
  +    public Object getProperty( Object p, String ns, String name ) {
           if( ! name.startsWith(PREFIX) )
               return null;
           try {
  @@ -93,13 +97,16 @@
               return null;
           }
       }
  -    
  +
  +    public VelocityEngine getVelocityEngine() {
  +        return engine;
  +    }
       
       public void execute() {
           try {
               PropertyHelper phelper=PropertyHelper.getPropertyHelper( project );
               phelper.addPropertyInterceptor( this );
  -            
  +
               engine=new VelocityEngine();
               engine.init();
               
  
  
  

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