热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.hadoop.hbase.security.visibility.Authorizations.()方法的使用及代码示例

本文整理了Java中org.apache.hadoop.hbase.security.visibility.Authorizations.<init>()方

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

Authorizations.介绍

暂无

代码示例

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

@Test
public void testSetAuthorizations() {
Scan scan = new Scan();
try {
scan.setAuthorizations(new Authorizations("\u002b|\u0029"));
scan.setAuthorizations(new Authorizations("A", "B", "0123", "A0", "1A1", "_a"));
scan.setAuthorizations(new Authorizations("A|B"));
scan.setAuthorizations(new Authorizations("A&B"));
scan.setAuthorizations(new Authorizations("!B"));
scan.setAuthorizations(new Authorizations("A", "(A)"));
scan.setAuthorizations(new Authorizations("A", "{A"));
scan.setAuthorizations(new Authorizations(" "));
scan.setAuthorizations(new Authorizations(":B"));
scan.setAuthorizations(new Authorizations("-B"));
scan.setAuthorizations(new Authorizations(".B"));
scan.setAuthorizations(new Authorizations("/B"));
} catch (IllegalArgumentException e) {
fail("should not throw exception");
}
}

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

return this.labelsCache.getUserAuths(Bytes.toString(user));
Scan s = new Scan();
if (user != null && user.length > 0) {
s.addColumn(LABELS_TABLE_FAMILY, user);
new Authorizations(SYSTEM_LABEL));
s.setFilter(filter);
ArrayList auths = new ArrayList<>();

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

@Test
public void testVisibilityLabelsInGetThatDoesNotMatchAnyDefinedLabels() throws Exception {
TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
try (Table table = createTableAndWriteDataWithLabels(tableName, "(" + SECRET + "|" + CONFIDENTIAL
+ ")", PRIVATE)) {
Get get = new Get(row1);
get.setAuthorizations(new Authorizations("SAMPLE"));
Result result = table.get(get);
assertTrue(result.isEmpty());
}
}

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

@Test
public void testDeleteWithNoVisibilitiesForPutsAndDeletes() throws Exception {
TableName tableName = createTable(5);
Put p = new Put(Bytes.toBytes("row1"));
p.addColumn(fam, qual, value);
Table table = TEST_UTIL.getConnection().getTable(tableName);
table.put(p);
p = new Put(Bytes.toBytes("row1"));
p.addColumn(fam, qual1, value);
table.put(p);
p = new Put(Bytes.toBytes("row2"));
p.addColumn(fam, qual, value);
table.put(p);
p = new Put(Bytes.toBytes("row2"));
p.addColumn(fam, qual1, value);
table.put(p);
Delete d = new Delete(Bytes.toBytes("row1"));
table.delete(d);
Get g = new Get(Bytes.toBytes("row1"));
g.readAllVersions();
g.setAuthorizations(new Authorizations(SECRET, PRIVATE));
Result result = table.get(g);
assertEquals(0, result.rawCells().length);
p = new Put(Bytes.toBytes("row1"));
p.addColumn(fam, qual, value);
table.put(p);
result = table.get(g);
assertEquals(1, result.rawCells().length);
}

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

@Override
public Void run() throws Exception {
Get g = new Get(row1);
g.setAuthorizations(new Authorizations(SECRET, CONFIDENTIAL));
try (Connection cOnnection= ConnectionFactory.createConnection(conf);
Table t = connection.getTable(table.getName())) {
Result result = t.get(g);
assertTrue(result.isEmpty());
}
return null;
}
};

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

private int doVerify(Path outputDir, int numReducers) throws IOException, InterruptedException,
ClassNotFoundException {
job = new Job(getConf());
job.setJobName("Link Verifier");
job.setNumReduceTasks(numReducers);
job.setJarByClass(getClass());
setJobScannerConf(job);
Scan scan = new Scan();
scan.addColumn(FAMILY_NAME, COLUMN_PREV);
scan.setCaching(10000);
scan.setCacheBlocks(false);
String[] split = labels.split(COMMA);
scan.setAuthorizations(new Authorizations(split[this.labelIndex * 2],
split[(this.labelIndex * 2) + 1]));
TableMapReduceUtil.initTableMapperJob(tableName.getName(), scan, VerifyMapper.class,
BytesWritable.class, BytesWritable.class, job);
TableMapReduceUtil.addDependencyJars(job.getConfiguration(), AbstractHBaseTool.class);
job.getConfiguration().setBoolean("mapreduce.map.speculative", false);
job.setReducerClass(VerifyReducer.class);
job.setOutputFormatClass(TextOutputFormat.class);
TextOutputFormat.setOutputPath(job, outputDir);
boolean success = job.waitForCompletion(true);
return success ? 0 : 1;
}

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

@Test
public void testVisibilityLabelsInScanThatDoesNotMatchAnyDefinedLabels() throws Exception {
TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
try ( Table table = createTableAndWriteDataWithLabels(tableName, "(" + SECRET + "|"
+ CONFIDENTIAL + ")", PRIVATE)){
Scan s = new Scan();
s.setAuthorizations(new Authorizations("SAMPLE"));
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertTrue(next.length == 0);
}
}

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

@Test
public void testVisibilityLabelsWithGet() throws Exception {
TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
try (Table table = createTableAndWriteDataWithLabels(tableName, SECRET + "&" + CONFIDENTIAL
+ "&!" + PRIVATE, SECRET + "&" + CONFIDENTIAL + "&" + PRIVATE)) {
Get get = new Get(row1);
get.setAuthorizations(new Authorizations(SECRET, CONFIDENTIAL));
Result result = table.get(get);
assertTrue(!result.isEmpty());
Cell cell = result.getColumnLatestCell(fam, qual);
assertTrue(Bytes.equals(value, 0, value.length, cell.getValueArray(), cell.getValueOffset(),
cell.getValueLength()));
}
}

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

@Test
public void testDeleteWithFamilyDeletesOfSameTsButDifferentVisibilities() throws Exception {
TableName tableName = createTable(5);
g.setAuthorizations(new Authorizations(SECRET, PRIVATE));
Result result = table.get(g);
assertEquals(0, result.rawCells().length);
g.setAuthorizations(new Authorizations(SECRET, PRIVATE));
result = table.get(g);
assertEquals(0, result.rawCells().length);

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

@Override
public Void run() throws Exception {
Get g = new Get(row1);
g.setAuthorizations(new Authorizations(SECRET, CONFIDENTIAL));
try (Connection cOnnection= ConnectionFactory.createConnection(conf);
Table t = connection.getTable(table.getName())) {
Result result = t.get(g);
assertTrue(!result.isEmpty());
}
return null;
}
};

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

job.getConfiguration().set("LABELS", labels);
job.setJarByClass(getClass());
scan = new Scan();
scan.setCacheBlocks(false);
scan.setRaw(true);
scan.setAuthorizations(new Authorizations(split[this.labelIndex * 2],
split[(this.labelIndex * 2) + 1]));
if (delete) {

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

return this.labelsCache.getGroupAuths(groups);
Scan s = new Scan();
if (groups != null && groups.length > 0) {
for (String group : groups) {
new Authorizations(SYSTEM_LABEL));
s.setFilter(filter);
Set auths = new HashSet<>();

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

@Test
public void testVisibilityLabelsThatDoesNotPassTheCriteria() throws Exception {
TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
try (Table table = createTableAndWriteDataWithLabels(tableName,
"(" + SECRET + "|" + CONFIDENTIAL + ")", PRIVATE)){
Scan s = new Scan();
s.setAuthorizations(new Authorizations(PUBLIC));
ResultScanner scanner = table.getScanner(s);
Result[] next = scanner.next(3);
assertTrue(next.length == 0);
}
}

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

@Test
public void testLabelsWithIncrement() throws Throwable {
TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
try (Table table = TEST_UTIL.createTable(tableName, fam)) {
byte[] row1 = Bytes.toBytes("row1");
byte[] val = Bytes.toBytes(1L);
Put put = new Put(row1);
put.addColumn(fam, qual, HConstants.LATEST_TIMESTAMP, val);
put.setCellVisibility(new CellVisibility(SECRET + " & " + CONFIDENTIAL));
table.put(put);
Get get = new Get(row1);
get.setAuthorizations(new Authorizations(SECRET));
Result result = table.get(get);
assertTrue(result.isEmpty());
table.incrementColumnValue(row1, fam, qual, 2L);
result = table.get(get);
assertTrue(result.isEmpty());
Increment increment = new Increment(row1);
increment.addColumn(fam, qual, 2L);
increment.setCellVisibility(new CellVisibility(SECRET));
table.increment(increment);
result = table.get(get);
assertTrue(!result.isEmpty());
}
}

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

@Override
public Void run() throws Exception {
try (Connection cOnnection= ConnectionFactory.createConnection(conf);
Table table = connection.getTable(tableName)) {
// Test that we enforce the defined set
Get get = new Get(ROW_1);
get.setAuthorizations(new Authorizations(new String[] { SECRET, CONFIDENTIAL }));
Result result = table.get(get);
assertFalse("Inappropriate authorization", result.containsColumn(CF, Q1));
assertTrue("Missing authorization", result.containsColumn(CF, Q2));
assertTrue("Inappropriate filtering", result.containsColumn(CF, Q3));
// Test that we also enforce the defined set for the user if no auths are provided
get = new Get(ROW_1);
result = table.get(get);
assertFalse("Inappropriate authorization", result.containsColumn(CF, Q1));
assertTrue("Missing authorization", result.containsColumn(CF, Q2));
assertTrue("Inappropriate filtering", result.containsColumn(CF, Q3));
return null;
}
}
});

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

return;
Scan scan = new Scan();
scan.setAuthorizations(new Authorizations(VisibilityUtils.SYSTEM_LABEL));
scan.addColumn(LABELS_TABLE_FAMILY, LABEL_QUALIFIER);
ResultScanner scanner = null;
try {
scanner = labelsTable.getScanner(scan);
Result next = null;
while ((next = scanner.next()) != null) {
byte[] row = next.getRow();
byte[] value = next.getValue(LABELS_TABLE_FAMILY, LABEL_QUALIFIER);

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

@Test
public void testLabelsWithAppend() throws Throwable {
TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
try (Table table = TEST_UTIL.createTable(tableName, fam)) {
byte[] row1 = Bytes.toBytes("row1");
byte[] val = Bytes.toBytes("a");
Put put = new Put(row1);
put.addColumn(fam, qual, HConstants.LATEST_TIMESTAMP, val);
put.setCellVisibility(new CellVisibility(SECRET + " & " + CONFIDENTIAL));
table.put(put);
Get get = new Get(row1);
get.setAuthorizations(new Authorizations(SECRET));
Result result = table.get(get);
assertTrue(result.isEmpty());
Append append = new Append(row1);
append.addColumn(fam, qual, Bytes.toBytes("b"));
table.append(append);
result = table.get(get);
assertTrue(result.isEmpty());
append = new Append(row1);
append.addColumn(fam, qual, Bytes.toBytes("c"));
append.setCellVisibility(new CellVisibility(SECRET));
table.append(append);
result = table.get(get);
assertTrue(!result.isEmpty());
}
}

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

Cell current;
Get get = new Get(row);
get.setAuthorizations(new Authorizations(auths));
Result result = table2.get(get);
cellScanner = result.cellScanner();
boolean advance = cellScanner.advance();
if (nullExpected) {
assertTrue(!advance);
return null;
assertTrue(foundNonVisTag);
return null;

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

@Override
public Void run() throws Exception {
Scan s = new Scan();
s.setAuthorizations(new Authorizations(SECRET, CONFIDENTIAL));
try (Connection cOnnection= ConnectionFactory.createConnection(conf);
Table t = connection.getTable(table.getName())) {
ResultScanner scanner = t.getScanner(s);
Result[] result = scanner.next(5);
assertTrue(result.length == 2);
}
return null;
}
};

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

@Test
public void testMutateRow() throws Exception {
final byte[] qual2 = Bytes.toBytes("qual2");
TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
HTableDescriptor desc = new HTableDescriptor(tableName);
HColumnDescriptor col = new HColumnDescriptor(fam);
desc.addFamily(col);
TEST_UTIL.getAdmin().createTable(desc);
try (Table table = TEST_UTIL.getConnection().getTable(tableName)){
Put p1 = new Put(row1);
p1.addColumn(fam, qual, value);
p1.setCellVisibility(new CellVisibility(CONFIDENTIAL));
Put p2 = new Put(row1);
p2.addColumn(fam, qual2, value);
p2.setCellVisibility(new CellVisibility(SECRET));
RowMutations rm = new RowMutations(row1);
rm.add(p1);
rm.add(p2);
table.mutateRow(rm);
Get get = new Get(row1);
get.setAuthorizations(new Authorizations(CONFIDENTIAL));
Result result = table.get(get);
assertTrue(result.containsColumn(fam, qual));
assertFalse(result.containsColumn(fam, qual2));
get.setAuthorizations(new Authorizations(SECRET));
result = table.get(get);
assertFalse(result.containsColumn(fam, qual));
assertTrue(result.containsColumn(fam, qual2));
}
}

推荐阅读
  • 本文详细介绍了Java中org.neo4j.helpers.collection.Iterators.single()方法的功能、使用场景及代码示例,帮助开发者更好地理解和应用该方法。 ... [详细]
  • 本文详细介绍了 Apache Jena 库中的 Txn.executeWrite 方法,通过多个实际代码示例展示了其在不同场景下的应用,帮助开发者更好地理解和使用该方法。 ... [详细]
  • 优化ListView性能
    本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ... [详细]
  • 本文介绍了Java并发库中的阻塞队列(BlockingQueue)及其典型应用场景。通过具体实例,展示了如何利用LinkedBlockingQueue实现线程间高效、安全的数据传递,并结合线程池和原子类优化性能。 ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • 深入解析Spring Cloud Ribbon负载均衡机制
    本文详细介绍了Spring Cloud中的Ribbon组件如何实现服务调用的负载均衡。通过分析其工作原理、源码结构及配置方式,帮助读者理解Ribbon在分布式系统中的重要作用。 ... [详细]
  • 本文详细介绍了Java编程语言中的核心概念和常见面试问题,包括集合类、数据结构、线程处理、Java虚拟机(JVM)、HTTP协议以及Git操作等方面的内容。通过深入分析每个主题,帮助读者更好地理解Java的关键特性和最佳实践。 ... [详细]
  • 本文详细介绍了Java中org.w3c.dom.Text类的splitText()方法,通过多个代码示例展示了其实际应用。该方法用于将文本节点在指定位置拆分为两个节点,并保持在文档树中。 ... [详细]
  • 本文介绍如何使用阿里云的fastjson库解析包含时间戳、IP地址和参数等信息的JSON格式文本,并进行数据处理和保存。 ... [详细]
  • 本文详细介绍了 Java 中 org.apache.xmlbeans.SchemaType 类的 getBaseEnumType() 方法,提供了多个代码示例,并解释了其在不同场景下的使用方法。 ... [详细]
  • 本文介绍如何在Java项目中使用Log4j库进行日志记录。我们将详细说明Log4j库的引入、配置及简单应用,帮助开发者快速上手。 ... [详细]
  • 本文详细介绍了中央电视台电影频道的节目预告,并通过专业工具分析了其加载方式,确保用户能够获取最准确的电视节目信息。 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 深入理解Cookie与Session会话管理
    本文详细介绍了如何通过HTTP响应和请求处理浏览器的Cookie信息,以及如何创建、设置和管理Cookie。同时探讨了会话跟踪技术中的Session机制,解释其原理及应用场景。 ... [详细]
  • 主要用了2个类来实现的,话不多说,直接看运行结果,然后在奉上源代码1.Index.javaimportjava.awt.Color;im ... [详细]
author-avatar
ttarm_33218389
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有