Package org.apache.tools.ant.taskdefs

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


      }
      else if ("jar".equalsIgnoreCase(type)) {
        File dir = new File(file.getParentFile(),
            file.getName() + ".extracted");
           dir.mkdir();
        Expand expand = (Expand)getProject().createTask("unjar");
        expand.setSrc(file);
        expand.setDest(dir);
        expand.perform();
        importFile = new File(dir, "build.xml");
        if (! importFile.exists()) {
          throw new BuildException("Cannot find a 'build.xml' file in " +
              file.getName());
        }
View Full Code Here


        if (!installMarker.exists()) {
            log.info("Installing assembly...");

            FileUtils.forceMkdir(geronimoHome);
           
            Expand unzip = (Expand)createTask("unzip");
            unzip.setSrc(assemblyArchive);
            unzip.setDest(installDirectory.getCanonicalFile());
            unzip.execute();

            // Make scripts executable, since Java unzip ignores perms
            Chmod chmod = (Chmod)createTask("chmod");
            chmod.setPerm("ugo+rx");
            chmod.setDir(geronimoHome);
View Full Code Here

        if (!installMarker.exists()) {
            log.info("Installing assembly...");

            FileUtils.forceMkdir(geronimoHome);
           
            Expand unzip = (Expand)createTask("unzip");
            unzip.setSrc(assemblyArchive);
            unzip.setDest(installDirectory);
            unzip.execute();

            // Make scripts executable, since Java unzip ignores perms
            Chmod chmod = (Chmod)createTask("chmod");
            chmod.setPerm("ugo+rx");
            chmod.setDir(geronimoHome);
View Full Code Here

   */
  public void execute() throws BuildException {
    DirectoryScanner  ds;
    int  hyphen;
    String  orbName, srcDir, destDir;
    Expand  unjar = new Expand();
    Delete  delete = new Delete();
    Mkdir  mkdir = new Mkdir();
    Jar  jar = new Jar();

    try {
      /* Remove any existing work directory */
      delete.setProject(getProject());
      delete.setDir(new File(workdir));
      delete.execute();
 
      /* Get list of files */
      final int numLibs = libs.size() ;
      for(int count = 0 ; count < numLibs ; count++)
      {
        final FileSet fileSet = (FileSet)libs.get(count) ;
        ds = fileSet.getDirectoryScanner(project);
        ds.scan();
        final String[] files = ds.getIncludedFiles() ;
        for (int i = 0; i < files.length;i++) {
          /* Build extract directory name */
          destDir = workdir.concat("/classes");
          hyphen = files[i].lastIndexOf('-');
          orbName = new String();
          if (!ignoreOrb && (hyphen > 0)) {
            orbName = orbName.concat(
                files[i].substring(hyphen,
                files[i].indexOf(".jar")));
            destDir = destDir.concat(orbName);
            if (!orbList.contains(orbName)) {
              orbList.add(orbName);
            }
          } else {
            if (!orbList.contains("")) {
              orbList.add("");
            }
          }
          /* Unpack jar file */
          unjar.setProject(getProject());
          unjar.setDest(new File(destDir));
          unjar.setSrc(new File(ds.getBasedir(), files[i]));
          unjar.setOverwrite(true);
          unjar.execute();
        }
      }
      for (Iterator i = orbList.iterator(); i.hasNext();) {
        /* Delete META-INF directory */
        orbName = i.next().toString();
View Full Code Here

        if (!installMarker.exists()) {
            log.info("Installing assembly...");

            FileUtils.forceMkdir(geronimoHome);
           
            Expand unzip = (Expand)createTask("unzip");
            unzip.setSrc(assemblyArchive);
            unzip.setDest(installDirectory.getCanonicalFile());
            unzip.execute();

            // Make scripts executable, since Java unzip ignores perms
            Chmod chmod = (Chmod)createTask("chmod");
            chmod.setPerm("ugo+rx");
            chmod.setDir(geronimoHome);
View Full Code Here

    while (it.hasNext()) {
      FileSet fs = (FileSet) it.next();
      DirectoryScanner scanner = fs.getDirectoryScanner(task.getProject());

      String[] files = scanner.getIncludedFiles();
      Expand unjar = (Expand) task.createSubtask(Expand.class);

      for (int i = 0; i < files.length; i++) {

        File unpackDir = new File(scratchDir, jarId++ + "");
        unpackDir.mkdirs();
        unpackedJarDirs.add(unpackDir);

        unjar.setDest(unpackDir);
        unjar.setSrc(new File(scanner.getBasedir(), files[i]));
        unjar.execute();
      }
    }
  }
View Full Code Here

      {
         // Get the name of a temporary output folder
         File outFolder = FileUtils.getFileUtils().createTempFile(TEMP_FILE_PREFIX, "", null, false, false);

         // Unzip the zip file
         Expand unzipper = (Expand)m_project.createTask("unzip");
         unzipper.setSrc(zipFileSet.getSrc(m_project));
         unzipper.setDest(outFolder);
         unzipper.execute();

         // Change the file set to use the new directory
         zipFileSet.setSrcResource(null);
         zipFileSet.setDir(outFolder);
View Full Code Here

  private String jarPath;
  private String pathInJar = "";
  private Expand expandTask;

  public ExtractedDirContent() {
    expandTask = new Expand();
    expandTask.setTaskName("unzip");
  }
View Full Code Here

        if (!installMarker.exists()) {
            log.info("Installing assembly...");

            FileUtils.forceMkdir(geronimoHome);
           
            Expand unzip = (Expand)createTask("unzip");
            unzip.setSrc(assemblyArchive);
            unzip.setDest(installDirectory.getCanonicalFile());
            unzip.execute();

            // Make scripts executable, since Java unzip ignores perms
            Chmod chmod = (Chmod)createTask("chmod");
            chmod.setPerm("ugo+rx");
            chmod.setDir(geronimoHome);
View Full Code Here

    }

    public static void unzip(Path tempZipFile, Path tempExtractedFolder) {
        LOGGER.info("Unzipping " + tempZipFile + " to " + tempExtractedFolder);

        Expand expand = new Expand();
        expand.setDest(tempExtractedFolder.toFile());
        expand.setSrc(tempZipFile.toFile());

        expand.setProject(AntUtil.builder().getProject());
        expand.setTaskName("unzip");

        expand.execute();
    }
View Full Code Here

TOP

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

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.