Class FileTriggerExecutor

java.lang.Object
ai.nervemind.app.executor.FileTriggerExecutor
All Implemented Interfaces:
NodeExecutor

@Component public class FileTriggerExecutor extends Object implements NodeExecutor
Executor for the "fileTrigger" node type - initiates workflow execution on file system events.

Monitors specified directories for file changes and triggers workflow execution when matching events occur. The actual file monitoring is performed by FileWatcherService; this executor handles both automatic event-triggered runs and manual test executions.

Node Parameters

File trigger configuration parameters
Parameter Type Default Description
watchPath String - Required. Directory path to monitor
filePattern String "*" Glob pattern to filter files (e.g., "*.pdf", "report-*.xlsx")
eventTypes String "CREATE,MODIFY" Comma-separated list: CREATE, MODIFY, DELETE

Execution Modes

This executor operates in two modes:

  • File Event Mode: Triggered automatically when a file event occurs. Input contains filePath, fileName, directory, and eventType.
  • Manual Mode: Triggered via UI "Run" button for testing. Provides configuration validation but no actual file data.

Output Data

Output keys added by this executor
Key Type Description
watchPath String The monitored directory path
pathExists Boolean Whether the path exists on disk
isDirectory Boolean Whether the path is a valid directory
filePattern String The glob pattern being used
eventTypes String Monitored event types
triggeredAt String ISO timestamp
triggerType String Always "file_event"
mode String "file_event" or "manual"

File Event Output (when triggered by actual file event)

  • filePath - Full path to the affected file
  • fileName - Just the file name
  • directory - Parent directory
  • eventType - CREATE, MODIFY, or DELETE
See Also:
  • Constructor Details

    • FileTriggerExecutor

      public FileTriggerExecutor(org.springframework.beans.factory.ObjectProvider<FileWatcherService> fileWatcherServiceProvider)
      Creates a new file trigger executor.
      Parameters:
      fileWatcherServiceProvider - provider for the file watcher service
  • Method Details

    • execute

      public Map<String,Object> execute(ai.nervemind.common.domain.Node node, Map<String,Object> input, ExecutionService.ExecutionContext context)
      Description copied from interface: NodeExecutor
      Executes the business logic for this node type.
      Specified by:
      execute in interface NodeExecutor
      Parameters:
      node - The node definition containing parameters and configuration. Use Node.parameters() to access user settings.
      input - Combined output from all upstream nodes that connected to this node. For simple flows, this contains the direct predecessor's output. For merge nodes, it contains combined data.
      context - Verification context providing access to workflow-scoped services, logger, and execution metadata.
      Returns:
      A Map containing the results of this node's execution. Keys in this map become available variables for downstream nodes.
      Note: Returning null is treated as an empty map.
    • getNodeType

      public String getNodeType()
      Description copied from interface: NodeExecutor
      Unique identifier for the node type this executor handles. This must match the 'type' field in the JSON definition of the node.
      Specified by:
      getNodeType in interface NodeExecutor
      Returns:
      The unique type string (e.g., "httpRequest", "llmChat").