当前位置: 首页>>代码示例>>Java>>正文


Java ACL.setId方法代码示例

本文整理汇总了Java中org.apache.zookeeper.data.ACL.setId方法的典型用法代码示例。如果您正苦于以下问题:Java ACL.setId方法的具体用法?Java ACL.setId怎么用?Java ACL.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.zookeeper.data.ACL的用法示例。


在下文中一共展示了ACL.setId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseACLs

import org.apache.zookeeper.data.ACL; //导入方法依赖的package包/类
private static List<ACL> parseACLs(String aclString) {
    List<ACL> acl;
    String acls[] = aclString.split(",");
    acl = new ArrayList<ACL>();
    for (String a : acls) {
        int firstColon = a.indexOf(':');
        int lastColon = a.lastIndexOf(':');
        if (firstColon == -1 || lastColon == -1 || firstColon == lastColon) {
            System.err
            .println(a + " does not have the form scheme:id:perm");
            continue;
        }
        ACL newAcl = new ACL();
        newAcl.setId(new Id(a.substring(0, firstColon), a.substring(
                firstColon + 1, lastColon)));
        newAcl.setPerms(getPermFromString(a.substring(lastColon + 1)));
        acl.add(newAcl);
    }
    return acl;
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:21,代码来源:ZooKeeperMain.java

示例2: parse

import org.apache.zookeeper.data.ACL; //导入方法依赖的package包/类
/**
 * parse string into list of ACL
 * @param aclString
 * @return 
 */
public static List<ACL> parse(String aclString) {
    List<ACL> acl;
    String acls[] = aclString.split(",");
    acl = new ArrayList<ACL>();
    for (String a : acls) {
        int firstColon = a.indexOf(':');
        int lastColon = a.lastIndexOf(':');
        if (firstColon == -1 || lastColon == -1 || firstColon == lastColon) {
            System.err.println(a + " does not have the form scheme:id:perm");
            continue;
        }
        ACL newAcl = new ACL();
        newAcl.setId(new Id(a.substring(0, firstColon), a.substring(
                firstColon + 1, lastColon)));
        newAcl.setPerms(getPermFromString(a.substring(lastColon + 1)));
        acl.add(newAcl);
    }
    return acl;
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:25,代码来源:AclParser.java

示例3: parseACLs

import org.apache.zookeeper.data.ACL; //导入方法依赖的package包/类
/**
 * Parse comma separated list of ACL entries to secure generated nodes, e.g.
 * <code>sasl:hdfs/[email protected]:cdrwa,sasl:hdfs/[email protected]:cdrwa</code>
 *
 * @return ACL list
 * @throws {@link BadAclFormatException} if an ACL is invalid
 */
public static List<ACL> parseACLs(String aclString) throws
    BadAclFormatException {
  List<ACL> acl = Lists.newArrayList();
  if (aclString == null) {
    return acl;
  }
  
  List<String> aclComps = Lists.newArrayList(
      Splitter.on(',').omitEmptyStrings().trimResults()
      .split(aclString));
  for (String a : aclComps) {
    // from ZooKeeperMain private method
    int firstColon = a.indexOf(':');
    int lastColon = a.lastIndexOf(':');
    if (firstColon == -1 || lastColon == -1 || firstColon == lastColon) {
      throw new BadAclFormatException(
          "ACL '" + a + "' not of expected form scheme:id:perm");
    }

    ACL newAcl = new ACL();
    newAcl.setId(new Id(a.substring(0, firstColon), a.substring(
        firstColon + 1, lastColon)));
    newAcl.setPerms(getPermFromString(a.substring(lastColon + 1)));
    acl.add(newAcl);
  }
  
  return acl;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:36,代码来源:ZKUtil.java

示例4: addNewItem

import org.apache.zookeeper.data.ACL; //导入方法依赖的package包/类
private void addNewItem() {
    ACL acl = new ACL();
    acl.setId(ZooDefs.Ids.ANYONE_ID_UNSAFE);
    acl.setPerms(ZooDefs.Perms.ALL);

    TableItem newItem = addAclTableItem(acl);
    Table table = getTable();
    table.setSelection(newItem);
    tableSelectionChanged(newItem);

    fireOrchestrationChange();
}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:13,代码来源:ZnodeAclComposite.java

示例5: buildACLs

import org.apache.zookeeper.data.ACL; //导入方法依赖的package包/类
/**
 * Parse the IDs, adding a realm if needed, setting the permissions
 * @param principalList id string
 * @param realm realm to add
 * @param perms permissions
 * @return the relevant ACLs
 * @throws IOException
 */
public List<ACL> buildACLs(String principalList, String realm, int perms)
    throws IOException {
  List<String> aclPairs = splitAclPairs(principalList, realm);
  List<ACL> ids = new ArrayList<ACL>(aclPairs.size());
  for (String aclPair : aclPairs) {
    ACL newAcl = new ACL();
    newAcl.setId(parse(aclPair, realm));
    newAcl.setPerms(perms);
    ids.add(newAcl);
  }
  return ids;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:RegistrySecurity.java


注:本文中的org.apache.zookeeper.data.ACL.setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。