Class WorkflowRunner

java.lang.Object
com.scivicslab.actoriac.example.WorkflowRunner

public class WorkflowRunner extends Object
Generic workflow runner for actor-IaC (Level 3).

This class provides a reusable entry point for executing workflows on infrastructure nodes. The actual operations are defined in external YAML/JSON/XML workflow files, not in Java code.

Usage

java -jar actor-IaC.jar inventory.ini webservers workflow.yaml

Actor Hierarchy

IIActorSystem
  └─ NodeGroupIIAR (parent)
       ├─ NodeIIAR (child, autonomous agent)
       ├─ NodeIIAR (child, autonomous agent)
       └─ NodeIIAR (child, autonomous agent)

Design Principle

This Java code is generic and does not need modification when changing targets or operations. All customization is done through:

  • inventory.ini - Define hosts and groups
  • workflow.yaml - Define operations to execute
Author:
devteam@scivics-lab.com
  • Field Details

  • Constructor Details

    • WorkflowRunner

      public WorkflowRunner(com.scivicslab.pojoactor.workflow.IIActorSystem system, NodeGroupIIAR nodeGroupActor)
      Constructs a WorkflowRunner with the specified system and parent actor.
      Parameters:
      system - the IIActorSystem for workflow execution
      nodeGroupActor - the NodeGroupIIAR parent actor
  • Method Details

    • main

      public static void main(String[] args) throws Exception
      Main entry point for workflow execution.

      Arguments:

      1. inventory - Path to Ansible inventory file
      2. group - Name of the host group to target
      3. workflow - Path to workflow file (YAML/JSON/XML)
      Parameters:
      args - command line arguments
      Throws:
      Exception - if execution fails
    • run

      public void run(String groupName, String workflowPath) throws Exception
      Executes the workflow on the specified group.

      Uses the apply method with runWorkflow to load and run workflows on all matching child actors in a single step.

      Parameters:
      groupName - the name of the host group
      workflowPath - the path to the workflow file
      Throws:
      Exception - if execution fails
    • executeCommand

      public void executeCommand(String groupName, String command) throws Exception
      Executes a single command on all nodes in the group.

      This is a convenience method for simple use cases where a full workflow is not needed.

      Parameters:
      groupName - the name of the host group
      command - the command to execute
      Throws:
      Exception - if execution fails