1 2 3 4 package net.nutch.net; 5 6 import net.nutch.util.*; 7 import java.util.logging.*; 8 9 10 public class UrlNormalizerFactory { 11 private static final Logger LOG = 12 LogFormatter.getLogger("net.nutch.net.UrlNormalizerFactory"); 13 14 private static final String URLNORMALIZER_CLASS = 15 NutchConf.get("urlnormalizer.class"); 16 17 private UrlNormalizerFactory() {} 19 private static UrlNormalizer normalizer; 20 21 22 public static UrlNormalizer getNormalizer() { 23 24 if (normalizer == null) { 25 try { 26 LOG.info("Using URL normalizer: " + URLNORMALIZER_CLASS); 27 Class normalizerClass = Class.forName(URLNORMALIZER_CLASS); 28 normalizer = (UrlNormalizer)normalizerClass.newInstance(); 29 } catch (Exception e) { 30 throw new RuntimeException ("Couldn't create "+URLNORMALIZER_CLASS, e); 31 } 32 } 33 34 return normalizer; 35 36 } 37 38 } 39 | Popular Tags |