Processes the file, recursing as necessary, generating the source code.
<p>
The number of altered files is returned.

@return the number of changed files
@throws Exception if an error occurs
13265
public int process() throws Exception {
        int changed = 0;
        for (File child : files) {
            changed += (processFile(child) != null ? 1 : 0);
        }
        return changed;
    }
781063
public ImageDownloadResult getImageDownloadResult() throws Exception {
		Future<ImageDownloadResult> future = pool.poll();
		if (future == null) { // no completed tasks in the pool
			return null;
		} else {
			try {
				ImageDownloadResult imdr = future.get();
				return imdr;
			} catch (Exception e) {
				throw e;
			} finally {
				// in any case (Exception or not) the numPendingTask should be reduced
				numPendingTasks--;
			}
		}
	}
973315
public int execute() throws IOException
   {
      outputDir.mkdirs();

      // some archetypes might not use maven or use the maven source layout so lets remove
      // the pom.xml and src folder if its already been pre-created
      // as these will be created if necessary via the archetype jar's contents
      File pom = new File(outputDir, "pom.xml");
      if (pom.isFile() && pom.exists()) {
         pom.delete();
      }
      File src = new File(outputDir, "src");
      if (src.isDirectory() && src.exists()) {
         recursiveDelete(src);
      }

      if (packageName == null || packageName.length() == 0)
      {
         packageName = groupId + "." + artifactId;
      }

      String packageDir = packageName.replace('.', '/');

      info("Creating archetype using Maven groupId: " +
               groupId + ", artifactId: " + artifactId + ", version: " + version
               + " in directory: " + outputDir);

      Map<String, String> replaceProperties = new HashMap<String, String>();

      ZipInputStream zip = null;
      try
      {
         zip = new ZipInputStream(archetypeIn);
         boolean ok = true;
         while (ok)
         {
            ZipEntry entry = zip.getNextEntry();
            if (entry == null)
            {
               ok = false;
            }
            else
            {
               if (!entry.isDirectory())
               {
                  String fullName = entry.getName();
                  if (fullName != null && fullName.startsWith(zipEntryPrefix))
                  {
                     String name = replaceFileProperties(fullName.substring(zipEntryPrefix.length()), replaceProperties);
                     debug("Processing resource: " + name);

                     int idx = name.lastIndexOf('/');
                     Matcher matcher = sourcePathRegexPattern.matcher(name);
                     String dirName;
                     if (packageName.length() > 0 && idx > 0 && matcher.matches())
                     {
                        String prefix = matcher.group(1);
                        dirName = prefix + packageDir + "/" + name.substring(prefix.length());
                     }
                     else if (packageName.length() > 0 && name.startsWith(webInfResources))
                     {
                        dirName = "src/main/webapp/WEB-INF/" + packageDir + "/resources"
                                 + name.substring(webInfResources.length());
                     }
                     else
                     {
                        dirName = name;
                     }

                     // lets replace properties...
                     File file = new File(outputDir, dirName);
                     file.getParentFile().mkdirs();
                     FileOutputStream out = null;
                     try
                     {
                        out = new FileOutputStream(file);
                        boolean isBinary = false;
                        for (String suffix : binarySuffixes)
                        {
                           if (name.endsWith(suffix))
                           {
                              isBinary = true;
                              break;
                           }
                        }
                        if (isBinary)
                        {
                           // binary file? don't transform.
                           Streams.write(zip, out);
                        }
                        else
                        {
                           // text file...
                           ByteArrayOutputStream bos = new ByteArrayOutputStream();
                           Streams.write(zip, bos);
                           String text = new String(bos.toByteArray(), "UTF-8");
                           out.write(transformContents(text, replaceProperties).getBytes());
                        }
                     }
                     finally
                     {
                        if (out != null)
                        {
                           out.close();
                        }
                     }
                  }
                  else if (fullName != null && fullName.equals("META-INF/maven/archetype-metadata.xml"))
                  {
                     // we assume that this resource will be first in Archetype's ZIP
                     // this way we can find out what are the required properties before we will actually use them
                     parseReplaceProperties(zip, replaceProperties);
                     replaceProperties.putAll(overrideProperties);
                  }
               }
               zip.closeEntry();
            }
         }
      }
      catch (Exception e)
      {
         throw new IOException(e.getMessage(), e);
      }
      finally
      {
         if (zip != null)
         {
            zip.close();
         }
      }

      info("Using replace properties: " + replaceProperties);

      // now lets replace all the properties in the pom.xml
      if (!replaceProperties.isEmpty())
      {
         String text;
         try (FileInputStream fis = new FileInputStream(pom))
         {
            text = Streams.toString(fis);
         }
         for (Map.Entry<String, String> e : replaceProperties.entrySet())
         {
            text = replaceVariable(text, e.getKey(), e.getValue());
         }
         try (FileWriter writer = new FileWriter(pom))
         {
            writer.write(text);
            writer.flush();
         }
      }

      // now lets create the default directories
      if (createDefaultDirectories && pom.exists())
      {
         File srcDir = new File(outputDir, "src");
         File mainDir = new File(srcDir, "main");
         File testDir = new File(srcDir, "test");

         String srcDirName = "java";
         // Who needs Scala in 2014?
         // if (new File(mainDir, "scala").exists() || new File(textDir, "scala").exists()) {
         // srcDirName = "scala";
         // }

         for (File dir : new File[] { mainDir, testDir })
         {
            for (String name : new String[] { srcDirName + "/" + packageDir, "resources" })
            {
               new File(dir, name).mkdirs();
            }
         }
      }

      return 0;
   }
1296858
public String[] getItems() throws Exception {
    String[] 	result;

    if (getCustomDelimiter().isEmpty())
      result = Utils.splitOptions(getList());
    else
      result = getList().split(getCustomDelimiter());

    return result;
  }
926579
public void make()
    throws Exception
  {
    for (int i = 0; i < _makeList.size(); i++) {
      Make make = _makeList.get(i);

      make.make();
    }
  }
602736
public static void doFile(File f)
                              throws Exception {
        // If this is a directory, walk each file/dir in that directory
        if (f.isDirectory()) {
            String files[] = f.list();
            for(int i=0; i < files.length; i++)
                doFile(new File(f, files[i]));
        }

        // otherwise, if this is a groovy file, parse it!
        else if (f.getName().endsWith(".groovy")) {
            System.err.println(" --- "+f.getAbsolutePath());
            // parseFile(f.getName(), new FileInputStream(f));
            SourceBuffer sourceBuffer = new SourceBuffer();
            UnicodeEscapingReader unicodeReader = new UnicodeEscapingReader(new FileReader(f),sourceBuffer);
            GroovyLexer lexer = new GroovyLexer(unicodeReader);
            unicodeReader.setLexer(lexer);
            parseFile(f.getName(),lexer,sourceBuffer);
        }
    }

    // Here's where we do the real work...
    public static void parseFile(String f, GroovyLexer l, SourceBuffer sourceBuffer)
                                 throws Exception {
        try {
            // Create a parser that reads from the scanner
            GroovyRecognizer parser = GroovyRecognizer.make(l);
            parser.setSourceBuffer(sourceBuffer);
            parser.setFilename(f);
                        
                        if (whitespaceIncluded) {
                            GroovyLexer lexer = parser.getLexer();
                            lexer.setWhitespaceIncluded(true);
                            while (true) {
                                Token t = lexer.nextToken();
                                System.out.println(t);
                                if (t == null || t.getType() == Token.EOF_TYPE)  break;
                            }
                            return;
                        }

            // start parsing at the compilationUnit rule
            parser.compilationUnit();
            
            System.out.println("parseFile "+f+" => "+parser.getAST());

            // do something with the tree
            doTreeAction(f, parser.getAST(), parser.getTokenNames());
        }
1077997
@Execute
    public void process() throws Exception {
        if (!concatOr(outPit == null, doReset)) {
            return;
        }
        checkNull(inElev);
        HashMap<String, Double> regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inElev);
        nCols = regionMap.get(CoverageUtilities.COLS).intValue();
        nRows = regionMap.get(CoverageUtilities.ROWS).intValue();
        xRes = regionMap.get(CoverageUtilities.XRES);
        yRes = regionMap.get(CoverageUtilities.YRES);

        elevationIter = CoverageUtilities.getRandomIterator(inElev);

        // output raster
        WritableRaster pitRaster = CoverageUtilities.createWritableRaster(nCols, nRows, null, null, null);
        pitIter = CoverageUtilities.getWritableRandomIterator(pitRaster);

        for( int i = 0; i < nRows; i++ ) {
            if (pm.isCanceled()) {
                return;
            }
            for( int j = 0; j < nCols; j++ ) {
                double value = elevationIter.getSampleDouble(j, i, 0);
                if (!isNovalue(value)) {
                    pitIter.setSample(j, i, 0, value);
                } else {
                    pitIter.setSample(j, i, 0, PITNOVALUE);
                }
            }
        }

        flood();
        if (pm.isCanceled()) {
            return;
        }

        for( int i = 0; i < nRows; i++ ) {
            if (pm.isCanceled()) {
                return;
            }
            for( int j = 0; j < nCols; j++ ) {
                if (dir[j][i] == 0) {
                    return;
                }
                double value = pitIter.getSampleDouble(j, i, 0);
                if (value == PITNOVALUE || isNovalue(value)) {
                    pitIter.setSample(j, i, 0, doubleNovalue);
                }
            }
        }
        pitIter.done();

        outPit = CoverageUtilities.buildCoverage("pitfiller", pitRaster, regionMap, inElev.getCoordinateReferenceSystem());
    }
366881
public File next() throws IOException {
        if (stack.isEmpty()) {
            current = null;
            return null;
        } else {
            current = stack.removeLast();
            if (current.isDirectory()) {
                if (stack.size() < rootCount) {
                    rootCount = stack.size();
                }
                addReverse(current.listFiles());
                return next();
            } else {
                return current;
            }
        }
    }
151687
@VisibleForTesting
    Process execute() {
        File workingDirectory = program.workingDirectory();
        if (!InvalidWorkingDirectoryException.check(workingDirectory)) {
            throw new InvalidWorkingDirectoryException(workingDirectory);
        }
        final Process process = createProcess(getCommandLine());
        processTracker.add(process);
        return process;
    }
317720
private void processFiles() throws CompilationFailedException, IOException, URISyntaxException {
        GroovyShell groovy = new GroovyShell(conf);
        setupContextClassLoader(groovy);

        Script s = groovy.parse(getScriptSource(isScriptFile, script));

        if (args.isEmpty()) {
            try(BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
                PrintWriter writer = new PrintWriter(System.out);
                processReader(s, reader, writer);
                writer.flush();
            }
        } else {
            Iterator i = args.iterator();
            while (i.hasNext()) {
                String filename = (String) i.next();
                //TODO: These are the arguments for -p and -i.  Why are we searching using Groovy script extensions?
                // Where is this documented?
                File file = huntForTheScriptFile(filename);
                processFile(s, file);
            }
        }
    }
1111735
public void processFile(String fileName, boolean failOnFileNotFound) throws Exception {

    boolean fileFound = false;
    InputStream f = null;
    try {
      String furl = null;

      File file = new File(fileName); // files in filesystem
      if (!file.exists()) {
        URL url = classLoadHelper.getResource(fileName);
        if (url != null) {
          try {
            furl = URLDecoder.decode(url.getPath(), "UTF-8");
          } catch (UnsupportedEncodingException e) {
            furl = url.getPath();
          }
          file = new File(furl);
          try {
            f = url.openStream();
          } catch (IOException ignor) {
            // Swallow the exception
          }
        }
      } else {
        try {
          f = new java.io.FileInputStream(file);
        } catch (FileNotFoundException e) {
          // ignore
        }
      }

      if (f == null) {
        fileFound = false;
      } else {
        fileFound = true;
      }
    } finally {
      try {
        if (f != null) {
          f.close();
        }
      } catch (IOException ioe) {
        logger.warn("Error closing jobs file " + fileName, ioe);
      }
    }

    if (!fileFound) {
      if (failOnFileNotFound) {
        throw new SchedulerException("File named '" + fileName + "' does not exist.");
      } else {
        logger.warn(
            "File named '"
                + fileName
                + "' does not exist. This is OK if you don't want to use an XML job config file.");
      }
    } else {
      processFile(fileName);
    }
  }
635474
private void processDataFile() {

        // OOo related code
        if (database.isStoredFileAccess()) {
            return;
        }

        // OOo end
        if (cache == null || filesReadOnly
                || !fa.isStreamElement(logFileName)) {
            return;
        }

        File file       = new File(logFileName);
        long logLength  = file.length();
        long dataLength = cache.getFileFreePos();

        if (logLength + dataLength > cache.maxDataFileSize) {
            database.logger.needsCheckpoint = true;
        }
    }
1115843
public function getChanges()
    {
        $response = $this->client->request('GET', "/{$this->name}/_changes");

        if (200 !== $response->getStatusCode()) {
            throw new Exception('Request wasn\'t successfull');
        }

        return JSONEncoder::decode((string) $response->getBody());
    }
501271
public Boolean call() throws Exception {
    Boolean 	result;

    try {
      result = doRun();
    }
    catch (Exception e) {
      m_Exception = e;
      throw e;
    }
    finally {
      cleanUp();
    }
    return result;
  }
533575
public CmsFileInput createFileInput() {

        // remove the current file input field and add a new one
        CmsFileInput previous = m_fileInput;
        if (m_fileInput != null) {
            m_fileInput.getElement().getStyle().setDisplay(Display.NONE);
        }
        m_fileInput = new CmsFileInput();
        m_fileInput.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {

                CmsDomUtil.ensureMouseOut(m_main.getElement());
                m_buttonHandler.onChange(m_fileInput);
            }
        });
        m_buttonHandler.initializeFileInput(m_fileInput);
        m_main.add(m_fileInput);
        return previous;
    }
1218469
public CmsFileInfo[] getFiles() {

        JsArray<CmsFileInfo> files = m_impl.getFiles(m_inputElement);
        CmsFileInfo[] result = new CmsFileInfo[files.length()];
        for (int i = 0; i < files.length(); ++i) {
            result[i] = files.get(i);
        }
        return result;
    }
30717
public void init() throws Exception {

        // If the status file exists, make sure it doesn't indicate
        // that the server is running!
        if (_statusFile.exists()) {
            ServerStatusMessage[] messages = getAllMessages();
            ServerStatusMessage lastMessage = messages[messages.length - 1];
            if (lastMessage.getState() == ServerState.STARTED) {
                throw new Exception("The server is already running or was shut down unexpectedly.\n"
                        + "If the server has shut down unexpectedly, you must manually delete\n"
                        + "the following file: "
                        + _statusFile.getPath()
                        + "\n"
                        + "then try again.");
            }
        }

        _statusFile.clear();
        _statusFile.append(ServerState.NOT_STARTING,
                           "Waiting for startup to begin");
    }