Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.Copy


                + "List.jsp"));
        copy.execute();
    }

    private void installTapestryViews() {
        Copy copy = (Copy) antProject.createTask("copy");
        copy
                .setFile(new File(sourceDirectory
                        + "/src/main/webapp/WEB-INF/tapestry/" + pojoName
                        + "Form.html"));
        copy.setTodir(new File(destinationDirectory
                + "/src/main/webapp/WEB-INF/tapestry"));
        copy.execute();

        copy
                .setFile(new File(sourceDirectory
                        + "/src/main/webapp/WEB-INF/tapestry/" + pojoName
                        + "Form.page"));
        copy.execute();

        copy
                .setFile(new File(sourceDirectory
                        + "/src/main/webapp/WEB-INF/tapestry/" + pojoName
                        + "List.html"));
        copy.execute();

        copy
                .setFile(new File(sourceDirectory
                        + "/src/main/webapp/WEB-INF/tapestry/" + pojoName
                        + "List.page"));
        copy.execute();
    }
View Full Code Here


        }
    }

    protected static void copySingleFile(File sourceFile, File destFile) {
        Project p = new Project();
        Copy c = new Copy();
        c.setProject(p);
        c.setTofile(destFile);
        FileSet fs = new FileSet();
        fs.setFile(sourceFile);
        c.addFileset(fs);
        c.execute();
    }
View Full Code Here

        c.execute();
    }
   
    protected static void copyDirectory(File source, File dest) {
        Project p = new Project();
        Copy c = new Copy();
        c.setProject(p);
        c.setTodir(dest);
        FileSet fs = new FileSet();
        fs.setDir(source);
        c.addFileset(fs);
        c.execute();
    }
View Full Code Here

     */
    protected static boolean copyDirectory(File source, String suffix, File dest) {
      boolean result = false;
      try {
        Project p = new Project();
        Copy c = new Copy();
        c.setProject(p);
        c.setTodir(dest);
        FileSet fs = new FileSet();
        fs.setDir(source);
        if (null != suffix) {
          fs.setIncludes("*" + suffix); // add the wildcard.
        }
        c.addFileset(fs);
        c.execute();
       
        // handle case where no files match; must create empty directory.
        if (!dest.exists()) {
          result = dest.mkdirs();
        } else {
View Full Code Here

  public static void copyDirectory(
    File source, File destination, String includes, String excludes,
    boolean overwrite, boolean preserveLastModified) {

    Copy copy = new Copy();

    FileSet fileSet = new FileSet();

    fileSet.setDir(source);

    if (StringUtils.isNotEmpty(excludes)) {
      fileSet.setExcludes(excludes);
    }

    if (StringUtils.isNotEmpty(includes)) {
      fileSet.setIncludes(includes);
    }

    copy.addFileset(fileSet);

    copy.setOverwrite(overwrite);
    copy.setPreserveLastModified(preserveLastModified);
    copy.setProject(AntUtil.getProject());
    copy.setTodir(destination);

    copy.execute();
  }
View Full Code Here

  public static void copyFile(
    File sourceFile, File destinationDir, String destinationFileName,
    Map<String, String> filterMap, boolean overwrite,
    boolean preserveLastModified) {

    Copy copy = new Copy();

    copy.setFile(sourceFile);
    copy.setFiltering(true);
    copy.setOverwrite(overwrite);
    copy.setPreserveLastModified(preserveLastModified);
    copy.setProject(AntUtil.getProject());

    if (destinationFileName == null) {
      copy.setTodir(destinationDir);
    }
    else {
      copy.setTofile(new File(destinationDir, destinationFileName));
    }

    if (filterMap != null) {
      FilterSet filterSet = copy.createFilterSet();

      for (Map.Entry<String, String> entry : filterMap.entrySet()) {
        String token = entry.getKey();
        String replacement = entry.getValue();

        filterSet.addFilter(token, replacement);
      }
    }

    copy.execute();
  }
View Full Code Here

 
  private static transient Logger logger = LoggerFactory.getLogger(Ant.class);
 
  public static void copyFile(File from, File to) throws BuildException {
    logger.info(I18N.translate("copy_file"), from, to);
    Copy copy = new Copy();
    copy.setFile(from);
    copy.setTofile(to);
    copy.execute();
  }
View Full Code Here

  /**
   * Prepares all path values needed for substitutions.
   */
  private void prepare52() {
    if (this.getApplicatonTask().getWOEnvironment().wo52()) {
      Copy cp = new Copy();
      // cp.setOwningTarget(getApplicatonTask().getProject().getDefaultTarget());
      cp.setProject(getApplicatonTask().getProject());
      cp.setTaskName("copy bootstrap");
      cp.setFile(this.getApplicatonTask().getWOEnvironment().bootstrap());
      cp.setTodir(getApplicatonTask().taskDir());
      cp.execute();
    }
  }
View Full Code Here

   * Method copyResources.
   *
   * @throws BuildException
   */
  protected void copyResources() throws BuildException {
    Copy cp = this.getSubtaskFactory().getResourceCopy();

    cp.setTodir(resourcesDir());
    int count = 0;
    Enumeration<WOFileSet> en = resources.elements();
    while (en.hasMoreElements()) {
      WOFileSet wofs = (WOFileSet) en.nextElement();
      if (wofs.testIfCondition()) {
        cp.addFileset( wofs );
        count++;
      }
    }

    // if no filesets were added, then don't run copy
    if (count > 0) {
      cp.execute();
    }
  }
View Full Code Here

   * if requested.
   *
   * @throws BuildException
   */
  protected void copyWsresources() throws BuildException {
    Copy cp = this.getSubtaskFactory().getResourceCopy();
    cp.setTodir(wsresourcesDir());

    int count = 0;
    Enumeration<WOFileSet> en = wsresources.elements();
    while (en.hasMoreElements()) {
      WOFileSet wofs = (WOFileSet) en.nextElement();
      if (wofs.testIfCondition()) {
        cp.addFileset(wofs);
        count++;
      }
    }

    // if no filesets were added, then don't run copy
    if (count > 0) {
      cp.execute();

      // do split install
      if (doingSplitInstall()) {
        log("Split install WebServerResources of " + name + " in " + wsDestDir);
        cp.setTodir(wsresourcesDestDir());
        cp.execute();
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Copy

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.