Package org.apache.tools.ant.types

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


  } // end of transform path structure.


  private void createPatternSet()
  {
    final PatternSet patternSet = new PatternSet();

    log("Creating a patternset for the bundles with id='" +patternSetId +"'.",
        Project.MSG_DEBUG);

    for (Iterator it=bas.allBundleArchives.iterator(); it.hasNext();) {
      BundleArchives.BundleArchive ba
        = (BundleArchives.BundleArchive) it.next();

      patternSet.setIncludes(ba.relPath);
      log("Adding includes '" +ba.relPath +"'.", Project.MSG_DEBUG);
    }
    getProject().addReference(patternSetId, patternSet);
  } // end of create pattern set for bundles
View Full Code Here


        log("copyInjars does not support inpath.\n", Project.MSG_WARN);
      }
      String taskName = getTaskName() + " - unzip";
      String[] paths = injars.list();
      if (!LangUtil.isEmpty(paths)) {
        PatternSet patternSet = new PatternSet();
        patternSet.setProject(project);
        patternSet.setIncludes("**/*");
        patternSet.setExcludes("**/*.class");
        for (int i = 0; i < paths.length; i++) {
          Expand unzip = new Expand();
          unzip.setProject(project);
          unzip.setTaskName(taskName);
          unzip.setDest(destDir);
View Full Code Here

            return getPattern().createExclude();
        }

        private PatternSet getPattern() {
            if (patternSet == null) {
                patternSet = new PatternSet();
            }
            return patternSet;
        }
View Full Code Here

        // for each sourcePath entry, add a directoryset with includes
        // taken from packagenames attribute and nested package
        // elements and excludes taken from excludepackages attribute
        // and nested excludepackage elements
        if (this.sourcePath != null) {
            PatternSet ps = new PatternSet();
            if (packageNames.size() > 0) {
                for (String pn : packageNames) {
                    String pkg = pn.replace('.', '/');
                    if (pkg.endsWith("*")) {
                        pkg += "*";
                    }
                    ps.createInclude().setName(pkg);
                }
            } else {
                ps.createInclude().setName("**");
            }

            for (String epn : excludePackageNames) {
                String pkg = epn.replace('.', '/');
                if (pkg.endsWith("*")) {
                    pkg += "*";
                }
                ps.createExclude().setName(pkg);
            }

            String[] pathElements = this.sourcePath.list();
            for (String pathElement : pathElements) {
                File dir = new File(pathElement);
View Full Code Here

        // for each sourcePath entry, add a directoryset with includes
        // taken from packagenames attribute and nested package
        // elements and excludes taken from excludepackages attribute
        // and nested excludepackage elements
        if (sourcePath != null && packageNames.size() > 0) {
            PatternSet ps = new PatternSet();
            Enumeration e = packageNames.elements();
            while (e.hasMoreElements()) {
                PackageName p = (PackageName) e.nextElement();
                String pkg = p.getName().replace('.', '/');
                if (pkg.endsWith("*")) {
                    pkg += "*";
                }
                ps.createInclude().setName(pkg);
            }

            e = excludePackageNames.elements();
            while (e.hasMoreElements()) {
                PackageName p = (PackageName) e.nextElement();
                String pkg = p.getName().replace('.', '/');
                if (pkg.endsWith("*")) {
                    pkg += "*";
                }
                ps.createExclude().setName(pkg);
            }


            String[] pathElements = sourcePath.list();
            for (int i = 0; i < pathElements.length; i++) {
View Full Code Here

         scanner.setIncludes(DEFAULT_INCLUDES);
      } else {
         scanner.setExcludes(this.patterns.getExcludePatterns(project));
         scanner.setIncludes(this.patterns.getIncludePatterns(project));        
         for (Iterator i = this.patternSets.iterator(); i.hasNext();) {
            PatternSet patternSet = (PatternSet)i.next();
            scanner.addExcludes(patternSet.getExcludePatterns(project));
            scanner.addIncludes(patternSet.getIncludePatterns(project));
         }
      }
      scanner.scan();
      return scanner;
   }
View Full Code Here

  
   /**
    * Creates a nested patternset.
    */
   public PatternSet createPatternSet() {
       PatternSet patterns = new PatternSet();
       this.patternSets.add(patterns);
       return patterns;
   }
View Full Code Here

            fs.setFollowSymlinks(syncTarget.isFollowSymlinks());

            // preserveInTarget would find all files we want to keep,
            // but we need to find all that we want to delete - so the
            // meaning of all patterns and selectors must be inverted
            PatternSet ps = syncTarget.mergePatterns(getProject());
            fs.appendExcludes(ps.getIncludePatterns(getProject()));
            fs.appendIncludes(ps.getExcludePatterns(getProject()));
            fs.setDefaultexcludes(!syncTarget.getDefaultexcludes());

            // selectors are implicitly ANDed in DirectoryScanner.  To
            // revert their logic we wrap them into a <none> selector
            // instead.
View Full Code Here

                .replace('\\', File.separatorChar);
            boolean included = false;
            Set includePatterns = new HashSet();
            Set excludePatterns = new HashSet();
            for (int v = 0, size = patternsets.size(); v < size; v++) {
                PatternSet p = (PatternSet) patternsets.elementAt(v);
                String[] incls = p.getIncludePatterns(getProject());
                if (incls == null || incls.length == 0) {
                    // no include pattern implicitly means includes="**"
                    incls = new String[] {"**"};
                }

                for (int w = 0; w < incls.length; w++) {
                    String pattern = incls[w].replace('/', File.separatorChar)
                        .replace('\\', File.separatorChar);
                    if (pattern.endsWith(File.separator)) {
                        pattern += "**";
                    }
                    includePatterns.add(pattern);
                }

                String[] excls = p.getExcludePatterns(getProject());
                if (excls != null) {
                    for (int w = 0; w < excls.length; w++) {
                        String pattern = excls[w]
                            .replace('/', File.separatorChar)
                            .replace('\\', File.separatorChar);
View Full Code Here

     */
    public synchronized PatternSet createPatternSet() {
        if (isReference()) {
            throw noChildrenAllowed();
        }
        PatternSet patterns = new PatternSet();
        additionalPatterns.addElement(patterns);
        ds = null;
        return patterns;
    }
View Full Code Here

TOP

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

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.