- java.lang.Object
-
- swim.system.AbstractWarpRef
-
- swim.system.AbstractTierBinding
-
- swim.system.agent.AgentView
-
- All Implemented Interfaces:
AgentContext
,DownlinkFactory
,LaneFactory
,WarpRef
,Store
,CellContext
,TierBinding
,TierContext
,Log
public class AgentView extends AbstractTierBinding implements TierContext, AgentContext
-
-
Field Summary
Fields Modifier and Type Field Description protected Agent
agent
protected Value
id
protected AgentModel
node
protected Value
props
-
Fields inherited from class swim.system.AbstractTierBinding
CLOSED_PHASE, CLOSED_STATE, CLOSING_STATE, FAILED_STATE, FAILING_STATE, LOADED_PHASE, LOADED_STATE, LOADING_STATE, OPENED_PHASE, OPENED_STATE, OPENING_STATE, PHASE_MASK, PHASE_SHIFT, RECOVERING_STATE, STARTED_PHASE, STARTED_STATE, STARTING_STATE, STATE_MASK, status, STATUS, STOPPING_STATE, UNLOADING_STATE
-
-
Constructor Summary
Constructors Constructor Description AgentView(AgentModel node, Value id, Value props)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Agent
agent()
Value
agentId()
FingerTrieSeq<Agent>
agents()
Stage
asyncStage()
The multi-threaded executionStage
on which thisAgentContext
can run asynchronous operations.LinkBinding
bindDownlink(Downlink downlink)
<T> T
bottomNode(Class<T> nodeClass)
NodeAddress
cellAddress()
void
closeAgent(String name)
void
closeAgent(Value id)
void
closeDownlink(LinkBinding link)
<V> CommandLane<V>
commandLane()
<A extends Agent>
AgentFactory<A>createAgentFactory(Class<? extends A> agentClass)
void
debug(Object message)
Logs a debug-level message.<V> DemandLane<V>
demandLane()
<K,V>
DemandMapLane<K,V>demandMapLane()
void
didClose()
void
didFail(Throwable error)
void
didLoad()
void
didOpen()
void
didStart()
void
didStop()
void
didUnload()
String
edgeName()
void
error(Object message)
Logs an error-level message.void
fail(Object message)
Logs an fail-level message.SpatialData<Value,R2Shape,Value>
geospatialData(String name)
SpatialData<Value,R2Shape,Value>
geospatialData(Value name)
<K,V>
SpatialLane<K,R2Shape,V>geospatialLane()
<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
inAgentContext.props()
.Value
getProp(Value key)
Returns the value ofkey
inAgentContext.props()
.Uri
hostUri()
ThehostUri
of theAgent
managed by thisAgentContext
.<V> HttpLane<V>
httpLane()
void
info(Object message)
Logs an info-level message.<L,K,V>
JoinMapLane<L,K,V>joinMapLane()
<K,V>
JoinValueLane<K,V>joinValueLane()
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.ListData<Value>
listData(String name)
ListData<Value>
listData(Value name)
<V> ListLane<V>
listLane()
MapData<Value,Value>
mapData(String name)
MapData<Value,Value>
mapData(Value name)
<K,V>
MapLane<K,V>mapLane()
Uri
meshUri()
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)
void
openDownlink(LinkBinding link)
Lane
openLane(Uri laneUri, Lane lane)
Registerslane
withlaneUri
and returnslane
.void
openMetaDownlink(LinkBinding downlink, NodeBinding metaDownlink)
Policy
policy()
Value
props()
ARecord
that maps every dynamic property inAgentContext.nodeUri()
, as defined byAgentRoute.pattern()
, to its value.void
pushDown(Push<?> push)
void
reportDown(Metric metric)
Schedule
schedule()
TheSchedule
that thisAgentContext
is bound to.<S> SpatialData<Value,S,Value>
spatialData(String name, Z2Form<S> shapeForm)
<S> SpatialData<Value,S,Value>
spatialData(Value name, Z2Form<S> shapeForm)
<K,S,V>
SpatialLane<K,S,V>spatialLane(Z2Form<S> shapeForm)
Stage
stage()
The single-threaded executionStage
on which thisAgentContext
runs its application logic.StoreBinding
store()
<V> SupplyLane<V>
supplyLane()
TierContext
tierContext()
void
trace(Object message)
Logs a trace-level message.<T> T
unwrapNode(Class<T> nodeClass)
ValueData<Value>
valueData(String name)
ValueData<Value>
valueData(Value name)
<V> ValueLane<V>
valueLane()
void
warn(Object message)
Logs a warn-level message.void
willClose()
void
willLoad()
void
willOpen()
void
willStart()
void
willStop()
void
willUnload()
<I,O>
WsLane<I,O>wsLane()
-
Methods inherited from class swim.system.AbstractTierBinding
activate, awaitStart, close, isClosed, isLoaded, isOpened, isStarted, load, open, start, stop, unload
-
Methods inherited from class swim.system.AbstractWarpRef
command, command, command, command, command, command, command, command, command, command, command, command, command, command, command, command, downlink, downlinkHttp, downlinkList, downlinkMap, downlinkValue, downlinkWs, hostRef, hostRef, laneRef, laneRef, laneRef, laneRef, nodeRef, nodeRef, nodeRef, nodeRef
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface swim.api.downlink.DownlinkFactory
downlink, downlinkHttp, downlinkList, downlinkMap, downlinkValue, downlinkWs
-
Methods inherited from interface swim.system.TierContext
close
-
-
-
-
Field Detail
-
node
protected final AgentModel node
-
id
protected final Value id
-
props
protected final Value props
-
agent
protected Agent agent
-
-
Constructor Detail
-
AgentView
public AgentView(AgentModel node, Value id, Value props)
-
-
Method Detail
-
agent
public final Agent agent()
-
tierContext
public TierContext tierContext()
- Specified by:
tierContext
in interfaceTierBinding
- Specified by:
tierContext
in classAbstractTierBinding
-
unwrapNode
public <T> T unwrapNode(Class<T> nodeClass)
-
bottomNode
public <T> T bottomNode(Class<T> nodeClass)
-
cellAddress
public NodeAddress cellAddress()
- Specified by:
cellAddress
in interfaceCellContext
-
edgeName
public final String edgeName()
- Specified by:
edgeName
in interfaceCellContext
-
meshUri
public final Uri meshUri()
- Specified by:
meshUri
in interfaceCellContext
-
hostUri
public final Uri hostUri()
Description copied from interface:AgentContext
ThehostUri
of theAgent
managed by thisAgentContext
.- Specified by:
hostUri
in interfaceAgentContext
-
nodeUri
public final Uri nodeUri()
Description copied from interface:AgentContext
ThenodeUri
of theAgent
managed by thisAgentContext
.- Specified by:
nodeUri
in interfaceAgentContext
-
agentId
public final Value agentId()
- Specified by:
agentId
in interfaceAgentContext
-
props
public final Value props()
Description copied from interface:AgentContext
ARecord
that maps every dynamic property inAgentContext.nodeUri()
, as defined byAgentRoute.pattern()
, to its value. An empty result indicates thatnodeUri
contains no dynamic components.- Specified by:
props
in interfaceAgentContext
-
getProp
public Value getProp(Value key)
Description copied from interface:AgentContext
Returns the value ofkey
inAgentContext.props()
.- Specified by:
getProp
in interfaceAgentContext
-
getProp
public Value getProp(String name)
Description copied from interface:AgentContext
Returns the value ofname
inAgentContext.props()
.- Specified by:
getProp
in interfaceAgentContext
-
policy
public Policy policy()
- Specified by:
policy
in interfaceCellContext
-
schedule
public Schedule schedule()
Description copied from interface:AgentContext
TheSchedule
that thisAgentContext
is bound to.- Specified by:
schedule
in interfaceAgentContext
- Specified by:
schedule
in interfaceCellContext
-
stage
public Stage stage()
Description copied from interface:AgentContext
The single-threaded executionStage
on which thisAgentContext
runs its application logic.- Specified by:
stage
in interfaceAgentContext
- Specified by:
stage
in interfaceCellContext
-
asyncStage
public Stage asyncStage()
Description copied from interface:AgentContext
The multi-threaded executionStage
on which thisAgentContext
can run asynchronous operations.- Specified by:
asyncStage
in interfaceAgentContext
-
store
public StoreBinding store()
- Specified by:
store
in interfaceCellContext
-
lane
public Lane lane()
Description copied from interface:AgentContext
Returns the currently executing lane, or null if not currently executing a lane or link callback.- Specified by:
lane
in interfaceAgentContext
-
link
public Link link()
Description copied from interface:AgentContext
Returns the currently executing link, or null if not currently executing a link callback.- Specified by:
link
in interfaceAgentContext
-
getLane
public Lane getLane(Uri laneUri)
Description copied from interface:AgentContext
Returns theLane
belonging to theAgent
managed by thisAgentContext
that is addressable bylaneUri
, ornull
if no suchLane
exists.- Specified by:
getLane
in interfaceAgentContext
-
openLane
public Lane openLane(Uri laneUri, Lane lane)
Description copied from interface:AgentContext
Registerslane
withlaneUri
and returnslane
.- Specified by:
openLane
in interfaceAgentContext
-
agents
public FingerTrieSeq<Agent> agents()
- Specified by:
agents
in interfaceAgentContext
-
getAgent
public Agent getAgent(Value id)
- Specified by:
getAgent
in interfaceAgentContext
-
getAgent
public Agent getAgent(String name)
- Specified by:
getAgent
in interfaceAgentContext
-
getAgent
public <A extends Agent> A getAgent(Class<? extends A> agentClass)
- Specified by:
getAgent
in interfaceAgentContext
-
createAgentFactory
public <A extends Agent> AgentFactory<A> createAgentFactory(Class<? extends A> agentClass)
-
openAgent
public <A extends Agent> A openAgent(Value id, Value props, AgentFactory<A> agentFactory)
- Specified by:
openAgent
in interfaceAgentContext
-
openAgent
public <A extends Agent> A openAgent(Value id, AgentFactory<A> agentFactory)
- Specified by:
openAgent
in interfaceAgentContext
-
openAgent
public <A extends Agent> A openAgent(String name, AgentFactory<A> agentFactory)
- Specified by:
openAgent
in interfaceAgentContext
-
openAgent
public <A extends Agent> A openAgent(Value id, Value props, Class<? extends A> agentClass)
- Specified by:
openAgent
in interfaceAgentContext
-
openAgent
public <A extends Agent> A openAgent(Value id, Class<? extends A> agentClass)
- Specified by:
openAgent
in interfaceAgentContext
-
openAgent
public <A extends Agent> A openAgent(String name, Class<? extends A> agentClass)
- Specified by:
openAgent
in interfaceAgentContext
-
closeAgent
public void closeAgent(Value id)
- Specified by:
closeAgent
in interfaceAgentContext
-
closeAgent
public void closeAgent(String name)
- Specified by:
closeAgent
in interfaceAgentContext
-
commandLane
public <V> CommandLane<V> commandLane()
- Specified by:
commandLane
in interfaceLaneFactory
-
demandLane
public <V> DemandLane<V> demandLane()
- Specified by:
demandLane
in interfaceLaneFactory
-
demandMapLane
public <K,V> DemandMapLane<K,V> demandMapLane()
- Specified by:
demandMapLane
in interfaceLaneFactory
-
httpLane
public <V> HttpLane<V> httpLane()
- Specified by:
httpLane
in interfaceLaneFactory
-
joinMapLane
public <L,K,V> JoinMapLane<L,K,V> joinMapLane()
- Specified by:
joinMapLane
in interfaceLaneFactory
-
joinValueLane
public <K,V> JoinValueLane<K,V> joinValueLane()
- Specified by:
joinValueLane
in interfaceLaneFactory
-
listLane
public <V> ListLane<V> listLane()
- Specified by:
listLane
in interfaceLaneFactory
-
mapLane
public <K,V> MapLane<K,V> mapLane()
- Specified by:
mapLane
in interfaceLaneFactory
-
spatialLane
public <K,S,V> SpatialLane<K,S,V> spatialLane(Z2Form<S> shapeForm)
- Specified by:
spatialLane
in interfaceLaneFactory
-
geospatialLane
public <K,V> SpatialLane<K,R2Shape,V> geospatialLane()
- Specified by:
geospatialLane
in interfaceLaneFactory
-
supplyLane
public <V> SupplyLane<V> supplyLane()
- Specified by:
supplyLane
in interfaceLaneFactory
-
valueLane
public <V> ValueLane<V> valueLane()
- Specified by:
valueLane
in interfaceLaneFactory
-
wsLane
public <I,O> WsLane<I,O> wsLane()
- Specified by:
wsLane
in interfaceLaneFactory
-
spatialData
public <S> SpatialData<Value,S,Value> spatialData(Value name, Z2Form<S> shapeForm)
- Specified by:
spatialData
in interfaceStore
-
spatialData
public <S> SpatialData<Value,S,Value> spatialData(String name, Z2Form<S> shapeForm)
- Specified by:
spatialData
in interfaceStore
-
geospatialData
public SpatialData<Value,R2Shape,Value> geospatialData(Value name)
- Specified by:
geospatialData
in interfaceStore
-
geospatialData
public SpatialData<Value,R2Shape,Value> geospatialData(String name)
- Specified by:
geospatialData
in interfaceStore
-
bindDownlink
public LinkBinding bindDownlink(Downlink downlink)
- Specified by:
bindDownlink
in interfaceCellContext
-
openDownlink
public void openDownlink(LinkBinding link)
- Specified by:
openDownlink
in interfaceCellContext
-
closeDownlink
public void closeDownlink(LinkBinding link)
- Specified by:
closeDownlink
in interfaceCellContext
-
pushDown
public void pushDown(Push<?> push)
- Specified by:
pushDown
in interfaceCellContext
-
reportDown
public void reportDown(Metric metric)
- Specified by:
reportDown
in interfaceCellContext
-
openMetaDownlink
public void openMetaDownlink(LinkBinding downlink, NodeBinding metaDownlink)
- Specified by:
openMetaDownlink
in interfaceCellContext
-
trace
public void trace(Object message)
Description copied from interface:Log
Logs a trace-level message.
-
debug
public void debug(Object message)
Description copied from interface:Log
Logs a debug-level message.
-
info
public void info(Object message)
Description copied from interface:Log
Logs an info-level message.
-
warn
public void warn(Object message)
Description copied from interface:Log
Logs a warn-level message.
-
error
public void error(Object message)
Description copied from interface:Log
Logs an error-level message.
-
fail
public void fail(Object message)
Description copied from interface:Log
Logs an fail-level message.
-
willOpen
public void willOpen()
- Specified by:
willOpen
in interfaceTierContext
- Overrides:
willOpen
in classAbstractTierBinding
-
didOpen
public void didOpen()
- Specified by:
didOpen
in interfaceTierContext
- Overrides:
didOpen
in classAbstractTierBinding
-
willLoad
public void willLoad()
- Specified by:
willLoad
in interfaceTierContext
- Overrides:
willLoad
in classAbstractTierBinding
-
didLoad
public void didLoad()
- Specified by:
didLoad
in interfaceTierContext
- Overrides:
didLoad
in classAbstractTierBinding
-
willStart
public void willStart()
- Specified by:
willStart
in interfaceTierContext
- Overrides:
willStart
in classAbstractTierBinding
-
didStart
public void didStart()
- Specified by:
didStart
in interfaceTierContext
- Overrides:
didStart
in classAbstractTierBinding
-
willStop
public void willStop()
- Specified by:
willStop
in interfaceTierContext
- Overrides:
willStop
in classAbstractTierBinding
-
didStop
public void didStop()
- Specified by:
didStop
in interfaceTierContext
- Overrides:
didStop
in classAbstractTierBinding
-
willUnload
public void willUnload()
- Specified by:
willUnload
in interfaceTierContext
- Overrides:
willUnload
in classAbstractTierBinding
-
didUnload
public void didUnload()
- Specified by:
didUnload
in interfaceTierContext
- Overrides:
didUnload
in classAbstractTierBinding
-
willClose
public void willClose()
- Specified by:
willClose
in interfaceTierContext
- Overrides:
willClose
in classAbstractTierBinding
-
didClose
public void didClose()
- Specified by:
didClose
in interfaceTierBinding
- Overrides:
didClose
in classAbstractTierBinding
-
didFail
public void didFail(Throwable error)
- Specified by:
didFail
in interfaceTierBinding
- Overrides:
didFail
in classAbstractTierBinding
-
-