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