org.marketcetera.ors
Class ReplyPersister

java.lang.Object
  extended by org.marketcetera.ors.ReplyPersister
All Implemented Interfaces:
ReportSavedListener

public class ReplyPersister
extends Object
implements ReportSavedListener

A persister of trade messages (replies) sent by the ORS to clients. It also handles mapping of messages to actors/viewers, via either replies previously persisted, or via an in-memory cache.

Since:
1.0.0
Version:
$Id: ReplyPersister.java 16161 2012-07-16 20:27:32Z colin $
Author:
tlerios@marketcetera.com

Constructor Summary
ReplyPersister(ReportHistoryServices historyServices, OrderInfoCache cache)
          Creates a new persister which relies on the given report history services provider for persistence operations.
 
Method Summary
 OrderInfo addOutgoingOrder(Message msg, UserID actorID)
          Adds the given outgoing order message, with the given actorID, to the receiver's cache, and returns the new cache entry.
 Principals getPrincipals(Message inMessage, boolean isAck)
          Returns the principals associated with the given message.
 void persistReply(TradeMessage msg)
          Persists the given message, which, while doing so, may be modified.
 void reportSaved(ReportBase report, boolean status)
          Called after the given report has been saved onto the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplyPersister

public ReplyPersister(ReportHistoryServices historyServices,
                      OrderInfoCache cache)
Creates a new persister which relies on the given report history services provider for persistence operations.

Parameters:
historyServices - The report history services provider.
Method Detail

reportSaved

public void reportSaved(ReportBase report,
                        boolean status)
Description copied from interface: ReportSavedListener
Called after the given report has been saved onto the database. The given flag indicates whether saving completed successfully or not.

Specified by:
reportSaved in interface ReportSavedListener
Parameters:
report - The report.
status - True if saving completed successfully.

persistReply

public void persistReply(TradeMessage msg)
Persists the given message, which, while doing so, may be modified. Persistence may be effected synchronously or asynchronously.

Parameters:
msg - The message.

addOutgoingOrder

public OrderInfo addOutgoingOrder(Message msg,
                                  UserID actorID)
Adds the given outgoing order message, with the given actorID, to the receiver's cache, and returns the new cache entry.

Parameters:
msg - The message.
actorID - The actor ID.
Returns:
The new cache entry, or null if one could not be created.

getPrincipals

public Principals getPrincipals(Message inMessage,
                                boolean isAck)
Returns the principals associated with the given message.

Parameters:
msg - The message.
isAck - True if the request is made for the purposes of processing an ORS ack.
Returns:
The principals. Any of its properties may be null if the associated principal cannot be determined; that includes the special case of returning Principals.UNKNOWN.


Copyright © 2012. All Rights Reserved.