View Javadoc

1   package ca.uhn.hl7v2.hoh.api;
2   
3   import java.net.URL;
4   import java.nio.charset.Charset;
5   
6   import ca.uhn.hl7v2.hoh.sign.ISigner;
7   import ca.uhn.hl7v2.hoh.sockets.ISocketFactory;
8   import ca.uhn.hl7v2.hoh.sockets.StandardSocketFactory;
9   
10  public interface IClient {
11  
12  	/**
13  	 * Getter for the host (e.g. "10.0.0.111" or "localhost")
14  	 */
15  	String getHost();
16  
17  	/**
18  	 * Getter for the port (e.g. 80 for standard HTTP)
19  	 */
20  	int getPort();
21  
22  	/**
23  	 * Returns the socket factory used by this client
24  	 */
25  	ISocketFactory getSocketFactory();
26  
27  	/**
28  	 * Getter for the "Path" portion of the URL. This is the path portion which
29  	 * comes after the host and port, so for example if this client is being
30  	 * used to send messages to
31  	 * <code>http://somehost.com:8888/messaging/receiver.jsp</code>, the URI
32  	 * path portion would be <code>/messaging/receiver.jsp</code>
33  	 */
34  	String getUriPath();
35  
36  	/**
37  	 * Getter for the URL to send messages to. 
38  	 */
39  	URL getUrl();
40  
41  	/**
42  	 * If set, provides a callback which will be used to se the username and
43  	 * password associated with the request
44  	 */
45  	void setAuthorizationCallback(IAuthorizationClientCallback theAuthorizationCallback);
46  
47  	/**
48  	 * <p>
49  	 * Sets the charset to use for requests from this client. May be changed at
50  	 * any time.
51  	 * </p>
52  	 * <p>
53  	 * Default is UTF-8
54  	 * </p>
55  	 */
56  	void setCharset(Charset theCharset);
57  
58  	/**
59  	 * Setter for the host (e.g. "10.0.0.111" or "localhost")
60  	 */
61  	void setHost(String theHost);
62  
63  	/**
64  	 * Setter for the "Path" portion of the URL. This is the path portion which
65  	 * comes after the host and port, so for example if this client is being
66  	 * used to send messages to
67  	 * <code>http://somehost.com:8888/messaging/receiver.jsp</code>, the URI
68  	 * path portion would be <code>/messaging/receiver.jsp</code>
69  	 */
70  	void setUriPath(String thePath);
71  
72  	/**
73  	 * Getter for the port (e.g. 80 for standard HTTP)
74  	 */
75  	void setPort(int thePort);
76  
77  	/**
78  	 * Sets the number of milliseconds before timing out. Default is
79  	 * {@link #DEFAULT_RESPONSE_TIMEOUT}
80  	 * 
81  	 * @param theResponseTimeout
82  	 *            The millis to wait before timeout.
83  	 * @see #DEFAULT_RESPONSE_TIMEOUT
84  	 */
85  	void setResponseTimeout(long theResponseTimeout);
86  
87  	/**
88  	 * @param theSigner
89  	 *            If provided, sets the Signature Profile signer implementation
90  	 *            to use. See <a href=
91  	 *            "http://hl7api.sourceforge.net/hapi-hl7overhttp/specification.html#SIGNATURE_PROFILE"
92  	 *            >http://hl7api.sourceforge.net/hapi-hl7overhttp/specification.
93  	 *            html#SIGNATURE_PROFILE</a>
94  	 */
95  	void setSigner(ISigner theSigner);
96  
97  	/**
98  	 * Sets the socket factory used by this client. Default is
99  	 * {@link StandardSocketFactory}.
100 	 * 
101 	 * @see ISocketFactory
102 	 */
103 	void setSocketFactory(ISocketFactory theSocketFactory);
104 
105 	/**
106 	 * Setter for the URL to send messages to. 
107 	 * Note that invoking this method replaces any values that have been 
108 	 * provided to {@link #setHost(String)}, {@link #setPort(int)}, or {@link #setUriPath(String)}
109 	 */
110 	void setUrl(URL theUrl);
111 
112 	/**
113 	 * Setter for the URL to send messages to. 
114 	 * Note that invoking this method replaces any values that have been 
115 	 * provided to {@link #setHost(String)}, {@link #setPort(int)}, or {@link #setUriPath(String)}
116 	 */
117 	void setUrlString(String theString);
118 
119 	/**
120 	 * Getter for the URL to send messages to. 
121 	 */
122 	String getUrlString();
123 
124 }