1 17 18 19 20 package org.apache.lenya.lucene.parser; 21 22 import java.io.File ; 23 24 import org.apache.log4j.Category; 25 26 29 public class HTMLParserFactory { 30 31 public static Category log = Category.getInstance(HTMLParserFactory.class); 32 33 36 public static HTMLParser newInstance(File file) { 37 HTMLParser parser = null; 38 39 if (file.getName().endsWith(".html")) { 41 parser = new SwingHTMLParser(); 42 } 43 else if (file.getName().endsWith(".txt")) { 45 parser = new PDFParserWrapper(); 46 } else { 47 parser = new SwingHTMLParser(); 48 log.debug(".newInstance(): WARNING: Suffix did no match (" + file.getName() + "). SwingHTMLParser as default parser selected!"); 49 } 50 51 log.debug("returning a " + parser.getClass().getName() + " for " + file.getName()); 52 53 return parser; 54 } 55 } 56 | Popular Tags |