// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/IJSBuildFile.java
// public interface IJSBuildFile extends IJSBuildFileNode {
// 
// 	/**
// 	 * Returns the default task and null otherwise.
// 	 * 
// 	 * @return the default task and null otherwise.
// 	 */
// 	ITask getDefaultTask();
// 
// 	/**
// 	 * Returns the resource file.
// 	 * 
// 	 * @return the resource file.
// 	 */
// 	IFile getBuildFileResource();
// 
// 	/**
// 	 * Returns the build file name.
// 	 * 
// 	 * @return the build file name.
// 	 */
// 	String getBuildFileName();
// 
// 	/**
// 	 * Parse JavaScript build file if needed to load tasks.
// 	 * 
// 	 * @throws CoreException
// 	 */
// 	void parseBuildFile() throws CoreException;
// 
// 	/**
// 	 * Force the parse of the JavaScript build file to load tasks.
// 	 * 
// 	 * @param force
// 	 * @throws CoreException
// 	 */
// 	void parseBuildFile(boolean force) throws CoreException;
// 
// 	/**
// 	 * Dispose the build file.
// 	 */
// 	void dispose();
// 
// }
// 
// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/IJSBuildFileFactory.java
// public interface IJSBuildFileFactory {
// 
// 	/**
// 	 * Returns true if the given file can use this factory to create
// 	 * {@link IJSBuildFile} and false otherwise.
// 	 * 
// 	 * @param file
// 	 * @return true if the given file can use this factory to create
// 	 *         {@link IJSBuildFile} and false otherwise.
// 	 */
// 	boolean isAdaptFor(IFile file);
// 
// 	/**
// 	 * Create an instance of {@link IJSBuildFile} from the given file.
// 	 * 
// 	 * @param file
// 	 *            (Gruntfile.js, gulpfile.js).
// 	 * @param factoryId
// 	 *            the factory id.
// 	 * @return an instance of {@link IJSBuildFile} from the given file.
// 	 */
// 	IJSBuildFile create(IFile file, String factoryId);
// 
// }


import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import fr.opensagres.eclipse.jsbuild.core.IJSBuildFile;
import fr.opensagres.eclipse.jsbuild.core.IJSBuildFileFactory;

/**
 *  Copyright (c) 2013-2014 Angelo ZERR.
 *  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
 *
 *  Contributors:
 *  Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
 */
package fr.opensagres.eclipse.jsbuild.internal.core;




/**
 * This class reads the plugin manifests to provide factory to create instance
 * of {@link IJSBuildFile}. Here a sample :
 * 
 * <pre>
 * <extension point="fr.opensagres.eclipse.jsbuild.core.jsBuildFactories">
 *     <jsBuildFactory
 *         id="fr.opensagres.eclipse.jsbuild.core.grunt"
 *         name="Grunt"
 *         class="tern.eclipse.ide.grunt.internal.GruntFileFactory" >
 *     </jsBuildFactory>
 *   </extension>
 * </pre>
 */
public class JSBuildFileFactoriesRegistryReader {

	protected static final String EXTENSION_POINT_ID = "jsBuildFactories"; //$NON-NLS-1$
	protected static final String TAG_CONTRIBUTION = "jsBuildFactory"; //$NON-NLS-1$

	private static JSBuildFileFactoriesRegistryReader INSTANCE = null;


// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/IJSBuildFile.java
// public interface IJSBuildFile extends IJSBuildFileNode {
// 
// 	/**
// 	 * Returns the default task and null otherwise.
// 	 * 
// 	 * @return the default task and null otherwise.
// 	 */
// 	ITask getDefaultTask();
// 
// 	/**
// 	 * Returns the resource file.
// 	 * 
// 	 * @return the resource file.
// 	 */
// 	IFile getBuildFileResource();
// 
// 	/**
// 	 * Returns the build file name.
// 	 * 
// 	 * @return the build file name.
// 	 */
// 	String getBuildFileName();
// 
// 	/**
// 	 * Parse JavaScript build file if needed to load tasks.
// 	 * 
// 	 * @throws CoreException
// 	 */
// 	void parseBuildFile() throws CoreException;
// 
// 	/**
// 	 * Force the parse of the JavaScript build file to load tasks.
// 	 * 
// 	 * @param force
// 	 * @throws CoreException
// 	 */
// 	void parseBuildFile(boolean force) throws CoreException;
// 
// 	/**
// 	 * Dispose the build file.
// 	 */
// 	void dispose();
// 
// }
// 
// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/IJSBuildFileFactory.java
// public interface IJSBuildFileFactory {
// 
// 	/**
// 	 * Returns true if the given file can use this factory to create
// 	 * {@link IJSBuildFile} and false otherwise.
// 	 * 
// 	 * @param file
// 	 * @return true if the given file can use this factory to create
// 	 *         {@link IJSBuildFile} and false otherwise.
// 	 */
// 	boolean isAdaptFor(IFile file);
// 
// 	/**
// 	 * Create an instance of {@link IJSBuildFile} from the given file.
// 	 * 
// 	 * @param file
// 	 *            (Gruntfile.js, gulpfile.js).
// 	 * @param factoryId
// 	 *            the factory id.
// 	 * @return an instance of {@link IJSBuildFile} from the given file.
// 	 */
// 	IJSBuildFile create(IFile file, String factoryId);
// 
// }


// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/internal/core/JSBuildFileFactoriesRegistryReader.java
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import fr.opensagres.eclipse.jsbuild.core.IJSBuildFile;
import fr.opensagres.eclipse.jsbuild.core.IJSBuildFileFactory;

/**
 *  Copyright (c) 2013-2014 Angelo ZERR.
 *  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
 *
 *  Contributors:
 *  Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
 */
package fr.opensagres.eclipse.jsbuild.internal.core;




/**
 * This class reads the plugin manifests to provide factory to create instance
 * of {@link IJSBuildFile}. Here a sample :
 * 
 * <pre>
 * <extension point="fr.opensagres.eclipse.jsbuild.core.jsBuildFactories">
 *     <jsBuildFactory
 *         id="fr.opensagres.eclipse.jsbuild.core.grunt"
 *         name="Grunt"
 *         class="tern.eclipse.ide.grunt.internal.GruntFileFactory" >
 *     </jsBuildFactory>
 *   </extension>
 * </pre>
 */
public class JSBuildFileFactoriesRegistryReader {

	protected static final String EXTENSION_POINT_ID = "jsBuildFactories"; //$NON-NLS-1$
	protected static final String TAG_CONTRIBUTION = "jsBuildFactory"; //$NON-NLS-1$

	private static JSBuildFileFactoriesRegistryReader INSTANCE = null;


	private final Map<String, IJSBuildFileFactory> factories;
