Package org.apache.tools.ant.types

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


   */
  protected void scanSrc() throws BuildException
  {
    for(Iterator it = src.iterator(); it.hasNext();)
    {
      Resource resource = (Resource)it.next();
      FileResource fileResource = resource instanceof FileResource ? (FileResource)resource : null;
      if (fileResource != null)
      {
        File file = fileResource.getFile();
        if (file.isDirectory())
View Full Code Here


   */
  protected void scanSrc() throws BuildException
  {
    for(Iterator it = src.iterator(); it.hasNext();)
    {
      Resource resource = (Resource)it.next();
      FileResource fileResource = resource instanceof FileResource ? (FileResource)resource : null;
      if (fileResource != null)
      {
        File file = fileResource.getFile();
        if (file.isDirectory())
View Full Code Here

   */
  protected void scanSrc() throws BuildException
  {
    for(Iterator it = src.iterator(); it.hasNext();)
    {
      Resource resource = (Resource)it.next();
      FileResource fileResource = resource instanceof FileResource ? (FileResource)resource : null;
      if (fileResource != null)
      {
        File file = fileResource.getFile();
        if (file.isDirectory())
View Full Code Here

   */
  protected void scanSrc() throws BuildException
  {
    for(Iterator it = src.iterator(); it.hasNext();)
    {
      Resource resource = (Resource)it.next();
      FileResource fileResource = resource instanceof FileResource ? (FileResource)resource : null;
      if (fileResource != null)
      {
        File file = fileResource.getFile();
        if (file.isDirectory())
View Full Code Here

   */
  protected void scanSrc() throws BuildException
  {
    for(Iterator it = src.iterator(); it.hasNext();)
    {
      Resource resource = (Resource)it.next();
      FileResource fileResource = resource instanceof FileResource ? (FileResource)resource : null;
      if (fileResource != null)
      {
        File file = fileResource.getFile();
        if (file.isDirectory())
View Full Code Here

      for (Iterator i = srcFilesets.iterator(); i.hasNext();) {
        FileSet fileset = (FileSet) i.next();

        for (Iterator fsIt = fileset.iterator(); fsIt.hasNext();) {
          final Resource res = (Resource) fsIt.next();
          analyze(res);
        }
      }
      // Scan done
      bpInfo.toJavaNames();
View Full Code Here

    // First analyze the exports resource collections
    for (Iterator it = exportsResourceCollections.iterator(); it.hasNext(); ) {
      final ResourceCollection rc = (ResourceCollection) it.next();

      for (Iterator rcIt = rc.iterator(); rcIt.hasNext();) {
        final Resource res = (Resource) rcIt.next();
        log("Exports resource: "+res, Project.MSG_DEBUG);
        analyze(res);
      }
    }// Scan done

    // Get the sub-set of the provided packages that are the exports set
    final Set providedExportSet = new TreeSet(bpInfo.getProvidedPackages());
    final Set manifestExportSet = getPredefinedExportSet();
    if (null!=manifestExportSet) {
      // An Export-Package header was given it shall contain
      // precisely the provided export set of Java packages.
      if (!manifestExportSet.equals(providedExportSet)) {
        // Found export package missmatch
        log("Provided package to export:  " +providedExportSet,
            Project.MSG_ERR);
        log("Given Export-Package header: " +manifestExportSet,
            Project.MSG_ERR);
        final StringBuffer msg = new StringBuffer();
        final TreeSet tmp = new TreeSet(manifestExportSet);
        tmp.removeAll(providedExportSet);
        if (0<tmp.size()) {
          msg.append("The following non-provided packages are present in the ")
            .append("Export-Package header: ")
            .append(tmp.toString())
            .append(". ");
        }
        tmp.clear();
        tmp.addAll(providedExportSet);
        tmp.removeAll(manifestExportSet);
        if (0<tmp.size()) {
          if (0<msg.length()) {
            msg.append("\n");
          }
          msg.append("The following packages are missing from ")
            .append("the given Export-Package header: ")
            .append(tmp.toString())
            .append(".");
        }
        tmp.clear();
        if (failOnExports) {
          log(msg.toString(), Project.MSG_ERR);
          throw new BuildException(msg.toString(), getLocation());
        } else {
          log(msg.toString(), Project.MSG_WARN);
        }
      }
    }
    log("Provided packages to export: " +providedExportSet,
        Project.MSG_VERBOSE);


    // Analyze the impls resource collections to find all provided
    // Java packages.
    for (Iterator it = implsResourceCollections.iterator(); it.hasNext(); ) {
      final ResourceCollection rc = (ResourceCollection) it.next();

      for (Iterator rcIt = rc.iterator(); rcIt.hasNext();) {
        final Resource res = (Resource) rcIt.next();
        log("Impl resource: "+res, Project.MSG_DEBUG);
        analyze(res);
      }
    }// Scan done
View Full Code Here

            continue;
          }
        }

        for (Iterator rcIt = rc.iterator(); rcIt.hasNext();) {
          final Resource res = (Resource) rcIt.next();
          if (res.getName().endsWith(".jar")) {
            task.log("Adding bundle: " + res, Project.MSG_VERBOSE);
            final BundleArchive ba = new BundleArchive(task,
                                                       (FileResource) res, parseExportImport);
            allBundleArchives.add(ba);
            addToMap(bnToBundleArchives, ba.bundleName, ba);
View Full Code Here

        for (int i = 0; i < rcs.size(); i++) {
          ResourceCollection rc = rcs.elementAt(i);
          if (rc.isFilesystemOnly()) {
            Iterator resources = rc.iterator();
            while (resources.hasNext()) {
              Resource r = (Resource) resources.next();
              if (!r.isExists() || !(r instanceof FileResource)) {
                continue;
              }
             
              totalFiles++;
View Full Code Here

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

      File jarFile = ((FileResource) r).getFile();
      if (! checkJarFile(jarFile) ) {
        errors++;
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.