Interface AccumuloElementConverter
-
- All Known Implementing Classes:
AbstractCoreKeyAccumuloElementConverter
,ByteEntityAccumuloElementConverter
,ClassicAccumuloElementConverter
public interface AccumuloElementConverter
The Accumulo ElementConverter Interface details the methods necessary to convert GafferElement
s to AccumuloKey
s andValue
s Some of these methods may not be required in your client code, but some iterators designed for common use may make use of them.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
buildColumnFamily(String group)
Creates a byte array representing the group.byte[]
buildColumnQualifier(String group, Properties properties)
Creates a byte array representing a set ofProperties
that are to be stored in the column qualifier.byte[]
buildColumnVisibility(String group, Properties properties)
Creates a byte array representing a set ofProperties
that are to be stored in the column visibility.long
buildTimestamp(String group, Properties properties)
Creates a timestamp based on the providedProperties
will return a default value if properties do not have a valid timestamp valueElement
getElementFromKey(org.apache.accumulo.core.data.Key key, boolean includeMatchedVertex)
Gets a newElement
from an AccumuloKey
.ElementId
getElementId(org.apache.accumulo.core.data.Key key, boolean includeMatchedVertex)
Gets a newElementId
from an AccumuloKey
.Element
getFullElement(org.apache.accumulo.core.data.Key key, org.apache.accumulo.core.data.Value value, boolean includeMatchedVertex)
String
getGroupFromColumnFamily(byte[] columnFamily)
Returns the element class from the given bytes.org.apache.accumulo.core.data.Key
getKeyFromEntity(Entity entity)
Converts anEntity
to aKey
.Pair<org.apache.accumulo.core.data.Key,org.apache.accumulo.core.data.Key>
getKeysFromEdge(Edge edge)
Converts anEdge
to a pair ofKey
s.Pair<org.apache.accumulo.core.data.Key,org.apache.accumulo.core.data.Key>
getKeysFromElement(Element element)
BytesAndRange
getPropertiesAsBytesFromColumnQualifier(String group, byte[] bytes, int numProps)
Truncates the provided columnQualifier, returning the byte representation of the serialised version of the specified properties.Properties
getPropertiesFromColumnQualifier(String group, byte[] columnQualifier)
Returns a set ofProperties
that are stored in the part of the key that is provided.Properties
getPropertiesFromColumnVisibility(String group, byte[] columnVisibility)
Returns a set ofProperties
that are stored in the part of the key that is provided.Properties
getPropertiesFromTimestamp(String group, long timestamp)
Creates a properties object based on the provided timestamp and group.Properties
getPropertiesFromValue(String group, org.apache.accumulo.core.data.Value value)
Converts an AccumuloValue
to aProperties
object.Pair<byte[],byte[]>
getRowKeysFromElement(Element element)
Creates a byte array representing the Element identifiers, this will be stored in the Accumulo row Key.org.apache.accumulo.core.data.Value
getValueFromElement(Element element)
Converts theProperties
in an element to an AccumuloValue
where the property has a position within the store schema that indicates it should be stored in the value.org.apache.accumulo.core.data.Value
getValueFromProperties(String group, Properties properties)
Converts a set ofProperties
to an AccumuloValue
.byte[]
serialiseVertex(Object vertex)
Helper Used to create Bloom Filters, method Serialises a given object (from anEntityId
) with the Identifier Serialiser defined in the schema.
-
-
-
Method Detail
-
getKeysFromElement
Pair<org.apache.accumulo.core.data.Key,org.apache.accumulo.core.data.Key> getKeysFromElement(Element element)
Converts anElement
Pair
of keys which represent the keys created from the given element. If the given element was an entity only one key will be created and the second item in the pair will be null.- Parameters:
element
- the element to be converted- Returns:
- The key(s) that represent the given element.
-
getKeysFromEdge
Pair<org.apache.accumulo.core.data.Key,org.apache.accumulo.core.data.Key> getKeysFromEdge(Edge edge)
Converts anEdge
to a pair ofKey
s.- Parameters:
edge
- The edge to be converted- Returns:
- The key(s) that represent the given edge
-
getKeyFromEntity
org.apache.accumulo.core.data.Key getKeyFromEntity(Entity entity)
Converts anEntity
to aKey
.- Parameters:
entity
- the entity to be converted- Returns:
- The key(s) that represent the given entity
-
getValueFromProperties
org.apache.accumulo.core.data.Value getValueFromProperties(String group, Properties properties)
Converts a set ofProperties
to an AccumuloValue
.- Parameters:
group
- the element groupproperties
- the properties to use to create a Value- Returns:
- A new Accumulo
Value
containing the serialisedProperties
-
getValueFromElement
org.apache.accumulo.core.data.Value getValueFromElement(Element element)
Converts theProperties
in an element to an AccumuloValue
where the property has a position within the store schema that indicates it should be stored in the value.- Parameters:
element
- the element to be converted- Returns:
- An Accumulo
Value
representing theProperties
that should be stored in the value.
-
getPropertiesFromValue
Properties getPropertiesFromValue(String group, org.apache.accumulo.core.data.Value value)
Converts an AccumuloValue
to aProperties
object.- Parameters:
group
- the element groupvalue
- the Value containing the serialised properties- Returns:
- A set of
Properties
that represent the property stored within theValue
-
getElementId
ElementId getElementId(org.apache.accumulo.core.data.Key key, boolean includeMatchedVertex)
Gets a newElementId
from an AccumuloKey
.- Parameters:
key
- the Key containing serialised parts of the ElementincludeMatchedVertex
- if true then the matchedVertex field is set on Edges- Returns:
- A new
ElementId
-
getElementFromKey
Element getElementFromKey(org.apache.accumulo.core.data.Key key, boolean includeMatchedVertex)
Gets a newElement
from an AccumuloKey
.- Parameters:
key
- the Key containing serialised parts of the ElementincludeMatchedVertex
- if true then the matchedVertex field is set on Edges- Returns:
- A new
Element
including a partial set ofProperties
that were store in theKey
-
getFullElement
Element getFullElement(org.apache.accumulo.core.data.Key key, org.apache.accumulo.core.data.Value value, boolean includeMatchedVertex)
- Parameters:
key
- the accumulo Key containing serialised parts of the Elementvalue
- the accumulo Value containing serialised properties of the ElementincludeMatchedVertex
- if true then the matchedVertex field is set on Edges- Returns:
- Returns an
Element
populated with all the properties defined within theKey
andValue
-
serialiseVertex
byte[] serialiseVertex(Object vertex)
Helper Used to create Bloom Filters, method Serialises a given object (from anEntityId
) with the Identifier Serialiser defined in the schema.- Parameters:
vertex
- the vertex identifier to serialise- Returns:
- A byte array representing the given object
-
getRowKeysFromElement
Pair<byte[],byte[]> getRowKeysFromElement(Element element)
Creates a byte array representing the Element identifiers, this will be stored in the Accumulo row Key.- Parameters:
element
- the element- Returns:
- the byte array(s) representing the provided
Element
identifiers.
-
buildColumnQualifier
byte[] buildColumnQualifier(String group, Properties properties)
Creates a byte array representing a set ofProperties
that are to be stored in the column qualifier.- Parameters:
group
- the element groupproperties
- the element properties- Returns:
- A byte array representing the provided
Properties
that are marked as to be stored in the provided position in theuk.gov.gchq.gaffer.accumulostore
schema.
-
getPropertiesFromColumnQualifier
Properties getPropertiesFromColumnQualifier(String group, byte[] columnQualifier)
Returns a set ofProperties
that are stored in the part of the key that is provided.- Parameters:
group
- the element groupcolumnQualifier
- the element column qualifier properties serialised into bytes- Returns:
- The Properties stored within the part of the
Key
specified e.g Column Qualifier
-
getPropertiesAsBytesFromColumnQualifier
BytesAndRange getPropertiesAsBytesFromColumnQualifier(String group, byte[] bytes, int numProps)
Truncates the provided columnQualifier, returning the byte representation of the serialised version of the specified properties.- Parameters:
group
- the element groupbytes
- the full list of property bytesnumProps
- the number of properties to extract- Returns:
- details of the bytes range.
-
buildColumnFamily
byte[] buildColumnFamily(String group)
Creates a byte array representing the group.- Parameters:
group
- the element group- Returns:
- A byte array representing the group
-
getGroupFromColumnFamily
String getGroupFromColumnFamily(byte[] columnFamily)
Returns the element class from the given bytes.- Parameters:
columnFamily
- the column family bytes- Returns:
- The element class
-
buildColumnVisibility
byte[] buildColumnVisibility(String group, Properties properties)
Creates a byte array representing a set ofProperties
that are to be stored in the column visibility.- Parameters:
group
- the element groupproperties
- the element properties- Returns:
- A byte array representing the provided
Properties
that are marked as to be stored in the provided position in the schema.
-
getPropertiesFromColumnVisibility
Properties getPropertiesFromColumnVisibility(String group, byte[] columnVisibility)
Returns a set ofProperties
that are stored in the part of the key that is provided.- Parameters:
group
- the element groupcolumnVisibility
- the element visibility property serialised into bytes- Returns:
- The Properties stored within the part of the
Key
specified e.g Column Qualifier
-
buildTimestamp
long buildTimestamp(String group, Properties properties)
Creates a timestamp based on the providedProperties
will return a default value if properties do not have a valid timestamp value- Parameters:
group
- the element groupproperties
- the element properties- Returns:
- the timestamp
-
getPropertiesFromTimestamp
Properties getPropertiesFromTimestamp(String group, long timestamp)
Creates a properties object based on the provided timestamp and group. If the group contains a timestamp property then this property is populated in the returned object. Otherwise, the result is an empty properties object.- Parameters:
group
- the group of the element - used to determine if the result should contain the timestamp.timestamp
- the timestamp- Returns:
- a properties object populated with the provided timestamp.
-
-