Module swim.api

Class AbstractAgent

    • Field Detail

      • context

        protected final AgentContext context
        Internal, immutable context that provides contextual Lane and Store creation mechanisms, URI-based addressability, logging, and scheduling.
    • Constructor Detail

      • AbstractAgent

        public AbstractAgent​(AgentContext context)
        Creates an AbstractAgent instance managed by context.
    • Method Detail

      • willOpen

        public void willOpen()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately before this Agent opens. //@see swim.runtime.TierBinding#open
        Specified by:
        willOpen in interface Agent
      • didOpen

        public void didOpen()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately after this Agent opens, i.e. before it loads. //@see swim.runtime.TierBinding#open //@see swim.runtime.TierBinding#load
        Specified by:
        didOpen in interface Agent
      • willLoad

        public void willLoad()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately before this Agent loads. //@see swim.runtime.TierBinding#load
        Specified by:
        willLoad in interface Agent
      • didLoad

        public void didLoad()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately after this Agent loads, i.e. before it starts. //@see swim.runtime.TierBinding#load //@see swim.runtime.TierBinding#start
        Specified by:
        didLoad in interface Agent
      • willStart

        public void willStart()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately before this Agent starts. //@see swim.runtime.TierBinding#start
        Specified by:
        willStart in interface Agent
      • didStart

        public void didStart()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately after this Agent starts. //@see swim.runtime.TierBinding#start
        Specified by:
        didStart in interface Agent
      • willStop

        public void willStop()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately before this Agent stops. //@see swim.runtime.TierBinding#stop
        Specified by:
        willStop in interface Agent
      • didStop

        public void didStop()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately after this Agent stops, i.e. before it unloads. //@see swim.runtime.TierBinding#stop //@see swim.runtime.TierBinding#unload
        Specified by:
        didStop in interface Agent
      • willUnload

        public void willUnload()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately before this Agent unloads. //@see swim.runtime.TierBinding#unload
        Specified by:
        willUnload in interface Agent
      • didUnload

        public void didUnload()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately after this Agent unloads, i.e. before it closes. //@see swim.runtime.TierBinding.unload //@see swim.runtime.TierBinding.close
        Specified by:
        didUnload in interface Agent
      • willClose

        public void willClose()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately before this Agent closes. //@see swim.runtime.TierBinding.close
        Specified by:
        willClose in interface Agent
      • didClose

        public void didClose()
        Description copied from interface: Agent
        Lifecycle callback invoked immediately after this Agent closes. //@see swim.runtime.TierBinding.close
        Specified by:
        didClose in interface Agent
      • didFail

        public void didFail​(Throwable error)
        Description copied from interface: Agent
        Lifecycle callback invoked immediately after this Agent throws error.
        Specified by:
        didFail in interface Agent
      • hostUri

        public final swim.uri.Uri hostUri()
        This Agent's hostUri.
      • nodeUri

        public final swim.uri.Uri nodeUri()
        This Agent's nodeUri.
      • props

        public final swim.structure.Value props()
        A Record that maps every dynamic property in nodeUri(), as defined by {@code agentType().route()}, to its value. An empty result indicates that nodeUri contains no dynamic components.
      • getProp

        public final swim.structure.Value getProp​(swim.structure.Value key)
        Returns the value of key in props().
      • getProp

        public final swim.structure.Value getProp​(String name)
        Returns the value of name in props().
      • schedule

        public final swim.concurrent.Schedule schedule()
        The Schedule that this Agent is bound to.
      • stage

        public final swim.concurrent.Stage stage()
        The Stage that this Agent is bound to.
      • lane

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

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

        public swim.collections.FingerTrieSeq<Agent> traits()
      • getTrait

        public <A extends Agent> A getTrait​(swim.structure.Value props)
      • getTrait

        public <A extends Agent> A getTrait​(String name)
      • getTrait

        public <A extends Agent> A getTrait​(Class<A> agentClass)
      • addTrait

        public <A extends Agent> A addTrait​(swim.structure.Value props,
                                            AgentFactory<A> agentFactory)
      • addTrait

        public <A extends Agent> A addTrait​(swim.structure.Value props,
                                            Class<A> agentClass)
      • addTrait

        public <A extends Agent> A addTrait​(String name,
                                            Class<A> agentClass)
      • removeTrait

        public void removeTrait​(swim.structure.Value props)
      • removeTrait

        public void removeTrait​(String name)
      • isSecure

        public boolean isSecure()
        Returns true if the currently executing link is secure, or false if the currently executing link is not secure, or if not currently executing a link callback.
      • securityProtocol

        public String securityProtocol()
        Returns the security protocol used by the currently executing link, or null if the currently executing link is not secure, or if not currently executing a link callback.
      • cipherSuite

        public String cipherSuite()
        Returns the cryptographic cipher suite used by the currently executing link, or null if the currently executing link is not secure, or if not currently executing a link callback.
      • localAddress

        public InetSocketAddress localAddress()
        Returns the local internet address of the currently executing link, or null if not currently executing a link callback.
      • localIdentity

        public Identity localIdentity()
        Returns the local user identity of the currently executing link, or null if the currently executing link has no local user identity, or if not currently executing a link callback.
      • localPrincipal

        public Principal localPrincipal()
        Returns the principal used to identify the local end of the currently executing link, or null if the currently executing link has no local principal, or if not currently executing a link callback.
      • localCertificates

        public Collection<Certificate> localCertificates()
        Returns the certificates used to authenticate the local end of the currently executing link; returns an empty collection if the currently executing link has no local certificates, or if not currently executing a link callback.
      • remoteAddress

        public InetSocketAddress remoteAddress()
        Returns the remote internet address of the currently executing link, or null if not currently executing a link callback.
      • remoteIdentity

        public Identity remoteIdentity()
        Returns the remote user identity of the currently executing link, or null if the currently executing link has no remote user identity, or if not currently executing a link callback.
      • remotePrincipal

        public Principal remotePrincipal()
        Returns the principal used to identify the remote end of the currently executing link, or null if the currently executing link has no remote principal, or if not currently executing a link callback.
      • remoteCertificates

        public Collection<Certificate> remoteCertificates()
        Returns the certificates used to authenticate the remote end of the currently executing link; returns an empty collection if the currently executing link has no remote certificates, or if not currently executing a link callback.
      • spatialLane

        public final <K,​S,​V> SpatialLane<K,​S,​V> spatialLane​(swim.math.Z2Form<S> shapeForm)
        Specified by:
        spatialLane in interface LaneFactory
      • listData

        public final ListData<swim.structure.Value> listData​(swim.structure.Value name)
        Specified by:
        listData in interface DataFactory
      • mapData

        public final MapData<swim.structure.Value,​swim.structure.Value> mapData​(swim.structure.Value name)
        Specified by:
        mapData in interface DataFactory
      • spatialData

        public final <S> SpatialData<swim.structure.Value,​S,​swim.structure.Value> spatialData​(swim.structure.Value name,
                                                                                                          swim.math.Z2Form<S> shapeForm)
        Specified by:
        spatialData in interface DataFactory
      • spatialData

        public final <S> SpatialData<swim.structure.Value,​S,​swim.structure.Value> spatialData​(String name,
                                                                                                          swim.math.Z2Form<S> shapeForm)
        Specified by:
        spatialData in interface DataFactory
      • geospatialData

        public final SpatialData<swim.structure.Value,​swim.math.R2Shape,​swim.structure.Value> geospatialData​(swim.structure.Value name)
        Specified by:
        geospatialData in interface DataFactory
      • valueData

        public final ValueData<swim.structure.Value> valueData​(swim.structure.Value name)
        Specified by:
        valueData in interface DataFactory
      • hostRef

        public final HostRef hostRef​(swim.uri.Uri hostUri)
        Specified by:
        hostRef in interface SwimRef
      • nodeRef

        public final NodeRef nodeRef​(swim.uri.Uri hostUri,
                                     swim.uri.Uri nodeUri)
        Specified by:
        nodeRef in interface SwimRef
      • nodeRef

        public final NodeRef nodeRef​(swim.uri.Uri nodeUri)
        Specified by:
        nodeRef in interface SwimRef
      • laneRef

        public final LaneRef laneRef​(swim.uri.Uri hostUri,
                                     swim.uri.Uri nodeUri,
                                     swim.uri.Uri laneUri)
        Specified by:
        laneRef in interface SwimRef
      • laneRef

        public final LaneRef laneRef​(swim.uri.Uri nodeUri,
                                     swim.uri.Uri laneUri)
        Specified by:
        laneRef in interface SwimRef
      • command

        public final void command​(swim.uri.Uri hostUri,
                                  swim.uri.Uri nodeUri,
                                  swim.uri.Uri laneUri,
                                  float prio,
                                  swim.structure.Value body)
        Specified by:
        command in interface SwimRef
      • command

        public final void command​(String hostUri,
                                  String nodeUri,
                                  String laneUri,
                                  float prio,
                                  swim.structure.Value body)
        Specified by:
        command in interface SwimRef
      • command

        public final void command​(swim.uri.Uri hostUri,
                                  swim.uri.Uri nodeUri,
                                  swim.uri.Uri laneUri,
                                  swim.structure.Value body)
        Specified by:
        command in interface SwimRef
      • command

        public final void command​(String hostUri,
                                  String nodeUri,
                                  String laneUri,
                                  swim.structure.Value body)
        Specified by:
        command in interface SwimRef
      • command

        public final void command​(swim.uri.Uri nodeUri,
                                  swim.uri.Uri laneUri,
                                  float prio,
                                  swim.structure.Value body)
        Specified by:
        command in interface SwimRef
      • command

        public final void command​(String nodeUri,
                                  String laneUri,
                                  float prio,
                                  swim.structure.Value body)
        Specified by:
        command in interface SwimRef
      • command

        public final void command​(swim.uri.Uri nodeUri,
                                  swim.uri.Uri laneUri,
                                  swim.structure.Value body)
        Specified by:
        command in interface SwimRef
      • command

        public final void command​(String nodeUri,
                                  String laneUri,
                                  swim.structure.Value body)
        Specified by:
        command in interface SwimRef
      • trace

        public void trace​(Object message)
        Specified by:
        trace in interface swim.util.Log
      • debug

        public void debug​(Object message)
        Specified by:
        debug in interface swim.util.Log
      • info

        public void info​(Object message)
        Specified by:
        info in interface swim.util.Log
      • warn

        public void warn​(Object message)
        Specified by:
        warn in interface swim.util.Log
      • error

        public void error​(Object message)
        Specified by:
        error in interface swim.util.Log
      • timer

        public final swim.concurrent.TimerRef timer​(swim.concurrent.TimerFunction timer)
        Specified by:
        timer in interface swim.concurrent.Schedule
      • setTimer

        public final swim.concurrent.TimerRef setTimer​(long millis,
                                                       swim.concurrent.TimerFunction timer)
        Specified by:
        setTimer in interface swim.concurrent.Schedule
      • close

        public void close()
        Specified by:
        close in interface SwimRef