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

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


            if (checkDestNotInSources.size() > 0) {
                throw new BuildException("Destination resource " + dest
                        + " was specified as an input resource.");
            }
        }
        Restrict noexistRc = new Restrict();
        noexistRc.add(NOT_EXISTS);
        noexistRc.add(rc);
        for (Resource r : noexistRc) {
            log(r + " does not exist.", Project.MSG_ERR);
        }
        Restrict result = new Restrict();
        result.add(EXISTS);
        result.add(rc);
        return result;
    }
View Full Code Here


            // ignored.
            if (textBuffer != null) {
                throw new BuildException(
                    "Cannot include inline text when using resources.");
            }
            Restrict noexistRc = new Restrict();
            noexistRc.add(NOT_EXISTS);
            noexistRc.add(rc);
            for (Iterator i = noexistRc.iterator(); i.hasNext();) {
                log(i.next() + " does not exist.", Project.MSG_ERR);
            }
            if (destinationFile != null) {
                for (Iterator i = rc.iterator(); i.hasNext();) {
                    Object o = i.next();
                    if (o instanceof FileResource) {
                        File f = ((FileResource) o).getFile();
                        if (FILE_UTILS.fileNameEquals(f, destinationFile)) {
                            throw new BuildException("Input file \""
                                + f + "\" is the same as the output file.");
                        }
                    }
                }
            }
            Restrict existRc = new Restrict();
            existRc.add(EXISTS);
            existRc.add(rc);
            boolean outofdate = destinationFile == null || forceOverwrite;
            if (!outofdate) {
                for (Iterator i = existRc.iterator(); !outofdate && i.hasNext();) {
                    Resource r = (Resource) i.next();
                    outofdate =
                        (r.getLastModified() == 0L
                         || r.getLastModified() > destinationFile.lastModified());
                }
View Full Code Here

            }
        }
        resourcesToDelete.add(filesetDirs);
        if (rcs != null) {
            // sort first to files, then dirs
            Restrict exists = new Restrict();
            exists.add(EXISTS);
            exists.add(rcs);
            Sort s = new Sort();
            s.add(REVERSE_FILESYSTEM);
            s.add(exists);
            resourcesToDelete.add(s);
        }
View Full Code Here

        log(newestSource.toLongString() + " is newest source", Project.MSG_VERBOSE);
        return oldestTarget.getLastModified() >= newestSource.getLastModified();
    }

    private void logFuture(ResourceCollection rc, ResourceSelector rsel) {
        Restrict r = new Restrict();
        r.add(rsel);
        r.add(rc);
        for (Iterator i = r.iterator(); i.hasNext();) {
            log("Warning: " + i.next() + " modified in the future.", Project.MSG_WARN);
        }
    }
View Full Code Here

            if (checkDestNotInSources.size() > 0) {
                throw new BuildException("Destination resource " + dest
                        + " was specified as an input resource.");
            }
        }
        Restrict noexistRc = new Restrict();
        noexistRc.add(NOT_EXISTS);
        noexistRc.add(rc);
        for (Iterator i = noexistRc.iterator(); i.hasNext();) {
            log(i.next() + " does not exist.", Project.MSG_ERR);
        }
        Restrict result = new Restrict();
        result.add(EXISTS);
        result.add(rc);
        return result;
    }
View Full Code Here

            }
        }
        resourcesToDelete.add(filesetDirs);
        if (rcs != null) {
            // sort first to files, then dirs
            Restrict exists = new Restrict();
            exists.add(EXISTS);
            exists.add(rcs);
            Sort s = new Sort();
            s.add(REVERSE_FILESYSTEM);
            s.add(exists);
            resourcesToDelete.add(s);
        }
View Full Code Here

        if (rc instanceof FileSet && rc.isFilesystemOnly()) {
            // receives special treatment in copy that this task relies on
            myCopy.add(rc);
        } else {
            if (resources == null) {
                resources = new Restrict();
                resources.add(new Exists());
                myCopy.add(resources);
            }
            resources.add(rc);
        }
View Full Code Here

        if (rc instanceof FileSet && rc.isFilesystemOnly()) {
            // receives special treatment in copy that this task relies on
            myCopy.add(rc);
        } else {
            if (resources == null) {
                Restrict r = new Restrict();
                r.add(new Exists());
                r.add(resources = new Resources());
                myCopy.add(r);
            }
            resources.add(rc);
        }
    }
View Full Code Here

            for (int i = 0; i < targetnames.length; i++) {
                targetColl.add(targets.getResource(
                    targetnames[i].replace(File.separatorChar, '/')));
            }
            //find the out-of-date targets:
            Restrict r = new Restrict();
            r.add(selector.getTargetSelectorForSource(sr));
            r.add(targetColl);
            if (r.size() > 0) {
                result.add(sr);
                Resource t = (Resource) (r.iterator().next());
                logTo.log(sr.getName() + " added as " + t.getName()
                    + (t.isExists() ? " is outdated." : " doesn\'t exist."),
                    Project.MSG_VERBOSE);
                continue;
            }
View Full Code Here

                                  ResourceCollection rc, long granularity) {
        long now = System.currentTimeMillis() + granularity;
        Date sel = new Date();
        sel.setMillis(now);
        sel.setWhen(TimeComparison.AFTER);
        Restrict future = new Restrict();
        future.add(sel);
        future.add(rc);
        for (Iterator iter = future.iterator(); iter.hasNext();) {
            logTo.log("Warning: " + ((Resource) iter.next()).getName()
                     + " modified in the future.", Project.MSG_WARN);
        }
    }
View Full Code Here

TOP

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

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.