View Javadoc

1   /*
2    * Created on 16-Apr-2004
3    */
4   package ca.uhn.hl7v2.protocol;
5   
6   import ca.uhn.hl7v2.HL7Exception;
7   
8   /**
9    * Represents a persistent store for incoming messages.  Messages 
10   * may be stored here before an accept ACK is returned.  The local
11   * side of the interface then takes on responsibility for delivering 
12   * the message to the application.  
13   * 
14   * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
15   * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:38 $ by $Author: jamesagnew $
16   */
17  public interface SafeStorage {
18  
19      /**
20       * Stores a message so that it can be reliably retrieved and sent to 
21       * the proper application, even if this service is restarted in the mean
22       * time.
23       *  
24       * @param theMessage the message to store 
25       * @throws HL7Exception if there is some problem accessing the store
26       */
27      public void store(Transportable theMessage) throws HL7Exception;
28      
29      /**
30       * If the given message exists in the store, it is removed.
31       *   
32       * @param theMessage the message to discard
33       * @throws HL7Exception if there is some problem accessing the store
34       */
35      public void discard(Transportable theMessage) throws HL7Exception;
36      
37      /**
38       * Returns all messages that have been stored.  The store retains a copy 
39       * of each one until discard() is called.  This method would be called 
40       * after the HL7 server is restarted.
41       *      
42       * @return all messages in the store 
43       * @throws HL7Exception if there is some problem accessing the store
44       */
45      public Transportable[] restore() throws HL7Exception;
46      
47  }