Package org.timedex.dao.impl

Examples of org.timedex.dao.impl.EventDAOImpl


    File indexDir = new File(props.getProperty("lucene.index.dir", DEFAULT_LUCENE_INDEX_DIR));
   
    IndexWriter writer = new IndexWriter(indexDir,
        new StandardAnalyzer(), true);

    EventDAO eventDAO = new EventDAOImpl();

    System.out.println("Counting events...");
    long t1 = System.currentTimeMillis();

    long events = 0;
    try {
      sessionStrategy.beginTransaction();
      events = eventDAO.count();
      sessionStrategy.commitTransaction();
    } finally {
      sessionStrategy.rollbackIfActive();
    }

    long t2 = System.currentTimeMillis();
    System.out.println("...done (" + events + " events). Took " + (t2 - t1) + "ms");

    System.out.println("\nIndexing to directory '" + indexDir.getAbsolutePath() + "'...");
    t1 = System.currentTimeMillis();
   
    DateFormat dateFormat = DateFormat.getDateInstance();
   
    int start = 0;
    while (start < events) {
      System.out.println("Working on chunk starting at " + start + " out of " + events);

      List<Event> chunk = Collections.emptyList();
      try {
        sessionStrategy.beginTransaction();
        chunk = eventDAO.findAll(start, CHUNK_SIZE);
        sessionStrategy.commitTransaction();
      } finally {
        sessionStrategy.rollbackIfActive();
      }
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

  private static final SessionStrategy sessionStrategy = HibernateSessionStrategy.getInstance();
 
  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();
      }

      for (Page p : chunk) {
        try {
          sessionStrategy.beginTransaction();

          int linksIn = pageLinkDAO.findLinkCountInByPage(p);

          List<Event> events = eventDAO.findByPage(p);
          for (Event e : events) {
            e.setRank(linksIn);
            eventDAO.update(e);
          }

          sessionStrategy.commitTransaction();
         
        } finally {
View Full Code Here

TOP

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

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.