1 /*2 * TransportInterface.java3 *4 * Created on 31. bøezen 2004, 17:205 */6 7 package SOFA.SOFAnet.Transport;8 9 import SOFA.SOFAnet.Core.NetOps;10 import SOFA.SOFAnet.Core.ShareOps;11 12 /**13 * Interface of transport layer of the SOFAnet.14 *15 * @author Ladislav Sobr16 */17 public interface TransportInterface18 {19 /**20 * Test whether 'push' of bundle or bundle offer is accepted by addressees.21 * <p>22 * Synchronous (waits for completion).23 * <p>24 * Input:25 * <ul>26 * <li> bundleName27 * <li> offer28 * <li> nodeName29 * <li> *OtherNodes.nodeName30 * </ul>31 * <p>32 * Output:33 * <ul>34 * <li> nodeName35 * <li> errCode36 * <ul>37 * <li> 0 == OK38 * <li> 1 == not allowed39 * </ul>40 * <li> *OtherNodes.nodeName41 * <li> *OtherNodes.errCode42 * <ul>43 * <li> 0 == OK44 * <li> 1 == not allowed45 * </ul>46 * </ul>47 *48 * @param params Input/Output data for the call49 */50 void testPush(IOParams params) throws TransportException;51 52 /**53 * Push bundle or bundle offer to nodes.54 * <p>55 * Asynchronous (doesn't wait for completion).56 * <p>57 * Input:58 * <ul>59 * <li> bundleName60 * <li> bundleData61 * <li> offer62 * <li> priority63 * <li> nodeName64 * <li> licence <i> (only if offer == false)</i>65 * <li> *OtherNodes.nodeName66 * <li> *OtherNodes.licence <i> (only if offer == false)</i>67 * </ul>68 * <p>69 * Output: none70 *71 * @param params Input data for the call72 */73 void push(IOParams params) throws TransportException;74 75 /**76 * Test whether 'pull' of bundle is accepted by source node.77 * <p>78 * Synchronous (waits for completion).79 * <p>80 * Input:81 * <ul>82 * <li> bundleName83 * <li> nodeName84 * <li> contractID85 * </ul>86 * <p>87 * Output:88 * <ul>89 * <li> errCode90 * <ul>91 * <li> 0 == OK92 * <li> 1 == not allowed93 * </ul>94 * </ul>95 *96 * @param params Input/Output data for the call97 */98 void testPull(IOParams params) throws TransportException;99 100 /**101 * Pulls bundle from node.102 * <p>103 * Asynchronous (doesn't wait for completion).104 * <p>105 * Input:106 * <ul>107 * <li> bundleName108 * <li> priority109 * <li> nodeName110 * <li> contractID111 * </ul>112 * <p>113 * Output: none (calls NetOps.deliverBundlePull)114 * 115 *116 * @param params Input data for the call117 */118 void pull(IOParams params) throws TransportException;119 120 /**121 * Pulls bundle from node.122 * <p>123 * Synchronous (waits for completion).124 * <p>125 * Input:126 * <ul>127 * <li> bundleName128 * <li> priority129 * <li> nodeName130 * <li> contractID131 * </ul>132 * <p>133 * Output:134 * <ul>135 * <li> errCode136 * <ul>137 * <li> 0 == OK138 * <li> 1 == Cannot find binary bundle139 * <li> 2 == Cannot create BundleData for bundle140 * <li> 3 == Pull not allowed141 * </ul>142 * <li> bundleData <i> (only if errCode == 0)</i>143 * <li> licence <i> (only if errCode == 0)</i>144 * </ul>145 * 146 *147 * @param params Input/Output data for the call148 */149 void synchroPull(IOParams params) throws TransportException;150 151 /**152 * Test whether source node's share manager can accept acquire.153 * <p>154 * Synchronous (waits for completion).155 * <p>156 * Input:157 * <ul>158 * <li> bundleName159 * <li> nodeName160 * </ul>161 * <p>162 * Output:163 * <ul>164 * <li> errCode165 * </ul>166 *167 *168 * @param params Input/Output data for the call169 */170 void testAcquireShared(IOParams params) throws TransportException;171 172 /**173 * Acquire bundle from node's share manager (or share client).174 * <p>175 * Synchronous (waits for completion).176 * <p>177 * Input:178 * <ul>179 * <li> bundleName180 * <li> priority181 * <li> nodeName182 * </ul>183 *184 * Output:185 * <ul>186 * <li> errCode187 * <ul>188 * <li> 0 == OK189 * <li> 1 == Not a share manager or access not allowed190 * <li> 2 == Licence not available191 * <li> 3 == Data error (binary bundle not available)192 * <li> 4 == Incosistent state of share manager193 * </ul>194 * <li> address <i> (only if errCode == 0 ; can be true only when calling share manager)</i>195 * <li> bundleData <i> (only if errCode == 0 && address == false)</i>196 * <li> addressNodeName <i> (only if errCode == 0 && address == true)</i>197 * <li> licence <i> (only if errCode == 0 and when calling share manager)</i>198 * </ul>199 * 200 *201 * @param params Input/Output data for the call202 */203 void acquireShared(IOParams params) throws TransportException;204 205 /**206 * Tests whether node (share client) can return shared bundle (it's licence) back to share manager.207 * <p>208 * Synchronous (waits for completion).209 * <p>210 * Input:211 * <ul>212 * <li> bundleName213 * <li> nodeName214 * </ul>215 *216 * Output:217 * <ul>218 * <li> errCode219 * <ul>220 * <li> 0 == OK221 * <li> 1 == Cannot return bundle(licence)222 * </ul>223 * </ul>224 *225 * @param params Input/Output data for the call226 */227 void canReturnShared(IOParams params) throws TransportException;228 229 /**230 * Return shared bundle (it's licence) back to share manager (and prepare binary bundle for acquire).231 * <p>232 * Synchronous (waits for completion).233 * <p>234 * Input:235 * <ul>236 * <li> bundleName237 * <li> nodeName238 * <li> address239 * <li> addressNodeName <i> (only if address == true)</i>240 * </ul>241 * <p>242 * Output:243 * <ul>244 * <li> errCode245 * <ul>246 * <li> 0 == OK247 * <li> 1 == Not a share client248 * <li> 2 == Cannot return bundle(licence)249 * <li> 3 == Cannot prepare for acquire (but licence is returned)250 * </ul>251 * </ul>252 *253 * @param params Input/Output data for the call254 */255 void returnShared(IOParams params) throws TransportException;256 257 /**258 * Ask share manager to call returnShared on us.259 * <p>260 * Synchronous (waits for completion).261 * <p>262 * Input:263 * <ul>264 * <li> bundleName265 * <li> nodeName266 * </ul>267 * <p>268 * Output:269 * <ul>270 * <li> errCode271 * <ul>272 * <li> 0 == OK273 * <li> 1 == Not a share manager or access not allowed274 * <li> 2 == returnShared failed275 * </ul>276 * </ul>277 *278 * @param params Input/Output data for the call279 */280 void manualReturnShared(IOParams params) throws TransportException;281 282 }283