Package org.apache.tools.ant.types.resources

Examples of org.apache.tools.ant.types.resources.FileResource


      URLResource stylesheet = new URLResource();
      URL stylesheetURL = getClass().getClassLoader().getResource(concat(XSL_FILE_PATH, xslname));
      stylesheet.setURL(stylesheetURL);
      return stylesheet;
    }
    FileResource stylesheet = new FileResource();
    File stylesheetFile = new File(styleDir, xslname);
    stylesheet.setFile(stylesheetFile);
    return stylesheet;
  }
View Full Code Here


                    fileLists.put(prefix, fileChecksums);
                }

                Iterator<FileResource> i = (Iterator<FileResource>) files.iterator();
                while (i.hasNext()) {
                    FileResource fr = i.next();
                    File f = fr.getFile();

                    String writeName = fr.getName().replace(File.separatorChar, '-');
                    writeName += ".checksum";
                    File checksumFile = new File(fileSetDir, writeName);

                    if (!checksumFile.exists() || outOfDate(checksumFile, f)) {
                        generateChecksum(fr, checksumFile);
                    }

                    String checksum = readChecksum(checksumFile);

                    fileChecksums.put(fr.getName(), checksum);
                }
            }

            // write file lists
            for (Map.Entry<String, Map<String, String>> e : fileLists.entrySet()) {
View Full Code Here

      org.apache.tools.ant.types.Path classpath =
        (org.apache.tools.ant.types.Path) classPathRef.getReferencedObject(getProject());

      Iterator<?> iter = classpath.iterator();
      while (iter.hasNext()) {
        FileResource resource = (FileResource) iter.next();
        File source = resource.getFile();
        File destination = new File(javaDirectory, source.getName());
        copy(source, destination);
      }
    }
  }
View Full Code Here

    /**
     * The XML file to parse; required.
     * @param src the file to parse
     */
    public void setFile(File src) {
        setSrcResource(new FileResource(src));
    }
View Full Code Here

    protected Resource getResource() {
        // delegate this way around to support subclasses that
        // overwrite getFile
        File f = getFile();
        if (f != null) {
            return new FileResource(f);
        } else {
            return src;
        }
    }
View Full Code Here

    /**
     * the file to compress; required.
     * @param src the source file
     */
    public void setSrc(File src) {
        setSrcResource(new FileResource(src));
    }
View Full Code Here

     * @param zOut the output stream
     * @throws IOException on error
     */
    protected void zipFile(File file, OutputStream zOut)
        throws IOException {
        zipResource(new FileResource(file), zOut);
    }
View Full Code Here

                    }

                    File base = null;
                    String name = res.getName();
                    if (res instanceof FileResource) {
                        FileResource fr = (FileResource) res;
                        base = fr.getBaseDir();
                        if (base == null) {
                            name = fr.getFile().getAbsolutePath();
                        }
                    }

                    if (restrict(new String[] {name}, base).length == 0) {
                        continue;
View Full Code Here

            //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]);
                signOneJar(fr.getFile(), destFile);
            }
        } finally {
            endExecution();
        }
    }
View Full Code Here

    /**
     * Set the single file for this task.
     * @param file the <code>File</code> whose length to retrieve.
     */
    public synchronized void setFile(File file) {
        add(new FileResource(file));
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.types.resources.FileResource

Copyright © 2018 www.massapicom. 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.