@Tags(value={"script","execute","groovy","python","jython","jruby","ruby","javascript","js","lua","luaj","clojure"}) @CapabilityDescription(value="Experimental - Executes a script given the flow file and a process session. The script is responsible for handling the incoming flow file (transfer to SUCCESS or remove, e.g.) as well as any flow files created by the script. If the handling is incomplete or incorrect, the session will be rolled back. Experimental: Impact of sustained usage not yet verified.") @DynamicProperty(name="A script engine property to update", value="The value to set it to", expressionLanguageScope=FLOWFILE_ATTRIBUTES, description="Updates a script engine property specified by the Dynamic Property\'s key with the value specified by the Dynamic Property\'s value") @Restricted(restrictions=@Restriction(requiredPermission=EXECUTE_CODE,explanation="Provides operator the ability to execute arbitrary code assuming all permissions that NiFi has.")) @InputRequirement(value=INPUT_ALLOWED) @Stateful(scopes={LOCAL,CLUSTER}, description="Scripts can store and retrieve state using the State Management APIs. Consult the State Manager section of the Developer\'s Guide for more details.") @SeeAlso(value=InvokeScriptedProcessor.class) public class ExecuteScript extends AbstractSessionFactoryProcessor implements Searchable
| Modifier and Type | Field and Description |
|---|---|
static Relationship |
REL_FAILURE |
static Relationship |
REL_SUCCESS |
(package private) ScriptingComponentHelper |
scriptingComponentHelper |
private String |
scriptToRun |
| Constructor and Description |
|---|
ExecuteScript() |
| Modifier and Type | Method and Description |
|---|---|
void |
added() |
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
Set<Relationship> |
getRelationships()
Returns the valid relationships for this processor.
|
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
Returns a PropertyDescriptor for the given name.
|
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors()
Returns a list of property descriptors supported by this processor.
|
void |
onTrigger(ProcessContext context,
ProcessSessionFactory sessionFactory)
Evaluates the given script body (or file) using the current session, context, and flowfile.
|
Collection<SearchResult> |
search(SearchContext context) |
void |
setup(ProcessContext context)
Performs setup operations when the processor is scheduled to run.
|
void |
stop() |
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatepublic static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private volatile String scriptToRun
volatile ScriptingComponentHelper scriptingComponentHelper
public Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponentpropertyDescriptorName - used to lookup if any property descriptors exist for that nameprotected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate in class AbstractConfigurableComponent@OnScheduled public void setup(ProcessContext context)
context - the context in which to perform the setup operationspublic void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException
onTrigger in interface Processorcontext - the current process contextsessionFactory - provides access to a ProcessSessionFactory, which
can be used for accessing FlowFiles, etc.ProcessException - if the scripted processor's onTrigger() method throws an exception@OnStopped public void stop()
@OnAdded public void added()
public Collection<SearchResult> search(SearchContext context)
search in interface SearchableCopyright © 2021 Apache NiFi Project. All rights reserved.