StateMachine
instance is required to construct a
caplin.trading.trademodel.Trade instance.<?xml version="1.0" encoding="UTF-8" ?> <tradeModels> <tradeModel name="ESP" initialState="Initial"> <state name="Initial"> <transition target="OpenSent" trigger="Open" source="client"/> </state> <state name="OpenSent" timeout="10" timeoutEvent="Timeout"> <transition target="Opened" trigger="OpenAck" source="server"/> </state> <state name="Opened"> <transition target="TradeConfirmed" trigger="TradeConfirmation" source="server"/> <transition target="TradePassed" trigger="Pass" source="server"/> <transition target="TradeExpired" trigger="Expired" source="server"/> </state> <state name="TradeConfirmed"> </state> <state name="TradePassed"> </state> <state name="TradeExpired"> </state> </tradeModel> </tradeModels>
The XML configuration file contains all possible routes a trade can traverse on its way to completion, whether or not it is successful. There are a number of states, each containing a number of transitions that cause the trade model to move to other states. A transition defines the message that will cause the change to occur, and the new state the model will move into. Transition events correlate to either server-side or client-side trade messages.
Attributes | Name and Description |
---|---|
|
caplin.trading.statemachine.StateMachineFactory()
Constructs a caplin.trading.statemachine.StateMachineFactory. |
Attributes | Name and Description |
---|---|
|
caplin.trading.statemachine.StateMachine
getStateMachine(String sModelName)
Returns a new StateMachine for the specified model name. |
|
void
loadModels(String sFileUrl)
Loads the models into the factory from the given file at the specified url. |
|
void
loadModelsFromXml(String sXmlString)
Loads the models into the factory from the specified XML string. |
|
void
loadModelsFromXmlElement( XML)
Loads the models into the factory from the specified XML DOM element. |
►
caplin.trading.statemachine.StateMachineFactory()
Constructs a caplin.trading.statemachine.StateMachineFactory.
►
caplin.trading.statemachine.StateMachine
getStateMachine(String sModelName)
Returns a new StateMachine for the specified model name.
String | sModelName | The model name for the wanted StateMachine. |
►
void
loadModels(String sFileUrl)
Loads the models into the factory from the given file at the specified url.
String | sFileUrl | The URL of the file to load the models from. |
►
void
loadModelsFromXml(String sXmlString)
Loads the models into the factory from the specified XML string.
String | sXmlString | The XML to load the models from. |
►
void
loadModelsFromXmlElement( XML)
Loads the models into the factory from the specified XML DOM element.
XML | DOM element to load the models from. |