本文整理了Java中org.apache.accumulo.server.zookeeper.ZooCache.get()
方法的一些代码示例,展示了ZooCache.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooCache.get()
方法的具体详情如下:
包路径:org.apache.accumulo.server.zookeeper.ZooCache
类名称:ZooCache
方法名:get
暂无
代码示例来源:origin: org.apache.accumulo/accumulo-server
/**
* Checks if a user exists
*/
@Override
public boolean userExists(String user) {
return zooCache.get(ZKUserPath + "/" + user) != null;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
private void updateTableStateCache() {
synchronized (tableStateCache) {
for (String tableId : zooStateCache
.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES))
if (zooStateCache.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId
+ Constants.ZTABLE_STATE) != null)
updateTableStateCache(tableId);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public boolean userExists(String user) {
return zooCache.get(ZKUserPath + "/" + user) != null;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
private void updateTableStateCache() {
synchronized (tableStateCache) {
for (String tableId : zooStateCache.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES))
if (zooStateCache.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE) != null)
updateTableStateCache(tableId);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
public synchronized String getRootUsername() {
if (rootUserName == null)
rootUserName = new String(zooCache.get(ZKUserPath), UTF_8);
return rootUserName;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
public synchronized String getRootUsername() {
if (rootUserName == null)
rootUserName = new String(zooCache.get(ZKUserPath), UTF_8);
return rootUserName;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
/**
* Fetches the absolute path of the file to be replicated.
*
* @param conn
* Accumulo Connector
* @param workQueuePath
* Root path for the Replication WorkQueue
* @param queueKey
* The Replication work queue key
* @return The absolute path for the file, or null if the key is no longer in ZooKeeper
*/
public String getAbsolutePath(Connector conn, String workQueuePath, String queueKey) {
byte[] data = zooCache.get(workQueuePath + "/" + queueKey);
if (null != data) {
return new String(data, UTF_8);
}
return null;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
@Override
public boolean hasCachedTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException, TableNotFoundException {
byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
if (serializedPerms != null) {
return ZKSecurityTool.convertTablePermissions(serializedPerms).contains(permission);
}
return false;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
@Override
public boolean hasCachedSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
byte[] perms = zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms);
if (perms == null)
return false;
return ZKSecurityTool.convertSystemPermissions(perms).contains(permission);
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public boolean hasCachedTablePermission(String user, String table, TablePermission permission)
throws AccumuloSecurityException, TableNotFoundException {
byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
if (serializedPerms != null) {
return ZKSecurityTool.convertTablePermissions(serializedPerms).contains(permission);
}
return false;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public boolean hasCachedNamespacePermission(String user, String namespace,
NamespacePermission permission) throws AccumuloSecurityException, NamespaceNotFoundException {
byte[] serializedPerms = zooCache
.get(ZKUserPath + "/" + user + ZKUserNamespacePerms + "/" + namespace);
if (serializedPerms != null) {
return ZKSecurityTool.convertNamespacePermissions(serializedPerms).contains(permission);
}
return false;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public boolean hasCachedSystemPermission(String user, SystemPermission permission)
throws AccumuloSecurityException {
byte[] perms = zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms);
if (perms == null)
return false;
return ZKSecurityTool.convertSystemPermissions(perms).contains(permission);
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public Authorizations getCachedUserAuthorizations(String user) {
byte[] authsBytes = zooCache.get(ZKUserPath + "/" + user + ZKUserAuths);
if (authsBytes != null)
return ZKSecurityTool.convertAuthorizations(authsBytes);
return Authorizations.EMPTY;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
@Override
public Authorizations getCachedUserAuthorizations(String user) {
byte[] authsBytes = zooCache.get(ZKUserPath + "/" + user + ZKUserAuths);
if (authsBytes != null)
return ZKSecurityTool.convertAuthorizations(authsBytes);
return Constants.NO_AUTHS;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
public TableState updateTableStateCache(String tableId) {
synchronized (tableStateCache) {
TableState tState = TableState.UNKNOWN;
byte[] data = zooStateCache.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE);
if (data != null) {
String sState = new String(data, UTF_8);
try {
tState = TableState.valueOf(sState);
} catch (IllegalArgumentException e) {
log.error("Unrecognized state for table with tableId=" + tableId + ": " + sState);
}
tableStateCache.put(tableId, tState);
}
return tState;
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
public TableState updateTableStateCache(String tableId) {
synchronized (tableStateCache) {
TableState tState = TableState.UNKNOWN;
byte[] data = zooStateCache.get(
ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE);
if (data != null) {
String sState = new String(data, UTF_8);
try {
tState = TableState.valueOf(sState);
} catch (IllegalArgumentException e) {
log.error("Unrecognized state for table with tableId=" + tableId + ": " + sState);
}
tableStateCache.put(tableId, tState);
}
return tState;
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public byte[] get(String path) throws DistributedStoreException {
try {
return cache.get(relative(path));
} catch (Exception ex) {
throw new DistributedStoreException(ex);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
@Override
public byte[] get(String path) throws DistributedStoreException {
try {
return cache.get(relative(path));
} catch (Exception ex) {
throw new DistributedStoreException(ex);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-master
/**
* Iterate over the queued work to remove entries that have been completed.
*/
@Override
protected void cleanupFinishedWork() {
final Iterator<String> work = queuedWork.iterator();
final String instanceId = conn.getInstance().getInstanceID();
while (work.hasNext()) {
String filename = work.next();
// Null equates to the work was finished
if (null == zooCache.get(
ZooUtil.getRoot(instanceId) + ReplicationConstants.ZOO_WORK_QUEUE + "/" + filename)) {
work.remove();
}
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
@Override
public boolean authenticateUser(String principal, AuthenticationToken token) throws AccumuloSecurityException {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
byte[] pass;
String zpath = ZKUserPath + "/" + principal;
pass = zooCache.get(zpath);
boolean result = ZKSecurityTool.checkPass(pt.getPassword(), pass);
if (!result) {
zooCache.clear(zpath);
pass = zooCache.get(zpath);
result = ZKSecurityTool.checkPass(pt.getPassword(), pass);
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!