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 Classes
    Modifier and Type
    Class
    Description
    private static class 
    Output 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

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    (package private) static final String
     
    (package private) static final String
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    private static final org.apache.nifi.components.Validator
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
     
    private Process
     
     
    private Future<?>
     
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    private static final List<org.apache.nifi.components.PropertyDescriptor>
     
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.processor.Relationship
     
    private static final Set<org.apache.nifi.processor.Relationship>
     
    static final org.apache.nifi.components.PropertyDescriptor
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<String>
    createCommandStrings(org.apache.nifi.processor.ProcessContext context, String command, String arguments)
     
    Set<org.apache.nifi.processor.Relationship>
     
    protected org.apache.nifi.components.PropertyDescriptor
     
    protected List<org.apache.nifi.components.PropertyDescriptor>
     
    protected Future<?>
    launchProcess(org.apache.nifi.processor.ProcessContext context, List<String> commandStrings, Long batchNanos, ExecuteProcess.ProxyOutputStream proxyOut)
     
    void
    onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
     
    void
    setupExecutor(org.apache.nifi.processor.ProcessContext context)
     
    void
     

    Methods inherited from class org.apache.nifi.processor.AbstractProcessor

    onTrigger

    Methods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor

    getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue

    Methods inherited from class org.apache.nifi.components.AbstractConfigurableComponent

    customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validate

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.nifi.components.ConfigurableComponent

    getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate

    Methods inherited from interface org.apache.nifi.processor.Processor

    isStateful, migrateProperties, migrateRelationships
  • Field Details

    • ATTRIBUTE_COMMAND

      static final String ATTRIBUTE_COMMAND
      See Also:
    • ATTRIBUTE_COMMAND_ARGS

      static final String 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

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • REL_SUCCESS

      public static final org.apache.nifi.processor.Relationship REL_SUCCESS
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • externalProcess

      private volatile Process externalProcess
    • executor

      private volatile ExecutorService executor
    • longRunningProcess

      private Future<?> longRunningProcess
    • failure

      private AtomicBoolean failure
    • proxyOut

      private volatile ExecuteProcess.ProxyOutputStream proxyOut
  • Constructor Details

    • ExecuteProcess

      public ExecuteProcess()
  • Method Details

    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • getSupportedDynamicPropertyDescriptor

      protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
      Overrides:
      getSupportedDynamicPropertyDescriptor in class org.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:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor
      Throws:
      org.apache.nifi.processor.exception.ProcessException
    • createCommandStrings

      protected List<String> createCommandStrings(org.apache.nifi.processor.ProcessContext context, String command, String arguments)
    • launchProcess

      protected Future<?> launchProcess(org.apache.nifi.processor.ProcessContext context, List<String> commandStrings, Long batchNanos, ExecuteProcess.ProxyOutputStream proxyOut) throws IOException
      Throws:
      IOException