001/* 002 * Created on 16-Apr-2004 003 */ 004package ca.uhn.hl7v2.protocol; 005 006import ca.uhn.hl7v2.HL7Exception; 007 008/** 009 * Represents a persistent store for incoming messages. Messages 010 * may be stored here before an accept ACK is returned. The local 011 * side of the interface then takes on responsibility for delivering 012 * the message to the application. 013 * 014 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a> 015 * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:38 $ by $Author: jamesagnew $ 016 */ 017public interface SafeStorage { 018 019 /** 020 * Stores a message so that it can be reliably retrieved and sent to 021 * the proper application, even if this service is restarted in the mean 022 * time. 023 * 024 * @param theMessage the message to store 025 * @throws HL7Exception if there is some problem accessing the store 026 */ 027 public void store(Transportable theMessage) throws HL7Exception; 028 029 /** 030 * If the given message exists in the store, it is removed. 031 * 032 * @param theMessage the message to discard 033 * @throws HL7Exception if there is some problem accessing the store 034 */ 035 public void discard(Transportable theMessage) throws HL7Exception; 036 037 /** 038 * Returns all messages that have been stored. The store retains a copy 039 * of each one until discard() is called. This method would be called 040 * after the HL7 server is restarted. 041 * 042 * @return all messages in the store 043 * @throws HL7Exception if there is some problem accessing the store 044 */ 045 public Transportable[] restore() throws HL7Exception; 046 047}