Class CommandManager

java.lang.Object
PamController.PamControlledUnit
PamController.command.CommandManager
All Implemented Interfaces:
SettingsNameProvider
Direct Known Subclasses:
MulticastController, NetworkController, TerminalController

public abstract class CommandManager extends PamControlledUnit
Interpret commands which may have come either from a terminal or from a Network (e.g. UDP) interface.
Author:
dg50
  • Constructor Details

  • Method Details

    • findCommand

      public ExtCommand findCommand(String command)
    • interpretCommand

      public boolean interpretCommand(String commandString)
      Interpret and act on a udp command string.
      Parameters:
      command - command string
      Returns:
      false if the command was to exit the program (in which case this thread will exit and close the port). True otherwise.
    • splitCommandLine

      public static String[] splitCommandLine(String command)
      Slightly nasty split since some module names will be in quotes if they are names with spaces so the split needs to a) take out multiple words surrounded by "" and then split what's left by word. Or split by work and rejoin anything with "" ?
      Parameters:
      command -
      Returns:
    • getCommandFromIndex

      public static String getCommandFromIndex(String command, int index)
      Get the command string left from the given index. This can be used to get everything left in the string that follows the command name, module type and module name fields for example.
      Parameters:
      command - full command string
      index - how many items to skip
      Returns:
      remainder of the string, warts n all.
    • sendData

      public abstract boolean sendData(ExtCommand extCommand, String dataString)
      Reply to data called from InterpredData
      Parameters:
      extCommand -
      dataString -
      Returns:
      true if replay successful