Class ExecuteProcess
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.ExecuteProcess
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@InputRequirement(INPUT_FORBIDDEN)
@Tags({"command","process","source","external","invoke","script"})
@CapabilityDescription("Runs an operating system command specified by the user and writes the output of that command to a FlowFile. If the command is expected to be long-running, the Processor can output the partial data on a specified interval. When this option is used, the output is expected to be in textual format, as it typically does not make sense to split binary data on arbitrary time-based intervals.")
@DynamicProperty(name="An environment variable name",
value="An environment variable value",
description="These environment variables are passed to the process spawned by this Processor")
@Restricted(restrictions=@Restriction(requiredPermission=EXECUTE_CODE,explanation="Provides operator the ability to execute arbitrary code assuming all permissions that NiFi has."))
@WritesAttribute(attribute="command",description="Executed command") @WritesAttribute(attribute="command.arguments",description="Arguments of the command") @WritesAttribute(attribute="mime.type",description="Sets the MIME type of the output if the \'Output MIME Type\' property is set and \'Batch Duration\' is not set")
public class ExecuteProcess
extends org.apache.nifi.processor.AbstractProcessor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classOutput stream that is used to wrap another output stream in a way that the underlying output stream can be swapped out for a different one when needed -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final String(package private) static final Stringstatic final org.apache.nifi.components.PropertyDescriptorprivate static final org.apache.nifi.components.Validatorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate ExecutorServiceprivate Processprivate AtomicBooleanprivate Future<?> (package private) static final org.apache.nifi.components.PropertyDescriptorprivate static final List<org.apache.nifi.components.PropertyDescriptor> private ExecuteProcess.ProxyOutputStreamstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> static final org.apache.nifi.components.PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCommandStrings(org.apache.nifi.processor.ProcessContext context, String command, String arguments) Set<org.apache.nifi.processor.Relationship> protected org.apache.nifi.components.PropertyDescriptorgetSupportedDynamicPropertyDescriptor(String propertyDescriptorName) protected List<org.apache.nifi.components.PropertyDescriptor> protected Future<?> launchProcess(org.apache.nifi.processor.ProcessContext context, List<String> commandStrings, Long batchNanos, ExecuteProcess.ProxyOutputStream proxyOut) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) voidsetupExecutor(org.apache.nifi.processor.ProcessContext context) voidMethods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateProperties, migrateRelationships
-
Field Details
-
ATTRIBUTE_COMMAND
- See Also:
-
ATTRIBUTE_COMMAND_ARGS
- See Also:
-
COMMAND
public static final org.apache.nifi.components.PropertyDescriptor COMMAND -
COMMAND_ARGUMENTS
public static final org.apache.nifi.components.PropertyDescriptor COMMAND_ARGUMENTS -
WORKING_DIR
public static final org.apache.nifi.components.PropertyDescriptor WORKING_DIR -
BATCH_DURATION
public static final org.apache.nifi.components.PropertyDescriptor BATCH_DURATION -
REDIRECT_ERROR_STREAM
public static final org.apache.nifi.components.PropertyDescriptor REDIRECT_ERROR_STREAM -
characterValidator
private static final org.apache.nifi.components.Validator characterValidator -
ARG_DELIMITER
static final org.apache.nifi.components.PropertyDescriptor ARG_DELIMITER -
MIME_TYPE
static final org.apache.nifi.components.PropertyDescriptor MIME_TYPE -
PROPERTY_DESCRIPTORS
-
REL_SUCCESS
public static final org.apache.nifi.processor.Relationship REL_SUCCESS -
RELATIONSHIPS
-
externalProcess
-
executor
-
longRunningProcess
-
failure
-
proxyOut
-
-
Constructor Details
-
ExecuteProcess
public ExecuteProcess()
-
-
Method Details
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getSupportedDynamicPropertyDescriptor
protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) - Overrides:
getSupportedDynamicPropertyDescriptorin classorg.apache.nifi.components.AbstractConfigurableComponent
-
setupExecutor
@OnScheduled public void setupExecutor(org.apache.nifi.processor.ProcessContext context) -
shutdownExecutor
@OnUnscheduled public void shutdownExecutor() -
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
createCommandStrings
-
launchProcess
protected Future<?> launchProcess(org.apache.nifi.processor.ProcessContext context, List<String> commandStrings, Long batchNanos, ExecuteProcess.ProxyOutputStream proxyOut) throws IOException - Throws:
IOException
-