Skip to content

Commit 0a4ace5

Browse files
authored
increase banzai's OCP a little
allow people to redefine the most "business-logicy" parts of banzai by extending the Banzai class and one of OrderTableModel, ExecutionTableModel, and BanzaiApplication
1 parent 24d836b commit 0a4ace5

File tree

1 file changed

+15
-3
lines changed
  • quickfixj-examples/banzai/src/main/java/quickfix/examples/banzai

1 file changed

+15
-3
lines changed

quickfixj-examples/banzai/src/main/java/quickfix/examples/banzai/Banzai.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ public Banzai(String[] args) throws Exception {
7171

7272
boolean logHeartbeats = Boolean.valueOf(System.getProperty("logHeartbeats", "true"));
7373

74-
OrderTableModel orderTableModel = new OrderTableModel();
75-
ExecutionTableModel executionTableModel = new ExecutionTableModel();
76-
BanzaiApplication application = new BanzaiApplication(orderTableModel, executionTableModel);
74+
OrderTableModel orderTableModel = orderTableModel();
75+
ExecutionTableModel executionTableModel = executionTableModel();
76+
BanzaiApplication application = application(orderTableModel, executionTableModel);
7777
MessageStoreFactory messageStoreFactory = new FileStoreFactory(settings);
7878
LogFactory logFactory = new ScreenLogFactory(true, true, true, logHeartbeats);
7979
MessageFactory messageFactory = new DefaultMessageFactory();
@@ -88,6 +88,18 @@ public Banzai(String[] args) throws Exception {
8888
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
8989
}
9090

91+
protected OrderTableModel orderTableModel() {
92+
return new OrderTableModel();
93+
}
94+
95+
protected ExecutionTableModel executionTableModel() {
96+
return new ExecutionTableModel();
97+
}
98+
99+
protected BanzaiApplication application(OrderTableModel orderTableModel, ExecutionTableModel executionTableModel) {
100+
return new BanzaiApplication(orderTableModel, executionTableModel);
101+
}
102+
91103
public synchronized void logon() {
92104
if (!initiatorStarted) {
93105
try {

0 commit comments

Comments
 (0)