本文整理了Java中com.twitter.distributedlog.acl.ZKAccessControlManager
类的一些代码示例,展示了ZKAccessControlManager
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKAccessControlManager
类的具体详情如下:
包路径:com.twitter.distributedlog.acl.ZKAccessControlManager
类名称:ZKAccessControlManager
[英]ZooKeeper Based com.twitter.distributedlog.acl.AccessControlManager
[中]基于ZooKeeper的com。啁啾分布式日志。国际计算语言学协会。访问控制管理器
代码示例来源:origin: twitter/distributedlog
private Future<Void> fetchAccessControlEntries() {
final Promise<Void> promise = new Promise<Void>();
fetchAccessControlEntries(promise);
return promise;
}
代码示例来源:origin: twitter/distributedlog
private Future<ZKAccessControl> fetchDefaultAccessControlEntry() {
final Promise<ZKAccessControl> promise = new Promise<ZKAccessControl>();
fetchDefaultAccessControlEntry(promise);
return promise;
}
代码示例来源:origin: twitter/distributedlog
@Override
public boolean allowDelete(String stream) {
return !getAccessControlEntry(stream).isDenyDelete();
}
代码示例来源:origin: twitter/distributedlog
String stream2 = "test-acm-2";
logger.info("Creating ACL Manager for {}", zkRootPath);
ZKAccessControlManager zkcm = new ZKAccessControlManager(conf, zkc, zkRootPath, executorService);
logger.info("Created ACL Manager for {}", zkRootPath);
try {
setACL(accessControl1);
logger.info("Create ACL for stream {} : {}", stream1, accessControl1);
while (zkcm.allowDelete(stream1)) {
Thread.sleep(100);
setACL(accessControl2);
logger.info("Create ACL for stream {} : {}", stream2, accessControl2);
while (zkcm.allowWrite(stream1)) {
Thread.sleep(100);
while (zkcm.allowTruncate(stream2)) {
Thread.sleep(100);
while (!zkcm.allowTruncate(stream2)) {
Thread.sleep(100);
while (zkcm.allowRelease(stream1)) {
Thread.sleep(100);
while (zkcm.allowAcquire(stream2)) {
Thread.sleep(100);
verifyStreamPermissions(zkcm, stream2, true, true, true, true, false);
代码示例来源:origin: twitter/distributedlog
static void verifyStreamPermissions(ZKAccessControlManager zkcm,
String stream,
boolean allowWrite,
boolean allowTruncate,
boolean allowRelease,
boolean allowDelete,
boolean allowAcquire) throws Exception {
assertEquals(allowWrite, zkcm.allowWrite(stream));
assertEquals(allowTruncate, zkcm.allowTruncate(stream));
assertEquals(allowRelease, zkcm.allowRelease(stream));
assertEquals(allowDelete, zkcm.allowDelete(stream));
assertEquals(allowAcquire, zkcm.allowAcquire(stream));
}
代码示例来源:origin: twitter/distributedlog
@Override
public synchronized AccessControlManager createAccessControlManager() throws IOException {
if (null == accessControlManager) {
String aclRootPath = bkdlConfig.getACLRootPath();
// Build the access control manager
if (aclRootPath == null) {
accessControlManager = DefaultAccessControlManager.INSTANCE;
LOG.info("Created default access control manager for {}", namespace);
} else {
if (!isReservedStreamName(aclRootPath)) {
throw new IOException("Invalid Access Control List Root Path : " + aclRootPath);
}
String zkRootPath = namespace.getPath() + "/" + aclRootPath;
LOG.info("Creating zk based access control manager @ {} for {}",
zkRootPath, namespace);
accessControlManager = new ZKAccessControlManager(conf, sharedReaderZKCForDL,
zkRootPath, scheduler);
LOG.info("Created zk based access control manager @ {} for {}",
zkRootPath, namespace);
}
}
return accessControlManager;
}
代码示例来源:origin: twitter/distributedlog
this.streamEntries = new ConcurrentHashMap<String, ZKAccessControl>();
try {
Await.result(fetchDefaultAccessControlEntry());
} catch (Throwable t) {
if (t instanceof InterruptedException) {
Await.result(fetchAccessControlEntries());
} catch (Throwable t) {
if (t instanceof InterruptedException) {
代码示例来源:origin: twitter/distributedlog
@Override
public boolean allowRelease(String stream) {
return !getAccessControlEntry(stream).isDenyRelease();
}
代码示例来源:origin: twitter/distributedlog
@Override
public boolean allowTruncate(String stream) {
return !getAccessControlEntry(stream).isDenyTruncate();
}
代码示例来源:origin: twitter/distributedlog
@Override
public boolean allowWrite(String stream) {
return !getAccessControlEntry(stream).isDenyWrite();
}
代码示例来源:origin: twitter/distributedlog
@Override
public boolean allowAcquire(String stream) {
return !getAccessControlEntry(stream).isDenyAcquire();
}
内容来源于网络,如有侵权,请联系作者删除!