Esempio n. 1
0
  public void indexBook(Book book) throws BookException, IOException {

    IndexManager inMan = new IndexManager();
    inMan.deleteBook(book.getName());

    CrawlLinkListener list = new CrawlLinkListener(book, inMan);

    DownloadParameters dlPars = new DownloadParameters();
    dlPars = dlPars.changeMaxThreads(0);
    dlPars = dlPars.changeMaxPageSize(-1);

    Crawler c = new Crawler();
    c.setRoot(new Link(book.getLocation()));
    c.addClassifier(new StandardClassifier());
    c.setDownloadParameters(dlPars);

    c.addLinkListener(list);
    c.setDomain(Crawler.SERVER);
    c.setLinkType(Crawler.HYPERLINKS);
    c.setMaxDepth(15);
    c.run();
  }