Package jadex.micro.quickstart
Class TimeProviderAgent
- java.lang.Object
- 
- jadex.micro.quickstart.TimeProviderAgent
 
- 
- All Implemented Interfaces:
- ITimeService
 
 public class TimeProviderAgent extends java.lang.Object implements ITimeService The time provider periodically sends out time values to all subscribers. For simplicity, the agent implements the time service itself.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.Map<SubscriptionIntermediateFuture<java.lang.String>,java.text.DateFormat>subscriptionsThe subscriptions to be informed about the time.
 - 
Constructor SummaryConstructors Constructor Description TimeProviderAgent()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbody(IInternalAccess ia)Due to annotation, called once after agent is initialized.IFuture<java.lang.String>getLocation()Get the location of the platform, where the time service runs.static voidmain(java.lang.String[] args)Start a Jadex platform and the TimeProviderAgent.ISubscriptionIntermediateFuture<java.lang.String>subscribe(java.text.DateFormat format)Subscribe to the time service.
 
- 
- 
- 
Field Detail- 
subscriptionsprotected java.util.Map<SubscriptionIntermediateFuture<java.lang.String>,java.text.DateFormat> subscriptions The subscriptions to be informed about the time.
 
- 
 - 
Method Detail- 
getLocationpublic IFuture<java.lang.String> getLocation() Get the location of the platform, where the time service runs. The location is a constant value for each service, therefore it can be cached and no future is needed.- Specified by:
- getLocationin interface- ITimeService
 
 - 
subscribepublic ISubscriptionIntermediateFuture<java.lang.String> subscribe(java.text.DateFormat format) Subscribe to the time service. Every couple of seconds, a string with the current time will be sent to the subscriber.- Specified by:
- subscribein interface- ITimeService
 
 - 
bodypublic void body(IInternalAccess ia) Due to annotation, called once after agent is initialized. The internal access parameter is optional and is injected automatically.
 - 
mainpublic static void main(java.lang.String[] args) Start a Jadex platform and the TimeProviderAgent.
 
- 
 
-