Package HBaseIA.TwitBase.hbase

Examples of HBaseIA.TwitBase.hbase.TwitsDAO


      System.exit(0);
    }

    HTablePool pool = new HTablePool(conf, Integer.MAX_VALUE);
    UsersDAO users = new UsersDAO(pool);
    TwitsDAO twits = new TwitsDAO(pool);

    int count = Integer.parseInt(args[0]);
    List<String> words = LoadUtils.readResource(LoadUtils.WORDS_PATH);

    for(User u : users.getUsers()) {
      for (int i = 0; i < count; i++) {
        twits.postTwit(u.user, randDT(), randTwit(words));
      }
    }

    pool.closeTablePool(UsersDAO.TABLE_NAME);
  }
View Full Code Here


      System.out.println(usage);
      System.exit(0);
    }

    HTablePool pool = new HTablePool();
    TwitsDAO twitsDao = new TwitsDAO(pool);
    UsersDAO usersDao = new UsersDAO(pool);

    if ("post".equals(args[0])) {
      DateTime now = new DateTime();
      log.debug(String.format("Posting twit at ...", now));
      twitsDao.postTwit(args[1], now, args[2]);
      Twit t = twitsDao.getTwit(args[1], now);
      usersDao.incTweetCount(args[1]);
      System.out.println("Successfully posted " + t);
    }

    if ("list".equals(args[0])) {
      List<Twit> twits = twitsDao.list(args[1]);
      log.info(String.format("Found %s twits.", twits.size()));
      for(Twit t : twits) {
        System.out.println(t);
      }
    }
View Full Code Here

TOP

Related Classes of HBaseIA.TwitBase.hbase.TwitsDAO

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.