Class NodeIIAR

java.lang.Object
com.scivicslab.pojoactor.core.ActorRef<NodeInterpreter>
com.scivicslab.pojoactor.workflow.IIActorRef<NodeInterpreter>
com.scivicslab.actoriac.NodeIIAR
All Implemented Interfaces:
com.scivicslab.pojoactor.core.CallableByActionName, AutoCloseable

public class NodeIIAR extends com.scivicslab.pojoactor.workflow.IIActorRef<NodeInterpreter>
Interpreter-interfaced actor reference for NodeInterpreter instances.

This class provides a concrete implementation of IIActorRef specifically for NodeInterpreter objects. It handles action invocations by name, supporting both workflow execution actions (inherited from Interpreter) and infrastructure actions (SSH command execution).

Supported actions:

Workflow actions (from Interpreter):

  • execCode - Executes the loaded workflow code
  • readYaml - Reads a YAML workflow definition from a file path
  • readJson - Reads a JSON workflow definition from a file path
  • readXml - Reads an XML workflow definition from a file path
  • reset - Resets the interpreter state

Infrastructure actions (Node-specific):

  • executeCommand - Executes a command and reports to accumulator (default)
  • executeCommandQuiet - Executes a command without reporting
  • executeSudoCommand - Executes sudo command and reports to accumulator (default)
  • executeSudoCommandQuiet - Executes sudo command without reporting
Author:
devteam@scivicslab.com
  • Field Details

  • Constructor Details

    • NodeIIAR

      public NodeIIAR(String actorName, NodeInterpreter object)
      Constructs a new NodeIIAR with the specified actor name and node interpreter object.
      Parameters:
      actorName - the name of this actor
      object - the NodeInterpreter instance managed by this actor reference
    • NodeIIAR

      public NodeIIAR(String actorName, NodeInterpreter object, com.scivicslab.pojoactor.workflow.IIActorSystem system)
      Constructs a new NodeIIAR with the specified actor name, node interpreter object, and actor system.
      Parameters:
      actorName - the name of this actor
      object - the NodeInterpreter instance managed by this actor reference
      system - the actor system managing this actor
  • Method Details

    • execCode

      public com.scivicslab.pojoactor.core.ActionResult execCode(String args)
    • readYaml

      public com.scivicslab.pojoactor.core.ActionResult readYaml(String args)
    • readJson

      public com.scivicslab.pojoactor.core.ActionResult readJson(String args)
    • readXml

      public com.scivicslab.pojoactor.core.ActionResult readXml(String args)
    • reset

      public com.scivicslab.pojoactor.core.ActionResult reset(String args)
    • runUntilEnd

      public com.scivicslab.pojoactor.core.ActionResult runUntilEnd(String args)
    • call

      public com.scivicslab.pojoactor.core.ActionResult call(String args)
    • runWorkflow

      public com.scivicslab.pojoactor.core.ActionResult runWorkflow(String args)
    • apply

      public com.scivicslab.pojoactor.core.ActionResult apply(String args)
    • executeCommand

      public com.scivicslab.pojoactor.core.ActionResult executeCommand(String args)
    • executeCommandQuiet

      public com.scivicslab.pojoactor.core.ActionResult executeCommandQuiet(String args)
    • executeSudoCommand

      public com.scivicslab.pojoactor.core.ActionResult executeSudoCommand(String args)
    • executeSudoCommandQuiet

      public com.scivicslab.pojoactor.core.ActionResult executeSudoCommandQuiet(String args)
    • sleep

      public com.scivicslab.pojoactor.core.ActionResult sleep(String args)
    • print

      public com.scivicslab.pojoactor.core.ActionResult print(String args)
    • doNothing

      public com.scivicslab.pojoactor.core.ActionResult doNothing(String args)
    • detectDocumentChanges

      public com.scivicslab.pojoactor.core.ActionResult detectDocumentChanges(String args)
    • cloneChangedDocuments

      public com.scivicslab.pojoactor.core.ActionResult cloneChangedDocuments(String args)
    • buildChangedDocuments

      public com.scivicslab.pojoactor.core.ActionResult buildChangedDocuments(String args)
    • deployChangedDocuments

      public com.scivicslab.pojoactor.core.ActionResult deployChangedDocuments(String args)
    • printJson

      public com.scivicslab.pojoactor.core.ActionResult printJson(String args)
      Outputs JSON State at the given path in pretty JSON format via outputMultiplexer.
      Parameters:
      args - the path to output (from JSON array)
      Returns:
      ActionResult with the formatted JSON
    • printYaml

      public com.scivicslab.pojoactor.core.ActionResult printYaml(String args)
      Outputs JSON State at the given path in YAML format via outputMultiplexer.
      Parameters:
      args - the path to output (from JSON array)
      Returns:
      ActionResult with the formatted YAML
    • sendToMultiplexer

      private void sendToMultiplexer(String formatted)
      Sends formatted output to the outputMultiplexer, line by line.
    • handleException

      private com.scivicslab.pojoactor.core.ActionResult handleException(Exception e)
      Handles exceptions and returns an appropriate ActionResult.
    • parseMaxIterations

      private int parseMaxIterations(String arg, int defaultValue)
    • createOutputCallback

      Creates an OutputCallback that forwards output to the multiplexer accumulator.
    • reportToAccumulator

      private void reportToAccumulator(Node.CommandResult result)
      Reports command result to the multiplexer accumulator actor if available.
    • reportOutputToMultiplexer

      private void reportOutputToMultiplexer(String nodeName, String message)
      Reports a message to the multiplexer accumulator.
    • combineOutput

      Combines stdout and stderr into a single output string.
    • extractRootCauseMessage

      Extracts a meaningful error message from an ExecutionException.
    • extractCommandFromArgs

      Extracts a command string from JSON array arguments.