예제 #1
0
  public List<String> getElementList(String key) {
    Object element = definitionMap.getMapElement(key);
    List<String> lst;

    if (element instanceof String) {
      return Collections.singletonList((String) element);
    } else if (element instanceof List) {
      return (List) element;
    } else {
      return null;
    }
  }
예제 #2
0
  protected FilterRule constructFilterRule(String contentType) {
    String mimeType = HeaderUtil.getMimeTypeFromContentType(contentType);

    Object filter_el =
        definitionMap.getMapElement(mimeType + DefinableArchivalUnit.SUFFIX_FILTER_RULE);

    if (filter_el instanceof String) {
      log.debug("Loading filter " + filter_el);
      return (FilterRule) newAuxClass((String) filter_el, FilterRule.class);
    } else if (filter_el instanceof List) {
      if (((List) filter_el).size() > 0) {
        return new DefinableFilterRule((List) filter_el);
      }
    }
    return super.constructFilterRule(mimeType);
  }
예제 #3
0
 /** Create a CrawlWindow if necessary and return it. The CrawlWindow must be thread-safe. */
 protected CrawlWindow makeCrawlWindow() {
   if (crawlWindow != null) {
     return crawlWindow;
   }
   CrawlWindow window =
       (CrawlWindow) definitionMap.getMapElement(DefinableArchivalUnit.KEY_AU_CRAWL_WINDOW_SER);
   if (window == null) {
     String window_class =
         definitionMap.getString(DefinableArchivalUnit.KEY_AU_CRAWL_WINDOW, null);
     if (window_class != null) {
       ConfigurableCrawlWindow ccw =
           (ConfigurableCrawlWindow) newAuxClass(window_class, ConfigurableCrawlWindow.class);
       try {
         window = ccw.makeCrawlWindow();
       } catch (PluginException e) {
         throw new RuntimeException(e);
       }
     }
   }
   crawlWindow = window;
   return window;
 }