Interface AccumuloElementConverter
-
- All Known Implementing Classes:
AbstractCoreKeyAccumuloElementConverter,ByteEntityAccumuloElementConverter,ClassicAccumuloElementConverter
public interface AccumuloElementConverterThe Accumulo ElementConverter Interface details the methods necessary to convert GafferElements to AccumuloKeys andValues 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 ofPropertiesthat are to be stored in the column qualifier.byte[]buildColumnVisibility(String group, Properties properties)Creates a byte array representing a set ofPropertiesthat are to be stored in the column visibility.longbuildTimestamp(String group, Properties properties)Creates a timestamp based on the providedPropertieswill return a default value if properties do not have a valid timestamp valueElementgetElementFromKey(org.apache.accumulo.core.data.Key key, boolean includeMatchedVertex)Gets a newElementfrom an AccumuloKey.ElementIdgetElementId(org.apache.accumulo.core.data.Key key, boolean includeMatchedVertex)Gets a newElementIdfrom an AccumuloKey.ElementgetFullElement(org.apache.accumulo.core.data.Key key, org.apache.accumulo.core.data.Value value, boolean includeMatchedVertex)StringgetGroupFromColumnFamily(byte[] columnFamily)Returns the element class from the given bytes.org.apache.accumulo.core.data.KeygetKeyFromEntity(Entity entity)Converts anEntityto aKey.Pair<org.apache.accumulo.core.data.Key,org.apache.accumulo.core.data.Key>getKeysFromEdge(Edge edge)Converts anEdgeto a pair ofKeys.Pair<org.apache.accumulo.core.data.Key,org.apache.accumulo.core.data.Key>getKeysFromElement(Element element)BytesAndRangegetPropertiesAsBytesFromColumnQualifier(String group, byte[] bytes, int numProps)Truncates the provided columnQualifier, returning the byte representation of the serialised version of the specified properties.PropertiesgetPropertiesFromColumnQualifier(String group, byte[] columnQualifier)Returns a set ofPropertiesthat are stored in the part of the key that is provided.PropertiesgetPropertiesFromColumnVisibility(String group, byte[] columnVisibility)Returns a set ofPropertiesthat are stored in the part of the key that is provided.PropertiesgetPropertiesFromTimestamp(String group, long timestamp)Creates a properties object based on the provided timestamp and group.PropertiesgetPropertiesFromValue(String group, org.apache.accumulo.core.data.Value value)Converts an AccumuloValueto aPropertiesobject.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.ValuegetValueFromElement(Element element)Converts thePropertiesin an element to an AccumuloValuewhere the property has a position within the store schema that indicates it should be stored in the value.org.apache.accumulo.core.data.ValuegetValueFromProperties(String group, Properties properties)Converts a set ofPropertiesto 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 anElementPairof 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 anEdgeto a pair ofKeys.- 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 anEntityto 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 ofPropertiesto an AccumuloValue.- Parameters:
group- the element groupproperties- the properties to use to create a Value- Returns:
- A new Accumulo
Valuecontaining the serialisedProperties
-
getValueFromElement
org.apache.accumulo.core.data.Value getValueFromElement(Element element)
Converts thePropertiesin an element to an AccumuloValuewhere 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
Valuerepresenting thePropertiesthat should be stored in the value.
-
getPropertiesFromValue
Properties getPropertiesFromValue(String group, org.apache.accumulo.core.data.Value value)
Converts an AccumuloValueto aPropertiesobject.- Parameters:
group- the element groupvalue- the Value containing the serialised properties- Returns:
- A set of
Propertiesthat represent the property stored within theValue
-
getElementId
ElementId getElementId(org.apache.accumulo.core.data.Key key, boolean includeMatchedVertex)
Gets a newElementIdfrom 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 newElementfrom 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
Elementincluding a partial set ofPropertiesthat 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
Elementpopulated with all the properties defined within theKeyandValue
-
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
Elementidentifiers.
-
buildColumnQualifier
byte[] buildColumnQualifier(String group, Properties properties)
Creates a byte array representing a set ofPropertiesthat are to be stored in the column qualifier.- Parameters:
group- the element groupproperties- the element properties- Returns:
- A byte array representing the provided
Propertiesthat are marked as to be stored in the provided position in theuk.gov.gchq.gaffer.accumulostoreschema.
-
getPropertiesFromColumnQualifier
Properties getPropertiesFromColumnQualifier(String group, byte[] columnQualifier)
Returns a set ofPropertiesthat 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
Keyspecified 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 ofPropertiesthat are to be stored in the column visibility.- Parameters:
group- the element groupproperties- the element properties- Returns:
- A byte array representing the provided
Propertiesthat are marked as to be stored in the provided position in the schema.
-
getPropertiesFromColumnVisibility
Properties getPropertiesFromColumnVisibility(String group, byte[] columnVisibility)
Returns a set ofPropertiesthat 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
Keyspecified e.g Column Qualifier
-
buildTimestamp
long buildTimestamp(String group, Properties properties)
Creates a timestamp based on the providedPropertieswill 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.
-
-