@Service public class PowerTacBroker extends Object implements BrokerContext
| Constructor and Description |
|---|
PowerTacBroker()
Default constructor for remote broker deployment
|
| Modifier and Type | Method and Description |
|---|---|
org.joda.time.Instant |
getBaseTime()
Returns the simulation base time
|
Broker |
getBroker()
Returns the "real" broker underneath this monstrosity
|
List<String> |
getBrokerList()
Returns the broker's list of competing brokers - non-public
|
String |
getBrokerUsername()
Returns the username for this broker
|
long |
getServerTimeOffset()
Returns the computed server time offset after login.
|
protected int |
getTimeslotCompleted() |
int |
getUsageRecordLength()
Returns the length of the standard data array (24h * 7d)
|
void |
handleMessage(BrokerAccept accept)
BrokerAccept comes out when our authentication credentials are accepted
and we become part of the game.
|
void |
handleMessage(Competition comp)
Handles the Competition instance that arrives at beginning of game.
|
void |
handleMessage(SimEnd se)
Receives the SimEnd message, which ends the broker session.
|
void |
handleMessage(SimPause sp)
Receives the SimPause message, used to pause the clock.
|
void |
handleMessage(SimResume sr)
Receives the SimResume message, used to update the clock.
|
void |
handleMessage(SimStart ss)
Receives the SimStart message, used to start the clock.
|
void |
handleMessage(TimeslotComplete tc)
TimeslotComplete is the last message sent by the server in each timeslot.
|
void |
handleMessage(TimeslotUpdate tu)
Updates the sim clock on receipt of the TimeslotUpdate message,
which should be the first to arrive in each timeslot.
|
void |
init()
Sets up the "adapter" broker, initializes the other services, registers
for incoming messages.
|
void |
registerMessageHandler(Object handler,
Class<?> messageType)
Delegates registrations to the router
|
void |
run()
Logs in and waits for the sim to end.
|
void |
sendMessage(Object message)
Sends an outgoing message.
|
void |
startSession(org.apache.commons.configuration2.PropertiesConfiguration cli,
File configFile,
long end)
Starts a new session, setting parameters from command-line and from
config file.
|
public PowerTacBroker()
public void startSession(org.apache.commons.configuration2.PropertiesConfiguration cli,
File configFile,
long end)
public void init()
public void run()
public Broker getBroker()
getBroker in interface BrokerContextpublic String getBrokerUsername()
getBrokerUsername in interface BrokerContextpublic org.joda.time.Instant getBaseTime()
getBaseTime in interface BrokerContextpublic int getUsageRecordLength()
getUsageRecordLength in interface BrokerContextpublic List<String> getBrokerList()
getBrokerList in interface BrokerContextpublic long getServerTimeOffset()
public void registerMessageHandler(Object handler, Class<?> messageType)
registerMessageHandler in interface BrokerContextpublic void sendMessage(Object message)
sendMessage in interface BrokerContextpublic void handleMessage(BrokerAccept accept)
public void handleMessage(Competition comp)
public void handleMessage(SimPause sp)
public void handleMessage(SimResume sr)
public void handleMessage(SimStart ss)
public void handleMessage(SimEnd se)
public void handleMessage(TimeslotUpdate tu)
public void handleMessage(TimeslotComplete tc)
protected int getTimeslotCompleted()
Copyright © 2018 Power TAC. All rights reserved.