本文整理汇总了Java中org.apache.accumulo.core.security.Authorizations.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Authorizations.equals方法的具体用法?Java Authorizations.equals怎么用?Java Authorizations.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.accumulo.core.security.Authorizations
的用法示例。
在下文中一共展示了Authorizations.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyAuthorizations
import org.apache.accumulo.core.security.Authorizations; //导入方法依赖的package包/类
protected void copyAuthorizations() throws IOException {
try {
final SecurityOperations parentSecOps = parentConnector.securityOperations();
final SecurityOperations childSecOps = childConnector.securityOperations();
final Authorizations parentAuths = parentSecOps.getUserAuthorizations(parentUser);
final Authorizations childAuths = childSecOps.getUserAuthorizations(childUser);
// Add any parent authorizations that the child doesn't have.
if (!childAuths.equals(parentAuths)) {
log.info("Adding the authorization, \"" + parentAuths.toString() + "\", to the child user, \"" + childUser + "\"");
final Authorizations newChildAuths = AccumuloRyaUtils.addUserAuths(childUser, childSecOps, parentAuths);
childSecOps.changeUserAuthorizations(childUser, newChildAuths);
}
} catch (AccumuloException | AccumuloSecurityException e) {
throw new IOException(e);
}
}
示例2: createTempTableIfNeeded
import org.apache.accumulo.core.security.Authorizations; //导入方法依赖的package包/类
/**
* Creates the temp child table if it doesn't already exist in the parent.
* @param childTableName the name of the child table.
* @throws IOException
*/
public void createTempTableIfNeeded(final String childTableName) throws IOException {
try {
final AccumuloRdfConfiguration accumuloRdfConfiguration = new AccumuloRdfConfiguration(conf);
accumuloRdfConfiguration.setTablePrefix(childTablePrefix);
final Connector connector = AccumuloRyaUtils.setupConnector(accumuloRdfConfiguration);
if (!connector.tableOperations().exists(childTableName)) {
log.info("Creating table: " + childTableName);
connector.tableOperations().create(childTableName);
log.info("Created table: " + childTableName);
log.info("Granting authorizations to table: " + childTableName);
final SecurityOperations secOps = connector.securityOperations();
secOps.grantTablePermission(userName, childTableName, TablePermission.WRITE);
log.info("Granted authorizations to table: " + childTableName);
final Authorizations parentAuths = secOps.getUserAuthorizations(userName);
// Add child authorizations so the temp parent table can be accessed.
if (!parentAuths.equals(childAuthorizations)) {
final List<String> childAuthList = findUniqueAuthsFromChild(parentAuths.toString(), childAuthorizations.toString());
tempChildAuths = Joiner.on(",").join(childAuthList);
log.info("Adding the authorization, \"" + tempChildAuths + "\", to the parent user, \"" + userName + "\"");
final Authorizations newAuths = AccumuloRyaUtils.addUserAuths(userName, secOps, new Authorizations(tempChildAuths));
secOps.changeUserAuthorizations(userName, newAuths);
}
}
} catch (TableExistsException | AccumuloException | AccumuloSecurityException e) {
throw new IOException(e);
}
}