Module swim.api

Interface AgentContext

All Superinterfaces:
DownlinkFactory, LaneFactory, Log, Store, WarpRef
All Known Implementing Classes:
AgentView

public interface AgentContext extends WarpRef, LaneFactory, Store, Log
Internal context that enables URI-based addressability, contextual Lane and Store creation mechanisms, logging, and scheduling to some Agent.
  • Method Details

    • hostUri

      Uri hostUri()
      The hostUri of the Agent managed by this AgentContext.
    • nodeUri

      Uri nodeUri()
      The nodeUri of the Agent managed by this AgentContext.
    • agentId

      Value agentId()
    • props

      Value props()
      A Record that maps every dynamic property in nodeUri(), as defined by AgentRoute.pattern(), to its value. An empty result indicates that nodeUri contains no dynamic components.
    • getProp

      Value getProp(Value key)
      Returns the value of key in props().
    • getProp

      Value getProp(String name)
      Returns the value of name in props().
    • schedule

      Schedule schedule()
      The Schedule that this AgentContext is bound to.
    • stage

      Stage stage()
      The single-threaded execution Stage on which this AgentContext runs its application logic.
    • asyncStage

      Stage asyncStage()
      The multi-threaded execution Stage on which this AgentContext can run asynchronous operations.
    • lane

      Lane lane()
      Returns the currently executing lane, or null if not currently executing a lane or link callback.
    • link

      Link link()
      Returns the currently executing link, or null if not currently executing a link callback.
    • getLane

      Lane getLane(Uri laneUri)
      Returns the Lane belonging to the Agent managed by this AgentContext that is addressable by laneUri, or null if no such Lane exists.
    • openLane

      Lane openLane(Uri laneUri, Lane lane)
      Registers lane with laneUri and returns lane.
    • agents

      FingerTrieSeq<Agent> agents()
    • getAgent

      Agent getAgent(Value id)
    • getAgent

      Agent getAgent(String name)
    • getAgent

      <A extends Agent> A getAgent(Class<? extends A> agentClass)
    • openAgent

      <A extends Agent> A openAgent(Value id, Value props, AgentFactory<A> agentFactory)
    • openAgent

      <A extends Agent> A openAgent(Value id, AgentFactory<A> agentFactory)
    • openAgent

      <A extends Agent> A openAgent(String name, AgentFactory<A> agentFactory)
    • openAgent

      <A extends Agent> A openAgent(Value id, Value props, Class<? extends A> agentClass)
    • openAgent

      <A extends Agent> A openAgent(Value id, Class<? extends A> agentClass)
    • openAgent

      <A extends Agent> A openAgent(String name, Class<? extends A> agentClass)
    • closeAgent

      void closeAgent(Value id)
    • closeAgent

      void closeAgent(String name)