org.apache.zookeeper.data.Id.equals()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.apache.zookeeper.data.Id.equals()方法的一些代码示例,展示了Id.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Id.equals()方法的具体详情如下:
包路径:org.apache.zookeeper.data.Id
类名称:Id
方法名:equals

Id.equals介绍

暂无

代码示例

代码示例来源:origin: apache/zookeeper

public boolean equals(Object peer_) {
 if (!(peer_ instanceof ACL)) {
  return false;
 }
 if (peer_ == this) {
  return true;
 }
 ACL peer = (ACL) peer_;
 boolean ret = false;
 ret = (perms==peer.perms);
 if (!ret) return ret;
 ret = id.equals(peer.id);
 if (!ret) return ret;
  return ret;
}
public int hashCode() {

代码示例来源:origin: org.apache.zookeeper/zookeeper

public boolean equals(Object peer_) {
 if (!(peer_ instanceof ACL)) {
  return false;
 }
 if (peer_ == this) {
  return true;
 }
 ACL peer = (ACL) peer_;
 boolean ret = false;
 ret = (perms==peer.perms);
 if (!ret) return ret;
 ret = id.equals(peer.id);
 if (!ret) return ret;
  return ret;
}
public int hashCode() {

代码示例来源:origin: apache/hbase

public static boolean isSuperUserId(String[] superUsers, Id id) {
 for (String user : superUsers) {
  // TODO: Validate super group members also when ZK supports setting node ACL for groups.
  if (!AuthUtil.isGroupPrincipal(user) && new Id("sasl", user).equals(id)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: apache/hive

private static void checkAcls(CuratorFramework zkClient, Id user, String path) {
 List<ACL> acls = null;
 try {
  acls = zkClient.getACL().forPath(path);
 } catch (Exception ex) {
  throw new RuntimeException("Error during the ACL check. " + DISABLE_MESSAGE, ex);
 }
 if (acls == null || acls.isEmpty()) {
  // There's some access (to get ACLs), so assume it means free for all.
  throw new SecurityException("No ACLs on "  + path + ". " + DISABLE_MESSAGE);
 }
 for (ACL acl : acls) {
  if (!user.equals(acl.getId())) {
   throw new SecurityException("The ACL " + acl + " is unnacceptable for " + path
     + "; only " + user + " is allowed. " + DISABLE_MESSAGE);
  }
 }
}

代码示例来源:origin: apache/hbase

if (Ids.ANYONE_ID_UNSAFE.equals(id)) {
 if (perms != Perms.READ) {
  if (LOG.isDebugEnabled()) {

代码示例来源:origin: apache/hive

private void checkAndSetAcls() throws Exception {
 if (!UserGroupInformation.isSecurityEnabled()) return;
 // We are trying to check ACLs on the "workers" directory, which noone except us should be
 // able to write to. Higher-level directories shouldn't matter - we don't read them.
 String pathToCheck = workersPath;
 List<ACL> acls = zooKeeperClient.getACL().forPath(pathToCheck);
 if (acls == null || acls.isEmpty()) {
  // Can there be no ACLs? There's some access (to get ACLs), so assume it means free for all.
  LOG.warn("No ACLs on "  + pathToCheck + "; setting up ACLs. " + disableMessage);
  setUpAcls(pathToCheck);
  return;
 }
 // This could be brittle.
 assert userNameFromPrincipal != null;
 Id currentUser = new Id("sasl", userNameFromPrincipal);
 for (ACL acl : acls) {
  if ((acl.getPerms() & ~ZooDefs.Perms.READ) == 0 || currentUser.equals(acl.getId())) {
   continue; // Read permission/no permissions, or the expected user.
  }
  LOG.warn("The ACL " + acl + " is unnacceptable for " + pathToCheck
   + "; setting up ACLs. " + disableMessage);
  setUpAcls(pathToCheck);
  return;
 }
}

代码示例来源:origin: apache/hbase

if (Ids.ANYONE_ID_UNSAFE.equals(id)) {
} else if (new Id("sasl", masterPrincipal).equals(id)) {

代码示例来源:origin: org.apache.hadoop/zookeeper

public boolean equals(Object peer_) {
 if (!(peer_ instanceof ACL)) {
  return false;
 }
 if (peer_ == this) {
  return true;
 }
 ACL peer = (ACL) peer_;
 boolean ret = false;
 ret = (perms==peer.perms);
 if (!ret) return ret;
 ret = id.equals(peer.id);
 if (!ret) return ret;
  return ret;
}
public int hashCode() {

代码示例来源:origin: harbby/presto-connectors

public static boolean isSuperUserId(String[] superUsers, Id id) {
 for (String user : superUsers) {
  // TODO: Validate super group members also when ZK supports setting node ACL for groups.
  if (!user.startsWith(AuthUtil.GROUP_PREFIX) && new Id("sasl", user).equals(id)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: org.apache.hbase/hbase-zookeeper

public static boolean isSuperUserId(String[] superUsers, Id id) {
 for (String user : superUsers) {
  // TODO: Validate super group members also when ZK supports setting node ACL for groups.
  if (!AuthUtil.isGroupPrincipal(user) && new Id("sasl", user).equals(id)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-client

if (Ids.ANYONE_ID_UNSAFE.equals(id)) {
 if (perms != Perms.READ) {
  if (LOG.isDebugEnabled()) {

代码示例来源:origin: org.apache.hbase/hbase-zookeeper

if (Ids.ANYONE_ID_UNSAFE.equals(id)) {
 if (perms != Perms.READ) {
  if (LOG.isDebugEnabled()) {

代码示例来源:origin: org.apache.hive/hive-llap-client

private void checkAndSetAcls() throws Exception {
 if (!UserGroupInformation.isSecurityEnabled()) return;
 // We are trying to check ACLs on the "workers" directory, which noone except us should be
 // able to write to. Higher-level directories shouldn't matter - we don't read them.
 String pathToCheck = workersPath;
 List<ACL> acls = zooKeeperClient.getACL().forPath(pathToCheck);
 if (acls == null || acls.isEmpty()) {
  // Can there be no ACLs? There's some access (to get ACLs), so assume it means free for all.
  LOG.warn("No ACLs on "  + pathToCheck + "; setting up ACLs. " + disableMessage);
  setUpAcls(pathToCheck);
  return;
 }
 // This could be brittle.
 assert userNameFromPrincipal != null;
 Id currentUser = new Id("sasl", userNameFromPrincipal);
 for (ACL acl : acls) {
  if ((acl.getPerms() & ~ZooDefs.Perms.READ) == 0 || currentUser.equals(acl.getId())) {
   continue; // Read permission/no permissions, or the expected user.
  }
  LOG.warn("The ACL " + acl + " is unnacceptable for " + pathToCheck
   + "; setting up ACLs. " + disableMessage);
  setUpAcls(pathToCheck);
  return;
 }
}

代码示例来源:origin: harbby/presto-connectors

if (Ids.ANYONE_ID_UNSAFE.equals(id)) {
 if (perms != Perms.READ) {
  if (LOG.isDebugEnabled()) {

代码示例来源:origin: org.apache.hbase/hbase-it

if (Ids.ANYONE_ID_UNSAFE.equals(id)) {
} else if (new Id("sasl", masterPrincipal).equals(id)) {

相关文章