ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types AbstractFileSet.java DirSet.java FileSet.java
Date Wed, 10 Apr 2002 11:27:16 GMT
conor       02/04/10 04:27:16

  Modified:    src/main/org/apache/tools/ant/taskdefs MatchingTask.java
               src/main/org/apache/tools/ant/types AbstractFileSet.java
                        DirSet.java FileSet.java
  Log:
  Fix up the determination of fileset names since most fileset subclasses
  won't override the getDataTypeName and thus be reported as fileset
  
  Revision  Changes    Path
  1.21      +8 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java
  
  Index: MatchingTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -w -u -r1.20 -r1.21
  --- MatchingTask.java	10 Apr 2002 08:35:01 -0000	1.20
  +++ MatchingTask.java	10 Apr 2002 11:27:16 -0000	1.21
  @@ -80,6 +80,14 @@
       protected FileSet fileset = new FileSet();
   
       /**
  +     * @see ProjectComponent#setProject
  +     */
  +    public void setProject(Project project) {
  +        super.setProject(project);
  +        fileset.setProject(project);
  +    }
  +
  +    /**
        * add a name entry on the include list
        */
       public PatternSet.NameEntry createInclude() {
  
  
  
  1.2       +28 -2     jakarta-ant/src/main/org/apache/tools/ant/types/AbstractFileSet.java
  
  Index: AbstractFileSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/AbstractFileSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -u -r1.1 -r1.2
  --- AbstractFileSet.java	8 Apr 2002 14:25:18 -0000	1.1
  +++ AbstractFileSet.java	10 Apr 2002 11:27:16 -0000	1.2
  @@ -62,6 +62,8 @@
   import java.io.File;
   import java.util.Stack;
   import java.util.Vector;
  +import java.util.Hashtable;
  +import java.util.Enumeration;
   
   /**
    * Class that holds an implicit patternset and supports nested
  @@ -85,6 +87,7 @@
       private boolean useDefaultExcludes = true;
       private boolean isCaseSensitive = true;
   
  +   
       public AbstractFileSet() {
           super();
       }
  @@ -95,7 +98,7 @@
           this.additionalPatterns = fileset.additionalPatterns;
           this.useDefaultExcludes = fileset.useDefaultExcludes;
           this.isCaseSensitive = fileset.isCaseSensitive;
  -        setProject(getProject());
  +        setProject(fileset.getProject());
       }
   
       /**
  @@ -270,10 +273,33 @@
           this.isCaseSensitive = isCaseSensitive;
       }
   
  +    
  +    
       /**
        * sets the name used for this datatype instance.
        */
  -    protected abstract String getDataTypeName();
  +    protected String getDataTypeName() {
  +        // look up the types in project and see if they match this class
  +        Project project = getProject();
  +        if (project != null) {
  +            Hashtable typedefs = project.getDataTypeDefinitions();
  +            for (Enumeration e = typedefs.keys(); e.hasMoreElements();) {
  +                String typeName = (String)e.nextElement();
  +                Class typeClass = (Class)typedefs.get(typeName);
  +                if (typeClass == getClass()) {
  +                    return typeName;
  +                }
  +            }
  +        }
  +            
  +        String classname = getClass().getName();
  +        
  +        int dotIndex = classname.lastIndexOf(".");
  +        if (dotIndex == -1) {
  +            return classname;
  +        }
  +        return classname.substring(dotIndex + 1); 
  +    }
   
       /**
        * Returns the directory scanner needed to access the files to process.
  
  
  
  1.6       +0 -4      jakarta-ant/src/main/org/apache/tools/ant/types/DirSet.java
  
  Index: DirSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/DirSet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -u -r1.5 -r1.6
  --- DirSet.java	8 Apr 2002 14:25:18 -0000	1.5
  +++ DirSet.java	10 Apr 2002 11:27:16 -0000	1.6
  @@ -70,10 +70,6 @@
           super(dirset);
       }
   
  -    protected String getDataTypeName() {
  -        return "dirset";
  -    }
  -
       /**
        * Return a DirSet that has the same basedir and same patternsets
        * as this one.
  
  
  
  1.28      +0 -4      jakarta-ant/src/main/org/apache/tools/ant/types/FileSet.java
  
  Index: FileSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/FileSet.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -w -u -r1.27 -r1.28
  --- FileSet.java	8 Apr 2002 14:25:18 -0000	1.27
  +++ FileSet.java	10 Apr 2002 11:27:16 -0000	1.28
  @@ -75,10 +75,6 @@
           super(fileset);
       }
   
  -    protected String getDataTypeName() {
  -        return "fileset";
  -    }
  -
       /**
        * Return a FileSet that has the same basedir and same patternsets
        * as this one.
  
  
  

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