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/sandbox/embed ant-sax2.jar build.xml org.apache.tools.ant.ProjectHelper RuntimeConfigurable2.java
Date Fri, 17 May 2002 23:12:51 GMT
costin      02/05/17 16:12:51

  Modified:    proposal/sandbox/embed RuntimeConfigurable2.java
  Added:       proposal/sandbox/embed ant-sax2.jar build.xml
                        org.apache.tools.ant.ProjectHelper
  Log:
  Fixes, build file, get it to work.
  
  Revision  Changes    Path
  1.2       +23 -33    jakarta-ant/proposal/sandbox/embed/RuntimeConfigurable2.java
  
  Index: RuntimeConfigurable2.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/sandbox/embed/RuntimeConfigurable2.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RuntimeConfigurable2.java	17 May 2002 21:26:41 -0000	1.1
  +++ RuntimeConfigurable2.java	17 May 2002 23:12:51 -0000	1.2
  @@ -58,6 +58,7 @@
   import java.util.Enumeration;
   import java.util.Locale;
   import java.util.Vector;
  +import java.util.Hashtable;
   import org.xml.sax.AttributeList;
   import org.xml.sax.Attributes;
   import org.xml.sax.helpers.AttributeListImpl;
  @@ -98,6 +99,8 @@
           super( proxy, elementTag );
           wrappedObject = proxy;
           this.elementTag = elementTag;
  +        if( proxy instanceof Task )
  +            ((Task)proxy).setRuntimeConfigurableWrapper( this );
       }
   
       /**
  @@ -280,7 +283,6 @@
               try {
                   ih.setAttribute(project, target, 
                                   attrs.getQName(i).toLowerCase(Locale.US), value);
  -                
               } catch (BuildException be) {
                   // id attribute must be set externally
                   if (!attrs.getQName(i).equals("id")) {
  @@ -329,7 +331,19 @@
           return sb.toString();
   
       }
  +
  +    static Hashtable propertySources=new Hashtable();
  +
  +    public static interface ProjectPropertySource {
  +
  +	public String getProperty( Project project, String key );
  +	
  +    }
       
  +    public static void addPropertySource( String ns, ProjectPropertySource src ) {
  +        propertySources.put( ns, src );
  +    }
  +
       
       /** Use the reference table to generate values for ${} substitution.
        *  To preserve backward compat ( as much as possible ) we'll only process
  @@ -343,20 +357,6 @@
        *    bean:idName.propertyName - we get the idName and call the getter for the property.

        */
       static String processReference( Project project, String name ) {
  -        if( name.startsWith("dom:") ) {
  -            name=name.substring( 4 );
  -            int idx=name.indexOf(":");
  -            if( idx<0 ) return null;
  -
  -            String objName=name.substring( 0, idx );
  -            String path=name.substring( idx );
  -            System.out.println("XXX dom: " + objName + " " + path );
  -
  -            Object v=project.getReference( objName );
  -            if( v==null ) return null;
  -
  -        }
  -
           if( name.startsWith( "toString:" )) {
               name=name.substring( "toString:".length());
               Object v=project.getReference( name );
  @@ -364,26 +364,16 @@
               return v.toString();
           }
   
  -        if( name.startsWith( "bean:" )) {
  -            name=name.substring( "toString:".length());
  -            int idx=name.indexOf(":");
  -            if( idx<0 ) return null;
  -
  -            String objName=name.substring( 0, idx );
  -            String path=name.substring( idx );
  -            System.out.println("XXX bean: " + objName + " " + path );
  +        int idx=name.indexOf(":");
  +        if( idx<0 ) return null;
   
  -            Object v=project.getReference( objName );
  -            if( v==null ) return null;
  -
  -            return v.toString();
  -        }
  +        String ns=name.substring( 0, idx );
  +        String path=name.substring( idx );
   
  +        ProjectPropertySource ps=(ProjectPropertySource)propertySources.get( ns );
  +        if( ps == null )
  +            return null;
   
  -        
  -        // If everything else fails, use toString()
  -        return null;
  +        return ps.getProperty( project, path );
       }
  -
  -
   }
  
  
  
  1.1                  jakarta-ant/proposal/sandbox/embed/ant-sax2.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-ant/proposal/sandbox/embed/build.xml
  
  Index: build.xml
  ===================================================================
  <project name="helper2" default="main" >
    <property name="ant.src" location="../../.." />
    <property name="ant.build" location="${ant.src}/build" />
    <property name="debug" value="true"/>
  
    <target name="main">
      <copy file="ProjectHelperImpl2.java"  
            todir="${ant.src}/src/main/org/apache/tools/ant/helper" />
      <copy file="RuntimeConfigurable2.java"  
            todir="${ant.src}/src/main/org/apache/tools/ant" />
  
      <javac srcdir="${ant.src}/src"  
             debug="${debug}"
             destdir="${ant.build}/classes" >
        <classpath location="${ant.build}/classes" />
        <include name="**/ProjectHelperImpl2.java" />
        <include name="**/RuntimeConfigurable2.java" />
      </javac>
  
      <mkdir dir="${ant.build}/classes/META-INF/services" />
  
      <copy file="org.apache.tools.ant.ProjectHelper" 
            tofile="${ant.build}/classes/META-INF/services/org.apache.tools.ant.ProjectHelper"
/>
  
      <jar file="ant-sax2.jar" basedir="${ant.build}/classes" >
        <include name="META-INF/**" />
        <include name="org/apache/tools/ant/helper/ProjectHelperImpl2*" />
        <include name="org/apache/tools/ant/RuntimeConfigurable2*" />
      </jar>
    </target>
  
    <target name="clean">
       <delete file="${ant.src}/src/main/org/apache/tools/ant/RuntimeConfigurable2.java"
/>
       <delete file="${ant.src}/src/main/org/apache/tools/ant/helper/ProjectHelperImpl2.java"
/>
    </target>
  
  </project>
  
  
  
  1.1                  jakarta-ant/proposal/sandbox/embed/org.apache.tools.ant.ProjectHelper
  
  Index: org.apache.tools.ant.ProjectHelper
  ===================================================================
  org.apache.tools.ant.helper.ProjectHelperImpl2
  
  
  

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