|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| IWsHelper.java | - | - | - | - |
|
||||||||||||||
| 1 | /** | |
| 2 | * JTRunner is free software; you can redistribute it and/or modify it under the | |
| 3 | * terms of the GNU General Public License as published by the Free Software | |
| 4 | * Foundation; either version 2, or (at your option) any later version. | |
| 5 | */ | |
| 6 | ||
| 7 | package jtr.ws; | |
| 8 | ||
| 9 | import java.util.concurrent.Future; | |
| 10 | import jtr.config.ws.Binding; | |
| 11 | import jtr.config.ws.WebServiceConfig; | |
| 12 | import jtr.runners.IRunnerWs; | |
| 13 | ||
| 14 | /** | |
| 15 | * This interface defines the methods every <i>webservice helper</i> class should | |
| 16 | * expose in the JTR framework.<br> | |
| 17 | * A <i>webservice helper</i> class is meant for shielding the <code>AbstractWsRunner</code> | |
| 18 | * and its subclasses from the API actually used to access and invoke webservices.<br> | |
| 19 | * Thus a <i>webservice-enabled runner</i> should not contain code related to a particular | |
| 20 | * webservice invocation API, but should only (as far as possible at least!) rely on the | |
| 21 | * configured <code>IWsHelper</code> concrete implementation.<br> | |
| 22 | * <b>Note:</b> this interface is not meant for direct use by user-defined runners. These | |
| 23 | * <code>AbstractWsRunner</code> subclasses can leverage on their super-class' methods to | |
| 24 | * perform web-services invocation. | |
| 25 | * | |
| 26 | * @see jtr.runners.AbstractWsRunner | |
| 27 | * @see jtr.ws.IWsHelperFactory | |
| 28 | * @see jtr.config.RegisteredFactories | |
| 29 | * @author Francesco Russo (frusso@dev.java.net) | |
| 30 | * @version 4.0 | |
| 31 | * @since 3.0 | |
| 32 | */ | |
| 33 | public interface IWsHelper { | |
| 34 | ||
| 35 | /** | |
| 36 | * This method performs a request/response synchronous webservice invocation. | |
| 37 | * The <code>input</code> parameter is the invocation argument, while the | |
| 38 | * returned <code>Object</code> instance is the result of the invocation. | |
| 39 | * | |
| 40 | * @param runner The runner on whose behalf the service is invoked | |
| 41 | * @param binding The JTR description of the webservice that must be invoked | |
| 42 | * @param input The input message | |
| 43 | * @return The output of the invoked webservice | |
| 44 | * @throws jtr.ws.WsProviderException | |
| 45 | */ | |
| 46 | public Object invoke(IRunnerWs runner, Binding binding, Object input) throws WsProviderException; | |
| 47 | ||
| 48 | /** | |
| 49 | * This method performs a request only webservice invocation. | |
| 50 | * The <code>input</code> parameter is the invocation argument. | |
| 51 | * | |
| 52 | * @param runner The runner on whose behalf the service is invoked | |
| 53 | * @param binding The JTR description of the webservice that must be invoked | |
| 54 | * @param input The input message | |
| 55 | * @throws jtr.ws.WsProviderException | |
| 56 | */ | |
| 57 | public void invokeOneWay(IRunnerWs runner, Binding binding, Object input) throws WsProviderException; | |
| 58 | ||
| 59 | /** | |
| 60 | * This method performs an asynchronous invocation of the webservice described by the | |
| 61 | * <code>binding</code> parameter. The returned <code>Future</code> instance can be | |
| 62 | * used to check whether the response message has been received or not. Once the | |
| 63 | * response message has been received the provided <code>IWsResponseListener</code> | |
| 64 | * will be notified and will be able to inspect the response. | |
| 65 | * | |
| 66 | * @param runner The runner on whose behalf the service is invoked | |
| 67 | * @param binding The JTR description of the webservice that must be invoked | |
| 68 | * @param input The input message | |
| 69 | * @param rl The listener to be notified upon response reception | |
| 70 | * @return The <code>Future</code> required to check for response availability | |
| 71 | * @throws jtr.ws.WsProviderException | |
| 72 | */ | |
| 73 | public Future<?> invokeAsync(IRunnerWs runner, Binding binding, Object input, IWsResponseListener rl) throws WsProviderException; | |
| 74 | ||
| 75 | /** | |
| 76 | * This method performs an asynchronous invocation of the webservice described by the | |
| 77 | * <code>binding</code> parameter. The returned <code>IWsResponse</code> instance is | |
| 78 | * required to check for response mesage availability and to inspect the response itself. | |
| 79 | * | |
| 80 | * @param runner The runner on whose behalf the service is invoked | |
| 81 | * @param binding The JTR description of the webservice that must be invoked | |
| 82 | * @param input The input message | |
| 83 | * @return The <code>IWsResponse</code> instance required to check for response mesage | |
| 84 | * availability and to inspect the response itself | |
| 85 | * @throws jtr.ws.WsProviderException | |
| 86 | */ | |
| 87 | public IWsResponse invokeAsync(IRunnerWs runner, Binding binding, Object input) throws WsProviderException; | |
| 88 | ||
| 89 | /** | |
| 90 | * This method "translates" the provided webservice configuration derived from | |
| 91 | * the <code>jtr.xml</code> configuration file, into an object-oriented representation | |
| 92 | * tailored for the underlying webservice invocation API in use. | |
| 93 | * @param wsCfg The static webservice configuration | |
| 94 | * @throws WsProviderException | |
| 95 | * @deprecated | |
| 96 | */ | |
| 97 | @Deprecated | |
| 98 | public void generateRuntimeConfig(WebServiceConfig wsCfg) throws WsProviderException; | |
| 99 | ||
| 100 | /** | |
| 101 | * This method performs a synchronous invocation of the webservice, following a request/response pattern. | |
| 102 | * @param binding The webservice binding to be used | |
| 103 | * @return boolean The outcome of the invocation | |
| 104 | * @throws WsProviderException | |
| 105 | * @deprecated | |
| 106 | */ | |
| 107 | @Deprecated | |
| 108 | public boolean synchronousInvoke(Binding binding) throws WsProviderException; | |
| 109 | ||
| 110 | /** | |
| 111 | * This method performs an asynchronous invocation of the webservice, following a one-way messaging pattern. | |
| 112 | * @param binding The webservice binding to be used | |
| 113 | * @throws WsProviderException | |
| 114 | * @deprecated | |
| 115 | */ | |
| 116 | @Deprecated | |
| 117 | public void asynchronousInputOnlyInvoke(Binding binding) throws WsProviderException; | |
| 118 | ||
| 119 | /** | |
| 120 | * This method sets the <code>Object</code> content of a specific message part. | |
| 121 | * @param binding The webservice binding to be used | |
| 122 | * @param partName The name of the message part | |
| 123 | * @param part The actual value of the part | |
| 124 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 125 | * @throws WsProviderException | |
| 126 | * @see jtr.ws.WsMsgType | |
| 127 | * @deprecated | |
| 128 | */ | |
| 129 | @Deprecated | |
| 130 | public void setMessageObjectPart(Binding binding, String partName, Object part, WsMsgType msgType) throws WsProviderException; | |
| 131 | ||
| 132 | /** | |
| 133 | * This method sets the <code>int</code> content of a specific message part. | |
| 134 | * @param binding The webservice binding to be used | |
| 135 | * @param partName The name of the message part | |
| 136 | * @param part The actual value of the part | |
| 137 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 138 | * @see jtr.ws.WsMsgType | |
| 139 | * @deprecated | |
| 140 | */ | |
| 141 | @Deprecated | |
| 142 | public void setMessageIntPart(Binding binding, String partName, int part, WsMsgType msgType); | |
| 143 | ||
| 144 | /** | |
| 145 | * This method sets the <code>boolean</code> content of a specific message part. | |
| 146 | * @param binding The webservice binding to be used | |
| 147 | * @param partName The name of the message part | |
| 148 | * @param part The actual value of the part | |
| 149 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 150 | * @see jtr.ws.WsMsgType | |
| 151 | * @deprecated | |
| 152 | */ | |
| 153 | @Deprecated | |
| 154 | public void setMessageBooleanPart(Binding binding, String partName, boolean part, WsMsgType msgType); | |
| 155 | ||
| 156 | /** | |
| 157 | * This method sets the <code>byte</code> content of a specific message part. | |
| 158 | * @param binding The webservice binding to be used | |
| 159 | * @param partName The name of the message part | |
| 160 | * @param part The actual value of the part | |
| 161 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 162 | * @see jtr.ws.WsMsgType | |
| 163 | * @deprecated | |
| 164 | */ | |
| 165 | @Deprecated | |
| 166 | public void setMessageBytePart(Binding binding, String partName, byte part, WsMsgType msgType); | |
| 167 | ||
| 168 | /** | |
| 169 | * This method sets the <code>char</code> content of a specific message part. | |
| 170 | * @param binding The webservice binding to be used | |
| 171 | * @param partName The name of the message part | |
| 172 | * @param part The actual value of the part | |
| 173 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 174 | * @see jtr.ws.WsMsgType | |
| 175 | * @deprecated | |
| 176 | */ | |
| 177 | @Deprecated | |
| 178 | public void setMessageCharPart(Binding binding, String partName, char part, WsMsgType msgType); | |
| 179 | ||
| 180 | /** | |
| 181 | * This method sets the <code>double</code> content of a specific message part. | |
| 182 | * @param binding The webservice binding to be used | |
| 183 | * @param partName The name of the message part | |
| 184 | * @param part The actual value of the part | |
| 185 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 186 | * @see jtr.ws.WsMsgType | |
| 187 | * @deprecated | |
| 188 | */ | |
| 189 | @Deprecated | |
| 190 | public void setMessageDoublePart(Binding binding, String partName, double part, WsMsgType msgType); | |
| 191 | ||
| 192 | /** | |
| 193 | * This method sets the <code>float</code> content of a specific message part. | |
| 194 | * @param binding The webservice binding to be used | |
| 195 | * @param partName The name of the message part | |
| 196 | * @param part The actual value of the part | |
| 197 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 198 | * @see jtr.ws.WsMsgType | |
| 199 | * @deprecated | |
| 200 | */ | |
| 201 | @Deprecated | |
| 202 | public void setMessageFloatPart(Binding binding, String partName, float part, WsMsgType msgType); | |
| 203 | ||
| 204 | /** | |
| 205 | * This method sets the <code>long</code> content of a specific message part. | |
| 206 | * @param binding The webservice binding to be used | |
| 207 | * @param partName The name of the message part | |
| 208 | * @param part The actual value of the part | |
| 209 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 210 | * @see jtr.ws.WsMsgType | |
| 211 | * @deprecated | |
| 212 | */ | |
| 213 | @Deprecated | |
| 214 | public void setMessageLongPart(Binding binding, String partName, long part, WsMsgType msgType); | |
| 215 | ||
| 216 | /** | |
| 217 | * This method gets the <code>Object</code> content of a specific message part. | |
| 218 | * @param binding The webservice binding to be used | |
| 219 | * @param partName The name of the message part | |
| 220 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 221 | * @return Object The content | |
| 222 | * @throws WsProviderException | |
| 223 | * @deprecated | |
| 224 | */ | |
| 225 | @Deprecated | |
| 226 | public Object getMessageObjectPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException; | |
| 227 | ||
| 228 | /** | |
| 229 | * This method gets the <code>int</code> content of a specific message part. | |
| 230 | * @param binding The webservice binding to be used | |
| 231 | * @param partName The name of the message part | |
| 232 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 233 | * @return int The content | |
| 234 | * @throws WsProviderException | |
| 235 | * @deprecated | |
| 236 | */ | |
| 237 | @Deprecated | |
| 238 | public int getMessageIntPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException; | |
| 239 | ||
| 240 | /** | |
| 241 | * This method gets the <code>boolean</code> content of a specific message part. | |
| 242 | * @param binding The webservice binding to be used | |
| 243 | * @param partName The name of the message part | |
| 244 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 245 | * @return boolean The content | |
| 246 | * @throws WsProviderException | |
| 247 | * @deprecated | |
| 248 | */ | |
| 249 | @Deprecated | |
| 250 | public boolean getMessageBooleanPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException; | |
| 251 | ||
| 252 | /** | |
| 253 | * This method gets the <code>byte</code> content of a specific message part. | |
| 254 | * @param binding The webservice binding to be used | |
| 255 | * @param partName The name of the message part | |
| 256 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 257 | * @return byte The content | |
| 258 | * @throws WsProviderException | |
| 259 | * @deprecated | |
| 260 | */ | |
| 261 | @Deprecated | |
| 262 | public byte getMessageBytePart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException; | |
| 263 | ||
| 264 | /** | |
| 265 | * This method gets the <code>char</code> content of a specific message part. | |
| 266 | * @param binding The webservice binding to be used | |
| 267 | * @param partName The name of the message part | |
| 268 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 269 | * @return char The content | |
| 270 | * @throws WsProviderException | |
| 271 | * @deprecated | |
| 272 | */ | |
| 273 | @Deprecated | |
| 274 | public char getMessageCharPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException; | |
| 275 | ||
| 276 | /** | |
| 277 | * This method gets the <code>double</code> content of a specific message part. | |
| 278 | * @param binding The webservice binding to be used | |
| 279 | * @param partName The name of the message part | |
| 280 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 281 | * @return double The content | |
| 282 | * @throws WsProviderException | |
| 283 | * @deprecated | |
| 284 | */ | |
| 285 | @Deprecated | |
| 286 | public double getMessageDoublePart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException; | |
| 287 | ||
| 288 | /** | |
| 289 | * This method gets the <code>float</code> content of a specific message part. | |
| 290 | * @param binding The webservice binding to be used | |
| 291 | * @param partName The name of the message part | |
| 292 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 293 | * @return float The content | |
| 294 | * @throws WsProviderException | |
| 295 | * @deprecated | |
| 296 | */ | |
| 297 | @Deprecated | |
| 298 | public float getMessageFloatPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException; | |
| 299 | ||
| 300 | /** | |
| 301 | * This method gets the <code>long</code> content of a specific message part. | |
| 302 | * @param binding The webservice binding to be used | |
| 303 | * @param partName The name of the message part | |
| 304 | * @param msgType The message type (<i>input, output, fault</i>) | |
| 305 | * @return long The content | |
| 306 | * @throws WsProviderException | |
| 307 | * @deprecated | |
| 308 | */ | |
| 309 | @Deprecated | |
| 310 | public long getMessageLongPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException; | |
| 311 | ||
| 312 | /** | |
| 313 | * Returns the <code>String[]</code> of the part names of the given message. | |
| 314 | * @param binding | |
| 315 | * @param msgType | |
| 316 | * @return String[] The part names | |
| 317 | * @deprecated | |
| 318 | */ | |
| 319 | @Deprecated | |
| 320 | public String[] getMessageParts(Binding binding, WsMsgType msgType); | |
| 321 | ||
| 322 | /** | |
| 323 | * This method returns the <code>String</code> representation of the fault message associated | |
| 324 | * with the given webservice operation. | |
| 325 | * @param binding The webservice binding to be used | |
| 326 | * @return String The fault message in a human-readable format | |
| 327 | * @deprecated | |
| 328 | */ | |
| 329 | @Deprecated | |
| 330 | public String getFaultMessageAsString(Binding binding); | |
| 331 | ||
| 332 | /** | |
| 333 | * This method returns the cause of the webservice failure as a <code>WsProviderException</code> instance. | |
| 334 | * @param binding The webservice binding to be used | |
| 335 | * @return Throwable The cause of the fault | |
| 336 | * @deprecated | |
| 337 | */ | |
| 338 | @Deprecated | |
| 339 | public Throwable getFaultCause(Binding binding); | |
| 340 | } |
|
||||||||||