public class ColumnVisibility extends Object
ColumnVisibility(byte[])
for the definition of an expression.
The expression is a sequence of characters from the set [A-Za-z0-9_-.] along with the binary operators "&" and "|" indicating that both operands are necessary, or the either is necessary. The following are valid expressions for visibility:
A A|B (A|B)&(C|D) orange|(red&yellow)
The following are not valid expressions for visibility:
A|B&C A=B A|B| A&|B () ) dog|!cat
In addition to the base set of visibilities, any character can be used in the expression if it is
quoted. If the quoted term contains '"' or '\', then escape the character with '\'. The
quote(String)
method can be used to properly quote and escape terms automatically. The
following is an example of a quoted term:
"A#C" & B
Modifier and Type | Class and Description |
---|---|
static class |
ColumnVisibility.Node
A node in the parse tree for a visibility expression.
|
static class |
ColumnVisibility.NodeComparator
A node comparator.
|
static class |
ColumnVisibility.NodeType
The node types in a parse tree for a visibility expression.
|
Constructor and Description |
---|
ColumnVisibility()
Creates an empty visibility.
|
ColumnVisibility(byte[] expression)
Creates a column visibility for a Mutation from a string already encoded in UTF-8 bytes.
|
ColumnVisibility(String expression)
Creates a column visibility for a Mutation.
|
ColumnVisibility(org.apache.hadoop.io.Text expression)
Creates a column visibility for a Mutation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(ColumnVisibility otherLe)
Compares two ColumnVisibilities for string equivalence, not as a meaningful comparison of terms
and conditions.
|
boolean |
equals(Object obj)
|
byte[] |
flatten()
Generates a byte[] that represents a normalized, but logically equivalent, form of this
evaluator's expression.
|
byte[] |
getExpression()
Accessor for the underlying byte string.
|
ColumnVisibility.Node |
getParseTree()
Gets the parse tree for this column visibility.
|
int |
hashCode() |
static ColumnVisibility.Node |
normalize(ColumnVisibility.Node root,
byte[] expression) |
static ColumnVisibility.Node |
normalize(ColumnVisibility.Node root,
byte[] expression,
ColumnVisibility.NodeComparator comparator) |
static byte[] |
quote(byte[] term)
Properly quotes terms in a column visibility expression.
|
static String |
quote(String term)
Properly quotes terms in a column visibility expression.
|
static void |
stringify(ColumnVisibility.Node root,
byte[] expression,
StringBuilder out) |
String |
toString() |
public ColumnVisibility()
ColumnVisibility(String)
public ColumnVisibility(String expression)
expression
- An expression of the rights needed to see this mutation. The expression syntax is
defined at the class-level documentationpublic ColumnVisibility(org.apache.hadoop.io.Text expression)
expression
- visibility expressionColumnVisibility(String)
public ColumnVisibility(byte[] expression)
expression
- visibility expression, encoded as UTF-8 bytesColumnVisibility(String)
public byte[] getExpression()
public static ColumnVisibility.Node normalize(ColumnVisibility.Node root, byte[] expression)
public static ColumnVisibility.Node normalize(ColumnVisibility.Node root, byte[] expression, ColumnVisibility.NodeComparator comparator)
public static void stringify(ColumnVisibility.Node root, byte[] expression, StringBuilder out)
public byte[] flatten()
public boolean equals(ColumnVisibility otherLe)
otherLe
- other column visibilitypublic ColumnVisibility.Node getParseTree()
public static String quote(String term)
Examples of using quote :
import static org.apache.accumulo.core.security.ColumnVisibility.quote; . . . String s = quote("A#C") + "&" + quote("FOO"); ColumnVisibility cv = new ColumnVisibility(s);
term
- term to quotepublic static byte[] quote(byte[] term)
term
- term to quote, encoded as UTF-8 bytesquote(String)
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.