r2corba 1.4.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +159 -0
  3. data/LICENSE +59 -0
  4. data/README +62 -0
  5. data/THANKS +52 -0
  6. data/bin/r2corba +8 -0
  7. data/bin/r2corba.bat +20 -0
  8. data/bin/ridlc +11 -0
  9. data/bin/ridlc.bat +23 -0
  10. data/bin/rins +7 -0
  11. data/bin/rins.bat +19 -0
  12. data/ext/.keep +0 -0
  13. data/lib/corba/cbase/IORMap.rb +33 -0
  14. data/lib/corba/cbase/ORB.rb +231 -0
  15. data/lib/corba/cbase/Request.rb +134 -0
  16. data/lib/corba/cbase/Streams.rb +129 -0
  17. data/lib/corba/cbase/Stub.rb +19 -0
  18. data/lib/corba/cbase/Typecode.rb +441 -0
  19. data/lib/corba/cbase/Values.rb +129 -0
  20. data/lib/corba/cbase/exception.rb +66 -0
  21. data/lib/corba/cbase/poa.rb +23 -0
  22. data/lib/corba/cbase/policies.rb +78 -0
  23. data/lib/corba/cbase/post_require.rb +14 -0
  24. data/lib/corba/cbase/require.rb +28 -0
  25. data/lib/corba/cmds/base.rb +85 -0
  26. data/lib/corba/cmds/test.rb +30 -0
  27. data/lib/corba/common/Any.rb +91 -0
  28. data/lib/corba/common/IDL.rb +104 -0
  29. data/lib/corba/common/ORB.rb +368 -0
  30. data/lib/corba/common/Object.rb +208 -0
  31. data/lib/corba/common/Request.rb +20 -0
  32. data/lib/corba/common/Servant.rb +108 -0
  33. data/lib/corba/common/Struct.rb +22 -0
  34. data/lib/corba/common/Stub.rb +79 -0
  35. data/lib/corba/common/Typecode.rb +1121 -0
  36. data/lib/corba/common/Union.rb +56 -0
  37. data/lib/corba/common/Values.rb +92 -0
  38. data/lib/corba/common/const.rb +22 -0
  39. data/lib/corba/common/exception.rb +68 -0
  40. data/lib/corba/common/require.rb +27 -0
  41. data/lib/corba/common/version.rb +22 -0
  42. data/lib/corba/idl/BiDirPolicyC.rb +63 -0
  43. data/lib/corba/idl/CosNamingC.rb +461 -0
  44. data/lib/corba/idl/CosNamingS.rb +309 -0
  45. data/lib/corba/idl/IDL.rb +21 -0
  46. data/lib/corba/idl/IORTable.pidl +62 -0
  47. data/lib/corba/idl/IORTableC.rb +117 -0
  48. data/lib/corba/idl/MessagingC.rb +904 -0
  49. data/lib/corba/idl/POAC.rb +930 -0
  50. data/lib/corba/idl/TAO_Ext.pidl +46 -0
  51. data/lib/corba/idl/TAO_ExtC.rb +179 -0
  52. data/lib/corba/idl/r2c_orb.rb +572 -0
  53. data/lib/corba/idl/require.rb +20 -0
  54. data/lib/corba/jbase/Any.rb +273 -0
  55. data/lib/corba/jbase/IORMap.rb +36 -0
  56. data/lib/corba/jbase/ORB.rb +99 -0
  57. data/lib/corba/jbase/Object.rb +98 -0
  58. data/lib/corba/jbase/Request.rb +226 -0
  59. data/lib/corba/jbase/Servant.rb +247 -0
  60. data/lib/corba/jbase/ServerRequest.rb +128 -0
  61. data/lib/corba/jbase/Streams.rb +671 -0
  62. data/lib/corba/jbase/Stub.rb +38 -0
  63. data/lib/corba/jbase/Typecode.rb +520 -0
  64. data/lib/corba/jbase/Values.rb +173 -0
  65. data/lib/corba/jbase/exception.rb +106 -0
  66. data/lib/corba/jbase/poa.rb +229 -0
  67. data/lib/corba/jbase/policies.rb +300 -0
  68. data/lib/corba/jbase/post_require.rb +14 -0
  69. data/lib/corba/jbase/require.rb +86 -0
  70. data/lib/corba/naming.rb +14 -0
  71. data/lib/corba/naming_service.rb +15 -0
  72. data/lib/corba/poa.rb +15 -0
  73. data/lib/corba/policies.rb +18 -0
  74. data/lib/corba/require.rb +17 -0
  75. data/lib/corba/svcs/ins/cos_naming.rb +426 -0
  76. data/lib/corba/svcs/ins/ins.rb +526 -0
  77. data/lib/corba/svcs/ins/naming_service.rb +119 -0
  78. data/lib/corba.rb +16 -0
  79. data/lib/ridlbe/ruby/config.rb +336 -0
  80. data/lib/ridlbe/ruby/orb.pidlc +0 -0
  81. data/lib/ridlbe/ruby/require.rb +16 -0
  82. data/lib/ridlbe/ruby/walker.rb +1582 -0
  83. data/mkrf_conf_bingem.rb +101 -0
  84. data/rakelib/bin.rake +80 -0
  85. data/rakelib/bin.rb +146 -0
  86. data/rakelib/build.rake +87 -0
  87. data/rakelib/config.rake +52 -0
  88. data/rakelib/config.rb +450 -0
  89. data/rakelib/ext.rake +242 -0
  90. data/rakelib/ext.rb +308 -0
  91. data/rakelib/ext_r2tao.rb +232 -0
  92. data/rakelib/gem.rake +212 -0
  93. data/rakelib/gem.rb +146 -0
  94. data/rakelib/package.rake +26 -0
  95. data/rakelib/test.rake +23 -0
  96. data/test/BiDirectional/Test.idl +34 -0
  97. data/test/BiDirectional/client.rb +132 -0
  98. data/test/BiDirectional/run_test.rb +68 -0
  99. data/test/BiDirectional/server.ior +1 -0
  100. data/test/BiDirectional/server.rb +169 -0
  101. data/test/CORBA_Services/Naming/BindingIterator/Test.idl +27 -0
  102. data/test/CORBA_Services/Naming/BindingIterator/client.rb +121 -0
  103. data/test/CORBA_Services/Naming/BindingIterator/ins.ior +1 -0
  104. data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +82 -0
  105. data/test/CORBA_Services/Naming/BindingIterator/server.rb +109 -0
  106. data/test/CORBA_Services/Naming/Corbaname/Test.idl +27 -0
  107. data/test/CORBA_Services/Naming/Corbaname/client.rb +85 -0
  108. data/test/CORBA_Services/Naming/Corbaname/corbaname.ior +1 -0
  109. data/test/CORBA_Services/Naming/Corbaname/ins.ior +1 -0
  110. data/test/CORBA_Services/Naming/Corbaname/run_test.rb +88 -0
  111. data/test/CORBA_Services/Naming/Corbaname/server.rb +135 -0
  112. data/test/CORBA_Services/Naming/Simple/Test.idl +27 -0
  113. data/test/CORBA_Services/Naming/Simple/client.rb +84 -0
  114. data/test/CORBA_Services/Naming/Simple/ins.ior +1 -0
  115. data/test/CORBA_Services/Naming/Simple/run_test.rb +82 -0
  116. data/test/CORBA_Services/Naming/Simple/server.rb +109 -0
  117. data/test/Collocation/Diamond.idl +39 -0
  118. data/test/Collocation/run_test.rb +52 -0
  119. data/test/Collocation/test.rb +195 -0
  120. data/test/Connect_Timeout/Test.idl +27 -0
  121. data/test/Connect_Timeout/client.rb +111 -0
  122. data/test/Connect_Timeout/run_test.rb +52 -0
  123. data/test/DII/Test.idl +27 -0
  124. data/test/DII/client.rb +115 -0
  125. data/test/DII/run_test.rb +69 -0
  126. data/test/DII/server.ior +1 -0
  127. data/test/DII/server.rb +95 -0
  128. data/test/DSI/Test.idl +27 -0
  129. data/test/DSI/client.rb +66 -0
  130. data/test/DSI/run_test.rb +69 -0
  131. data/test/DSI/server.ior +1 -0
  132. data/test/DSI/server.rb +106 -0
  133. data/test/Exceptions/Test.idl +48 -0
  134. data/test/Exceptions/client.rb +118 -0
  135. data/test/Exceptions/run_test.rb +69 -0
  136. data/test/Exceptions/server.ior +1 -0
  137. data/test/Exceptions/server.rb +131 -0
  138. data/test/Hello/Test.idl +27 -0
  139. data/test/Hello/client.rb +78 -0
  140. data/test/Hello/run_test.rb +71 -0
  141. data/test/Hello/server.rb +95 -0
  142. data/test/IDL_Test/Test.idl +113 -0
  143. data/test/IDL_Test/Test_inc.idl +17 -0
  144. data/test/IDL_Test/client.rb +102 -0
  145. data/test/IDL_Test/run_test.rb +69 -0
  146. data/test/IDL_Test/server.ior +1 -0
  147. data/test/IDL_Test/server.rb +99 -0
  148. data/test/IORMap/Test.idl +27 -0
  149. data/test/IORMap/client.rb +73 -0
  150. data/test/IORMap/run_test.rb +69 -0
  151. data/test/IORMap/server.ior +1 -0
  152. data/test/IORMap/server.rb +114 -0
  153. data/test/IORTable/Test.idl +27 -0
  154. data/test/IORTable/client.rb +75 -0
  155. data/test/IORTable/run_test.rb +69 -0
  156. data/test/IORTable/server.ior +1 -0
  157. data/test/IORTable/server.rb +130 -0
  158. data/test/Implicit_Conversion/Test.idl +31 -0
  159. data/test/Implicit_Conversion/client.rb +110 -0
  160. data/test/Implicit_Conversion/run_test.rb +69 -0
  161. data/test/Implicit_Conversion/server.ior +1 -0
  162. data/test/Implicit_Conversion/server.rb +99 -0
  163. data/test/Multi_Threading/Multiple_ORB/Test.idl +27 -0
  164. data/test/Multi_Threading/Multiple_ORB/client.rb +82 -0
  165. data/test/Multi_Threading/Multiple_ORB/run_test.rb +71 -0
  166. data/test/Multi_Threading/Multiple_ORB/server.rb +108 -0
  167. data/test/Multi_Threading/Multiple_ORB/server0.ior +1 -0
  168. data/test/Multi_Threading/Multiple_ORB/server1.ior +1 -0
  169. data/test/Multi_Threading/Simple/Test.idl +27 -0
  170. data/test/Multi_Threading/Simple/client.rb +88 -0
  171. data/test/Multi_Threading/Simple/run_test.rb +69 -0
  172. data/test/Multi_Threading/Simple/server.ior +1 -0
  173. data/test/Multi_Threading/Simple/server.rb +118 -0
  174. data/test/Multi_Threading/Threads/Test.idl +31 -0
  175. data/test/Multi_Threading/Threads/client.rb +80 -0
  176. data/test/Multi_Threading/Threads/run_test.rb +76 -0
  177. data/test/Multi_Threading/Threads/server.ior +1 -0
  178. data/test/Multi_Threading/Threads/server.rb +119 -0
  179. data/test/Multi_Threading/Threads/watchdog.ior +1 -0
  180. data/test/Multi_Threading/Threads/watchdog.rb +87 -0
  181. data/test/Multiple_Servant_Interfaces/Test.idl +34 -0
  182. data/test/Multiple_Servant_Interfaces/client.rb +70 -0
  183. data/test/Multiple_Servant_Interfaces/run_test.rb +69 -0
  184. data/test/Multiple_Servant_Interfaces/server.ior +1 -0
  185. data/test/Multiple_Servant_Interfaces/server.rb +102 -0
  186. data/test/Nil/Test.idl +27 -0
  187. data/test/Nil/run_test.rb +52 -0
  188. data/test/Nil/test.rb +78 -0
  189. data/test/OBV/AbstractInterface/client.rb +179 -0
  190. data/test/OBV/AbstractInterface/run_test.rb +69 -0
  191. data/test/OBV/AbstractInterface/server.ior +1 -0
  192. data/test/OBV/AbstractInterface/server.rb +149 -0
  193. data/test/OBV/AbstractInterface/test.idl +53 -0
  194. data/test/OBV/Custom/OBV.idl +18 -0
  195. data/test/OBV/Custom/OBV_impl.rb +40 -0
  196. data/test/OBV/Custom/client.rb +86 -0
  197. data/test/OBV/Custom/run_test.rb +69 -0
  198. data/test/OBV/Custom/server.ior +1 -0
  199. data/test/OBV/Custom/server.rb +100 -0
  200. data/test/OBV/Simple/OBV.idl +15 -0
  201. data/test/OBV/Simple/OBV_impl.rb +26 -0
  202. data/test/OBV/Simple/client.rb +86 -0
  203. data/test/OBV/Simple/run_test.rb +69 -0
  204. data/test/OBV/Simple/server.ior +1 -0
  205. data/test/OBV/Simple/server.rb +100 -0
  206. data/test/OBV/Simple_Event/Event.idl +15 -0
  207. data/test/OBV/Simple_Event/Event_impl.rb +26 -0
  208. data/test/OBV/Simple_Event/client.rb +86 -0
  209. data/test/OBV/Simple_Event/run_test.rb +69 -0
  210. data/test/OBV/Simple_Event/server.ior +1 -0
  211. data/test/OBV/Simple_Event/server.rb +100 -0
  212. data/test/OBV/Supports/client.rb +116 -0
  213. data/test/OBV/Supports/run_test.rb +69 -0
  214. data/test/OBV/Supports/server.ior +1 -0
  215. data/test/OBV/Supports/server.rb +103 -0
  216. data/test/OBV/Supports/supports.idl +33 -0
  217. data/test/OBV/Supports/supports_impl.rb +57 -0
  218. data/test/OBV/Tree/client.rb +116 -0
  219. data/test/OBV/Tree/run_test.rb +69 -0
  220. data/test/OBV/Tree/server.ior +1 -0
  221. data/test/OBV/Tree/server.rb +117 -0
  222. data/test/OBV/Tree/test.idl +32 -0
  223. data/test/OBV/Truncatable/Extra.idl +27 -0
  224. data/test/OBV/Truncatable/Truncatable.idl +105 -0
  225. data/test/OBV/Truncatable/Truncatable_impl.rb +86 -0
  226. data/test/OBV/Truncatable/client.rb +279 -0
  227. data/test/OBV/Truncatable/run_test.rb +69 -0
  228. data/test/OBV/Truncatable/server.ior +1 -0
  229. data/test/OBV/Truncatable/server.rb +89 -0
  230. data/test/OBV/ValueBox/client.rb +497 -0
  231. data/test/OBV/ValueBox/run_test.rb +69 -0
  232. data/test/OBV/ValueBox/server.ior +1 -0
  233. data/test/OBV/ValueBox/server.rb +271 -0
  234. data/test/OBV/ValueBox/valuebox.idl +101 -0
  235. data/test/OBV/ValueBox/vb_basic.idl +75 -0
  236. data/test/OBV/ValueBox/vb_struct.idl +68 -0
  237. data/test/OBV/ValueBox/vb_union.idl +21 -0
  238. data/test/Object/Test.idl +27 -0
  239. data/test/Object/client.rb +103 -0
  240. data/test/Object/run_test.rb +69 -0
  241. data/test/Object/server.ior +1 -0
  242. data/test/Object/server.rb +126 -0
  243. data/test/POA/Test.idl +27 -0
  244. data/test/POA/run_test.rb +52 -0
  245. data/test/POA/test.rb +112 -0
  246. data/test/Param_Test/Test.idl +182 -0
  247. data/test/Param_Test/client.rb +277 -0
  248. data/test/Param_Test/run_test.rb +69 -0
  249. data/test/Param_Test/server.ior +1 -0
  250. data/test/Param_Test/server.rb +296 -0
  251. data/test/Performance/Simple/Test.idl +27 -0
  252. data/test/Performance/Simple/client.rb +90 -0
  253. data/test/Performance/Simple/run_test.rb +69 -0
  254. data/test/Performance/Simple/server.ior +1 -0
  255. data/test/Performance/Simple/server.rb +95 -0
  256. data/test/Policies/Test.idl +27 -0
  257. data/test/Policies/run_test.rb +52 -0
  258. data/test/Policies/test.rb +144 -0
  259. data/test/Timeout/client.rb +207 -0
  260. data/test/Timeout/run_test.rb +69 -0
  261. data/test/Timeout/server.ior +1 -0
  262. data/test/Timeout/server.rb +109 -0
  263. data/test/Timeout/test.idl +19 -0
  264. data/test/lib/assert.rb +43 -0
  265. data/test/lib/test.rb +542 -0
  266. data/test/test_runner.rb +193 -0
  267. metadata +342 -0
@@ -0,0 +1,671 @@
1
+ #--------------------------------------------------------------------
2
+ # Streams.rb - Java/JacORB Definition of CORBA CDR Streams
3
+ #
4
+ # Author: Martin Corino
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the R2CORBA LICENSE which is
8
+ # included with this program.
9
+ #
10
+ # Copyright (c) Remedy IT Expertise BV
11
+ # Chamber of commerce Rotterdam nr.276339, The Netherlands
12
+ #--------------------------------------------------------------------
13
+
14
+ module R2CORBA
15
+ module CORBA
16
+ module Portable
17
+ module InputStream
18
+ @@wrapper_klass = Class.new do
19
+ include CORBA::Portable::InputStream
20
+ def initialize(jobj)
21
+ @stream_ = jobj
22
+ end
23
+ attr_reader :stream_
24
+ end
25
+
26
+ def self._wrap_native(jobj)
27
+ if jobj.nil? || !jobj.is_a?(Native::V2_3::Portable::InputStream)
28
+ raise ArgumentError, 'Expected org.omg.CORBA.portable.InputStream'
29
+ end
30
+ @@wrapper_klass.new(jobj)
31
+ end
32
+
33
+ def read_member(tc)
34
+ tc = tc.resolved_tc # takes care of recursive typecodes
35
+ v = case tc.kind
36
+ when TK_ANY
37
+ read_any()
38
+ when TK_BOOLEAN
39
+ read_boolean()
40
+ when TK_SHORT
41
+ read_short()
42
+ when TK_LONG
43
+ read_long()
44
+ when TK_USHORT
45
+ read_ushort()
46
+ when TK_WCHAR
47
+ read_wchar()
48
+ when TK_ULONG
49
+ read_ulong()
50
+ when TK_LONGLONG
51
+ read_longlong()
52
+ when TK_ULONGLONG
53
+ read_ulonglong()
54
+ when TK_OCTET
55
+ read_octet()
56
+ when TK_FLOAT
57
+ read_float()
58
+ when TK_DOUBLE
59
+ read_double()
60
+ when TK_LONGDOUBLE
61
+ raise CORBA::NO_IMPLEMENT.new('LongDouble not supported',0,CORBA::COMPLETED_NO)
62
+ when TK_FIXED
63
+ read_fixed()
64
+ when TK_CHAR
65
+ read_char()
66
+ when TK_STRING
67
+ read_string()
68
+ when TK_WSTRING
69
+ read_wstring()
70
+ when TK_OBJREF
71
+ read_Object()
72
+ when TK_TYPECODE
73
+ read_TypeCode()
74
+ when TK_ARRAY, TK_SEQUENCE,
75
+ TK_ENUM, TK_STRUCT, TK_EXCEPT, TK_UNION,
76
+ TK_PRINCIPAL
77
+ read_construct(tc)
78
+ when TK_ABSTRACT_INTERFACE
79
+ read_Abstract()
80
+ when TK_VALUE
81
+ read_value()
82
+ when TK_VALUE_BOX
83
+ read_valuebox(tc.get_type.boxedvalue_helper)
84
+ ## TODO: TK_NATIVE
85
+ end
86
+ v
87
+ end
88
+
89
+ def read_any()
90
+ begin
91
+ self.stream_.read_any()
92
+ rescue ::NativeException
93
+ CORBA::Exception.native2r($!)
94
+ end
95
+ end
96
+ def read_boolean()
97
+ begin
98
+ self.stream_.read_boolean()
99
+ rescue ::NativeException
100
+ CORBA::Exception.native2r($!)
101
+ end
102
+ end
103
+ def read_boolean_array(arr, offset, length)
104
+ jarr = Array.new(arr.size).to_java(:boolean)
105
+ begin
106
+ self.stream_.read_boolean_array(jarr, offset, length)
107
+ rescue ::NativeException
108
+ CORBA::Exception.native2r($!)
109
+ end
110
+ arr.fill(offset, length) {|i| jarr[i]}
111
+ end
112
+ def read_char()
113
+ begin
114
+ self.stream_.read_char().chr
115
+ rescue ::NativeException
116
+ CORBA::Exception.native2r($!)
117
+ end
118
+ end
119
+ def read_char_array(arr, offset, length)
120
+ jarr = Array.new(arr.size).to_java(:char)
121
+ begin
122
+ self.stream_.read_char_array(jarr, offset, length)
123
+ rescue ::NativeException
124
+ CORBA::Exception.native2r($!)
125
+ end
126
+ arr.fill(offset, length) {|i| jarr[i].chr }
127
+ end
128
+ def read_wchar()
129
+ begin
130
+ self.stream_.read_wchar()
131
+ rescue ::NativeException
132
+ CORBA::Exception.native2r($!)
133
+ end
134
+ end
135
+ def read_wchar_array(arr, offset, length)
136
+ jarr = Array.new(arr.size).to_java(:char)
137
+ begin
138
+ self.stream_.read_char_array(jarr, offset, length)
139
+ rescue ::NativeException
140
+ CORBA::Exception.native2r($!)
141
+ end
142
+ arr.fill(offset, length) {|i| jarr[i] }
143
+ end
144
+ def read_octet(value)
145
+ begin
146
+ [self.stream_.read_octet()].pack('c').unpack('C').first
147
+ rescue ::NativeException
148
+ CORBA::Exception.native2r($!)
149
+ end
150
+ end
151
+ def read_octet_array(arr, offset, length)
152
+ jarr = Array.new(arr.size).to_java(:byte)
153
+ begin
154
+ self.stream_.read_octet_array(jarr, offset, length)
155
+ rescue ::NativeException
156
+ CORBA::Exception.native2r($!)
157
+ end
158
+ jarr = jarr.pack('c*').unpack('C*')
159
+ arr.fill(offset, length) {|i| jarr[i] }
160
+ end
161
+ def read_short()
162
+ begin
163
+ self.stream_.read_short()
164
+ rescue ::NativeException
165
+ CORBA::Exception.native2r($!)
166
+ end
167
+ end
168
+ def read_short_array(arr, offset, length)
169
+ jarr = Array.new(arr.size).to_java(:short)
170
+ begin
171
+ self.stream_.read_short_array(jarr, offset, length)
172
+ rescue ::NativeException
173
+ CORBA::Exception.native2r($!)
174
+ end
175
+ arr.fill(offset, length) {|i| jarr[i] }
176
+ end
177
+ def read_ushort()
178
+ begin
179
+ [self.stream_.read_ushort()].pack('s').unpack('S').first
180
+ rescue ::NativeException
181
+ CORBA::Exception.native2r($!)
182
+ end
183
+ end
184
+ def read_ushort_array(arr, offset, length)
185
+ jarr = Array.new(arr.size).to_java(:short)
186
+ begin
187
+ self.stream_.read_octet_array(jarr, offset, length)
188
+ rescue ::NativeException
189
+ CORBA::Exception.native2r($!)
190
+ end
191
+ jarr = jarr.pack('s*').unpack('S*')
192
+ arr.fill(offset, length) {|i| jarr[i] }
193
+ end
194
+ def read_long()
195
+ begin
196
+ self.stream_.read_long()
197
+ rescue ::NativeException
198
+ CORBA::Exception.native2r($!)
199
+ end
200
+ end
201
+ def read_long_array(arr, offset, length)
202
+ jarr = Array.new(arr.size).to_java(:int)
203
+ begin
204
+ self.stream_.read_long_array(jarr, offset, length)
205
+ rescue ::NativeException
206
+ CORBA::Exception.native2r($!)
207
+ end
208
+ arr.fill(offset, length) {|i| jarr[i] }
209
+ end
210
+ def read_ulong()
211
+ begin
212
+ [self.stream_.read_ulong()].pack('l').unpack('L').first
213
+ rescue ::NativeException
214
+ CORBA::Exception.native2r($!)
215
+ end
216
+ end
217
+ def read_ulong_array(arr, offset, length)
218
+ jarr = Array.new(arr.size).to_java(:int)
219
+ begin
220
+ self.stream_.read_ulong_array(jarr, offset, length)
221
+ rescue ::NativeException
222
+ CORBA::Exception.native2r($!)
223
+ end
224
+ jarr = jarr.pack('l*').unpack('L*')
225
+ arr.fill(offset, length) {|i| jarr[i] }
226
+ end
227
+ def read_longlong()
228
+ begin
229
+ self.stream_.read_longlong()
230
+ rescue ::NativeException
231
+ CORBA::Exception.native2r($!)
232
+ end
233
+ end
234
+ def read_longlong_array(arr, offset, length)
235
+ jarr = Array.new(arr.size).to_java(:long)
236
+ begin
237
+ self.stream_.read_longlong_array(jarr, offset, length)
238
+ rescue ::NativeException
239
+ CORBA::Exception.native2r($!)
240
+ end
241
+ arr.fill(offset, length) {|i| jarr[i] }
242
+ end
243
+ def read_ulonglong()
244
+ begin
245
+ [self.stream_.read_ulonglong()].pack('q').unpack('Q').first
246
+ rescue ::NativeException
247
+ CORBA::Exception.native2r($!)
248
+ end
249
+ end
250
+ def read_ulonglong_array(arr, offset, length)
251
+ jarr = Array.new(arr.size).to_java(:long)
252
+ begin
253
+ self.stream_.read_ulonglong_array(jarr, offset, length)
254
+ rescue ::NativeException
255
+ CORBA::Exception.native2r($!)
256
+ end
257
+ jarr = jarr.pack('q*').unpack('Q*')
258
+ arr.fill(offset, length) {|i| jarr[i] }
259
+ end
260
+ def read_float()
261
+ begin
262
+ self.stream_.read_float()
263
+ rescue ::NativeException
264
+ CORBA::Exception.native2r($!)
265
+ end
266
+ end
267
+ def read_float_array(arr, offset, length)
268
+ jarr = Array.new(arr.size).to_java(:float)
269
+ begin
270
+ self.stream_.read_float_array(jarr, offset, length)
271
+ rescue ::NativeException
272
+ CORBA::Exception.native2r($!)
273
+ end
274
+ arr.fill(offset, length) {|i| jarr[i] }
275
+ end
276
+ def read_double()
277
+ begin
278
+ self.stream_.read_double()
279
+ rescue ::NativeException
280
+ CORBA::Exception.native2r($!)
281
+ end
282
+ end
283
+ def read_double_array(arr, offset, length)
284
+ jarr = Array.new(arr.size).to_java(:double)
285
+ begin
286
+ self.stream_.read_double_array(jarr, offset, length)
287
+ rescue ::NativeException
288
+ CORBA::Exception.native2r($!)
289
+ end
290
+ arr.fill(offset, length) {|i| jarr[i] }
291
+ end
292
+ def read_string()
293
+ begin
294
+ self.stream_.read_string()
295
+ rescue ::NativeException
296
+ CORBA::Exception.native2r($!)
297
+ end
298
+ end
299
+ def read_wstring()
300
+ begin
301
+ self.stream_.read_wstring()
302
+ rescue ::NativeException
303
+ CORBA::Exception.native2r($!)
304
+ end
305
+ end
306
+ def read_Object()
307
+ begin
308
+ CORBA::Object._wrap_native(self.stream_().read_Object())
309
+ rescue ::NativeException
310
+ CORBA::Exception.native2r($!)
311
+ end
312
+ end
313
+ def read_TypeCode()
314
+ begin
315
+ CORBA::TypeCode._wrap_native(self.stream_().read_TypeCode())
316
+ rescue ::NativeException
317
+ CORBA::Exception.native2r($!)
318
+ end
319
+ end
320
+ def read_fixed()
321
+ begin
322
+ java.math.BigDecimal.new(self.stream_.read_fixed().toString())
323
+ rescue ::NativeException
324
+ CORBA::Exception.native2r($!)
325
+ end
326
+ end
327
+ def read_construct(tc)
328
+ begin
329
+ jany = self.stream_.orb().create_any()
330
+ jany.read_value(self.stream_, tc.tc_)
331
+ CORBA::Any.from_java(jany, self.stream_.orb(), tc)
332
+ rescue ::NativeException
333
+ CORBA::Exception.native2r($!)
334
+ end
335
+ end
336
+ def read_Abstract()
337
+ begin
338
+ obj = self.stream_.read_abstract_interface()
339
+ rescue ::NativeException
340
+ CORBA::Exception.native2r($!)
341
+ end
342
+ obj = CORBA::Object._wrap_native(obj) if obj.is_a?(CORBA::Native::Object)
343
+ obj
344
+ end
345
+ def read_value()
346
+ begin
347
+ self.stream_.read_value()
348
+ rescue ::NativeException
349
+ CORBA::Exception.native2r($!)
350
+ end
351
+ end
352
+ alias :read_Value :read_value
353
+ def read_valuebox(boxedvalue_helper)
354
+ begin
355
+ self.stream_.read_value(boxedvalue_helper)
356
+ rescue ::NativeException
357
+ CORBA::Exception.native2r($!)
358
+ end
359
+ end
360
+ end
361
+
362
+ module OutputStream
363
+ @@wrapper_klass = Class.new do
364
+ include CORBA::Portable::OutputStream
365
+ def initialize(jobj)
366
+ @stream_ = jobj
367
+ end
368
+ attr_reader :stream_
369
+ end
370
+
371
+ def self._wrap_native(jobj)
372
+ if jobj.nil? || !jobj.is_a?(Native::V2_3::Portable::OutputStream)
373
+ raise ArgumentError, 'Expected org.omg.CORBA.portable.OutputStream'
374
+ end
375
+ @@wrapper_klass.new(jobj)
376
+ end
377
+
378
+ def write_member(tc, value)
379
+ tc = tc.resolved_tc # takes care of recursive typecodes
380
+ case tc.kind
381
+ when TK_ANY
382
+ write_any(value)
383
+ when TK_BOOLEAN
384
+ write_boolean(value)
385
+ when TK_SHORT
386
+ write_short(value)
387
+ when TK_LONG
388
+ write_long(value)
389
+ when TK_USHORT
390
+ write_ushort(value)
391
+ when TK_WCHAR
392
+ write_wchar(value)
393
+ when TK_ULONG
394
+ write_ulong(value)
395
+ when TK_LONGLONG
396
+ write_longlong(value)
397
+ when TK_ULONGLONG
398
+ write_ulonglong(value)
399
+ when TK_OCTET
400
+ write_octet(value)
401
+ when TK_FLOAT
402
+ write_float(value)
403
+ when TK_DOUBLE
404
+ write_double(value)
405
+ when TK_LONGDOUBLE
406
+ raise CORBA::NO_IMPLEMENT.new('LongDouble not supported',0,CORBA::COMPLETED_NO)
407
+ when TK_FIXED
408
+ write_fixed(value)
409
+ when TK_CHAR
410
+ write_char(value)
411
+ when TK_STRING
412
+ write_string(value)
413
+ when TK_WSTRING
414
+ write_wstring(value)
415
+ when TK_OBJREF
416
+ write_Object(value)
417
+ when TK_TYPECODE
418
+ write_TypeCode(value)
419
+ when TK_ARRAY, TK_SEQUENCE,
420
+ TK_ENUM, TK_STRUCT, TK_EXCEPT, TK_UNION,
421
+ TK_PRINCIPAL
422
+ write_construct(value, tc)
423
+ when TK_ABSTRACT_INTERFACE
424
+ write_Abstract(value)
425
+ when TK_VALUE
426
+ write_value(value)
427
+ when TK_VALUE_BOX
428
+ write_valuebox(value, tc.get_type().boxedvalue_helper())
429
+ ## TODO: TK_NATIVE
430
+ end
431
+ end
432
+
433
+ def write_any(value)
434
+ begin
435
+ self.stream_.write_any(value)
436
+ rescue ::NativeException
437
+ CORBA::Exception.native2r($!)
438
+ end
439
+ end
440
+ def write_boolean(value)
441
+ begin
442
+ self.stream_.write_boolean(value)
443
+ rescue ::NativeException
444
+ CORBA::Exception.native2r($!)
445
+ end
446
+ end
447
+ def write_boolean_array(value, offset, length)
448
+ begin
449
+ self.stream_.write_boolean_array(value.to_java(:boolean), offset, length)
450
+ rescue ::NativeException
451
+ CORBA::Exception.native2r($!)
452
+ end
453
+ end
454
+ def write_char(value)
455
+ begin
456
+ self.stream_.write_char(value[0])
457
+ rescue ::NativeException
458
+ CORBA::Exception.native2r($!)
459
+ end
460
+ end
461
+ def write_char_array(value, offset, length)
462
+ begin
463
+ self.stream_.write_char_array(value.collect{|c| c[0]}.to_java(:char), offset, length)
464
+ rescue ::NativeException
465
+ CORBA::Exception.native2r($!)
466
+ end
467
+ end
468
+ def write_wchar(value)
469
+ self.stream_.write_wchar(value)
470
+ end
471
+ def write_wchar_array(value, offset, length)
472
+ begin
473
+ self.stream_.write_wchar_array(value.to_java(:char), offset, length)
474
+ rescue ::NativeException
475
+ CORBA::Exception.native2r($!)
476
+ end
477
+ end
478
+ def write_octet(value)
479
+ begin
480
+ self.stream_.write_octet([value].pack('C').unpack('c').first)
481
+ rescue ::NativeException
482
+ CORBA::Exception.native2r($!)
483
+ end
484
+ end
485
+ def write_octet_array(value, offset, length)
486
+ begin
487
+ self.stream_.write_octet_array(value.pack('C*').unpack('c*').to_java(:byte), offset, length)
488
+ rescue ::NativeException
489
+ CORBA::Exception.native2r($!)
490
+ end
491
+ end
492
+ def write_short(value)
493
+ begin
494
+ self.stream_.write_short(value)
495
+ rescue ::NativeException
496
+ CORBA::Exception.native2r($!)
497
+ end
498
+ end
499
+ def write_short_array(value, offset, length)
500
+ begin
501
+ self.stream_.write_short_array(value.to_java(:short), offset, length)
502
+ rescue ::NativeException
503
+ CORBA::Exception.native2r($!)
504
+ end
505
+ end
506
+ def write_ushort(value)
507
+ begin
508
+ self.stream_.write_ushort([value].pack('S').unpack('s').first)
509
+ rescue ::NativeException
510
+ CORBA::Exception.native2r($!)
511
+ end
512
+ end
513
+ def write_ushort_array(value, offset, length)
514
+ begin
515
+ self.stream_.write_ushort_array(value.pack('S*').unpack('s*').to_java(:short), offset, length)
516
+ rescue ::NativeException
517
+ CORBA::Exception.native2r($!)
518
+ end
519
+ end
520
+ def write_long(value)
521
+ begin
522
+ self.stream_.write_long(value)
523
+ rescue ::NativeException
524
+ CORBA::Exception.native2r($!)
525
+ end
526
+ end
527
+ def write_long_array(value, offset, length)
528
+ begin
529
+ self.stream_.write_long_array(value.to_java(:int), offset, length)
530
+ rescue ::NativeException
531
+ CORBA::Exception.native2r($!)
532
+ end
533
+ end
534
+ def write_ulong(value)
535
+ begin
536
+ self.stream_.write_ulong([value].pack('L').unpack('l').first)
537
+ rescue ::NativeException
538
+ CORBA::Exception.native2r($!)
539
+ end
540
+ end
541
+ def write_ulong_array(value, offset, length)
542
+ begin
543
+ self.stream_.write_ulong_array(value.pack('L*').unpack('l*').to_java(:int), offset, length)
544
+ rescue ::NativeException
545
+ CORBA::Exception.native2r($!)
546
+ end
547
+ end
548
+ def write_longlong(value)
549
+ begin
550
+ self.stream_.write_longlong(value)
551
+ rescue ::NativeException
552
+ CORBA::Exception.native2r($!)
553
+ end
554
+ end
555
+ def write_longlong_array(value, offset, length)
556
+ begin
557
+ self.stream_.write_longlong_array(value.to_java(:long), offset, length)
558
+ rescue ::NativeException
559
+ CORBA::Exception.native2r($!)
560
+ end
561
+ end
562
+ def write_ulonglong(value)
563
+ begin
564
+ self.stream_.write_ulonglong([value].pack('Q').unpack('q').first)
565
+ rescue ::NativeException
566
+ CORBA::Exception.native2r($!)
567
+ end
568
+ end
569
+ def write_ulonglong_array(value, offset, length)
570
+ begin
571
+ self.stream_.write_ulonglong_array(value.pack('Q*').unpack('q*').to_java(:long), offset, length)
572
+ rescue ::NativeException
573
+ CORBA::Exception.native2r($!)
574
+ end
575
+ end
576
+ def write_float(value)
577
+ begin
578
+ self.stream_.write_float(value)
579
+ rescue ::NativeException
580
+ CORBA::Exception.native2r($!)
581
+ end
582
+ end
583
+ def write_float_array(value, offset, length)
584
+ begin
585
+ self.stream_.write_float_array(value.to_java(:float), offset, length)
586
+ rescue ::NativeException
587
+ CORBA::Exception.native2r($!)
588
+ end
589
+ end
590
+ def write_double(value)
591
+ begin
592
+ self.stream_.write_double(value)
593
+ rescue ::NativeException
594
+ CORBA::Exception.native2r($!)
595
+ end
596
+ end
597
+ def write_double_array(value, offset, length)
598
+ begin
599
+ self.stream_.write_double_array(value.to_java(:double), offset, length)
600
+ rescue ::NativeException
601
+ CORBA::Exception.native2r($!)
602
+ end
603
+ end
604
+ def write_string(value)
605
+ begin
606
+ self.stream_.write_string(value)
607
+ rescue ::NativeException
608
+ CORBA::Exception.native2r($!)
609
+ end
610
+ end
611
+ def write_wstring(value)
612
+ begin
613
+ self.stream_.write_wstring(value.inject('') {|s,b| s << b.chr})
614
+ rescue ::NativeException
615
+ CORBA::Exception.native2r($!)
616
+ end
617
+ end
618
+ def write_fixed(value)
619
+ begin
620
+ self.stream_.write_fixed(java.math.BigDecimal.new(value.to_s))
621
+ rescue ::NativeException
622
+ CORBA::Exception.native2r($!)
623
+ end
624
+ end
625
+ def write_Object(value)
626
+ begin
627
+ self.stream_.write_Object(value.objref_)
628
+ rescue ::NativeException
629
+ CORBA::Exception.native2r($!)
630
+ end
631
+ end
632
+ def write_TypeCode(value)
633
+ begin
634
+ self.stream_.write_TypeCode(value.tc_)
635
+ rescue ::NativeException
636
+ CORBA::Exception.native2r($!)
637
+ end
638
+ end
639
+ def write_construct(value, tc)
640
+ begin
641
+ CORBA::Any.to_any(value, tc).to_java(self.stream_().orb()).write_value(self.stream_)
642
+ rescue ::NativeException
643
+ CORBA::Exception.native2r($!)
644
+ end
645
+ end
646
+ def write_Abstract(value)
647
+ begin
648
+ self.stream_().write_abstract_interface(value.is_a?(CORBA::Object) ? value.objref_ : value)
649
+ rescue ::NativeException
650
+ CORBA::Exception.native2r($!)
651
+ end
652
+ end
653
+ def write_value(value)
654
+ begin
655
+ self.stream_.write_value(value)
656
+ rescue ::NativeException
657
+ CORBA::Exception.native2r($!)
658
+ end
659
+ end
660
+ alias :write_Value :write_value
661
+ def write_valuebox(value, boxedvalue_helper)
662
+ begin
663
+ self.stream_.write_value(value, boxedvalue_helper)
664
+ rescue ::NativeException
665
+ CORBA::Exception.native2r($!)
666
+ end
667
+ end
668
+ end
669
+ end
670
+ end
671
+ end
@@ -0,0 +1,38 @@
1
+ #--------------------------------------------------------------------
2
+ # Stub.rb - Java/JacORB CORBA Stub definitions
3
+ #
4
+ # Author: Martin Corino
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the R2CORBA LICENSE which is
8
+ # included with this program.
9
+ #
10
+ # Copyright (c) Remedy IT Expertise BV
11
+ # Chamber of commerce Rotterdam nr.276339, The Netherlands
12
+ #--------------------------------------------------------------------
13
+ module R2CORBA
14
+ module CORBA
15
+ module Stub
16
+ include R2CORBA::CORBA::Portable::Stub
17
+
18
+ protected
19
+
20
+ ##
21
+ # Handle IDL generated invocation
22
+ def _invoke(operation, param = {})
23
+ raise ArgumentError, 'expected Hash' unless ::Hash === param
24
+ req = self._request(operation)
25
+ req.arguments = param[:arg_list] if param.has_key?(:arg_list)
26
+ req.exceptions = param[:exc_list] if param.has_key?(:exc_list)
27
+ if param.has_key?(:result_type)
28
+ req.set_return_type(param[:result_type])
29
+ return req.invoke
30
+ else
31
+ req.send_oneway
32
+ return nil
33
+ end
34
+ end
35
+
36
+ end # Stub
37
+ end # CORBA
38
+ end # R2CORBA