Coverage Report - ca.uhn.hl7v2.protocol.Initiator
 
Classes in this File Line Coverage Branch Coverage Complexity
Initiator
N/A
N/A
1
 
 1  
 /*
 2  
  * Created on 16-Apr-2004
 3  
  */
 4  
 package ca.uhn.hl7v2.protocol;
 5  
 
 6  
 import java.util.List;
 7  
 
 8  
 import ca.uhn.hl7v2.HL7Exception;
 9  
 import ca.uhn.hl7v2.model.Message;
 10  
 import ca.uhn.hl7v2.parser.Parser;
 11  
 
 12  
 /**
 13  
  * <p>A convenient way for the initiator of a message exchange to send a 
 14  
  * message to a remote server and await the response in the same thread.</p>  
 15  
  * 
 16  
  * <p>Acknowledgements, threading, and accept-level retries are handled by 
 17  
  * an associated <code>Processor</code>.</p>
 18  
  * 
 19  
  * <p>Recall that acknowledgement requirements are specified in MSH fields 15 
 20  
  * and 16 (see HL7 v2.5 chapter 2), so the sender has control.  If no response is 
 21  
  * needed, and you would like this call to return right away, specify that no 
 22  
  * acknowledgements are required.</p> 
 23  
  * 
 24  
  * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
 25  
  * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:38 $ by $Author: jamesagnew $
 26  
  */
 27  
 public interface Initiator {
 28  
     
 29  
     /**
 30  
      * Encodes a message, sends it to a remote system, awaits the response, 
 31  
      * parses it, and returns it.  The response may be null if the message doesn't 
 32  
      * require an application-level acknowledgement.   
 33  
      *  
 34  
      * @param theMessage the message to send to the remote system
 35  
      * @return the response from the remote system 
 36  
      */
 37  
     public Message sendAndReceive(Message theMessage) throws HL7Exception;
 38  
     
 39  
     /**
 40  
      * @return the <code>Parser</code> that is used to encode outbound messages
 41  
      * and parse inbound ones.  It may be of interest to set certain parameters 
 42  
      * of this parser, for example whether to use XML encoding.   
 43  
      */
 44  
     public Parser getParser();
 45  
     
 46  
     /**
 47  
      * @return the <code>Processor</code> instance that is used to perform the message
 48  
      * exchange   
 49  
      */
 50  
     public Processor getUnderlyingProcessor();
 51  
     
 52  
     /**
 53  
      * @return the list of fields that will be included as metadata when a <code>Message</code>
 54  
      * is converted to a <code>Transportable</code>.  Each field is a <code>Terser</code>
 55  
      * path (type String).  
 56  
      */
 57  
     public List<String> getMetadataFields();
 58  
         
 59  
 }