Package org.apache.tools.ant.types

Examples of org.apache.tools.ant.types.Resource


        final List optimizedTests = configureOptimisedTestSet(antProj);

        StringBuffer testPattern = new StringBuffer();
        for (Iterator iterator = optimizedTests.iterator(); iterator.hasNext();) {
            Resource test = (Resource) iterator.next();
            getLog().info("Running TEST: " + test.getName());
            testPattern.append(test.getName());
            testPattern.append(",");
        }
        getLog().info("Setting test property to: " + testPattern);

        if (optimizedTests.size() == 0) { // ensure surefire wont fail if we run no tests
View Full Code Here


     * @return the resource with the given name.
     * @since Ant 1.5.2
     */
    public synchronized Resource getResource(String name) {
        File f = FILE_UTILS.resolveFile(basedir, name);
        return new Resource(name, f.exists(), f.lastModified(),
                            f.isDirectory(), f.length());
    }
View Full Code Here

   */
  private void setExternalDependencyProperties() {
    @SuppressWarnings("unchecked")
    Iterator<Resource> iter = (Iterator<Resource>)ivyXmlResources.iterator();
    while (iter.hasNext()) {
      final Resource resource = iter.next();
      if ( ! resource.isExists()) {
        throw new BuildException("Resource does not exist: " + resource.getName());
      }
      if ( ! (resource instanceof FileResource)) {
        throw new BuildException("Only filesystem resources are supported: "
            + resource.getName() + ", was: " + resource.getClass().getName());
      }

      File ivyXmlFile = ((FileResource)resource).getFile();
      try {
        collectExternalDependenciesFromIvyXmlFile(ivyXmlFile);
View Full Code Here

    int numChecked = 0;

    @SuppressWarnings("unchecked")
    Iterator<Resource> iter = (Iterator<Resource>)ivyXmlResources.iterator();
    while (iter.hasNext()) {
      final Resource resource = iter.next();
      if ( ! resource.isExists()) {
        throw new BuildException("Resource does not exist: " + resource.getName());
      }
      if ( ! (resource instanceof FileResource)) {
        throw new BuildException("Only filesystem resources are supported: "
            + resource.getName() + ", was: " + resource.getClass().getName());
      }

      File ivyXmlFile = ((FileResource)resource).getFile();
      try {
        if ( ! checkIvyXmlFile(ivyXmlFile)) {
View Full Code Here

            throw new BuildException("File extension when specified must not be an empty string");
        }
        try {
            if (resources != null) {
                for (Iterator i = resources.iterator(); i.hasNext();) {
                    Resource r = (Resource) i.next();
                    File src = ((FileProvider) r.as(FileProvider.class))
                        .getFile();
                    if (totalproperty != null || todir != null) {
                        // Use '/' to calculate digest based on file name.
                        // This is required in order to get the same result
                        // on different platforms.
                        relativeFilePaths.put(src, r.getName().replace(File.separatorChar, '/'));
                    }
                    addToIncludeFileMap(src);
                }
            }
            if (file != null) {
View Full Code Here

        for (int i = 0; i < rcs.length; i++) {
            Iterator iter = rcs[i].iterator();
            ArrayList dirs = new ArrayList();
            ArrayList files = new ArrayList();
            while (iter.hasNext()) {
                Resource r = (Resource) iter.next();
                if (r.isExists()) {
                    if (r.isDirectory()) {
                        dirs.add(r);
                    } else {
                        files.add(r);
                    }
                }
            }
            // make sure directories are in alpha-order - this also
            // ensures parents come before their children
            Collections.sort(dirs, new Comparator() {
                    public int compare(Object o1, Object o2) {
                        Resource r1 = (Resource) o1;
                        Resource r2 = (Resource) o2;
                        return r1.getName().compareTo(r2.getName());
                    }
                });
            ArrayList rs = new ArrayList(dirs);
            rs.addAll(files);
            result[i] = (Resource[]) rs.toArray(new Resource[rs.size()]);
View Full Code Here

        try {
            Path sources = createUnifiedSourcePath();
            Iterator iter = sources.iterator();
            while (iter.hasNext()) {
                Resource r = (Resource) iter.next();
                FileProvider fr = (FileProvider) r.as(FileProvider.class);
                verifyOneJar(fr.getFile());
            }

        } finally {
            endExecution();
View Full Code Here

    private boolean isUpToDate(ResourceCollection c) {
        if (dest == null || forceOverwrite) {
            return false;
        }
        for (Iterator i = c.iterator(); i.hasNext();) {
            Resource r = (Resource) i.next();
            if (SelectorUtils.isOutOfDate(r, dest, FILE_UTILS.getFileTimestampGranularity())) {
                return false;
            }
        }
        return true;
View Full Code Here

        if (getLocation() == null || getLocation().getFileName() == null) {
            throw new BuildException("Unable to get location of import task");
        }

        Union resourcesToImport = new Union(getProject(), resources);
        Resource fromFileAttribute = getFileAttributeResource();
        if (fromFileAttribute != null) {
            resources.add(fromFileAttribute);
        }
        for (Iterator i = resourcesToImport.iterator(); i.hasNext(); ) {
            importResource(helper, (Resource) i.next());
View Full Code Here

        }
    }

    private void handleResources(Handler h) {
        for (Iterator i = resources.iterator(); i.hasNext();) {
            Resource r = (Resource) i.next();
            if (!r.isExists()) {
                log(r + " does not exist", Project.MSG_WARN);
            }
            if (r.isDirectory()) {
                log(r + " is a directory; length may not be meaningful", Project.MSG_WARN);
            }
            h.handle(r);
        }
        h.complete();
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.types.Resource

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.