Package org.timedex.dao.interfaces

Examples of org.timedex.dao.interfaces.PageDAO


  }
 
  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


    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

      }
    }
  }
 
  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 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

  }
 
 
  //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.interfaces.PageDAO

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.