org.apache.accumulo.core.security
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 |
static class |
ColumnVisibility.NodeComparator |
static class |
ColumnVisibility.NodeType |
Constructor and Description |
---|
ColumnVisibility()
Empty visibility.
|
ColumnVisibility(byte[] expression)
A convenience method for constructing from a string already encoded in UTF-8 bytes.
|
ColumnVisibility(String expression)
Set the column visibility for a Mutation.
|
ColumnVisibility(org.apache.hadoop.io.Text expression)
A convenience method for constructing from a string already encoded in UTF-8 bytes and contained in a
Text object. |
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 the supplied expression.
|
byte[] |
getExpression()
Accessor for the underlying byte string.
|
ColumnVisibility.Node |
getParseTree() |
int |
hashCode() |
static byte[] |
quote(byte[] term)
A convenience method to quote terms which are already encoded as UTF-8 bytes.
|
static String |
quote(String term)
Use to properly quote terms in a column visibility expression.
|
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)
Text
object.ColumnVisibility(String)
public ColumnVisibility(byte[] expression)
ColumnVisibility(String)
public byte[] getExpression()
public byte[] flatten()
public boolean equals(ColumnVisibility otherLe)
public ColumnVisibility.Node getParseTree()
public static String quote(String term)
Examples of using quote :
import static org.apache.accumulo.core.security.ColumnVisibility.quote; . . . ColumnVisibility cv = new ColumnVisibility(quote("A#C") + "&" + quote("FOO"));
public static byte[] quote(byte[] term)
quote(String)
Copyright © 2014 Apache Accumulo Project. All Rights Reserved.