// Path: src/main/java/com/lumata/lib/lupa/Scraper.java
// @Service
// public interface Scraper {
// 
// 	/**
// 	 * Extract the list of structured contents from the given URL.
// 	 * 
// 	 * @param url
// 	 *            of the web resource
// 	 * @return the {@link WebContent} object describing the contents of the URL and all alias URLs. Or null if no
// 	 *         content is found.
// 	 * @throws IOException
// 	 *             is an IO error occurs while connecting to the URL.
// 	 * @throws HttpException
// 	 */
// 	WebContent scrapContent(String url) throws IOException;
// 
// 	/**
// 	 * Extract the list of structured contents from the given URL.
// 	 * 
// 	 * @param url
// 	 *            of the web resource
// 	 * @return the {@link WebContent} object describing the contents of the URL and all alias URLs. Or null if no
// 	 *         content is found.
// 	 * @throws IOException
// 	 *             is an IO error occurs while connecting to the URL.
// 	 * @throws HttpException
// 	 */
// 	<E extends WebContent> E scrapContent(String url, Class<E> contentType) throws IOException;
// 
// 	/**
// 	 * Extract the list of structured contents from the given URL.
// 	 * 
// 	 * @param url
// 	 *            of the web resource
// 	 * @return the {@link WebContent} object describing the contents of the URL and all alias URLs. Or null if no
// 	 *         content is found.
// 	 * @throws IOException
// 	 *             is an IO error occurs while connecting to the URL.
// 	 * @throws HttpException
// 	 */
// 	WebContent scrapContent(ReadableResource resource) throws IOException;
// 
// 	/**
// 	 * Extract the list of structured contents from the given URL.
// 	 * 
// 	 * @param url
// 	 *            of the web resource
// 	 * @return the {@link WebContent} object describing the contents of the URL and all alias URLs. Or null if no
// 	 *         content is found.
// 	 * @throws IOException
// 	 *             is an IO error occurs while connecting to the URL.
// 	 * @throws HttpException
// 	 */
// 	<E extends WebContent> E scrapContent(ReadableResource resource, Class<E> contentType) throws IOException;
// 
// }


import java.io.PrintStream;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.lumata.lib.lupa.Scraper;
		Lupa lupa = new Lupa();
		lupa.run(args);
	}

	private Lupa() {
		options = createOptions();
	}

	private Options createOptions() {
		Options options = new Options();
		options.addOption("h", false, "Print help");
		return options;
	}

	public final void run(String[] args) {
		try {
			CommandLine line = parseCommandLine(args);
			int result = execute(line);
			System.exit(result);
		} catch (ParseException exp) {
			printUsage();
		} catch (Throwable exp) {
			LOG.error("Unexpected error", exp);
		}
	}

	private int execute(CommandLine line) {
		if (line.hasOption("h") || line.getArgList().isEmpty()) {
			printUsage();
		} else {
// Path: src/main/java/com/lumata/lib/lupa/Scraper.java
// @Service
// public interface Scraper {
// 
// 	/**
// 	 * Extract the list of structured contents from the given URL.
// 	 * 
// 	 * @param url
// 	 *            of the web resource
// 	 * @return the {@link WebContent} object describing the contents of the URL and all alias URLs. Or null if no
// 	 *         content is found.
// 	 * @throws IOException
// 	 *             is an IO error occurs while connecting to the URL.
// 	 * @throws HttpException
// 	 */
// 	WebContent scrapContent(String url) throws IOException;
// 
// 	/**
// 	 * Extract the list of structured contents from the given URL.
// 	 * 
// 	 * @param url
// 	 *            of the web resource
// 	 * @return the {@link WebContent} object describing the contents of the URL and all alias URLs. Or null if no
// 	 *         content is found.
// 	 * @throws IOException
// 	 *             is an IO error occurs while connecting to the URL.
// 	 * @throws HttpException
// 	 */
// 	<E extends WebContent> E scrapContent(String url, Class<E> contentType) throws IOException;
// 
// 	/**
// 	 * Extract the list of structured contents from the given URL.
// 	 * 
// 	 * @param url
// 	 *            of the web resource
// 	 * @return the {@link WebContent} object describing the contents of the URL and all alias URLs. Or null if no
// 	 *         content is found.
// 	 * @throws IOException
// 	 *             is an IO error occurs while connecting to the URL.
// 	 * @throws HttpException
// 	 */
// 	WebContent scrapContent(ReadableResource resource) throws IOException;
// 
// 	/**
// 	 * Extract the list of structured contents from the given URL.
// 	 * 
// 	 * @param url
// 	 *            of the web resource
// 	 * @return the {@link WebContent} object describing the contents of the URL and all alias URLs. Or null if no
// 	 *         content is found.
// 	 * @throws IOException
// 	 *             is an IO error occurs while connecting to the URL.
// 	 * @throws HttpException
// 	 */
// 	<E extends WebContent> E scrapContent(ReadableResource resource, Class<E> contentType) throws IOException;
// 
// }


// Path: src/main/java/com/lumata/lib/lupa/cli/Lupa.java
import java.io.PrintStream;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.lumata.lib.lupa.Scraper;

		Lupa lupa = new Lupa();
		lupa.run(args);
	}

	private Lupa() {
		options = createOptions();
	}

	private Options createOptions() {
		Options options = new Options();
		options.addOption("h", false, "Print help");
		return options;
	}

	public final void run(String[] args) {
		try {
			CommandLine line = parseCommandLine(args);
			int result = execute(line);
			System.exit(result);
		} catch (ParseException exp) {
			printUsage();
		} catch (Throwable exp) {
			LOG.error("Unexpected error", exp);
		}
	}

	private int execute(CommandLine line) {
		if (line.hasOption("h") || line.getArgList().isEmpty()) {
			printUsage();
		} else {
			Scraper scraper = loadStringContextAndGetScraper();