@EventDriven @SupportsBatching @SideEffectFree @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"record","transform","script","groovy","jython","python","update","modify","filter"}) @Restricted(restrictions=@Restriction(requiredPermission=EXECUTE_CODE,explanation="Provides operator the ability to execute arbitrary code assuming all permissions that NiFi has.")) @WritesAttribute(attribute="mime.type",description="Sets the mime.type attribute to the MIME Type specified by the Record Writer") @WritesAttribute(attribute="record.count",description="The number of records in the FlowFile") @WritesAttribute(attribute="record.error.message",description="This attribute provides on failure the error message encountered by the Reader or Writer.") @CapabilityDescription(value="Provides the ability to evaluate a simple script against each record in an incoming FlowFile. The script may transform the record in some way, filter the record, or fork additional records. See Processor\'s Additional Details for more information.") @SeeAlso(classNames={"org.apache.nifi.processors.script.ExecuteScript","org.apache.nifi.processors.standard.UpdateRecord","org.apache.nifi.processors.standard.QueryRecord","org.apache.nifi.processors.jolt.record.JoltTransformRecord","org.apache.nifi.processors.standard.LookupRecord"}) public class ScriptedTransformRecord extends AbstractProcessor implements Searchable
| Modifier and Type | Class and Description |
|---|---|
private static class |
ScriptedTransformRecord.Counts |
private class |
ScriptedTransformRecord.InterpretedScriptEvaluator |
private class |
ScriptedTransformRecord.PythonScriptEvaluator |
private static interface |
ScriptedTransformRecord.RecordWriteAction |
private static interface |
ScriptedTransformRecord.ScriptEvaluator |
| Modifier and Type | Field and Description |
|---|---|
private AtomicReference<CompiledScript> |
compiledScriptRef |
private List<PropertyDescriptor> |
descriptors |
(package private) static PropertyDescriptor |
LANGUAGE |
private static String |
PYTHON_SCRIPT_LANGUAGE |
(package private) static PropertyDescriptor |
RECORD_READER |
(package private) static PropertyDescriptor |
RECORD_WRITER |
static Relationship |
REL_FAILURE |
static Relationship |
REL_SUCCESS |
private static Set<String> |
SCRIPT_OPTIONS |
private ScriptingComponentHelper |
scriptingComponentHelper |
private String |
scriptToRun |
| Constructor and Description |
|---|
ScriptedTransformRecord() |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprivate static final String PYTHON_SCRIPT_LANGUAGE
static final PropertyDescriptor RECORD_READER
static final PropertyDescriptor RECORD_WRITER
static final PropertyDescriptor LANGUAGE
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private volatile String scriptToRun
private final AtomicReference<CompiledScript> compiledScriptRef
private final ScriptingComponentHelper scriptingComponentHelper
private final List<PropertyDescriptor> descriptors
public Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate in class AbstractConfigurableComponent@OnScheduled public void setup(ProcessContext context) throws IOException
IOExceptionpublic void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionprivate void transform(FlowFile flowFile, ScriptedTransformRecord.ScriptEvaluator evaluator, ProcessContext context, ProcessSession session)
private void processRecord(Record inputRecord, FlowFile flowFile, ScriptedTransformRecord.Counts counts, ScriptedTransformRecord.RecordWriteAction recordWriteAction, ScriptedTransformRecord.ScriptEvaluator evaluator) throws IOException, ScriptException
IOExceptionScriptExceptionprivate ScriptedTransformRecord.ScriptEvaluator createEvaluator(ScriptEngine scriptEngine, FlowFile flowFile) throws ScriptException
ScriptExceptionprivate CompiledScript getOrCompileScript(Compilable scriptEngine, String scriptToRun) throws ScriptException
ScriptExceptionprivate static Bindings setupBindings(ScriptEngine scriptEngine)
public Collection<SearchResult> search(SearchContext context)
search in interface SearchableCopyright © 2021 Apache NiFi Project. All rights reserved.