-
- 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, contextualLane
andStore
creation mechanisms, logging, and scheduling to someAgent
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Value
agentId()
FingerTrieSeq<Agent>
agents()
Stage
asyncStage()
The multi-threaded executionStage
on which thisAgentContext
can run asynchronous operations.void
closeAgent(String name)
void
closeAgent(Value id)
<A extends Agent>
AgetAgent(Class<? extends A> agentClass)
Agent
getAgent(String name)
Agent
getAgent(Value id)
Lane
getLane(Uri laneUri)
Returns theLane
belonging to theAgent
managed by thisAgentContext
that is addressable bylaneUri
, ornull
if no suchLane
exists.Value
getProp(String name)
Returns the value ofname
inprops()
.Value
getProp(Value key)
Returns the value ofkey
inprops()
.Uri
hostUri()
ThehostUri
of theAgent
managed by thisAgentContext
.Lane
lane()
Returns the currently executing lane, or null if not currently executing a lane or link callback.Link
link()
Returns the currently executing link, or null if not currently executing a link callback.Uri
nodeUri()
ThenodeUri
of theAgent
managed by thisAgentContext
.<A extends Agent>
AopenAgent(String name, Class<? extends A> agentClass)
<A extends Agent>
AopenAgent(String name, AgentFactory<A> agentFactory)
<A extends Agent>
AopenAgent(Value id, Class<? extends A> agentClass)
<A extends Agent>
AopenAgent(Value id, AgentFactory<A> agentFactory)
<A extends Agent>
AopenAgent(Value id, Value props, Class<? extends A> agentClass)
<A extends Agent>
AopenAgent(Value id, Value props, AgentFactory<A> agentFactory)
Lane
openLane(Uri laneUri, Lane lane)
Registerslane
withlaneUri
and returnslane
.Value
props()
ARecord
that maps every dynamic property innodeUri()
, as defined byAgentRoute.pattern()
, to its value.Schedule
schedule()
TheSchedule
that thisAgentContext
is bound to.Stage
stage()
The single-threaded executionStage
on which thisAgentContext
runs its application logic.-
Methods inherited from interface swim.api.downlink.DownlinkFactory
downlink, downlinkHttp, downlinkList, downlinkMap, downlinkValue, downlinkWs
-
Methods inherited from interface swim.api.lane.LaneFactory
commandLane, demandLane, demandMapLane, geospatialLane, httpLane, joinMapLane, joinValueLane, listLane, mapLane, spatialLane, supplyLane, valueLane, wsLane
-
Methods inherited from interface swim.api.store.Store
geospatialData, geospatialData, listData, listData, mapData, mapData, spatialData, spatialData, valueData, valueData
-
-
-
-
Method Detail
-
hostUri
Uri hostUri()
ThehostUri
of theAgent
managed by thisAgentContext
.
-
nodeUri
Uri nodeUri()
ThenodeUri
of theAgent
managed by thisAgentContext
.
-
agentId
Value agentId()
-
props
Value props()
ARecord
that maps every dynamic property innodeUri()
, as defined byAgentRoute.pattern()
, to its value. An empty result indicates thatnodeUri
contains no dynamic components.
-
stage
Stage stage()
The single-threaded executionStage
on which thisAgentContext
runs its application logic.
-
asyncStage
Stage asyncStage()
The multi-threaded executionStage
on which thisAgentContext
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 theLane
belonging to theAgent
managed by thisAgentContext
that is addressable bylaneUri
, ornull
if no suchLane
exists.
-
agents
FingerTrieSeq<Agent> agents()
-
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)
-
closeAgent
void closeAgent(Value id)
-
closeAgent
void closeAgent(String name)
-
-