Package com.hbasebook.hush.model

Examples of com.hbasebook.hush.model.User


    table.flushCommits();
    rm.putTable(table);
  }

  public User getUser(String username) throws IOException {
    User user = null;
    HTable table = null;
    try {
      table = rm.getTable(UserTable.NAME);
      Get get = new Get(Bytes.toBytes(username));

      Result result = table.get(get);
      if (result.isEmpty()) {
        return null;
      }

      String firstName = Bytes.toString(
        result.getValue(UserTable.DATA_FAMILY, UserTable.FIRSTNAME));
      String lastName = Bytes.toString(
        result.getValue(UserTable.DATA_FAMILY, UserTable.LASTNAME));
      String email = Bytes.toString(result.getValue(UserTable.DATA_FAMILY,
        UserTable.EMAIL));
      String credentials = Bytes.toString(result.getValue(UserTable.DATA_FAMILY,
        UserTable.CREDENTIALS));
      String roles = Bytes.toString(result.getValue(UserTable.DATA_FAMILY,
        UserTable.ROLES));
      user = new User(username, firstName, lastName, email, credentials, roles);
    } catch (Exception e) {
      LOG.error(String.format("Unable to get user '%s'", username), e);
    } finally {
      rm.putTable(table);
    }
View Full Code Here


            result.getValue(UserTable.DATA_FAMILY, UserTable.EMAIL));
          String credentials = Bytes.toString(
            result.getValue(UserTable.DATA_FAMILY, UserTable.CREDENTIALS));
          String roles = Bytes.toString(
            result.getValue(UserTable.DATA_FAMILY, UserTable.ROLES));
          User user = new User(username, firstName, lastName, email,
            credentials, roles);
          users.add(user);
        } catch (Exception e) {
          errors++;
        }
View Full Code Here

  @Override
  protected UserIdentity loadUser(String username) {
    try {
      UserManager manager = ResourceManager.getInstance().getUserManager();
      User user = manager.getUser(username);
      String roleString = user.getRoles();
      String[] roles = roleString == null ? null : roleString.split(",");
      return putUser(username, Credential.getCredential(user.getCredentials()),
        roles);
    } catch (Exception e) {
      LOG.error(String.format("Unable to get user '%s'", username), e);
      return null;
    }
View Full Code Here

TOP

Related Classes of com.hbasebook.hush.model.User

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.