// Path: src/main/java/com/lumata/lib/lupa/extractor/ContentExtractor.java
// public interface ContentExtractor<E extends WebContent> {
// 
// 	E extractContent(ReadableResource resource, ServiceLocator serviceLocator) throws IOException;
// 
// 	void setConfiguration(Map<String, String> config);
// 
// 	Class<E> getExtractableWebContentType();
// 
// }


import com.lumata.lib.lupa.extractor.ContentExtractor;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/*
 * 2011 copyright Buongiorno SpA
 */
package com.lumata.lib.lupa.extractor.internal.config;



/**
 * @author Alexander De Leon - alexander.leon@buongiorno.com
 * 
 */
public abstract class AbstractExtractorConfigurationModule implements ExtractorConfigurationModule {

	private final List<ExtractorConfiguration> configurations = new ArrayList<ExtractorConfiguration>();

	@Override
	public ExtractorConfiguration[] configurations() {
		configure();
		return configurations.toArray(new ExtractorConfiguration[configurations.size()]);
	}

	protected abstract void configure();

	protected ConfigurationBuilder when(Map<String, String> constraints) {
		ConfigurationBuilder builder = new ConfigurationBuilder();
		builder.configuration.setConstraints(constraints);
		return builder;
	}

	/* ----------------------- inner classes -- */
	protected class ConfigurationBuilder {
		private final ExtractorConfiguration configuration = new ExtractorConfiguration();

// Path: src/main/java/com/lumata/lib/lupa/extractor/ContentExtractor.java
// public interface ContentExtractor<E extends WebContent> {
// 
// 	E extractContent(ReadableResource resource, ServiceLocator serviceLocator) throws IOException;
// 
// 	void setConfiguration(Map<String, String> config);
// 
// 	Class<E> getExtractableWebContentType();
// 
// }


// Path: src/main/java/com/lumata/lib/lupa/extractor/internal/config/AbstractExtractorConfigurationModule.java
import com.lumata.lib.lupa.extractor.ContentExtractor;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/*
 * 2011 copyright Buongiorno SpA
 */
package com.lumata.lib.lupa.extractor.internal.config;



/**
 * @author Alexander De Leon - alexander.leon@buongiorno.com
 * 
 */
public abstract class AbstractExtractorConfigurationModule implements ExtractorConfigurationModule {

	private final List<ExtractorConfiguration> configurations = new ArrayList<ExtractorConfiguration>();

	@Override
	public ExtractorConfiguration[] configurations() {
		configure();
		return configurations.toArray(new ExtractorConfiguration[configurations.size()]);
	}

	protected abstract void configure();

	protected ConfigurationBuilder when(Map<String, String> constraints) {
		ConfigurationBuilder builder = new ConfigurationBuilder();
		builder.configuration.setConstraints(constraints);
		return builder;
	}

	/* ----------------------- inner classes -- */
	protected class ConfigurationBuilder {
		private final ExtractorConfiguration configuration = new ExtractorConfiguration();

		public ConfigurationParametarizer use(Class<? extends ContentExtractor<?>> c) {