- 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 allAgents. This class provides skeletalAgentlifecycle callback implementations, contextualLaneandStorecreation mechanisms, URI-based addressability, logging, and scheduling, primarily via delegation to its internal, immutableAgentContext.
- 
- 
Field SummaryFields Modifier and Type Field Description protected AgentContextcontextInternal, immutable context that provides contextualLaneandStorecreation mechanisms, URI-based addressability, logging, and scheduling.
 - 
Constructor SummaryConstructors Constructor Description AbstractAgent()Creates anAbstractAgentinstance managed bySwimContext.getAgentContext().AbstractAgent(AgentContext context)Creates anAbstractAgentinstance managed bycontext.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description AgentContextagentContext()Returns theAgentContextused to manage thisAgent.ValueagentId()FingerTrieSeq<Agent>agents()StageasyncStage()The multi-threaded executionStageon which thisAgentContextcan run asynchronous operations.StringcipherSuite()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)voidcommand(String nodeUri, String laneUri, float prio, Value body)voidcommand(String nodeUri, String laneUri, float prio, Value body, Cont<CommandMessage> cont)voidcommand(String hostUri, String nodeUri, String laneUri, float prio, Value body)voidcommand(String hostUri, String nodeUri, String laneUri, float prio, Value body, Cont<CommandMessage> cont)voidcommand(String hostUri, String nodeUri, String laneUri, Value body)voidcommand(String hostUri, String nodeUri, String laneUri, Value body, Cont<CommandMessage> cont)voidcommand(String nodeUri, String laneUri, Value body)voidcommand(String nodeUri, String laneUri, Value body, Cont<CommandMessage> cont)voidcommand(Uri nodeUri, Uri laneUri, float prio, Value body)voidcommand(Uri nodeUri, Uri laneUri, float prio, Value body, Cont<CommandMessage> cont)voidcommand(Uri nodeUri, Uri laneUri, Value body)voidcommand(Uri nodeUri, Uri laneUri, Value body, Cont<CommandMessage> cont)voidcommand(Uri hostUri, Uri nodeUri, Uri laneUri, float prio, Value body)voidcommand(Uri hostUri, Uri nodeUri, Uri laneUri, float prio, Value body, Cont<CommandMessage> cont)voidcommand(Uri hostUri, Uri nodeUri, Uri laneUri, Value body)voidcommand(Uri hostUri, Uri nodeUri, Uri laneUri, Value body, Cont<CommandMessage> cont)<V> CommandLane<V>commandLane()voiddebug(Object message)Logs a debug-level message.<V> DemandLane<V>demandLane()<K,V>
 DemandMapLane<K,V>demandMapLane()voiddidClose()Lifecycle callback invoked immediately after thisAgentcloses.voiddidFail(Throwable error)Lifecycle 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.voiddidUnload()Lifecycle callback invoked immediately after thisAgentunloads, i.e.EventDownlink<Value>downlink()<V> HttpDownlink<V>downlinkHttp()ListDownlink<Value>downlinkList()MapDownlink<Value,Value>downlinkMap()ValueDownlink<Value>downlinkValue()<I,O>
 WsDownlink<I,O>downlinkWs()voiderror(Object message)Logs an error-level message.voidfail(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<A> agentClass)AgentgetAgent(String name)AgentgetAgent(Value id)LanegetLane(Uri laneUri)ValuegetProp(String name)Returns the value ofnameinprops().ValuegetProp(Value key)Returns the value ofkeyinprops().HostRefhostRef(String hostUri)HostRefhostRef(Uri hostUri)UrihostUri()ThisAgent'shostUri.<V> HttpLane<V>httpLane()voidinfo(Object message)Logs 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.<L,K,V>
 JoinMapLane<L,K,V>joinMapLane()<K,V>
 JoinValueLane<K,V>joinValueLane()Lanelane()Returns the currently executing lane, or null if not currently executing a lane or link callback.LaneReflaneRef(String nodeUri, String laneUri)LaneReflaneRef(String hostUri, String nodeUri, String laneUri)LaneReflaneRef(Uri nodeUri, Uri laneUri)LaneReflaneRef(Uri hostUri, Uri nodeUri, Uri laneUri)Linklink()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()InetSocketAddresslocalAddress()Returns the local internet address of the currently executing link, or null if not currently executing a link callback.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.IdentitylocalIdentity()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.PrincipallocalPrincipal()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.MapData<Value,Value>mapData(String name)MapData<Value,Value>mapData(Value name)<K,V>
 MapLane<K,V>mapLane()NodeRefnodeRef(String nodeUri)NodeRefnodeRef(String hostUri, String nodeUri)NodeRefnodeRef(Uri nodeUri)NodeRefnodeRef(Uri hostUri, Uri nodeUri)UrinodeUri()ThisAgent'snodeUri.<A extends Agent>
 AopenAgent(String name, Class<A> agentClass)<A extends Agent>
 AopenAgent(String name, AgentFactory<A> agentFactory)<A extends Agent>
 AopenAgent(Value id, Class<A> agentClass)<A extends Agent>
 AopenAgent(Value id, AgentFactory<A> agentFactory)<A extends Agent>
 AopenAgent(Value id, Value props, Class<A> agentClass)<A extends Agent>
 AopenAgent(Value id, Value props, AgentFactory<A> agentFactory)LaneopenLane(Uri laneUri, Lane lane)Valueprops()ARecordthat maps every dynamic property innodeUri(), as defined byAgentRoute.pattern(), to its value.InetSocketAddressremoteAddress()Returns the remote internet address of the currently executing link, or null if not currently executing a link callback.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.IdentityremoteIdentity()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.PrincipalremotePrincipal()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.Scheduleschedule()TheSchedulethat thisAgentis bound to.StringsecurityProtocol()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.TimerRefsetTimer(long millis, TimerFunction timer)Schedulestimerto execute aftermillismilliseconds have elapsed.<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)Stagestage()The single-threaded executionStageon which thisAgentContextruns its application logic.<V> SupplyLane<V>supplyLane()TimerReftimer(TimerFunction timer)Returns an unscheduledTimerRefbound totimer, which can later be used to scheduletimer.voidtrace(Object message)Logs a trace-level message.ValueData<Value>valueData(String name)ValueData<Value>valueData(Value name)<V> ValueLane<V>valueLane()voidwarn(Object message)Logs a warn-level message.voidwillClose()Lifecycle callback invoked immediately before thisAgentcloses.voidwillLoad()Lifecycle callback invoked immediately before thisAgentloads.voidwillOpen()Lifecycle callback invoked immediately before thisAgentopens.voidwillStart()Lifecycle callback invoked immediately before thisAgentstarts.voidwillStop()Lifecycle callback invoked immediately before thisAgentstops.voidwillUnload()Lifecycle callback invoked immediately before thisAgentunloads.<I,O>
 WsLane<I,O>wsLane()
 
- 
- 
- 
Field Detail- 
contextprotected final AgentContext context Internal, immutable context that provides contextualLaneandStorecreation mechanisms, URI-based addressability, logging, and scheduling.
 
- 
 - 
Constructor Detail- 
AbstractAgentpublic AbstractAgent(AgentContext context) Creates anAbstractAgentinstance managed bycontext.
 - 
AbstractAgentpublic AbstractAgent() Creates anAbstractAgentinstance managed bySwimContext.getAgentContext().
 
- 
 - 
Method Detail- 
agentContextpublic AgentContext agentContext() Description copied from interface:AgentReturns theAgentContextused to manage thisAgent.- Specified by:
- agentContextin interface- Agent
 
 - 
willOpenpublic void willOpen() Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentopens.//@see swim.system.TierBinding#open 
 - 
didOpenpublic 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 
 - 
willLoadpublic void willLoad() Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentloads.//@see swim.system.TierBinding#load 
 - 
didLoadpublic 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 
 - 
willStartpublic void willStart() Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentstarts.//@see swim.system.TierBinding#start 
 - 
didStartpublic void didStart() Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentstarts.//@see swim.system.TierBinding#start 
 - 
willStoppublic void willStop() Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentstops.//@see swim.system.TierBinding#stop 
 - 
didStoppublic 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 
 - 
willUnloadpublic void willUnload() Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentunloads.//@see swim.system.TierBinding#unload - Specified by:
- willUnloadin interface- Agent
 
 - 
didUnloadpublic 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 
 - 
willClosepublic void willClose() Description copied from interface:AgentLifecycle callback invoked immediately before thisAgentcloses.//@see swim.system.TierBinding.close 
 - 
didClosepublic void didClose() Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentcloses.//@see swim.system.TierBinding.close 
 - 
didFailpublic void didFail(Throwable error) Description copied from interface:AgentLifecycle callback invoked immediately after thisAgentthrowserror.
 - 
hostUripublic final Uri hostUri() ThisAgent'shostUri.
 - 
nodeUripublic final Uri nodeUri() ThisAgent'snodeUri.
 - 
agentIdpublic final Value agentId() 
 - 
propspublic final Value props() ARecordthat maps every dynamic property innodeUri(), as defined byAgentRoute.pattern(), to its value. An empty result indicates thatnodeUricontains no dynamic components.
 - 
stagepublic final Stage stage() The single-threaded executionStageon which thisAgentContextruns its application logic.
 - 
asyncStagepublic final Stage asyncStage() The multi-threaded executionStageon which thisAgentContextcan run asynchronous operations.
 - 
lanepublic final Lane lane() Returns the currently executing lane, or null if not currently executing a lane or link callback.
 - 
linkpublic final Link link() Returns the currently executing link, or null if not currently executing a link callback.
 - 
agentspublic FingerTrieSeq<Agent> agents() 
 - 
openAgentpublic <A extends Agent> A openAgent(Value id, Value props, AgentFactory<A> agentFactory) 
 - 
openAgentpublic <A extends Agent> A openAgent(Value id, AgentFactory<A> agentFactory) 
 - 
openAgentpublic <A extends Agent> A openAgent(String name, AgentFactory<A> agentFactory) 
 - 
closeAgentpublic void closeAgent(Value id) 
 - 
closeAgentpublic void closeAgent(String name) 
 - 
isSecurepublic 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.
 - 
securityProtocolpublic 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.
 - 
cipherSuitepublic 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.
 - 
localAddresspublic InetSocketAddress localAddress() Returns the local internet address of the currently executing link, or null if not currently executing a link callback.
 - 
localIdentitypublic 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.
 - 
localPrincipalpublic 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.
 - 
localCertificatespublic 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.
 - 
remoteAddresspublic InetSocketAddress remoteAddress() Returns the remote internet address of the currently executing link, or null if not currently executing a link callback.
 - 
remoteIdentitypublic 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.
 - 
remotePrincipalpublic 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.
 - 
remoteCertificatespublic 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.
 - 
commandLanepublic final <V> CommandLane<V> commandLane() - Specified by:
- commandLanein interface- LaneFactory
 
 - 
demandLanepublic final <V> DemandLane<V> demandLane() - Specified by:
- demandLanein interface- LaneFactory
 
 - 
demandMapLanepublic final <K,V> DemandMapLane<K,V> demandMapLane() - Specified by:
- demandMapLanein interface- LaneFactory
 
 - 
httpLanepublic final <V> HttpLane<V> httpLane() - Specified by:
- httpLanein interface- LaneFactory
 
 - 
joinMapLanepublic final <L,K,V> JoinMapLane<L,K,V> joinMapLane() - Specified by:
- joinMapLanein interface- LaneFactory
 
 - 
joinValueLanepublic final <K,V> JoinValueLane<K,V> joinValueLane() - Specified by:
- joinValueLanein interface- LaneFactory
 
 - 
listLanepublic final <V> ListLane<V> listLane() - Specified by:
- listLanein interface- LaneFactory
 
 - 
mapLanepublic final <K,V> MapLane<K,V> mapLane() - Specified by:
- mapLanein interface- LaneFactory
 
 - 
spatialLanepublic final <K,S,V> SpatialLane<K,S,V> spatialLane(Z2Form<S> shapeForm) - Specified by:
- spatialLanein interface- LaneFactory
 
 - 
geospatialLanepublic final <K,V> SpatialLane<K,R2Shape,V> geospatialLane() - Specified by:
- geospatialLanein interface- LaneFactory
 
 - 
supplyLanepublic final <V> SupplyLane<V> supplyLane() - Specified by:
- supplyLanein interface- LaneFactory
 
 - 
valueLanepublic final <V> ValueLane<V> valueLane() - Specified by:
- valueLanein interface- LaneFactory
 
 - 
wsLanepublic final <I,O> WsLane<I,O> wsLane() - Specified by:
- wsLanein interface- LaneFactory
 
 - 
spatialDatapublic final <S> SpatialData<Value,S,Value> spatialData(Value name, Z2Form<S> shapeForm) - Specified by:
- spatialDatain interface- Store
 
 - 
spatialDatapublic final <S> SpatialData<Value,S,Value> spatialData(String name, Z2Form<S> shapeForm) - Specified by:
- spatialDatain interface- Store
 
 - 
geospatialDatapublic final SpatialData<Value,R2Shape,Value> geospatialData(Value name) - Specified by:
- geospatialDatain interface- Store
 
 - 
geospatialDatapublic final SpatialData<Value,R2Shape,Value> geospatialData(String name) - Specified by:
- geospatialDatain interface- Store
 
 - 
downlinkpublic final EventDownlink<Value> downlink() - Specified by:
- downlinkin interface- DownlinkFactory
 
 - 
downlinkListpublic final ListDownlink<Value> downlinkList() - Specified by:
- downlinkListin interface- DownlinkFactory
 
 - 
downlinkMappublic final MapDownlink<Value,Value> downlinkMap() - Specified by:
- downlinkMapin interface- DownlinkFactory
 
 - 
downlinkValuepublic final ValueDownlink<Value> downlinkValue() - Specified by:
- downlinkValuein interface- DownlinkFactory
 
 - 
downlinkHttppublic final <V> HttpDownlink<V> downlinkHttp() - Specified by:
- downlinkHttpin interface- DownlinkFactory
 
 - 
downlinkWspublic final <I,O> WsDownlink<I,O> downlinkWs() - Specified by:
- downlinkWsin interface- DownlinkFactory
 
 - 
commandpublic final void command(Uri hostUri, Uri nodeUri, Uri laneUri, float prio, Value body, Cont<CommandMessage> cont) 
 - 
commandpublic final void command(String hostUri, String nodeUri, String laneUri, float prio, Value body, Cont<CommandMessage> cont) 
 - 
commandpublic final void command(Uri hostUri, Uri nodeUri, Uri laneUri, Value body, Cont<CommandMessage> cont) 
 - 
commandpublic final void command(String hostUri, String nodeUri, String laneUri, Value body, Cont<CommandMessage> cont) 
 - 
commandpublic final void command(Uri nodeUri, Uri laneUri, float prio, Value body, Cont<CommandMessage> cont) 
 - 
commandpublic final void command(String nodeUri, String laneUri, float prio, Value body, Cont<CommandMessage> cont) 
 - 
commandpublic final void command(Uri nodeUri, Uri laneUri, Value body, Cont<CommandMessage> cont) 
 - 
commandpublic final void command(String nodeUri, String laneUri, Value body, Cont<CommandMessage> cont) 
 - 
commandpublic final void command(String hostUri, String nodeUri, String laneUri, float prio, Value body) 
 - 
tracepublic void trace(Object message) Description copied from interface:LogLogs a trace-level message.
 - 
debugpublic void debug(Object message) Description copied from interface:LogLogs a debug-level message.
 - 
infopublic void info(Object message) Description copied from interface:LogLogs an info-level message.
 - 
warnpublic void warn(Object message) Description copied from interface:LogLogs a warn-level message.
 - 
errorpublic void error(Object message) Description copied from interface:LogLogs an error-level message.
 - 
failpublic void fail(Object message) Description copied from interface:LogLogs an fail-level message.
 - 
timerpublic final TimerRef timer(TimerFunction timer) Description copied from interface:ScheduleReturns an unscheduledTimerRefbound totimer, which can later be used to scheduletimer.
 - 
setTimerpublic final TimerRef setTimer(long millis, TimerFunction timer) Description copied from interface:ScheduleSchedulestimerto execute aftermillismilliseconds have elapsed. Returns aTimerRefthat can be used to check the status of, reschedule, and canceltimer.
 
- 
 
-