Class DiarcComponent

java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
Direct Known Subclasses:
AgentModel, ASRWebsocketComponent, AvaComponent, AvaDisplayComponent, AvaGuiProvider, AvaMediaProvider, AvaStatisticsManagerComponent, BeliefComponent, CachedNLGComponent, CachedParserComponent, CallHelloComponent, DialogueComponent, ExplorationComponent, FrontEndConfigurationComponent, GoalManagerComponent, HybridNLGComponent, HybridParserComponent, IHMCComponent, KioskGoalManager, LidarDoorComponent, ListenerComponent, LLMComponent, LLMNLGComponent, LLMParserComponent, LLMServiceProvider, LLMServiceProvider, MapComponent, MaryTTSComponent, MockArmComponent, MockAvaComponent, MockHumanAgent, MockMoveBaseComponent, MockMoveItComponent, MockNaoComponent, MockPR2Component, MockScaleComponent, MockSpotComponent, MockTemiV3Component, MockTFComponent, MockUnityPR2Component, MockUnitySpaceStationComponent, MockVisionComponent, MockYumiComponent, NaoComponent, NormComponent, NovelRunComponent, OpenTTSComponent, PathPlannerComponent, PatternMatchingParser, PickAndPlaceLLM, PolycraftComponent, PolycraftRLComponent, PragmaticsComponent, PrintHelloComponent, ReferenceResolutionComponent, RequestFromHumanComponent, RLActionManager, ScaleComponent, SimpleNLGComponent, SimSpeechProductionComponent, SimSpeechRecognitionComponent, SimulationBasedPlanning, SpaceStationPatternMatcher, Sphinx4Component, SpotComponent, StreamingTTSComponent, SupermarketAgent, SupermarketComponent, TemplatedNLG, TLDLParserComponent, TradeServiceComponent, TRADEServiceGui, UnityAgentComponent, UnityComponent, UnitySpaceStationLLM, UnitySpaceStationNLGComponent, WhisperComponent

public abstract class DiarcComponent extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected long
    Execution loop time (in milliseconds).
    protected org.slf4j.Logger
    DIARC Component logger.
    protected boolean
    Flag used to start execution loop thread.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<org.apache.commons.cli.Option>
    Override this method to define command line options available in sub-class.
    protected void
    Moved location where the shutdown hook is attached out of the default constructor.
    static final <T extends DiarcComponent>
    T
    createInstance(Class<T> clazz, boolean registerWithTrade, boolean addShutdownHook, String... args)
    Factory method to create a DIARC component instance, parseArgs, init, and finally register as with TRADE.
    static final <T extends DiarcComponent>
    T
    createInstance(Class<T> clazz, boolean registerWithTrade, String... args)
    Convenience method to optionally register with TRADE, and automatically add a shutdown hook.
    static final <T extends DiarcComponent>
    T
    createInstance(Class<T> clazz, String... args)
    Convenience method to automatically register with TRADE, and add a shutdown hook.
    protected void
    This is where any code that needs to be called repeatedly in a dedicated thread should live.
    ai.thinkingrobots.trade.TRADEServiceConstraints
    Return DIARC component groups as a TRADEServiceConstraint instance, which can be further modified.
    Return DIARC component groups.
    ai.thinkingrobots.trade.TRADEServiceInfo
    getMyService(String serviceName, Class<?>... argTypes)
    Get a TRADEServiceInfo instance for one of the services provides by this DIARC Component.
    Collection<ai.thinkingrobots.trade.TRADEServiceInfo>
    Get all services offered by this component.
    protected void
    Perform any component initialization.
    static final void
    main(String[] args)
    Main method to allow starting of a single DIARC component from the command line.
    protected void
    parseArgs(org.apache.commons.cli.CommandLine cmdLine)
    Override this method to parse command line args in the sub-class.
    protected void
     
    final void
    Main entrypoint for component shutdown logic.
    protected void
    Any component that needs particular shutdown logic needs to override this method and

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • log

      protected org.slf4j.Logger log
      DIARC Component logger.
    • shouldRunExecutionLoop

      protected boolean shouldRunExecutionLoop
      Flag used to start execution loop thread. False by default.
    • executionLoopCycleTime

      protected long executionLoopCycleTime
      Execution loop time (in milliseconds).
  • Constructor Details

    • DiarcComponent

      protected DiarcComponent()
  • Method Details

    • init

      protected void init()
      Perform any component initialization. This should not be used for setting local fields to default values as was the case in DIARC. This method is called after the constructor, and after parseArgs. Setting default values should be done in field declaration or in the constructor.
    • postRegistrationInit

      protected void postRegistrationInit()
    • parseArgs

      protected void parseArgs(org.apache.commons.cli.CommandLine cmdLine)
      Override this method to parse command line args in the sub-class. Called directly after construction to pass runtime values that will override default values. This should parse all the options that additionalUsageInfo provides.
      Parameters:
      cmdLine -
    • additionalUsageInfo

      protected List<org.apache.commons.cli.Option> additionalUsageInfo()
      Override this method to define command line options available in sub-class. This should be paired with a parseArgs implementation.
      Returns:
    • executionLoop

      protected void executionLoop()
      This is where any code that needs to be called repeatedly in a dedicated thread should live. It is not called by default and you must set shouldRunExecutionLoop to true in your constructor.
    • attachShutdownHook

      protected void attachShutdownHook()
      Moved location where the shutdown hook is attached out of the default constructor. DiarcConfiguration attaches the same hook for all inner DiarcConponents, so this should only be attached internally for standalone components.
    • shutdownComponent

      protected void shutdownComponent()
      Any component that needs particular shutdown logic needs to override this method and
    • shutdown

      public final void shutdown()
      Main entrypoint for component shutdown logic. This is automatically triggered by the Java shutdown hook (i.e., ctrl-C).
    • getMyGroups

      public List<String> getMyGroups()
      Return DIARC component groups. This is a shallow copy.
      Returns:
    • getMyGroupConstraints

      public ai.thinkingrobots.trade.TRADEServiceConstraints getMyGroupConstraints()
      Return DIARC component groups as a TRADEServiceConstraint instance, which can be further modified.
      Returns:
    • getMyServices

      public Collection<ai.thinkingrobots.trade.TRADEServiceInfo> getMyServices()
      Get all services offered by this component.
      Returns:
    • getMyService

      public ai.thinkingrobots.trade.TRADEServiceInfo getMyService(String serviceName, Class<?>... argTypes)
      Get a TRADEServiceInfo instance for one of the services provides by this DIARC Component.
      Parameters:
      serviceName -
      argTypes -
      Returns:
    • createInstance

      public static final <T extends DiarcComponent> T createInstance(Class<T> clazz, boolean registerWithTrade, boolean addShutdownHook, String... args)
      Factory method to create a DIARC component instance, parseArgs, init, and finally register as with TRADE.
      Type Parameters:
      T -
      Parameters:
      clazz - class to be instantiated (must extend DiarcComponent)
      registerWithTrade - true/false whether to register with TRADE
      addShutdownHook - whether this class should automatically register a shutdown hook
      args - command line arguments
      Returns:
    • createInstance

      public static final <T extends DiarcComponent> T createInstance(Class<T> clazz, boolean registerWithTrade, String... args)
      Convenience method to optionally register with TRADE, and automatically add a shutdown hook.
      Type Parameters:
      T -
      Parameters:
      clazz - class to be instantiated (must extend DiarcComponent)
      args - command line arguments
      Returns:
    • createInstance

      public static final <T extends DiarcComponent> T createInstance(Class<T> clazz, String... args)
      Convenience method to automatically register with TRADE, and add a shutdown hook.
      Type Parameters:
      T -
      Parameters:
      clazz - class to be instantiated (must extend DiarcComponent)
      args - command line arguments
      Returns:
    • main

      public static final void main(String[] args)
      Main method to allow starting of a single DIARC component from the command line.
      Parameters:
      args -