KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnet > Transport > TransportInterface


1 /*
2  * TransportInterface.java
3  *
4  * Created on 31. bøezen 2004, 17:20
5  */

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 Sobr
16  */

17 public interface TransportInterface
18 {
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> bundleName
27    * <li> offer
28    * <li> nodeName
29    * <li> *OtherNodes.nodeName
30    * </ul>
31    * <p>
32    * Output:
33    * <ul>
34    * <li> nodeName
35    * <li> errCode
36    * <ul>
37    * <li> 0 == OK
38    * <li> 1 == not allowed
39    * </ul>
40    * <li> *OtherNodes.nodeName
41    * <li> *OtherNodes.errCode
42    * <ul>
43    * <li> 0 == OK
44    * <li> 1 == not allowed
45    * </ul>
46    * </ul>
47    *
48    * @param params Input/Output data for the call
49    */

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> bundleName
60    * <li> bundleData
61    * <li> offer
62    * <li> priority
63    * <li> nodeName
64    * <li> licence &nbsp;&nbsp;<i> (only if offer == false)</i>
65    * <li> *OtherNodes.nodeName
66    * <li> *OtherNodes.licence &nbsp;&nbsp;<i> (only if offer == false)</i>
67    * </ul>
68    * <p>
69    * Output: none
70    *
71    * @param params Input data for the call
72    */

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> bundleName
83    * <li> nodeName
84    * <li> contractID
85    * </ul>
86    * <p>
87    * Output:
88    * <ul>
89    * <li> errCode
90    * <ul>
91    * <li> 0 == OK
92    * <li> 1 == not allowed
93    * </ul>
94    * </ul>
95    *
96    * @param params Input/Output data for the call
97    */

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> bundleName
108    * <li> priority
109    * <li> nodeName
110    * <li> contractID
111    * </ul>
112    * <p>
113    * Output: none (calls NetOps.deliverBundlePull)
114    *
115    *
116    * @param params Input data for the call
117    */

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> bundleName
128    * <li> priority
129    * <li> nodeName
130    * <li> contractID
131    * </ul>
132    * <p>
133    * Output:
134    * <ul>
135    * <li> errCode
136    * <ul>
137    * <li> 0 == OK
138    * <li> 1 == Cannot find binary bundle
139    * <li> 2 == Cannot create BundleData for bundle
140    * <li> 3 == Pull not allowed
141    * </ul>
142    * <li> bundleData &nbsp;&nbsp;<i> (only if errCode == 0)</i>
143    * <li> licence &nbsp;&nbsp;<i> (only if errCode == 0)</i>
144    * </ul>
145    *
146    *
147    * @param params Input/Output data for the call
148    */

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> bundleName
159    * <li> nodeName
160    * </ul>
161    * <p>
162    * Output:
163    * <ul>
164    * <li> errCode
165    * </ul>
166    *
167    *
168    * @param params Input/Output data for the call
169    */

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> bundleName
180    * <li> priority
181    * <li> nodeName
182    * </ul>
183    *
184    * Output:
185    * <ul>
186    * <li> errCode
187    * <ul>
188    * <li> 0 == OK
189    * <li> 1 == Not a share manager or access not allowed
190    * <li> 2 == Licence not available
191    * <li> 3 == Data error (binary bundle not available)
192    * <li> 4 == Incosistent state of share manager
193    * </ul>
194    * <li> address &nbsp;&nbsp;<i> (only if errCode == 0 ; can be true only when calling share manager)</i>
195    * <li> bundleData &nbsp;&nbsp;<i> (only if errCode == 0 && address == false)</i>
196    * <li> addressNodeName &nbsp;&nbsp;<i> (only if errCode == 0 && address == true)</i>
197    * <li> licence &nbsp;&nbsp;<i> (only if errCode == 0 and when calling share manager)</i>
198    * </ul>
199    *
200    *
201    * @param params Input/Output data for the call
202    */

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> bundleName
213    * <li> nodeName
214    * </ul>
215    *
216    * Output:
217    * <ul>
218    * <li> errCode
219    * <ul>
220    * <li> 0 == OK
221    * <li> 1 == Cannot return bundle(licence)
222    * </ul>
223    * </ul>
224    *
225    * @param params Input/Output data for the call
226    */

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> bundleName
237    * <li> nodeName
238    * <li> address
239    * <li> addressNodeName &nbsp;&nbsp;<i> (only if address == true)</i>
240    * </ul>
241    * <p>
242    * Output:
243    * <ul>
244    * <li> errCode
245    * <ul>
246    * <li> 0 == OK
247    * <li> 1 == Not a share client
248    * <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 call
254    */

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> bundleName
265    * <li> nodeName
266    * </ul>
267    * <p>
268    * Output:
269    * <ul>
270    * <li> errCode
271    * <ul>
272    * <li> 0 == OK
273    * <li> 1 == Not a share manager or access not allowed
274    * <li> 2 == returnShared failed
275    * </ul>
276    * </ul>
277    *
278    * @param params Input/Output data for the call
279    */

280   void manualReturnShared(IOParams params) throws TransportException;
281
282 }
283
Popular Tags