java.lang.Object
swim.api.agent.AbstractAgent
- All Implemented Interfaces:
Agent,DownlinkFactory,LaneFactory,WarpRef,Store,Schedule,Log
public class AbstractAgent
extends Object
implements Agent, WarpRef, LaneFactory, Schedule, Store, Log
Abstract base class for all
Agents. This class
provides skeletal Agent lifecycle callback implementations,
contextual Lane and Store creation mechanisms, URI-based
addressability, logging, and scheduling, primarily via delegation to its
internal, immutable AgentContext.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AgentContextInternal, immutable context that provides contextualLaneandStorecreation mechanisms, URI-based addressability, logging, and scheduling. -
Constructor Summary
ConstructorsConstructorDescriptionCreates anAbstractAgentinstance managed bySwimContext.getAgentContext().AbstractAgent(AgentContext context) Creates anAbstractAgentinstance managed bycontext. -
Method Summary
Modifier and TypeMethodDescriptionReturns theAgentContextused to manage thisAgent.final ValueagentId()agents()final StageThe multi-threaded executionStageon which thisAgentContextcan run asynchronous operations.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.voidclose()voidcloseAgent(String name) voidcloseAgent(Value id) final voidfinal voidfinal voidfinal voidcommand(String hostUri, String nodeUri, String laneUri, float prio, Value body, Cont<CommandMessage> cont) final voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal <V> CommandLane<V>voidLogs a debug-level message.final <V> DemandLane<V>final <K,V> DemandMapLane<K, V> voiddidClose()Lifecycle callback invoked immediately after thisAgentcloses.voidLifecycle callback invoked immediately after thisAgentthrowserror.voiddidLoad()Lifecycle callback invoked immediately after thisAgentloads, i.e.voiddidOpen()Lifecycle callback invoked immediately after thisAgentopens, i.e.voiddidStart()Lifecycle callback invoked immediately after thisAgentstarts.voiddidStop()Lifecycle callback invoked immediately after thisAgentstops, i.e.voidLifecycle callback invoked immediately after thisAgentunloads, i.e.final EventDownlink<Value>downlink()final <V> HttpDownlink<V>final ListDownlink<Value>final MapDownlink<Value,Value> final ValueDownlink<Value>final <I,O> WsDownlink<I, O> voidLogs an error-level message.voidLogs an fail-level message.final SpatialData<Value,R2Shape, Value> geospatialData(String name) final SpatialData<Value,R2Shape, Value> geospatialData(Value name) final <K,V> SpatialLane<K, R2Shape, V> <A extends Agent>
Afinal Lanefinal ValueReturns the value ofnameinprops().final ValueReturns the value ofkeyinprops().final HostReffinal HostReffinal UrihostUri()ThisAgent'shostUri.final <V> HttpLane<V>httpLane()voidLogs an info-level message.booleanisSecure()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.final <L,K, V> JoinMapLane<L, K, V> final <K,V> JoinValueLane<K, V> final Lanelane()Returns the currently executing lane, or null if not currently executing a lane or link callback.final LaneReffinal LaneReffinal LaneReffinal LaneReffinal Linklink()Returns the currently executing link, or null if not currently executing a link callback.final <V> ListLane<V>listLane()Returns the local internet address of the currently executing link, or null if not currently executing a link callback.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.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.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.final <K,V> MapLane<K, V> mapLane()final NodeReffinal NodeReffinal NodeReffinal NodeReffinal UrinodeUri()ThisAgent'snodeUri.<A extends Agent>
A<A extends Agent>
AopenAgent(String name, AgentFactory<A> agentFactory) <A extends Agent>
A<A extends Agent>
AopenAgent(Value id, AgentFactory<A> agentFactory) <A extends Agent>
A<A extends Agent>
AopenAgent(Value id, Value props, AgentFactory<A> agentFactory) final Lanefinal Valueprops()ARecordthat maps every dynamic property innodeUri(), as defined byAgentRoute.pattern(), to its value.Returns the remote internet address of the currently executing link, or null if not currently executing a link callback.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.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.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.final Scheduleschedule()TheSchedulethat thisAgentis bound to.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.final TimerRefsetTimer(long millis, TimerFunction timer) Schedulestimerto execute aftermillismilliseconds have elapsed.final <S> SpatialData<Value,S, Value> spatialData(String name, Z2Form<S> shapeForm) final <S> SpatialData<Value,S, Value> spatialData(Value name, Z2Form<S> shapeForm) final <K,S, V> SpatialLane<K, S, V> spatialLane(Z2Form<S> shapeForm) final Stagestage()The single-threaded executionStageon which thisAgentContextruns its application logic.final <V> SupplyLane<V>final TimerReftimer(TimerFunction timer) Returns an unscheduledTimerRefbound totimer, which can later be used to scheduletimer.voidLogs a trace-level message.final <V> ValueLane<V>voidLogs a warn-level message.voidLifecycle callback invoked immediately before thisAgentcloses.voidwillLoad()Lifecycle callback invoked immediately before thisAgentloads.voidwillOpen()Lifecycle callback invoked immediately before thisAgentopens.voidLifecycle callback invoked immediately before thisAgentstarts.voidwillStop()Lifecycle callback invoked immediately before thisAgentstops.voidLifecycle callback invoked immediately before thisAgentunloads.final <I,O> WsLane<I, O> wsLane()
-
Field Details
-
context
Internal, immutable context that provides contextualLaneandStorecreation mechanisms, URI-based addressability, logging, and scheduling.
-
-
Constructor Details
-
AbstractAgent
Creates anAbstractAgentinstance managed bycontext. -
AbstractAgent
public AbstractAgent()Creates anAbstractAgentinstance managed bySwimContext.getAgentContext().
-
-
Method Details
-
agentContext
Description copied from interface:AgentReturns theAgentContextused to manage thisAgent.- Specified by:
agentContextin interfaceAgent
-
willOpen
public void willOpen()Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentopens.//@see swim.system.TierBinding#open
-
didOpen
public void didOpen()Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentopens, i.e. before it loads.//@see swim.system.TierBinding#open //@see swim.system.TierBinding#load
-
willLoad
public void willLoad()Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentloads.//@see swim.system.TierBinding#load
-
didLoad
public void didLoad()Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentloads, i.e. before it starts.//@see swim.system.TierBinding#load //@see swim.system.TierBinding#start
-
willStart
public void willStart()Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentstarts.//@see swim.system.TierBinding#start
-
didStart
public void didStart()Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentstarts.//@see swim.system.TierBinding#start
-
willStop
public void willStop()Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentstops.//@see swim.system.TierBinding#stop
-
didStop
public void didStop()Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentstops, i.e. before it unloads.//@see swim.system.TierBinding#stop //@see swim.system.TierBinding#unload
-
willUnload
public void willUnload()Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentunloads.//@see swim.system.TierBinding#unload
- Specified by:
willUnloadin interfaceAgent
-
didUnload
public void didUnload()Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentunloads, i.e. before it closes.//@see swim.system.TierBinding.unload //@see swim.system.TierBinding.close
-
willClose
public void willClose()Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentcloses.//@see swim.system.TierBinding.close
-
didClose
public void didClose()Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentcloses.//@see swim.system.TierBinding.close
-
didFail
Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentthrowserror. -
hostUri
ThisAgent'shostUri. -
nodeUri
ThisAgent'snodeUri. -
agentId
-
props
ARecordthat maps every dynamic property innodeUri(), as defined byAgentRoute.pattern(), to its value. An empty result indicates thatnodeUricontains no dynamic components. -
getProp
Returns the value ofkeyinprops(). -
getProp
Returns the value ofnameinprops(). -
schedule
TheSchedulethat thisAgentis bound to. -
stage
The single-threaded executionStageon which thisAgentContextruns its application logic. -
asyncStage
The multi-threaded executionStageon which thisAgentContextcan run asynchronous operations. -
lane
Returns the currently executing lane, or null if not currently executing a lane or link callback. -
link
Returns the currently executing link, or null if not currently executing a link callback. -
getLane
-
openLane
-
agents
-
getAgent
-
getAgent
-
getAgent
-
openAgent
-
openAgent
-
openAgent
-
openAgent
-
openAgent
-
openAgent
-
closeAgent
-
closeAgent
-
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
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
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
Returns the local internet address of the currently executing link, or null if not currently executing a link callback. -
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
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
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
Returns the remote internet address of the currently executing link, or null if not currently executing a link callback. -
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
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
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. -
commandLane
- Specified by:
commandLanein interfaceLaneFactory
-
demandLane
- Specified by:
demandLanein interfaceLaneFactory
-
demandMapLane
- Specified by:
demandMapLanein interfaceLaneFactory
-
httpLane
- Specified by:
httpLanein interfaceLaneFactory
-
joinMapLane
- Specified by:
joinMapLanein interfaceLaneFactory
-
joinValueLane
- Specified by:
joinValueLanein interfaceLaneFactory
-
listLane
- Specified by:
listLanein interfaceLaneFactory
-
mapLane
- Specified by:
mapLanein interfaceLaneFactory
-
spatialLane
- Specified by:
spatialLanein interfaceLaneFactory
-
geospatialLane
- Specified by:
geospatialLanein interfaceLaneFactory
-
supplyLane
- Specified by:
supplyLanein interfaceLaneFactory
-
valueLane
- Specified by:
valueLanein interfaceLaneFactory
-
wsLane
- Specified by:
wsLanein interfaceLaneFactory
-
listData
-
listData
-
mapData
-
mapData
-
spatialData
- Specified by:
spatialDatain interfaceStore
-
spatialData
- Specified by:
spatialDatain interfaceStore
-
geospatialData
- Specified by:
geospatialDatain interfaceStore
-
geospatialData
- Specified by:
geospatialDatain interfaceStore
-
valueData
-
valueData
-
downlink
- Specified by:
downlinkin interfaceDownlinkFactory
-
downlinkList
- Specified by:
downlinkListin interfaceDownlinkFactory
-
downlinkMap
- Specified by:
downlinkMapin interfaceDownlinkFactory
-
downlinkValue
- Specified by:
downlinkValuein interfaceDownlinkFactory
-
downlinkHttp
- Specified by:
downlinkHttpin interfaceDownlinkFactory
-
downlinkWs
- Specified by:
downlinkWsin interfaceDownlinkFactory
-
hostRef
-
hostRef
-
nodeRef
-
nodeRef
-
nodeRef
-
nodeRef
-
laneRef
-
laneRef
-
laneRef
-
laneRef
-
command
-
command
-
command
-
command
-
command
public final void command(Uri nodeUri, Uri laneUri, float prio, Value body, Cont<CommandMessage> cont) -
command
public final void command(String nodeUri, String laneUri, float prio, Value body, Cont<CommandMessage> cont) -
command
-
command
-
command
-
command
-
command
-
command
-
command
-
command
-
command
-
command
-
trace
Description copied from interface:LogLogs a trace-level message. -
debug
Description copied from interface:LogLogs a debug-level message. -
info
Description copied from interface:LogLogs an info-level message. -
warn
Description copied from interface:LogLogs a warn-level message. -
error
Description copied from interface:LogLogs an error-level message. -
fail
Description copied from interface:LogLogs an fail-level message. -
timer
Description copied from interface:ScheduleReturns an unscheduledTimerRefbound totimer, which can later be used to scheduletimer. -
setTimer
Description copied from interface:ScheduleSchedulestimerto execute aftermillismilliseconds have elapsed. Returns aTimerRefthat can be used to check the status of, reschedule, and canceltimer. -
close
public void close()
-