Examples of FileNameMapper


Examples of org.apache.tools.ant.util.FileNameMapper

    buildAutomata(grammarFile);

    DirectoryScanner scanner = getDirectoryScanner(srcDir);

    FileNameMapper mapperImpl;

    if (mapper==null)
      mapperImpl = new IdentityMapper();
    else
      mapperImpl = mapper.getImplementation();

    String[] list = scanner.getIncludedFiles();

    for (int i = 0; i<list.length; i++)
    {
      String[] dest = mapperImpl.mapFileName(list[i]);

      if (dest!=null)
        for (int j = 0; j<dest.length; j++)
        {
          log("Transforming "+list[i]+" to "+dest[j], Project.MSG_DEBUG);
View Full Code Here

Examples of org.apache.tools.ant.util.FileNameMapper

    buildAutomata(lexiconFile, grammarFile);

    DirectoryScanner scanner = getDirectoryScanner(srcDir);

    FileNameMapper mapperImpl;

    if (mapper==null)
      mapperImpl = new IdentityMapper();
    else
      mapperImpl = mapper.getImplementation();

    String[] list = scanner.getIncludedFiles();

    for (int i = 0; i<list.length; i++)
    {
      String[] dest = mapperImpl.mapFileName(list[i]);

      if (dest!=null)
        for (int j = 0; j<dest.length; j++)
        {
          log("Transforming "+list[i]+" to "+dest[j], Project.MSG_DEBUG);
View Full Code Here

Examples of org.apache.tools.ant.util.FileNameMapper

            if (initialResources[i].length == 0) {
                newerResources[i] = new Resource[] {};
                continue;
            }
           
            FileNameMapper myMapper = new IdentityMapper();
            if (filesets[i] instanceof ZipFileSet) {
                ZipFileSet zfs = (ZipFileSet) filesets[i];
                if (zfs.getFullpath() != null
                    && !zfs.getFullpath().equals("") ) {
                    // in this case all files from origin map to
View Full Code Here

Examples of org.apache.tools.ant.util.FileNameMapper

            //the rest of the method treats single jar like
            //a nested path with one file

            Path sources = createUnifiedSourcePath();
            //set up our mapping policy
            FileNameMapper destMapper;
            if (hasMapper) {
                destMapper = mapper;
            } else {
                //no mapper? use the identity policy
                destMapper = new IdentityMapper();
            }


            //at this point the paths are set up with lists of files,
            //and the mapper is ready to map from source dirs to dest files
            //now we iterate through every JAR giving source and dest names
            // deal with the paths
            Iterator iter = sources.iterator();
            while (iter.hasNext()) {
                FileResource fr = (FileResource) iter.next();

                //calculate our destination directory; it is either the destDir
                //attribute, or the base dir of the fileset (for in situ updates)
                File toDir = hasDestDir ? destDir : fr.getBaseDir();

                //determine the destination filename via the mapper
                String[] destFilenames = destMapper.mapFileName(fr.getName());
                if (destFilenames == null || destFilenames.length != 1) {
                    //we only like simple mappers.
                    throw new BuildException(ERROR_BAD_MAP + fr.getFile());
                }
                File destFile = new File(toDir, destFilenames[0]);
View Full Code Here

Examples of org.apache.tools.ant.util.FileNameMapper

            tis =
                new TarInputStream(compression.decompress(name,
                                                          new BufferedInputStream(stream)));
            log("Expanding: " + name + " into " + dir, Project.MSG_INFO);
            TarEntry te = null;
            FileNameMapper mapper = getMapper();
            while ((te = tis.getNextEntry()) != null) {
                extractFile(FileUtils.getFileUtils(), null, dir, tis,
                            te.getName(), te.getModTime(),
                            te.isDirectory(), mapper);
            }
View Full Code Here

Examples of org.apache.tools.ant.util.FileNameMapper

     * @param files    A list of files to copy.
     * @param dirs     A list of directories to copy.
     */
    protected void scan(File fromDir, File toDir, String[] files,
                        String[] dirs) {
        FileNameMapper mapper = getMapper();
        buildMap(fromDir, toDir, files, mapper, fileCopyMap);

        if (includeEmpty) {
            buildMap(fromDir, toDir, dirs, mapper, dirCopyMap);
        }
View Full Code Here

Examples of org.apache.tools.ant.util.FileNameMapper

    /**
     * returns the mapper to use based on nested elements or the
     * flatten attribute.
     */
    private FileNameMapper getMapper() {
        FileNameMapper mapper = null;
        if (mapperElement != null) {
            mapper = mapperElement.getImplementation();
        } else if (flatten) {
            mapper = new FlatFileNameMapper();
        } else {
View Full Code Here

Examples of org.apache.tools.ant.util.FileNameMapper

     * @param dir       the destination directory
     */
    protected void expandFile(FileUtils fileUtils, File srcF, File dir) {
        log("Expanding: " + srcF + " into " + dir, Project.MSG_INFO);
        ZipFile zf = null;
        FileNameMapper mapper = getMapper();
        try {
            zf = new ZipFile(srcF, encoding);
            Enumeration e = zf.getEntries();
            while (e.hasMoreElements()) {
                ZipEntry ze = (ZipEntry) e.nextElement();
View Full Code Here

Examples of org.apache.tools.ant.util.FileNameMapper

    /**
     * get a mapper for a file
     * @return a filenamemapper for a file
     */
    protected FileNameMapper getMapper() {
        FileNameMapper mapper = null;
        if (mapperElement != null) {
            mapper = mapperElement.getImplementation();
        } else {
            mapper = new IdentityMapper();
        }
View Full Code Here

Examples of org.apache.tools.ant.util.FileNameMapper

                cachedNames = names;
            }
        } else {
            names = cachedNames;
        }
        FileNameMapper m = null;
        Mapper myMapper = getMapper();
        if (myMapper != null) {
            m = myMapper.getImplementation();
        }
        Properties properties = new Properties();
        //iterate through the names, get the matching values
        for (Iterator iter = names.iterator(); iter.hasNext();) {
            String name = (String) iter.next();
            String value = (String) props.get(name);
            if (value != null) {
                // may be null if a system property has been added
                // after the project instance has been initialized
                if (m != null) {
                    //map the names
                    String[] newname = m.mapFileName(name);
                    if (newname != null) {
                        name = newname[0];
                    }
                }
                properties.setProperty(name, value);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.