marilyn-rpc 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/LICENCE +18 -0
  2. data/README.md +170 -0
  3. data/doc/MarilynRPC/CallRequestMail.html +578 -0
  4. data/doc/MarilynRPC/CallResponseMail.html +418 -0
  5. data/doc/MarilynRPC/Envelope.html +705 -0
  6. data/doc/MarilynRPC/ExceptionMail.html +338 -0
  7. data/doc/MarilynRPC/Gentleman.html +658 -0
  8. data/doc/MarilynRPC/MailFactory.html +284 -0
  9. data/doc/MarilynRPC/MailHelper.html +489 -0
  10. data/doc/MarilynRPC/NativeClient.html +579 -0
  11. data/doc/MarilynRPC/NativeClientProxy.html +303 -0
  12. data/doc/MarilynRPC/Server.html +406 -0
  13. data/doc/MarilynRPC/Service.html +599 -0
  14. data/doc/MarilynRPC/ServiceCache.html +481 -0
  15. data/doc/MarilynRPC.html +108 -0
  16. data/doc/_index.html +219 -0
  17. data/doc/class_list.html +36 -0
  18. data/doc/css/common.css +1 -0
  19. data/doc/css/full_list.css +53 -0
  20. data/doc/css/style.css +318 -0
  21. data/doc/file.README.html +154 -0
  22. data/doc/file_list.html +38 -0
  23. data/doc/frames.html +13 -0
  24. data/doc/index.html +154 -0
  25. data/doc/js/app.js +203 -0
  26. data/doc/js/full_list.js +149 -0
  27. data/doc/js/jquery.js +16 -0
  28. data/doc/method_list.html +467 -0
  29. data/doc/top-level-namespace.html +88 -0
  30. data/examples/async/client.rb +40 -0
  31. data/examples/async/server.rb +26 -0
  32. data/examples/callbacks/client.rb +8 -0
  33. data/examples/callbacks/server.rb +26 -0
  34. data/examples/secure/client.rb +9 -0
  35. data/examples/secure/server.rb +22 -0
  36. data/kiss.png +0 -0
  37. data/lib/marilyn-rpc/client.rb +91 -26
  38. data/lib/marilyn-rpc/gentleman.rb +4 -1
  39. data/lib/marilyn-rpc/mails.rb +1 -1
  40. data/lib/marilyn-rpc/server.rb +27 -3
  41. data/lib/marilyn-rpc/service.rb +64 -0
  42. data/lib/marilyn-rpc/service_cache.rb +13 -2
  43. data/lib/marilyn-rpc/version.rb +1 -1
  44. metadata +39 -3
@@ -0,0 +1,303 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Class: MarilynRPC::NativeClientProxy</title>
7
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="../_index.html">Index (N)</a> &raquo;
27
+ <span class='title'><span class='object_link'><a href="../MarilynRPC.html" title="MarilynRPC (module)">MarilynRPC</a></span></span>
28
+ &raquo;
29
+ <span class="title">NativeClientProxy</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: MarilynRPC::NativeClientProxy
47
+
48
+
49
+
50
+ </h1>
51
+
52
+ <dl class="box">
53
+
54
+ <dt class="r1">Inherits:</dt>
55
+ <dd class="r1">
56
+ <span class="inheritName">Object</span>
57
+
58
+ <ul class="fullTree">
59
+ <li>Object</li>
60
+
61
+ <li class="next">MarilynRPC::NativeClientProxy</li>
62
+
63
+ </ul>
64
+ <a href="#" class="inheritanceTree">show all</a>
65
+
66
+ </dd>
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ <dt class="r2 last">Defined in:</dt>
77
+ <dd class="r2 last">lib/marilyn-rpc/client.rb</dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+
83
+
84
+
85
+
86
+ <h2>
87
+ Instance Method Summary
88
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
89
+ </h2>
90
+
91
+ <ul class="summary">
92
+
93
+ <li class="public ">
94
+ <span class="summary_signature">
95
+
96
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (NativeClientProxy) <strong>initialize</strong>(path, socket) </a>
97
+
98
+
99
+
100
+ </span>
101
+
102
+ <span class="note title constructor">constructor</span>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ <span class="summary_desc"><div class='inline'><p>Creates a new Native client proxy, were the calls get send to the remote side.</p></div></span>
112
+
113
+ </li>
114
+
115
+
116
+ <li class="public ">
117
+ <span class="summary_signature">
118
+
119
+ <a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(method, *args, &amp;block) </a>
120
+
121
+
122
+
123
+ </span>
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+ <span class="summary_desc"><div class='inline'><p>Handler for calls to the remote system.</p></div></span>
133
+
134
+ </li>
135
+
136
+
137
+ </ul>
138
+
139
+
140
+ <div id="constructor_details" class="method_details_list">
141
+ <h2>Constructor Details</h2>
142
+
143
+ <div class="method_details first">
144
+ <p class="signature first" id="initialize-instance_method">
145
+
146
+ - (<tt><span class='object_link'><a href="" title="MarilynRPC::NativeClientProxy (class)">NativeClientProxy</a></span></tt>) <strong>initialize</strong>(path, socket)
147
+
148
+
149
+
150
+ </p><div class="docstring">
151
+ <div class="discussion">
152
+ <p>Creates a new Native client proxy, were the calls get send to the remote side.</p>
153
+
154
+ </div>
155
+ </div>
156
+ <div class="tags">
157
+ <h3>Parameters:</h3>
158
+ <ul class="param">
159
+
160
+ <li>
161
+
162
+ <span class='type'>(<tt>Object</tt>)</span>
163
+
164
+
165
+ <span class='name'>path</span>
166
+
167
+
168
+
169
+ &mdash;
170
+ <div class='inline'><p>the path that is used to identify the service</p></div>
171
+
172
+ </li>
173
+
174
+ <li>
175
+
176
+ <span class='type'>(<tt>Socekt</tt>)</span>
177
+
178
+
179
+ <span class='name'>socket</span>
180
+
181
+
182
+
183
+ &mdash;
184
+ <div class='inline'><p>the socket to use for communication</p></div>
185
+
186
+ </li>
187
+
188
+ </ul>
189
+
190
+ </div><table class="source_code">
191
+ <tr>
192
+ <td>
193
+ <pre class="lines">
194
+
195
+
196
+ 9
197
+ 10
198
+ 11</pre>
199
+ </td>
200
+ <td>
201
+ <pre class="code"><span class="info file"># File 'lib/marilyn-rpc/client.rb', line 9</span>
202
+
203
+ <span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='path identifier id'>path</span><span class='comma token'>,</span> <span class='socket identifier id'>socket</span><span class='rparen token'>)</span>
204
+ <span class='@path ivar id'>@path</span><span class='comma token'>,</span> <span class='@socket ivar id'>@socket</span> <span class='assign token'>=</span> <span class='path identifier id'>path</span><span class='comma token'>,</span> <span class='socket identifier id'>socket</span>
205
+ <span class='end end kw'>end</span>
206
+ </pre>
207
+ </td>
208
+ </tr>
209
+ </table>
210
+ </div>
211
+
212
+ </div>
213
+ <div id="method_missing_details" class="method_details_list">
214
+ <h2>Dynamic Method Handling</h2>
215
+ <p class="notice this">
216
+ This class handles dynamic methods through the <tt>method_missing</tt> method
217
+
218
+ </p>
219
+
220
+ <div class="method_details first">
221
+ <p class="signature first" id="method_missing-instance_method">
222
+
223
+ - (<tt>Object</tt>) <strong>method_missing</strong>(method, *args, &amp;block)
224
+
225
+
226
+
227
+ </p><div class="docstring">
228
+ <div class="discussion">
229
+ <p>Handler for calls to the remote system</p>
230
+
231
+ </div>
232
+ </div>
233
+ <div class="tags">
234
+
235
+ </div><table class="source_code">
236
+ <tr>
237
+ <td>
238
+ <pre class="lines">
239
+
240
+
241
+ 14
242
+ 15
243
+ 16
244
+ 17
245
+ 18
246
+ 19
247
+ 20
248
+ 21
249
+ 22
250
+ 23
251
+ 24
252
+ 25
253
+ 26
254
+ 27
255
+ 28
256
+ 29
257
+ 30
258
+ 31
259
+ 32
260
+ 33</pre>
261
+ </td>
262
+ <td>
263
+ <pre class="code"><span class="info file"># File 'lib/marilyn-rpc/client.rb', line 14</span>
264
+
265
+ <span class='def def kw'>def</span> <span class='method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='block identifier id'>block</span><span class='rparen token'>)</span>
266
+ <span class='comment val'># since this client can't multiplex, we set the tag to nil</span>
267
+ <span class='@socket ivar id'>@socket</span><span class='dot token'>.</span><span class='write identifier id'>write</span><span class='lparen token'>(</span><span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='MailFactory constant id'>MailFactory</span><span class='dot token'>.</span><span class='build_call identifier id'>build_call</span><span class='lparen token'>(</span><span class='nil nil kw'>nil</span><span class='comma token'>,</span> <span class='@path ivar id'>@path</span><span class='comma token'>,</span> <span class='method identifier id'>method</span><span class='comma token'>,</span> <span class='args identifier id'>args</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
268
+
269
+ <span class='comment val'># read the answer of the server back in</span>
270
+ <span class='answer identifier id'>answer</span> <span class='assign token'>=</span> <span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='Envelope constant id'>Envelope</span><span class='dot token'>.</span><span class='new identifier id'>new</span>
271
+ <span class='comment val'># read the header to have the size</span>
272
+ <span class='answer identifier id'>answer</span><span class='dot token'>.</span><span class='parse! fid id'>parse!</span><span class='lparen token'>(</span><span class='@socket ivar id'>@socket</span><span class='dot token'>.</span><span class='read identifier id'>read</span><span class='lparen token'>(</span><span class='integer val'>4</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
273
+ <span class='comment val'># so now that we know the site, read the rest of the envelope</span>
274
+ <span class='answer identifier id'>answer</span><span class='dot token'>.</span><span class='parse! fid id'>parse!</span><span class='lparen token'>(</span><span class='@socket ivar id'>@socket</span><span class='dot token'>.</span><span class='read identifier id'>read</span><span class='lparen token'>(</span><span class='answer identifier id'>answer</span><span class='dot token'>.</span><span class='size identifier id'>size</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
275
+
276
+ <span class='comment val'># returns the result part of the mail or raise the exception if there is </span>
277
+ <span class='comment val'># one</span>
278
+ <span class='mail identifier id'>mail</span> <span class='assign token'>=</span> <span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='MailFactory constant id'>MailFactory</span><span class='dot token'>.</span><span class='unpack identifier id'>unpack</span><span class='lparen token'>(</span><span class='answer identifier id'>answer</span><span class='rparen token'>)</span>
279
+ <span class='if if kw'>if</span> <span class='mail identifier id'>mail</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span> <span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='CallResponseMail constant id'>CallResponseMail</span>
280
+ <span class='mail identifier id'>mail</span><span class='dot token'>.</span><span class='result identifier id'>result</span>
281
+ <span class='else else kw'>else</span>
282
+ <span class='raise identifier id'>raise</span> <span class='mail identifier id'>mail</span><span class='dot token'>.</span><span class='exception identifier id'>exception</span>
283
+ <span class='end end kw'>end</span>
284
+ <span class='end end kw'>end</span>
285
+ </pre>
286
+ </td>
287
+ </tr>
288
+ </table>
289
+ </div>
290
+
291
+ </div>
292
+
293
+
294
+ </div>
295
+
296
+ <div id="footer">
297
+ Generated on Wed Jun 8 18:26:45 2011 by
298
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
299
+ 0.6.8 (ruby-1.8.7).
300
+ </div>
301
+
302
+ </body>
303
+ </html>