com.teraspaces.qwfix.ordermanager
Class FIXOrderManager

java.lang.Object
  extended by com.teraspaces.qwfix.ordermanager.FIXOrderManager

public final class FIXOrderManager
extends Object

Provides global methods for QWFIX Order Manager related operations. This class cannot be inherited.


Field Summary
static Object syncRoot
          The global synchronization object.
 
Constructor Summary
FIXOrderManager()
           
 
Method Summary
static FIXOrderManagerSettings addFIXEngine(FIXEngine engine, com.teraspaces.visuallambda.VisualLambdaModuleFactory visualLambdaLoader)
          Initializes the order management support on a given FIXEngine.
static void addListener(FIXOrderManagerListener listener)
           
static boolean enableRemoteManagementService(FIXStandaloneApplication application)
          Enables the remote management service by registering the service to the application.
static FIXSessionOrderList getSessionOrderList(FIXSessionPersistence sessionPersistence)
          Gets the session order list.
static FIXSessionOrderManager getSessionOrderManager(FIXMessage message)
          Gets the FIXSessionOrderManager by the FIXSession of the input message.
static FIXSessionOrderManager getSessionOrderManager(FIXSession session)
          Gets the session order manager.
static FIXSessionOrderManager getSessionOrderManager(FIXSessionPersistence sessionPersistence)
          Gets the FIXSessionOrderManager by the FIXSession of the input session persistence.
static boolean isOrderManagerSupported(FIXEngineSettings engineSettings, com.teraspaces.visuallambda.VisualLambdaModuleFactory visualLambdaLoader)
          Determines whether order manager is supported in the specified engine settings.
static void removeFIXEngine(FIXEngine engine)
           
static void removeListener(FIXOrderManagerListener listener)
           
static void reset()
          Remove all registered instances of FIXEngine and reset the order manager.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

syncRoot

public static final Object syncRoot
The global synchronization object.

The FIXOrderManager is designed to process FIX messages in order. While the underlying FIX engine may process FIX messages in different FIX sessions with different direction in parallel, the FIXOrdermanager will only process one FIX message at any given time.

The syncRoot is used to synchronize the message process globally. It is used in most of the public methods and properties in QWFIX Order Manager component.

Sometimes applications may need to acquire lock to syncRoot, too. For example, application may acquire lock before sending new order messages to prevent incoming execution messages from being processed before the send order methods return. Application may also need to acquire the lock before access multiple properties about an order order to make sure the order order is not updated during the process.

Constructor Detail

FIXOrderManager

public FIXOrderManager()
Method Detail

getSessionOrderManager

public static FIXSessionOrderManager getSessionOrderManager(FIXMessage message)
Gets the FIXSessionOrderManager by the FIXSession of the input message.

Parameters:
message - the message
Returns:
the session order manager; or null if session is not supported

getSessionOrderManager

public static FIXSessionOrderManager getSessionOrderManager(FIXSessionPersistence sessionPersistence)
Gets the FIXSessionOrderManager by the FIXSession of the input session persistence.

Parameters:
sessionPersistence - the session persistence
Returns:
the session order manager; or null if session is not supported

getSessionOrderList

public static FIXSessionOrderList getSessionOrderList(FIXSessionPersistence sessionPersistence)
Gets the session order list.

Parameters:
sessionPersistence - the session persistence
Returns:
the session order list; or null is session is not supported

getSessionOrderManager

public static FIXSessionOrderManager getSessionOrderManager(FIXSession session)
Gets the session order manager.

Parameters:
session - the session
Returns:
the session order manager; or null if session is not supported

enableRemoteManagementService

public static boolean enableRemoteManagementService(FIXStandaloneApplication application)
Enables the remote management service by registering the service to the application.

This method returns false if the session management service is not enabled in application. User needs to enable it using the Enterprise Manager GUI tool.

This operation calls FIXStandaloneApplication.registerRemoteService(String, com.teraspaces.qwframework.communication.QWRemoteServiceActivator) to register the service.

Parameters:
application - the application
Returns:
true if the operation succeeds; otherwise false

isOrderManagerSupported

public static boolean isOrderManagerSupported(FIXEngineSettings engineSettings,
                                              com.teraspaces.visuallambda.VisualLambdaModuleFactory visualLambdaLoader)
Determines whether order manager is supported in the specified engine settings.

Parameters:
engineSettings - the engine settings
visualLambdaLoader - the visual lambda loader
Returns:
true if order manager is supported; otherwise, false

reset

public static void reset()
Remove all registered instances of FIXEngine and reset the order manager.

This method should be called before FIXEngine.unloadAll()


addFIXEngine

public static FIXOrderManagerSettings addFIXEngine(FIXEngine engine,
                                                   com.teraspaces.visuallambda.VisualLambdaModuleFactory visualLambdaLoader)
Initializes the order management support on a given FIXEngine.

The settings of the order manager is retrieved by calling to FIXEngineSettings.getBusinessLogicHandlerSettingsXml(String)

The visualLambdaLoader is used to load the visual lambda custom modules associated with the order manager.

This method registers session message handlers to the supported session using FIXEngine.setEngineMessageHandler(FIXSession, FIXEngineMessageHandler, String...), the order flow will be handled by the code in order manager.

Parameters:
engine - the engine
visualLambdaLoader - the visual lambda loader
Returns:
an instance of FIXOrderManagerSettings; or null if order manager is not supported

addListener

public static void addListener(FIXOrderManagerListener listener)

removeListener

public static void removeListener(FIXOrderManagerListener listener)

removeFIXEngine

public static void removeFIXEngine(FIXEngine engine)