// 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/IResourceTaskProvider.java
// public interface IResourceTaskProvider {
//   /**
//    * Collect task references provided by this provider.
//    *
//    * <p>In theory this is similar to calling
//    * {@code collectTaskReferences(".", extFilter, collector)}, but
//    * that's in theory only.
//    *
//    * @param extFilter the filename extension to filter.
//    * @param collector the collector to receive all task references.
//    *
//    * TODO(konigsberg): Remove the filter parameter.
//    */
//   void collectTaskReferences(
//       String extFilter,
//       ICollector<IResourceTaskReference> collector);
// 
//   /**
//    * Collect task references provided by this provider, relative to the
//    * provider's root.
//    *
//    * <p>This is only used for finding Class-based tasks, and is not even
//    * implemented in the UriTaskProvider.
//    *
//    * @param localPath the relative path to the resources
//    * @param extFilter the filename extension to filter.
//    * @param collector the collector to receive all task references.
//    *
//    * TODO(konigsberg): Remove the filter parameter.
//    */
//   void collectTaskReferences(
//       String localPath,
//       String extFilter,
//       ICollector<IResourceTaskReference> collector);
// }
// 
// 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;
// }


import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import com.google.common.base.Joiner;
import com.google.common.collect.Maps;
import com.google.common.hash.Hashing;
import com.google.common.io.ByteStreams;
import com.google.common.io.InputSupplier;
import com.google.eclipse.mechanic.ICollector;
import com.google.eclipse.mechanic.IResourceTaskProvider;
import com.google.eclipse.mechanic.IResourceTaskReference;
/*******************************************************************************
 * Copyright (C) 2014, Google Inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package com.google.eclipse.mechanic.samples;



/**
 * Task provider that uses an in-memory map to provide task data.
 */
public class InMemoryTaskProvider implements IResourceTaskProvider {

  private static final Map<String, String> RESOURCES = Maps.newLinkedHashMap();
  private static final String SHOW_LINE_NUMBERS = Joiner.on("\n").join( 
      "# @title Show Line Numbers",
      "# @description Show line numbers in text editors.",
      "# @audit_type LASTMOD",
      "",
      "file_export_version=3.0",
      "/instance/org.eclipse.ui.editors/lineNumberRuler=true");

  static {
    RESOURCES.put("foo.message", "HELLO");
    RESOURCES.put("showlinenumbers.epf", SHOW_LINE_NUMBERS);
    RESOURCES.put("breakpoint.showview", "org.eclipse.debug.ui.BreakpointView");
    RESOURCES.put("junit.showview", "org.eclipse.jdt.junit.ResultView");
    RESOURCES.put("packageexplorer.showview", "org.eclipse.jdt.ui.PackageExplorer");
  }

  public void collectTaskReferences(String extFilter,
// 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/IResourceTaskProvider.java
// public interface IResourceTaskProvider {
//   /**
//    * Collect task references provided by this provider.
//    *
//    * <p>In theory this is similar to calling
//    * {@code collectTaskReferences(".", extFilter, collector)}, but
//    * that's in theory only.
//    *
//    * @param extFilter the filename extension to filter.
//    * @param collector the collector to receive all task references.
//    *
//    * TODO(konigsberg): Remove the filter parameter.
//    */
//   void collectTaskReferences(
//       String extFilter,
//       ICollector<IResourceTaskReference> collector);
// 
//   /**
//    * Collect task references provided by this provider, relative to the
//    * provider's root.
//    *
//    * <p>This is only used for finding Class-based tasks, and is not even
//    * implemented in the UriTaskProvider.
//    *
//    * @param localPath the relative path to the resources
//    * @param extFilter the filename extension to filter.
//    * @param collector the collector to receive all task references.
//    *
//    * TODO(konigsberg): Remove the filter parameter.
//    */
//   void collectTaskReferences(
//       String localPath,
//       String extFilter,
//       ICollector<IResourceTaskReference> collector);
// }
// 
// 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/examples/com.google.eclipse.mechanic.samples/src/com/google/eclipse/mechanic/samples/InMemoryTaskProvider.java
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import com.google.common.base.Joiner;
import com.google.common.collect.Maps;
import com.google.common.hash.Hashing;
import com.google.common.io.ByteStreams;
import com.google.common.io.InputSupplier;
import com.google.eclipse.mechanic.ICollector;
import com.google.eclipse.mechanic.IResourceTaskProvider;
import com.google.eclipse.mechanic.IResourceTaskReference;

/*******************************************************************************
 * Copyright (C) 2014, Google Inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package com.google.eclipse.mechanic.samples;



/**
 * Task provider that uses an in-memory map to provide task data.
 */
public class InMemoryTaskProvider implements IResourceTaskProvider {

  private static final Map<String, String> RESOURCES = Maps.newLinkedHashMap();
  private static final String SHOW_LINE_NUMBERS = Joiner.on("\n").join( 
      "# @title Show Line Numbers",
      "# @description Show line numbers in text editors.",
      "# @audit_type LASTMOD",
      "",
      "file_export_version=3.0",
      "/instance/org.eclipse.ui.editors/lineNumberRuler=true");

  static {
    RESOURCES.put("foo.message", "HELLO");
    RESOURCES.put("showlinenumbers.epf", SHOW_LINE_NUMBERS);
    RESOURCES.put("breakpoint.showview", "org.eclipse.debug.ui.BreakpointView");
    RESOURCES.put("junit.showview", "org.eclipse.jdt.junit.ResultView");
    RESOURCES.put("packageexplorer.showview", "org.eclipse.jdt.ui.PackageExplorer");
  }

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