@EventDriven @SideEffectFree @SupportsBatching @Tags(value={"attributes","hash","md5","sha","keccak","blake2","cryptography"}) @InputRequirement(value=INPUT_REQUIRED) @CapabilityDescription(value="Calculates a hash value for each of the specified attributes using the given algorithm and writes it to an output attribute. Please refer to https://csrc.nist.gov/Projects/Hash-Functions/NIST-Policy-on-Hash-Functions for help to decide which algorithm to use. ") @WritesAttribute(attribute="<Specified Attribute Name per Dynamic Property>", description="This Processor adds an attribute whose value is the result of hashing the specified attribute. The name of this attribute is specified by the value of the dynamic property.") @DynamicProperty(name="A flowfile attribute key for attribute inspection", value="Attribute Name", description="The property name defines the attribute to look for and hash in the incoming flowfile. The property value defines the name to give the generated attribute. Attribute names must be unique.") public class CryptographicHashAttribute extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
static class |
CryptographicHashAttribute.PartialAttributePolicy |
Modifier and Type | Field and Description |
---|---|
private static AllowableValue |
ALLOW_PARTIAL_ATTRIBUTES_VALUE |
private AtomicReference<Map<String,String>> |
attributeToGenerateNameMapRef |
(package private) static PropertyDescriptor |
CHARACTER_SET |
private static AllowableValue |
FAIL_PARTIAL_ATTRIBUTES_VALUE |
(package private) static PropertyDescriptor |
FAIL_WHEN_EMPTY |
(package private) static PropertyDescriptor |
HASH_ALGORITHM |
(package private) static PropertyDescriptor |
PARTIAL_ATTR_ROUTE_POLICY |
private static List<PropertyDescriptor> |
properties |
static Relationship |
REL_FAILURE |
static Relationship |
REL_SUCCESS |
private static Set<Relationship> |
relationships |
Constructor and Description |
---|
CryptographicHashAttribute() |
Modifier and Type | Method and Description |
---|---|
private static String |
getMissingKeysString(Set<String> foundKeys,
Set<String> wantedKeys) |
Set<Relationship> |
getRelationships() |
private static SortedMap<String,String> |
getRelevantAttributes(FlowFile flowFile,
Map<String,String> attributeToGeneratedNameMap) |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
private String |
hashValue(HashAlgorithm algorithm,
String value,
Charset charset) |
void |
onPropertyModified(PropertyDescriptor descriptor,
String oldValue,
String newValue) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, validate
private static final AllowableValue ALLOW_PARTIAL_ATTRIBUTES_VALUE
private static final AllowableValue FAIL_PARTIAL_ATTRIBUTES_VALUE
static final PropertyDescriptor CHARACTER_SET
static final PropertyDescriptor FAIL_WHEN_EMPTY
static final PropertyDescriptor HASH_ALGORITHM
static final PropertyDescriptor PARTIAL_ATTR_ROUTE_POLICY
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private static final Set<Relationship> relationships
private static final List<PropertyDescriptor> properties
private final AtomicReference<Map<String,String>> attributeToGenerateNameMapRef
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor
in class AbstractConfigurableComponent
public void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)
onPropertyModified
in interface ConfigurableComponent
onPropertyModified
in class AbstractConfigurableComponent
public void onTrigger(ProcessContext context, ProcessSession session)
onTrigger
in class AbstractProcessor
private static SortedMap<String,String> getRelevantAttributes(FlowFile flowFile, Map<String,String> attributeToGeneratedNameMap)
private String hashValue(HashAlgorithm algorithm, String value, Charset charset)
Copyright © 2021 Apache NiFi Project. All rights reserved.