Package HBaseIA.TwitBase.hbase

Examples of HBaseIA.TwitBase.hbase.RelationsDAO


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

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

    if ("follows".equals(args[0])) {
      log.debug(String.format("Adding follower %s -> %s", args[1], args[2]));
      dao.addFollows(args[1], args[2]);
      System.out.println("Successfully added relationship");
    }

    if ("list".equals(args[0])) {
      List<Relation> results = new ArrayList<Relation>();
      if (args[1].equals("follows"))
        results.addAll(dao.listFollows(args[2]));
      else if (args[1].equals("followedBy"))
        results.addAll(dao.listFollowedBy(args[2]));

      if (results.isEmpty())
        System.out.println("No relations found.");
      for (Relation r : results) {
        System.out.println(r);
      }
    }

    if ("followedByScan".equals(args[0])) {
      long count = dao.followedByCountScan(args[1]);
      System.out.println(String.format("%s has %s followers.", args[1], count));
    }

    if ("followedByCoproc".equals(args[0])) {
      long count = dao.followedByCount(args[1]);
      System.out.println(String.format("%s has %s followers.", args[1], count));
    }

    pool.closeTablePool(RelationsDAO.FOLLOWS_TABLE_NAME);
    pool.closeTablePool(RelationsDAO.FOLLOWED_TABLE_NAME);
View Full Code Here


    KeyValue kv = put.get(RELATION_FAM, FROM).get(0);
    String from = Bytes.toString(kv.getValue());
    kv = put.get(RELATION_FAM, TO).get(0);
    String to = Bytes.toString(kv.getValue());

    RelationsDAO relations = new RelationsDAO(pool);
    relations.addFollowedBy(to, from);
  }
View Full Code Here

TOP

Related Classes of HBaseIA.TwitBase.hbase.RelationsDAO

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.