View Javadoc

1   /*
2      Licensed under the Apache License, Version 2.0 (the "License");
3      you may not use this file except in compliance with the License.
4      You may obtain a copy of the License at
5   
6        http://www.apache.org/licenses/LICENSE-2.0
7   
8      Unless required by applicable law or agreed to in writing, software
9      distributed under the License is distributed on an "AS IS" BASIS,
10     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11     See the License for the specific language governing permissions and
12     limitations under the License.
13  */
14  package uk.nhs.interoperability.transport;
15  
16  import com.xmlsolutions.annotation.Requirement;
17  
18  import uk.nhs.interoperability.infrastructure.ITKMessageProperties;
19  import uk.nhs.interoperability.payload.ITKMessage;
20  
21  /**
22   * Container for transport properties associated with the
23   * {@link ITKMessage}.<br/><br/>
24   * 
25   * The transport properties represented here have been drived from
26   * the useful set of properties from <code>&lt;soap/&gt;</code>
27   * however they should be abstract enough to represent for different
28   * transports such as TMS and DTS
29   * 
30   * 
31   * @see ITKMessageProperties
32   * @see ITKMessage
33   * 
34   * @author Michael Odling-Smee
35   * @author Nicholas Jones
36   * @since 0.1
37   *
38   */
39  public interface ITKTransportProperties {
40  
41  	/**
42  	 * Sets the unique transport level identifier for the
43  	 * associated message.
44  	 * 
45  	 * Typically this identifier is not
46  	 * know by, or preserved by application layer components
47  	 * and is often only pertinent to an individual transport
48  	 * hop (for example ITK WS-ADR-01 says every hop/WS invocation
49  	 * should use a new
50  	 * <code>&lt;wsa:MessageID/&gt;</code>).
51  	 * 
52  	 * @param transportMessageId
53  	 */
54  	@Requirement(traceTo="WS-ADR-01", status="abstract")
55  	public void setTransportMessageId(String transportMessageId);
56  
57  	/**
58  	 * Gets the unique transport level identifier for the
59  	 * associated message.
60  	 * 
61  	 * Typically this identifier is not
62  	 * know by, or preserved by application layer components
63  	 * and is often only pertinent to an individual transport
64  	 * hop (for example ITK WS-ADR-01 says every hop/WS invocation
65  	 * should use a new
66  	 * <code>&lt;wsa:MessageID/&gt;</code>).
67  	 * 
68  	 * @return the <code>transportMessageId</code> for
69  	 * the transport hop
70  	 */
71  	@Requirement(traceTo="WS-ADR-01", status="abstract")
72  	public String getTransportMessageId();
73  
74  	/**
75  	 * Sets the URL of the invoked service or transport hop.<br/><br/>
76  	 * 
77  	 * For SOAP this is mapped to/from <code>&lt;wsa:To/&gt;</code>
78  	 * 
79  	 * @param invokedUrl The URL of the transport hop
80  	 * destination
81  	 */
82  	public void setInvokedUrl(String invokedUrl);
83  
84  	/**
85  	 * Gets the URL of the invoked service or transport hop.<br/><br/>
86  	 * 
87  	 * For SOAP this is mapped to/from <code>&lt;wsa:To/&gt;</code>
88  	 * 
89  	 * @return the URL of the transport hop
90  	 * destination
91  	 */
92  	public String getInvokedUrl();
93  
94  	/**
95  	 * Sets the transportAction for the associated ITKMessage.<br/><br/>
96  	 * 
97  	 * For SOAP this is mapped to/from <code>&lt;wsa:Action/&gt;</code>
98  	 * 
99  	 * @param transportAction The transport action - e.g. 
100 	 * <code>urn:nhs-itk:services:201005:transferPatient-v1-0</code>
101 	 */
102 	public void setTransportAction(String transportAction);
103 
104 	/**
105 	 * Gets the transportAction for the associated ITKMessage.<br/><br/>
106 	 * 
107 	 * For SOAP this is mapped to/from <code>&lt;wsa:Action/&gt;</code>
108 	 * 
109 	 * @return The transport action - e.g. 
110 	 * <code>urn:nhs-itk:services:201005:transferPatient-v1-0</code>
111 	 */
112 	public String getTransportAction();
113 
114 	/**
115 	 * Sets the transport address property that allows asynchronous transport layer
116 	 * faults to be returned.<br/><br/>
117 	 * 
118 	 * For SOAP this is mapped to/from <code>&lt;wsa:FaultTo/&gt;</code>.<br/><br/>
119 	 * 
120 	 * Note if the transport does not support a distinct <code>faultTo</code> property
121 	 * this should be set to the same as {@link #setTransportReplyTo(String)} property
122 	 * or failing that the {@link #setTransportFrom(String)}
123 	 * 
124 	 * @param transportFaultTo The transport fault to address - e.g. 
125 	 * <code>http://myserver.com/faulthandler</code>
126 	 */
127 	public void setTransportFaultTo(String transportFaultTo);
128 
129 	/**
130 	 * Gets the transport address property that allows asynchronous transport layer
131 	 * faults to be returned.<br/><br/>
132 	 * 
133 	 * For SOAP this is mapped to/from <code>&lt;wsa:FaultTo/&gt;</code><br/><br/>
134 	 * 
135 	 * Note if the transport does not support a distinct <code>faultTo</code> property
136 	 * this should return the same as {@link #getTransportReplyTo()} property
137 	 * or failing that the {@link #getTransportFrom()}
138 	 * 
139 	 * @return The transport fault to address - e.g. 
140 	 * <code>http://myserver.com/faulthandler</code>
141 	 */
142 	public String getTransportFaultTo();
143 
144 	/**
145 	 * Sets the transport address property that allows asynchronous transport layer
146 	 * responses to be returned.<br/><br/>
147 	 * 
148 	 * For SOAP this is mapped to/from <code>&lt;wsa:ReplyTo/&gt;</code>.<br/><br/>
149 	 * 
150 	 * Note if the transport does not support a distinct <code>replyTo</code> property
151 	 * this should be set to the same as the {@link #setTransportFrom(String)}
152 	 * 
153 	 * @param transportReplyTo The transport reply to address - e.g. 
154 	 * <code>http://myserver.com/responsehandler</code>
155 	 */
156 	public void setTransportReplyTo(String transportReplyTo);
157 
158 	/**
159 	 * Gets the transport address property that allows asynchronous transport layer
160 	 * responses to be returned.<br/><br/>
161 	 * 
162 	 * For SOAP this is mapped to/from <code>&lt;wsa:ReplyTo/&gt;</code>.<br/><br/>
163 	 * 
164 	 * Note if the transport does not support a distinct <code>replyTo</code> property
165 	 * this should return the same as the {@link #getTransportFrom()}
166 	 * 
167 	 * @return The transport reply to address - e.g. 
168 	 * <code>http://myserver.com/responsehandler</code>
169 	 */
170 	public String getTransportReplyTo();
171 
172 	/**
173 	 * Sets the transport relates to property that allows asynchronous transport layer
174 	 * messages to be correlated with their associated requests.<br/><br/>
175 	 * 
176 	 * For SOAP this is mapped to/from <code>&lt;wsa:RelatesTo/&gt;</code>.<br/><br/>
177 	 * 
178 	 * @param transportRelatesTo The message id of the message to which this relates.
179 	 * For request messages this should be <code>null</code>
180 	 */
181 	public void setTransportRelatesTo(String transportRelatesTo);
182 
183 	/**
184 	 * Gets the transport relates to property that allows asynchronous transport layer
185 	 * messages to be correlated with their associated requests.<br/><br/>
186 	 * 
187 	 * For SOAP this is mapped to/from <code>&lt;wsa:RelatesTo/&gt;</code>.<br/><br/>
188 	 * 
189 	 * @return The message id of the message to which this relates.
190 	 * For request messages this will return <code>null</code>
191 	 */
192 	public String getTransportRelatesTo();
193 
194 	/**
195 	 * Sets the transport hop destination. Typically (at least for SOAP)
196 	 * this may be equivalent to {@link #setInvokedUrl(String)}
197 	 * 
198 	 * @param transportTo The destination system address
199 	 */
200 	public void setTransportTo(String transportTo);
201 
202 	/**
203 	 * Gets the transport hop destination. Typically (at least for SOAP)
204 	 * this may be equivalent to {@link #getInvokedUrl()}
205 	 * 
206 	 * @return The destination system address
207 	 */
208 	public String getTransportTo();
209 
210 	/**
211 	 * Sets the transport from address property - this may be used to return
212 	 * asynchronous responses to the originator.<br/><br/>
213 	 * 
214 	 * For SOAP this is mapped to/from <code>&lt;wsa:From/&gt;</code>.<br/><br/>
215 	 * 
216 	 * @param transportFrom The address of the message originator
217 	 */
218 	public void setTransportFrom(String transportFrom);
219 
220 	/**
221 	 * Gets the transport from address property - this may be used to return
222 	 * asynchronous responses to the originator.<br/><br/>
223 	 * 
224 	 * For SOAP this is mapped to/from <code>&lt;wsa:From/&gt;</code>.<br/><br/>
225 	 * 
226 	 * @return The address of the message originator
227 	 */
228 	public String getTransportFrom();
229 	
230 	/**
231 	 * Sets the transport type associated with this transport hop
232 	 * 
233 	 * @param transportType The transportType. Can be one of
234 	 * {@link ITKTransportRoute#DTS}; {@link ITKTransportRoute#HTTP_WS};
235 	 * {@link ITKTransportRoute#SPINE_TMS} or {@link ITKTransportRoute#UNKNOWN}
236 	 */
237 	public void setTransportType(String transportType);
238 	
239 	/**
240 	 * Convenience method to return a fully constructed
241 	 * {@link ITKTransportRoute} for returning asynchronous
242 	 * response messages to.
243 	 * 
244 	 * @return A fully constructed {@link ITKTransportRoute} or <code>null</code>
245 	 * if there is no {@link #getTransportReplyTo()} address specified. 
246 	 */
247 	public ITKTransportRoute getTransportReplyToRoute();
248 	
249 	/**
250 	 * Convenience method to return a fully constructed
251 	 * {@link ITKTransportRoute} for returning asynchronous
252 	 * faults to.
253 	 * 
254 	 * @return A fully constructed {@link ITKTransportRoute} or <code>null</code>
255 	 * if there is no {@link #getTransportFaultTo()} address specified. 
256 	 */
257 	public ITKTransportRoute getTransportFaultToRoute();
258 
259 }