package info.bukova.isspst.services.fulltext;

/**
 * @author Pepa Rokos
 *
 * Factory pro konkrétní extractor
 */
public class ExtractorFactory {

	/**
	 * Vytvoří extractor podle předaného content typu
	 *
	 * @param contentType
	 * @return Extractor
	 */
	public static Extractor createExtractor(String contentType) {
		if (contentType.equals("application/vnd.oasis.opendocument.text")
				|| contentType.equals("application/vnd.oasis.opendocument.spreadsheet")
				|| contentType.equals("application/vnd.oasis.opendocument.presentation")) {
			return new OdfExtractor();
		}

		if (contentType.equals("application/vnd.openxmlformats-officedocument.wordprocessingml.document")) {
			return new WordExtractor();
		}

		if (contentType.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) {
			return new ExcelExtractor();
		}

		if (contentType.equals("application/vnd.openxmlformats-officedocument.presentationml.slideshow")) {
			return new PowerPointExtractor();
		}

		if (contentType.equals("application/pdf")) {
			return new PdfExtractor();
		}

		return null;
	}

}
