java.lang.Object
swim.api.agent.AbstractAgent
- All Implemented Interfaces:
Agent,DownlinkFactory,LaneFactory,WarpRef,Store,swim.concurrent.Schedule,swim.util.Log
public class AbstractAgent
extends Object
implements Agent, WarpRef, LaneFactory, swim.concurrent.Schedule, Store, swim.util.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 swim.structure.ValueagentId()swim.collections.FingerTrieSeq<Agent>agents()final swim.concurrent.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(swim.structure.Value id) final voidfinal voidcommand(String nodeUri, String laneUri, float prio, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) final voidfinal voidcommand(String hostUri, String nodeUri, String laneUri, float prio, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) final voidfinal voidcommand(String hostUri, String nodeUri, String laneUri, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) final voidfinal voidcommand(String nodeUri, String laneUri, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) final voidcommand(swim.uri.Uri nodeUri, swim.uri.Uri laneUri, float prio, swim.structure.Value body) final voidcommand(swim.uri.Uri nodeUri, swim.uri.Uri laneUri, float prio, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) final voidcommand(swim.uri.Uri nodeUri, swim.uri.Uri laneUri, swim.structure.Value body) final voidcommand(swim.uri.Uri nodeUri, swim.uri.Uri laneUri, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) final voidcommand(swim.uri.Uri hostUri, swim.uri.Uri nodeUri, swim.uri.Uri laneUri, float prio, swim.structure.Value body) final voidcommand(swim.uri.Uri hostUri, swim.uri.Uri nodeUri, swim.uri.Uri laneUri, float prio, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) final voidcommand(swim.uri.Uri hostUri, swim.uri.Uri nodeUri, swim.uri.Uri laneUri, swim.structure.Value body) final voidcommand(swim.uri.Uri hostUri, swim.uri.Uri nodeUri, swim.uri.Uri laneUri, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) final <V> CommandLane<V>voidfinal <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<swim.structure.Value>downlink()final <V> HttpDownlink<V>final ListDownlink<swim.structure.Value>final MapDownlink<swim.structure.Value,swim.structure.Value> final ValueDownlink<swim.structure.Value>final <I,O> WsDownlink<I, O> voidvoidfinal SpatialData<swim.structure.Value,swim.math.R2Shape, swim.structure.Value> geospatialData(String name) final SpatialData<swim.structure.Value,swim.math.R2Shape, swim.structure.Value> geospatialData(swim.structure.Value name) final <K,V> SpatialLane<K, swim.math.R2Shape, V> <A extends Agent>
AgetAgent(swim.structure.Value id) final LanegetLane(swim.uri.Uri laneUri) final swim.structure.ValueReturns the value ofnameinprops().final swim.structure.ValuegetProp(swim.structure.Value key) Returns the value ofkeyinprops().final HostReffinal HostRefhostRef(swim.uri.Uri hostUri) final swim.uri.UrihostUri()ThisAgent'shostUri.final <V> HttpLane<V>httpLane()voidbooleanisSecure()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 LaneReflaneRef(swim.uri.Uri nodeUri, swim.uri.Uri laneUri) final LaneReflaneRef(swim.uri.Uri hostUri, swim.uri.Uri nodeUri, swim.uri.Uri laneUri) final Linklink()Returns the currently executing link, or null if not currently executing a link callback.final ListData<swim.structure.Value>final ListData<swim.structure.Value>listData(swim.structure.Value name) 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 MapData<swim.structure.Value,swim.structure.Value> final MapData<swim.structure.Value,swim.structure.Value> mapData(swim.structure.Value name) final <K,V> MapLane<K, V> mapLane()final NodeReffinal NodeReffinal NodeRefnodeRef(swim.uri.Uri nodeUri) final NodeRefnodeRef(swim.uri.Uri hostUri, swim.uri.Uri nodeUri) final swim.uri.UrinodeUri()ThisAgent'snodeUri.<A extends Agent>
A<A extends Agent>
AopenAgent(String name, AgentFactory<A> agentFactory) <A extends Agent>
A<A extends Agent>
AopenAgent(swim.structure.Value id, AgentFactory<A> agentFactory) <A extends Agent>
A<A extends Agent>
AopenAgent(swim.structure.Value id, swim.structure.Value props, AgentFactory<A> agentFactory) final Lanefinal swim.structure.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 swim.concurrent.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 swim.concurrent.TimerRefsetTimer(long millis, swim.concurrent.TimerFunction timer) final <S> SpatialData<swim.structure.Value,S, swim.structure.Value> spatialData(String name, swim.math.Z2Form<S> shapeForm) final <S> SpatialData<swim.structure.Value,S, swim.structure.Value> spatialData(swim.structure.Value name, swim.math.Z2Form<S> shapeForm) final <K,S, V> SpatialLane<K, S, V> spatialLane(swim.math.Z2Form<S> shapeForm) final swim.concurrent.Stagestage()The single-threaded executionStageon which thisAgentContextruns its application logic.final <V> SupplyLane<V>final swim.concurrent.TimerReftimer(swim.concurrent.TimerFunction timer) voidfinal ValueData<swim.structure.Value>final ValueData<swim.structure.Value>valueData(swim.structure.Value name) final <V> ValueLane<V>voidvoidLifecycle 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
public final swim.uri.Uri hostUri()ThisAgent'shostUri. -
nodeUri
public final swim.uri.Uri nodeUri()ThisAgent'snodeUri. -
agentId
public final swim.structure.Value agentId() -
props
public final swim.structure.Value props()ARecordthat maps every dynamic property innodeUri(), as defined byAgentRoute.pattern(), to its value. An empty result indicates thatnodeUricontains no dynamic components. -
getProp
public final swim.structure.Value getProp(swim.structure.Value key) Returns the value ofkeyinprops(). -
getProp
Returns the value ofnameinprops(). -
schedule
public final swim.concurrent.Schedule schedule()TheSchedulethat thisAgentis bound to. -
stage
public final swim.concurrent.Stage stage()The single-threaded executionStageon which thisAgentContextruns its application logic. -
asyncStage
public final swim.concurrent.Stage 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
public <A extends Agent> A openAgent(swim.structure.Value id, swim.structure.Value props, AgentFactory<A> agentFactory) -
openAgent
-
openAgent
-
openAgent
-
openAgent
-
openAgent
-
closeAgent
public void closeAgent(swim.structure.Value id) -
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
public final <S> SpatialData<swim.structure.Value,S, spatialDataswim.structure.Value> (swim.structure.Value name, swim.math.Z2Form<S> shapeForm) - Specified by:
spatialDatain interfaceStore
-
spatialData
public final <S> SpatialData<swim.structure.Value,S, spatialDataswim.structure.Value> (String name, swim.math.Z2Form<S> shapeForm) - Specified by:
spatialDatain interfaceStore
-
geospatialData
public final SpatialData<swim.structure.Value,swim.math.R2Shape, geospatialDataswim.structure.Value> (swim.structure.Value name) - Specified by:
geospatialDatain interfaceStore
-
geospatialData
public final SpatialData<swim.structure.Value,swim.math.R2Shape, geospatialDataswim.structure.Value> (String name) - 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
public final void command(swim.uri.Uri hostUri, swim.uri.Uri nodeUri, swim.uri.Uri laneUri, float prio, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) -
command
-
command
public final void command(swim.uri.Uri hostUri, swim.uri.Uri nodeUri, swim.uri.Uri laneUri, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) -
command
-
command
public final void command(swim.uri.Uri nodeUri, swim.uri.Uri laneUri, float prio, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) -
command
-
command
public final void command(swim.uri.Uri nodeUri, swim.uri.Uri laneUri, swim.structure.Value body, swim.concurrent.Cont<swim.warp.CommandMessage> cont) -
command
-
command
public final void command(swim.uri.Uri hostUri, swim.uri.Uri nodeUri, swim.uri.Uri laneUri, float prio, swim.structure.Value body) -
command
-
command
public final void command(swim.uri.Uri hostUri, swim.uri.Uri nodeUri, swim.uri.Uri laneUri, swim.structure.Value body) -
command
-
command
public final void command(swim.uri.Uri nodeUri, swim.uri.Uri laneUri, float prio, swim.structure.Value body) -
command
-
command
public final void command(swim.uri.Uri nodeUri, swim.uri.Uri laneUri, swim.structure.Value body) -
command
-
trace
- Specified by:
tracein interfaceswim.util.Log
-
debug
- Specified by:
debugin interfaceswim.util.Log
-
info
- Specified by:
infoin interfaceswim.util.Log
-
warn
- Specified by:
warnin interfaceswim.util.Log
-
error
- Specified by:
errorin interfaceswim.util.Log
-
fail
- Specified by:
failin interfaceswim.util.Log
-
timer
public final swim.concurrent.TimerRef timer(swim.concurrent.TimerFunction timer) - Specified by:
timerin interfaceswim.concurrent.Schedule
-
setTimer
public final swim.concurrent.TimerRef setTimer(long millis, swim.concurrent.TimerFunction timer) - Specified by:
setTimerin interfaceswim.concurrent.Schedule
-
close
public void close()
-