// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/ICollector.java
// public interface ICollector<T> {
//   /**
//    * Add a element to the collector.
//    */
//   void collect(T element);
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/IResourceTaskReference.java
// public interface IResourceTaskReference {
//   /** Return the name of the task reference. This is typically a local name. */
//   String getName();
// 
//   /** Return the task reference as an input stream. */
//   InputStream newInputStream() throws IOException;
// 
//   /**
//    * Return the time this resource was last modified, in milliseconds since the epoch.
//    */
//   long getLastModified() throws IOException;
// 
//   /** 
//    * Return the task reference path. Provide enough metadata to give it some distinction,
//    * separate from other providers.
//    */
//   String getPath();
// 
//   /**
//    * Return the File representation of this resource. Is {@code null} it's not a File.
//    */
//   File asFile();
// 
//   /**
//    * Return the MD5 hash of this task
//    */
//   long computeMD5() throws IOException;
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/SuffixFileFilter.java
// public final class SuffixFileFilter implements FileFilter {
// 
//   private final String suffix;
// 
//   public SuffixFileFilter(String suffix) {
//     this.suffix = suffix;
//   }
// 
//   public boolean accept(File file) {
//     return file.getName().endsWith(suffix);
//   }
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/plugin/core/ResourceTaskProvider.java
// public abstract class ResourceTaskProvider implements IResourceTaskProvider {
// 
//   /**
//    * Throws exception, ensures subclasses implement equals method.
//    */
//   @Override
//   public boolean equals(Object obj) {
//     throw new RuntimeException(this.getClass().getName() + "doesn't implement equals");
//   }
// 
//   /**
//    * Throws exception, ensures subclasses implement hashCode method.
//    */
//   @Override
//   public int hashCode() {
//     throw new RuntimeException(this.getClass().getName() + "doesn't implement hashCode");
//   }
// }


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.hash.Hashing;
import com.google.common.io.Files;
import com.google.eclipse.mechanic.ICollector;
import com.google.eclipse.mechanic.IResourceTaskReference;
import com.google.eclipse.mechanic.SuffixFileFilter;
import com.google.eclipse.mechanic.plugin.core.ResourceTaskProvider;
  public File getFile() {
    return dir;
  }

  private void validateInitialization() throws IOException {
    if (!dir.exists()) {
      throw new FileNotFoundException(
          String.format("Directory '%s' does not exist.", dir));
    }
    if (!dir.canRead()) {
      throw new IOException(
          String.format("Directory '%s' is not readable.", dir));
    }
  }

  public void collectTaskReferences(
      String localPath, String filter, ICollector<IResourceTaskReference> collector) {
    // dir points to the root of the task directory, we
    // add the PACKAGE PATH to point to the dir with classes.
    File localDir = new File(dir.getAbsolutePath() + File.separator + localPath);
    try {
      FileTaskProvider.newInstance(localDir).collectTaskReferences(filter, collector);
    } catch(FileNotFoundException e) {
      // Ignore, this will happen most of the time.
    } catch(IOException e) {
      // Ugh, another mess that class files make. :)
      LOG.log(Level.SEVERE, "Can't collect relative files.", e);
    }
  }

// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/ICollector.java
// public interface ICollector<T> {
//   /**
//    * Add a element to the collector.
//    */
//   void collect(T element);
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/IResourceTaskReference.java
// public interface IResourceTaskReference {
//   /** Return the name of the task reference. This is typically a local name. */
//   String getName();
// 
//   /** Return the task reference as an input stream. */
//   InputStream newInputStream() throws IOException;
// 
//   /**
//    * Return the time this resource was last modified, in milliseconds since the epoch.
//    */
//   long getLastModified() throws IOException;
// 
//   /** 
//    * Return the task reference path. Provide enough metadata to give it some distinction,
//    * separate from other providers.
//    */
//   String getPath();
// 
//   /**
//    * Return the File representation of this resource. Is {@code null} it's not a File.
//    */
//   File asFile();
// 
//   /**
//    * Return the MD5 hash of this task
//    */
//   long computeMD5() throws IOException;
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/SuffixFileFilter.java
// public final class SuffixFileFilter implements FileFilter {
// 
//   private final String suffix;
// 
//   public SuffixFileFilter(String suffix) {
//     this.suffix = suffix;
//   }
// 
//   public boolean accept(File file) {
//     return file.getName().endsWith(suffix);
//   }
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/plugin/core/ResourceTaskProvider.java
// public abstract class ResourceTaskProvider implements IResourceTaskProvider {
// 
//   /**
//    * Throws exception, ensures subclasses implement equals method.
//    */
//   @Override
//   public boolean equals(Object obj) {
//     throw new RuntimeException(this.getClass().getName() + "doesn't implement equals");
//   }
// 
//   /**
//    * Throws exception, ensures subclasses implement hashCode method.
//    */
//   @Override
//   public int hashCode() {
//     throw new RuntimeException(this.getClass().getName() + "doesn't implement hashCode");
//   }
// }


// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/internal/FileTaskProvider.java
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.hash.Hashing;
import com.google.common.io.Files;
import com.google.eclipse.mechanic.ICollector;
import com.google.eclipse.mechanic.IResourceTaskReference;
import com.google.eclipse.mechanic.SuffixFileFilter;
import com.google.eclipse.mechanic.plugin.core.ResourceTaskProvider;

  public File getFile() {
    return dir;
  }

  private void validateInitialization() throws IOException {
    if (!dir.exists()) {
      throw new FileNotFoundException(
          String.format("Directory '%s' does not exist.", dir));
    }
    if (!dir.canRead()) {
      throw new IOException(
          String.format("Directory '%s' is not readable.", dir));
    }
  }

  public void collectTaskReferences(
      String localPath, String filter, ICollector<IResourceTaskReference> collector) {
    // dir points to the root of the task directory, we
    // add the PACKAGE PATH to point to the dir with classes.
    File localDir = new File(dir.getAbsolutePath() + File.separator + localPath);
    try {
      FileTaskProvider.newInstance(localDir).collectTaskReferences(filter, collector);
    } catch(FileNotFoundException e) {
      // Ignore, this will happen most of the time.
    } catch(IOException e) {
      // Ugh, another mess that class files make. :)
      LOG.log(Level.SEVERE, "Can't collect relative files.", e);
    }
  }

  public void collectTaskReferences(String filterText, ICollector<IResourceTaskReference> collector) {