Package HBaseIA.TwitBase.hbase

Examples of HBaseIA.TwitBase.hbase.UsersDAO


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

    HTablePool pool = new HTablePool();
    UsersDAO dao = new UsersDAO(pool);

    if ("get".equals(args[0])) {
      log.debug(String.format("Getting user %s", args[1]));
      User u = dao.getUser(args[1]);
      System.out.println(u);
    }

    if ("add".equals(args[0])) {
      log.debug("Adding user...");
      dao.addUser(args[1], args[2], args[3], args[4]);
      User u = dao.getUser(args[1]);
      System.out.println("Successfully added user " + u);
    }

    if ("list".equals(args[0])) {
      List<User> users = dao.getUsers();
      log.info(String.format("Found %s users.", users.size()));
      for(User u : users) {
        System.out.println(u);
      }
    }
View Full Code Here


                         "destination tables first.");
      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));
      }
    }
View Full Code Here

      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]);
View Full Code Here

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

    HTablePool pool = new HTablePool();
    UsersDAO dao = new UsersDAO(pool);

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

    for (int i = 0; i < count; i++) {
      String name = randName(names);
      String user = randUser(name);
      String email = randEmail(user, words);
      dao.addUser(user, name, email, "abc123");
    }

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

TOP

Related Classes of HBaseIA.TwitBase.hbase.UsersDAO

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.