@Domain public class Broker extends Object
Brokers may be local or non-local (remote), and they may be wholesale or non-wholesale (retail) brokers. Remote brokers receive messages through JMS, while local brokers are assumed to reside in the server's process space where they receive messages by calls to their receiveMessage() methods. Local brokers must override receiveMessage() to see these messages, otherwise they will be dropped on the floor. Local brokers can send messages by calling BrokerProxy.routeMessage();
Wholesale brokers are not permitted to offer tariffs, but may trade in the wholesale market, and they are not included in the balancing process.
Constructor and Description |
---|
Broker(String username)
Constructor for username only.
|
Broker(String username,
boolean local,
boolean wholesale)
Constructor to specify non-standard local/wholesale flags.
|
Modifier and Type | Method and Description |
---|---|
Broker |
addMarketPosition(MarketPosition posn,
int slot)
Associates a MarketPosition with a given Timeslot.
|
Broker |
addMarketPosition(MarketPosition posn,
Timeslot slot)
Deprecated.
|
MarketPosition |
findMarketPositionByTimeslot(int slot)
Returns the MarketPosition associated with the given Timeslot.
|
MarketPosition |
findMarketPositionByTimeslot(Timeslot slot)
Deprecated.
|
double |
getCashBalance()
Returns broker's cash balance.
|
long |
getId()
Returns the unique ID for this broker
|
int |
getIdPrefix()
Returns the ID prefix for this broker.
|
String |
getKey()
Returns the jms ID for this broker.
|
String |
getPassword() |
String |
getUsername()
Returns the username for this Broker.
|
boolean |
isEnabled()
True just in case either the broker is logged in, or is a local wholesale
broker.
|
boolean |
isLocal()
True for a Broker that is local to the server.
|
boolean |
isWholesale()
True for a broker that operates on the wholeside of the wholesale market.
|
void |
receiveMessage(Object object)
Default implementation does nothing.
|
void |
setEnabled(boolean enabled)
Enables this Broker.
|
void |
setIdPrefix(int prefix)
Sets the ID prefix for this broker.
|
void |
setKey(String key)
Sets the jms key for a remote broker.
|
void |
setLocal(boolean value)
Allows subclasses to set themselves as local brokers.
|
void |
setPassword(String newPassword) |
void |
setQueueName(String queueName)
Sets the broker's queue name.
|
void |
setWholesale(boolean value)
Allows subclasses to make themselves wholesale brokers
|
String |
toQueueName()
Returns the broker's queue name if it's been set, otherwise the default
queue name.
|
String |
toString() |
void |
updateCash(double depositAmount)
Updates broker's cash position.
|
public Broker(String username)
public Broker(String username, boolean local, boolean wholesale)
public long getId()
public void setKey(String key)
public String getKey()
public void setIdPrefix(int prefix)
public int getIdPrefix()
public void updateCash(double depositAmount)
public double getCashBalance()
@StateChange public Broker addMarketPosition(MarketPosition posn, int slot)
@Deprecated public Broker addMarketPosition(MarketPosition posn, Timeslot slot)
public MarketPosition findMarketPositionByTimeslot(int slot)
@Deprecated public MarketPosition findMarketPositionByTimeslot(Timeslot slot)
public String getUsername()
public String getPassword()
public void setPassword(String newPassword)
public boolean isEnabled()
public void setEnabled(boolean enabled)
public boolean isLocal()
@StateChange public void setLocal(boolean value)
public boolean isWholesale()
@StateChange public void setWholesale(boolean value)
public void setQueueName(String queueName)
public String toQueueName()
public void receiveMessage(Object object)
Copyright © 2019 Power TAC. All rights reserved.