Package org.timedex.dao.impl

Examples of org.timedex.dao.impl.PageDAOImpl


public class PageDAOTest extends AbstractBusinessImplTest {
  private PageDAO pageDAO;;
 
  @Override
  public void setUpInternal() {
    pageDAO = new PageDAOImpl();
  }
View Full Code Here


  private PageDAO pageDAO;
  private PageLinkDAO pageLinkDAO;
 
  @Override
  public void setUpInternal() {
    pageDAO = new PageDAOImpl();
    pageLinkDAO = new PageLinkDAOImpl();
  }
View Full Code Here

  private PageTextDAO pageTextDAO;
  private PageDAO pageDAO;
 
  @Override
  public void setUpInternal() {
    pageDAO = new PageDAOImpl();
    pageTextDAO = new PageTextDAOImpl();
  }
View Full Code Here

    }
  }
 
  public static void main(String[] args) {
    ExtractEventsApp esa = new ExtractEventsApp();
    esa.setPageDAO(new PageDAOImpl());
    esa.setPtDAO(new PageTextDAOImpl());
    esa.setEventDAO(new EventDAOImpl());
    esa.setPageLinkDAO(new PageLinkDAOImpl());
    esa.setSessionStrategy(HibernateSessionStrategy.getInstance());
    esa.run();
View Full Code Here

      }
    }
  }
 
  public static void iterate(int iterations) {
    PageDAO pageDAO = new PageDAOImpl();
    final Lock countLock = new ReentrantLock();
   
    for (int iteration = 0; iteration < iterations; iteration++) {
      System.out.println("Performing iteration " + (iteration + 1) + " with up to " + THREAD_COUNT + " chunk threads per iteration");
     
      int pages = 0;
      try {
        sessionStrategy.beginTransaction();
        pages = pageDAO.count();
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
     
View Full Code Here

      System.out.println("\tThread starting with " + start + ", " + chunkSize);
      double pre = ((1.0 - DAMPING) / (double)pages) + DAMPING;
     
      PageMetaDAO pageMetaDAO = new PageMetaDAOImpl();
      PageLinkDAO pageLinkDAO = new PageLinkDAOImpl();
      PageDAO pageDAO = new PageDAOImpl();
     
      List<Page> chunk = Collections.emptyList();
      try {
        sessionStrategy.beginTransaction();
        chunk = pageDAO.findAll(start, chunkSize);
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
View Full Code Here

  }
 
  public static void iterate(int iterations) {
    PageMetaDAO pageMetaDAO = new PageMetaDAOImpl();
    PageLinkDAO pageLinkDAO = new PageLinkDAOImpl();
    PageDAO pageDAO = new PageDAOImpl();
   
    for (int iteration = 0; iteration < iterations; iteration++) {
      System.out.print("Performing iteration " + (iteration + 1) + " ... ");
     
      int pages = 0;
      try {
        sessionStrategy.beginTransaction();
        pages = pageDAO.count();
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
     
      int start = 0;
     
      double pre = ((1.0 - DAMPING) / (double)pages) + DAMPING;
     
      while (start < pages) {
       
        List<Page> chunk = Collections.emptyList();
        try {
          sessionStrategy.beginTransaction();
          chunk = pageDAO.findAll(start, CHUNK_SIZE);
          sessionStrategy.commitTransaction();
        } finally {
          sessionStrategy.rollbackIfActive();
        }
View Full Code Here

  public static void main(String[] args) {
    System.out.println("Running naive page rank");
   
    EventDAO eventDAO = new EventDAOImpl();
    PageLinkDAO pageLinkDAO = new PageLinkDAOImpl();
    PageDAO pageDAO = new PageDAOImpl();
   
    int pages = 0;
    try {
      sessionStrategy.beginTransaction();
      pages = pageDAO.count();
      sessionStrategy.commitTransaction();
    } finally {
      sessionStrategy.rollbackIfActive();
    }
   
    int start = 0;
   
    while (start < pages) {
     
      List<Page> chunk = Collections.emptyList();
      try {
        sessionStrategy.beginTransaction();
        chunk = pageDAO.findAll(start, CHUNK_SIZE);
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
View Full Code Here

    clearBadRows();
  }
 
  public static void clearBadRows() {
    PageLinkDAO pageLinkDAO = new PageLinkDAOImpl();
    PageDAO pageDAO = new PageDAOImpl();
   
    int count = -1;
   
    try {
      sessionStrategy.beginTransaction();
      count = pageLinkDAO.count();
      sessionStrategy.commitTransaction();
    } finally {
      sessionStrategy.rollbackIfActive();
    }
   
    int start = 0;
    long erased = 0;
   
    while (start < count) {
      List<PageLink> chunk = null;
      try {
        sessionStrategy.beginTransaction();
       
        chunk = pageLinkDAO.findDistinctSources(start, CHUNK_SIZE);
       
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
     
      for (PageLink pl : chunk) {
        try {
          sessionStrategy.beginTransaction();
         
          Page found = pageDAO.findById(pl.getSourcePageId());
         
          if (found == null) {
            pageLinkDAO.delete(pl);
            erased++;
          } else {
            Page found2 = pageDAO.findByTitleAndNamespace(pl.getDestinationTitle(), pl.getDestinationNamespace());
         
            if (found2 == null) {
              pageLinkDAO.delete(pl);
              erased++;
            }
View Full Code Here

  }
 
 
  //test
  public static void main(String[] args) {
    PageDAO pageDAO = new PageDAOImpl();
    PageTextDAO pageTextDAO = new PageTextDAOImpl();
    Page page = pageDAO.findById(927);
    PageText ptext = pageTextDAO.findByPage(page);
    String text = ptext.getTextAsString();
    WikitextStripper stripper = new WikitextStripper();
    //stripper.setLeaveHeadings(true);
    System.out.println(text);
View Full Code Here

TOP

Related Classes of org.timedex.dao.impl.PageDAOImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.