r2corba 1.4.1-x86-mingw32 → 1.5.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. checksums.yaml +7 -7
  2. data/CHANGES +173 -159
  3. data/LICENSE +59 -59
  4. data/README +62 -62
  5. data/THANKS +54 -52
  6. data/bin/r2corba +1 -1
  7. data/bin/ridlc +1 -1
  8. data/bin/rins +1 -1
  9. data/lib/corba.rb +16 -16
  10. data/lib/corba/cbase/IORMap.rb +33 -33
  11. data/lib/corba/cbase/ORB.rb +237 -231
  12. data/lib/corba/cbase/Request.rb +133 -133
  13. data/lib/corba/cbase/Streams.rb +129 -129
  14. data/lib/corba/cbase/Stub.rb +19 -19
  15. data/lib/corba/cbase/Typecode.rb +441 -441
  16. data/lib/corba/cbase/Values.rb +129 -129
  17. data/lib/corba/cbase/exception.rb +66 -66
  18. data/lib/corba/cbase/poa.rb +23 -23
  19. data/lib/corba/cbase/policies.rb +77 -77
  20. data/lib/corba/cbase/post_require.rb +13 -13
  21. data/lib/corba/cbase/require.rb +28 -28
  22. data/lib/corba/cmds/base.rb +85 -85
  23. data/lib/corba/cmds/test.rb +30 -30
  24. data/lib/corba/common/Any.rb +91 -91
  25. data/lib/corba/common/IDL.rb +104 -104
  26. data/lib/corba/common/ORB.rb +368 -368
  27. data/lib/corba/common/Object.rb +208 -208
  28. data/lib/corba/common/Request.rb +19 -19
  29. data/lib/corba/common/Servant.rb +108 -108
  30. data/lib/corba/common/Struct.rb +21 -21
  31. data/lib/corba/common/Stub.rb +79 -79
  32. data/lib/corba/common/Typecode.rb +1121 -1121
  33. data/lib/corba/common/Union.rb +55 -55
  34. data/lib/corba/common/Values.rb +91 -91
  35. data/lib/corba/common/const.rb +22 -22
  36. data/lib/corba/common/exception.rb +68 -68
  37. data/lib/corba/common/require.rb +27 -27
  38. data/lib/corba/common/version.rb +22 -22
  39. data/lib/corba/idl/IDL.rb +21 -21
  40. data/lib/corba/idl/IORTable.pidl +62 -62
  41. data/lib/corba/idl/TAO_Ext.pidl +46 -46
  42. data/lib/corba/idl/require.rb +20 -20
  43. data/lib/corba/jbase/Any.rb +273 -273
  44. data/lib/corba/jbase/IORMap.rb +35 -35
  45. data/lib/corba/jbase/ORB.rb +112 -99
  46. data/lib/corba/jbase/Object.rb +99 -98
  47. data/lib/corba/jbase/Request.rb +225 -225
  48. data/lib/corba/jbase/Servant.rb +247 -246
  49. data/lib/corba/jbase/ServerRequest.rb +127 -127
  50. data/lib/corba/jbase/Streams.rb +670 -670
  51. data/lib/corba/jbase/Stub.rb +38 -38
  52. data/lib/corba/jbase/Typecode.rb +520 -520
  53. data/lib/corba/jbase/Values.rb +173 -173
  54. data/lib/corba/jbase/exception.rb +106 -106
  55. data/lib/corba/jbase/poa.rb +228 -228
  56. data/lib/corba/jbase/policies.rb +299 -299
  57. data/lib/corba/jbase/post_require.rb +14 -14
  58. data/lib/corba/jbase/require.rb +89 -86
  59. data/lib/corba/naming.rb +14 -14
  60. data/lib/corba/naming_service.rb +15 -15
  61. data/lib/corba/poa.rb +15 -15
  62. data/lib/corba/policies.rb +18 -18
  63. data/lib/corba/require.rb +17 -17
  64. data/lib/corba/svcs/ins/cos_naming.rb +426 -426
  65. data/lib/corba/svcs/ins/ins.rb +526 -526
  66. data/lib/corba/svcs/ins/naming_service.rb +119 -119
  67. data/lib/ridlbe/ruby/config.rb +336 -336
  68. data/lib/ridlbe/ruby/orb.pidlc +0 -0
  69. data/lib/ridlbe/ruby/require.rb +16 -16
  70. data/lib/ridlbe/ruby/walker.rb +1582 -1582
  71. data/mkrf_conf_bingem.rb +151 -101
  72. data/rakelib/bin.rake +80 -80
  73. data/rakelib/bin.rb +145 -145
  74. data/rakelib/build.rake +87 -87
  75. data/rakelib/config.rake +51 -51
  76. data/rakelib/config.rb +543 -449
  77. data/rakelib/ext.rake +242 -242
  78. data/rakelib/ext.rb +316 -308
  79. data/rakelib/ext_r2tao.rb +235 -232
  80. data/rakelib/gem.rake +235 -211
  81. data/rakelib/gem.rb +145 -145
  82. data/rakelib/package.rake +26 -26
  83. data/rakelib/test.rake +23 -23
  84. data/test/BiDirectional/Test.idl +34 -34
  85. data/test/BiDirectional/client.rb +131 -131
  86. data/test/BiDirectional/run_test.rb +68 -68
  87. data/test/BiDirectional/server.ior +1 -1
  88. data/test/BiDirectional/server.rb +169 -169
  89. data/test/CORBA_Services/Naming/BindingIterator/Test.idl +27 -27
  90. data/test/CORBA_Services/Naming/BindingIterator/client.rb +121 -121
  91. data/test/CORBA_Services/Naming/BindingIterator/ins.ior +1 -1
  92. data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +82 -82
  93. data/test/CORBA_Services/Naming/BindingIterator/server.rb +109 -109
  94. data/test/CORBA_Services/Naming/Corbaname/Test.idl +27 -27
  95. data/test/CORBA_Services/Naming/Corbaname/client.rb +85 -85
  96. data/test/CORBA_Services/Naming/Corbaname/ins.ior +1 -1
  97. data/test/CORBA_Services/Naming/Corbaname/run_test.rb +88 -88
  98. data/test/CORBA_Services/Naming/Corbaname/server.rb +135 -135
  99. data/test/CORBA_Services/Naming/Simple/Test.idl +27 -27
  100. data/test/CORBA_Services/Naming/Simple/client.rb +84 -84
  101. data/test/CORBA_Services/Naming/Simple/ins.ior +1 -1
  102. data/test/CORBA_Services/Naming/Simple/run_test.rb +82 -82
  103. data/test/CORBA_Services/Naming/Simple/server.rb +109 -109
  104. data/test/Collocation/Diamond.idl +39 -39
  105. data/test/Collocation/run_test.rb +52 -52
  106. data/test/Collocation/test.rb +195 -195
  107. data/test/Connect_Timeout/Test.idl +27 -27
  108. data/test/Connect_Timeout/client.rb +111 -111
  109. data/test/Connect_Timeout/run_test.rb +52 -52
  110. data/test/DII/Test.idl +27 -27
  111. data/test/DII/client.rb +115 -115
  112. data/test/DII/run_test.rb +69 -69
  113. data/test/DII/server.ior +1 -1
  114. data/test/DII/server.rb +95 -95
  115. data/test/DSI/Test.idl +27 -27
  116. data/test/DSI/client.rb +66 -66
  117. data/test/DSI/run_test.rb +69 -69
  118. data/test/DSI/server.ior +1 -1
  119. data/test/DSI/server.rb +106 -106
  120. data/test/Exceptions/Test.idl +48 -48
  121. data/test/Exceptions/client.rb +117 -117
  122. data/test/Exceptions/run_test.rb +69 -69
  123. data/test/Exceptions/server.ior +1 -1
  124. data/test/Exceptions/server.rb +131 -131
  125. data/test/Hello/Test.idl +27 -27
  126. data/test/Hello/client.rb +78 -78
  127. data/test/Hello/run_test.rb +71 -71
  128. data/test/Hello/server.rb +95 -95
  129. data/test/IDL_Test/Test.idl +113 -113
  130. data/test/IDL_Test/Test_inc.idl +17 -17
  131. data/test/IDL_Test/client.rb +102 -102
  132. data/test/IDL_Test/run_test.rb +69 -69
  133. data/test/IDL_Test/server.ior +1 -1
  134. data/test/IDL_Test/server.rb +99 -99
  135. data/test/IORMap/Test.idl +27 -27
  136. data/test/IORMap/client.rb +73 -73
  137. data/test/IORMap/run_test.rb +69 -69
  138. data/test/IORMap/server.ior +1 -1
  139. data/test/IORMap/server.rb +114 -114
  140. data/test/IORTable/Test.idl +27 -27
  141. data/test/IORTable/client.rb +75 -75
  142. data/test/IORTable/run_test.rb +69 -69
  143. data/test/IORTable/server.ior +1 -1
  144. data/test/IORTable/server.rb +130 -130
  145. data/test/Implicit_Conversion/Test.idl +31 -31
  146. data/test/Implicit_Conversion/client.rb +110 -110
  147. data/test/Implicit_Conversion/run_test.rb +69 -69
  148. data/test/Implicit_Conversion/server.ior +1 -1
  149. data/test/Implicit_Conversion/server.rb +99 -99
  150. data/test/Multi_Threading/Multiple_ORB/Test.idl +27 -27
  151. data/test/Multi_Threading/Multiple_ORB/client.rb +82 -82
  152. data/test/Multi_Threading/Multiple_ORB/run_test.rb +71 -71
  153. data/test/Multi_Threading/Multiple_ORB/server.rb +108 -108
  154. data/test/Multi_Threading/Multiple_ORB/server0.ior +1 -1
  155. data/test/Multi_Threading/Multiple_ORB/server1.ior +1 -1
  156. data/test/Multi_Threading/Simple/Test.idl +27 -27
  157. data/test/Multi_Threading/Simple/client.rb +93 -88
  158. data/test/Multi_Threading/Simple/run_test.rb +69 -69
  159. data/test/Multi_Threading/Simple/server.ior +1 -1
  160. data/test/Multi_Threading/Simple/server.rb +117 -117
  161. data/test/Multi_Threading/Threads/Test.idl +31 -31
  162. data/test/Multi_Threading/Threads/client.rb +80 -80
  163. data/test/Multi_Threading/Threads/run_test.rb +76 -76
  164. data/test/Multi_Threading/Threads/server.ior +1 -1
  165. data/test/Multi_Threading/Threads/server.rb +119 -119
  166. data/test/Multi_Threading/Threads/watchdog.ior +1 -1
  167. data/test/Multi_Threading/Threads/watchdog.rb +87 -87
  168. data/test/Multiple_Servant_Interfaces/Test.idl +34 -34
  169. data/test/Multiple_Servant_Interfaces/client.rb +70 -70
  170. data/test/Multiple_Servant_Interfaces/run_test.rb +69 -69
  171. data/test/Multiple_Servant_Interfaces/server.ior +1 -1
  172. data/test/Multiple_Servant_Interfaces/server.rb +102 -102
  173. data/test/Nil/Test.idl +27 -27
  174. data/test/Nil/run_test.rb +52 -52
  175. data/test/Nil/test.rb +78 -78
  176. data/test/OBV/AbstractInterface/client.rb +179 -179
  177. data/test/OBV/AbstractInterface/run_test.rb +69 -69
  178. data/test/OBV/AbstractInterface/server.ior +1 -1
  179. data/test/OBV/AbstractInterface/server.rb +149 -149
  180. data/test/OBV/AbstractInterface/test.idl +53 -53
  181. data/test/OBV/Custom/OBV.idl +18 -18
  182. data/test/OBV/Custom/OBV_impl.rb +40 -40
  183. data/test/OBV/Custom/client.rb +86 -86
  184. data/test/OBV/Custom/run_test.rb +69 -69
  185. data/test/OBV/Custom/server.ior +1 -1
  186. data/test/OBV/Custom/server.rb +100 -100
  187. data/test/OBV/Simple/OBV.idl +15 -15
  188. data/test/OBV/Simple/OBV_impl.rb +26 -26
  189. data/test/OBV/Simple/client.rb +86 -86
  190. data/test/OBV/Simple/run_test.rb +69 -69
  191. data/test/OBV/Simple/server.ior +1 -1
  192. data/test/OBV/Simple/server.rb +100 -100
  193. data/test/OBV/Simple_Event/Event.idl +15 -15
  194. data/test/OBV/Simple_Event/Event_impl.rb +26 -26
  195. data/test/OBV/Simple_Event/client.rb +86 -86
  196. data/test/OBV/Simple_Event/run_test.rb +69 -69
  197. data/test/OBV/Simple_Event/server.ior +1 -1
  198. data/test/OBV/Simple_Event/server.rb +100 -100
  199. data/test/OBV/Supports/client.rb +116 -116
  200. data/test/OBV/Supports/run_test.rb +69 -69
  201. data/test/OBV/Supports/server.ior +1 -1
  202. data/test/OBV/Supports/server.rb +103 -103
  203. data/test/OBV/Supports/supports.idl +33 -33
  204. data/test/OBV/Supports/supports_impl.rb +57 -57
  205. data/test/OBV/Tree/client.rb +116 -116
  206. data/test/OBV/Tree/run_test.rb +69 -69
  207. data/test/OBV/Tree/server.ior +1 -1
  208. data/test/OBV/Tree/server.rb +117 -117
  209. data/test/OBV/Tree/test.idl +32 -32
  210. data/test/OBV/Truncatable/Extra.idl +27 -27
  211. data/test/OBV/Truncatable/Truncatable.idl +105 -105
  212. data/test/OBV/Truncatable/Truncatable_impl.rb +86 -86
  213. data/test/OBV/Truncatable/client.rb +279 -279
  214. data/test/OBV/Truncatable/run_test.rb +69 -69
  215. data/test/OBV/Truncatable/server.ior +1 -1
  216. data/test/OBV/Truncatable/server.rb +89 -89
  217. data/test/OBV/ValueBox/client.rb +497 -497
  218. data/test/OBV/ValueBox/run_test.rb +69 -69
  219. data/test/OBV/ValueBox/server.ior +1 -1
  220. data/test/OBV/ValueBox/server.rb +271 -271
  221. data/test/OBV/ValueBox/valuebox.idl +101 -101
  222. data/test/OBV/ValueBox/vb_basic.idl +75 -75
  223. data/test/OBV/ValueBox/vb_struct.idl +68 -68
  224. data/test/OBV/ValueBox/vb_union.idl +21 -21
  225. data/test/Object/Test.idl +27 -27
  226. data/test/Object/client.rb +112 -103
  227. data/test/Object/run_test.rb +69 -69
  228. data/test/Object/server.ior +1 -1
  229. data/test/Object/server.rb +126 -126
  230. data/test/POA/Test.idl +27 -27
  231. data/test/POA/run_test.rb +52 -52
  232. data/test/POA/test.rb +111 -111
  233. data/test/Param_Test/Test.idl +182 -182
  234. data/test/Param_Test/client.rb +277 -277
  235. data/test/Param_Test/run_test.rb +69 -69
  236. data/test/Param_Test/server.ior +1 -1
  237. data/test/Param_Test/server.rb +296 -296
  238. data/test/Performance/Simple/Test.idl +27 -27
  239. data/test/Performance/Simple/client.rb +90 -90
  240. data/test/Performance/Simple/run_test.rb +69 -69
  241. data/test/Performance/Simple/server.ior +1 -1
  242. data/test/Performance/Simple/server.rb +95 -95
  243. data/test/Policies/Test.idl +27 -27
  244. data/test/Policies/run_test.rb +52 -52
  245. data/test/Policies/test.rb +144 -144
  246. data/test/Timeout/client.rb +207 -207
  247. data/test/Timeout/run_test.rb +69 -69
  248. data/test/Timeout/server.ior +1 -1
  249. data/test/Timeout/server.rb +109 -109
  250. data/test/Timeout/test.idl +19 -19
  251. data/test/lib/assert.rb +43 -43
  252. data/test/lib/test.rb +542 -542
  253. data/test/test_runner.rb +193 -193
  254. metadata +141 -137
@@ -1,526 +1,526 @@
1
- #--------------------------------------------------------------------
2
- # ins.rb - main file for R2CORBA INS service
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
- require 'corba/svcs/ins/naming_service'
15
- require 'optparse'
16
-
17
- module R2CORBA
18
- module INS
19
- INS_VERSION_MAJOR = 0.freeze
20
- INS_VERSION_MINOR = 1.freeze
21
- INS_VERSION_RELEASE = 1.freeze
22
- INS_COPYRIGHT = 'Copyright (c) 2011-2013 Remedy IT Expertise BV, The Netherlands'.freeze
23
-
24
- IS_WIN32 = (RUBY_PLATFORM =~ /win32/ || RUBY_PLATFORM =~ /mingw32/ || ENV['OS'] =~ /windows/i) ? true : false
25
- IS_JRUBY = defined?(JRUBY_VERSION)
26
-
27
- @@daemons_installed = false
28
-
29
- unless IS_WIN32 || IS_JRUBY
30
- begin
31
- require 'rubygems'
32
- require 'daemons'
33
- @@daemons_installed = true
34
- rescue LoadError
35
- STDERR.puts 'Daemon functionality requires installed "daemons" GEM.'
36
- end
37
- end
38
-
39
- def INS.daemons_installed
40
- @@daemons_installed
41
- end
42
-
43
- class Controller
44
- def initialize(options)
45
- @options = options
46
- end
47
-
48
- def report(msg)
49
- STDERR.puts msg if @options[:verbose]
50
- end
51
- end
52
-
53
- if IS_WIN32 || IS_JRUBY || !INS.daemons_installed
54
- class Controller
55
- def start
56
- report 'INS - initializing service'
57
-
58
- if self.pidfile_exists?
59
- rc, pid = self.check_pidfile
60
- if rc
61
- STDERR.puts "ERROR: INS - existing PID file #{self.pidfile} found; service may still be alive"
62
- exit 1
63
- else
64
- File.delete(self.pidfile)
65
- end
66
- end
67
-
68
- begin
69
- File.open(self.pidfile, File::CREAT|File::EXCL|File::WRONLY) do |f|
70
- f.write Process.pid
71
- end
72
- report "INS - PID \##{Process.pid} written to '#{self.pidfile}'"
73
- rescue ::Exception
74
- STDERR.puts "ERROR: INS - failed to write PID file #{self.pidfile}"
75
- exit 1
76
- end
77
-
78
- $ins_service_pid_file = self.pidfile
79
- at_exit {
80
- File.delete($ins_service_pid_file)
81
- }
82
-
83
- # initialize service
84
- ins_svc = INS::Service.new(@options)
85
-
86
- report 'INS - running service'
87
-
88
- stop_proc = Proc.new do
89
- report 'INS - shutting down'
90
- begin; ins_svc.shutdown; rescue ::Exception; STDERR.puts "#{$!}\n#{$!.backtrace.join("\n")}"; end
91
- end
92
- Signal.trap('INT', stop_proc)
93
- Signal.trap('TERM', stop_proc)
94
-
95
- ins_svc.setup
96
-
97
- ins_svc.run
98
-
99
- report 'INS - stopped'
100
- end
101
-
102
- def stop
103
- report 'INS - stopping service'
104
-
105
- rc, pid = self.check_pidfile()
106
-
107
- if pid
108
- report 'INS - signalling service'
109
- if IS_WIN32
110
- Kernel.system("taskkill /PID #{pid} /F")
111
- File.delete(self.pidfile)
112
- else
113
- Process.kill(:TERM, pid) rescue nil
114
- end
115
- end
116
- end
117
-
118
- def status
119
- report 'INS - retrieving service status'
120
-
121
- rc, pid = self.check_pidfile()
122
-
123
- if pid
124
- if rc
125
- STDERR.puts "found PID #{pid} in file #{pidfile} : process is alive"
126
- else
127
- STDERR.puts "found PID #{pid} in file #{pidfile} : process is not running"
128
- exit 1
129
- end
130
- end
131
- end
132
-
133
- protected
134
- def pidfile
135
- @pidfile ||= File.join(@options[:piddir], 'ins.rb.pid')
136
- end
137
-
138
- def pidfile_exists?
139
- File.exists?(self.pidfile)
140
- end
141
-
142
- def check_pidfile
143
- pid = nil
144
- begin
145
- File.open(self.pidfile, 'r') do |f|
146
- pid = f.read.to_i
147
- end
148
- rescue ::Exception
149
- STDERR.puts "ERROR: INS - failed to read PID file #{self.pidfile}"
150
- return [false, nil]
151
- end
152
-
153
- begin
154
- Process.kill(0, pid)
155
- return [true, pid]
156
- rescue ::Exception
157
- return [false, pid]
158
- end
159
- end
160
- end # Controller
161
- else
162
- # Service controller for *nix platforms
163
- #
164
- require 'rubygems'
165
- require 'daemons'
166
-
167
- class ::Daemons::Application
168
- def exit
169
- # make exit() call a NOOP here
170
- # Daemons calls this when shutting down and that messes up our clean shutdown
171
- # STDERR.puts 'exit NOOP'
172
- end
173
- end
174
-
175
- class Controller
176
- def start
177
- report 'INS - initializing service'
178
- # initialize service
179
- ins_svc = INS::Service.new(@options)
180
-
181
- if @options[:daemon]
182
- report 'INS - starting daemon mode'
183
-
184
- daemon_opt = {
185
- :app_name => 'rins',
186
- :ARGV => ['start'],
187
- :dir_mode => :normal,
188
- :dir => @options[:piddir],
189
- :multiple => true,
190
- :log_dir => @options[:logdir] || @options[:piddir],
191
- :log_output => true,
192
- :stop_proc => Proc.new do
193
- report 'INS - shutting down'
194
- ins_svc.shutdown
195
- end
196
- }
197
-
198
- Daemons.run_proc('ins.rb', daemon_opt) do
199
- report 'INS - daemon started'
200
-
201
- ins_svc.setup
202
-
203
- ins_svc.run
204
-
205
- report 'INS - stopped'
206
- end
207
- else
208
- report 'INS - running service in foreground'
209
-
210
- if self.pidfile_exists?
211
- rc, pid = self.check_pidfile
212
- if rc
213
- STDERR.puts "ERROR: INS - existing PID file #{self.pidfile} found; service may still be alive"
214
- exit 1
215
- else
216
- File.delete(self.pidfile)
217
- end
218
- end
219
-
220
- begin
221
- File.open(self.pidfile, File::CREAT|File::EXCL|File::WRONLY) do |f|
222
- f.write Process.pid
223
- end
224
- report "INS - PID \##{Process.pid} written to '#{self.pidfile}'"
225
- rescue ::Exception
226
- STDERR.puts "ERROR: INS - failed to write PID file #{self.pidfile}"
227
- exit 1
228
- end
229
-
230
- $ins_service_pid_file = self.pidfile
231
- at_exit {
232
- File.delete($ins_service_pid_file)
233
- }
234
-
235
- stop_proc = Proc.new do
236
- report 'INS - shutting down'
237
- begin; ins_svc.shutdown; rescue ::Exception; STDERR.puts "#{$!}\n#{$!.backtrace.join("\n")}"; end
238
- end
239
- Signal.trap('INT', stop_proc)
240
- Signal.trap('TERM', stop_proc)
241
-
242
- ins_svc.setup
243
-
244
- ins_svc.run
245
-
246
- report 'INS - stopped'
247
-
248
- exit(0)
249
- end
250
- end
251
-
252
- def stop
253
- report 'INS - stopping service'
254
- if @options[:daemon]
255
- daemon_opt = {
256
- :app_name => 'rins',
257
- :ARGV => ['stop'],
258
- :dir_mode => :normal,
259
- :dir => @options[:piddir],
260
- :multiple => true,
261
- }
262
-
263
- Daemons.run_proc('ins.rb', daemon_opt) {}
264
- else
265
- rc, pid = self.check_pidfile()
266
-
267
- if pid
268
- report 'INS - signalling service'
269
- Process.kill(:TERM, pid) rescue nil
270
- end
271
- end
272
- end
273
-
274
- def restart
275
- if @options[:daemon]
276
- report 'INS - initializing service'
277
- # initialize service
278
- ins_svc = INS::Service.new(@options)
279
-
280
- report 'INS - restarting daemon mode'
281
-
282
- daemon_opt = {
283
- :app_name => 'rins',
284
- :ARGV => ['restart'],
285
- :dir_mode => :normal,
286
- :dir => @options[:piddir],
287
- :multiple => true,
288
- :log_dir => @options[:logdir] || @options[:piddir],
289
- :log_output => true,
290
- :stop_proc => Proc.new do
291
- report 'INS - shutting down'
292
- ins_svc.shutdown
293
- end
294
- }
295
-
296
- Daemons.run_proc('ins.rb', daemon_opt) do
297
- report 'INS - daemon started'
298
-
299
- ins_svc.setup
300
-
301
- ins_svc.run
302
-
303
- report 'INS - stopped'
304
- end
305
- else
306
- STDERR.puts "INS - restart command is only functional in daemon mode"
307
- exit 1
308
- end
309
- end
310
-
311
- def status
312
- report 'INS - retrieving service status'
313
- daemon_opt = {
314
- :app_name => 'rins',
315
- :ARGV => ['status'],
316
- :dir_mode => :normal,
317
- :dir => @options[:piddir],
318
- :multiple => true,
319
- }
320
-
321
- Daemons.run_proc('ins.rb', daemon_opt) {}
322
- end
323
-
324
- protected
325
- def pidfile
326
- @pidfile ||= File.join(@options[:piddir], 'ins.rb.pid')
327
- end
328
-
329
- def pidfile_exists?
330
- File.exists?(self.pidfile)
331
- end
332
-
333
- def check_pidfile
334
- pid = nil
335
- begin
336
- File.open(self.pidfile, 'r') do |f|
337
- pid = f.read.to_i
338
- end
339
- rescue ::Exception
340
- STDERR.puts "ERROR: INS - failed to read PID file #{self.pidfile}"
341
- return [false, nil]
342
- end
343
-
344
- begin
345
- Process.kill(0, pid)
346
- return [true, pid]
347
- rescue ::Exception
348
- return [false, pid]
349
- end
350
- end
351
- end # Controller
352
- end
353
-
354
- OPTIONS = {
355
- :piddir => Dir.getwd,
356
- :iorfile => 'ins.ior',
357
- :debug => 0,
358
- :logdir => nil,
359
- :threads => 5,
360
- :orbprop => {},
361
- :port => 0,
362
- }
363
-
364
- COMMANDS = [
365
- :start,
366
- :stop,
367
- :restart,
368
- :status,
369
- :help,
370
- :version
371
- ]
372
- if IS_JRUBY
373
- COMMANDS.delete(:restart)
374
- end
375
- if IS_WIN32
376
- COMMANDS << :install
377
- COMMANDS << :remove
378
- end
379
-
380
- @@command = nil
381
-
382
- def INS.command
383
- @@command
384
- end
385
-
386
- def INS.parse_arg
387
- script_name = File.basename($0, '.bat')
388
- if not script_name =~ /rins/
389
- script_name = "ruby "+$0
390
- end
391
-
392
- @@command = ARGV.shift.to_sym unless ARGV.empty?
393
- unless COMMANDS.include?(@@command)
394
- STDERR.puts "ERROR: Invalid command [#{command}]!\n"+
395
- "Usage: #{script_name} #{COMMANDS.join('|')} [options]\n"
396
- exit 1
397
- end
398
-
399
- # extract -ORBxxx aguments
400
- f_ = false
401
- ARGV.collect! { |a|
402
- if f_
403
- f_ = false
404
- OPTIONS[:orbprop] << a
405
- nil
406
- else
407
- f_ = /^-ORB/ =~ a
408
- OPTIONS[:orbprop] << a if f_
409
- f_ ? nil : a
410
- end
411
- }.compact!
412
-
413
- case @@command
414
- when :help
415
- puts "Usage: #{script_name} #{COMMANDS.join('|')} [options]\n"
416
- puts "\n"
417
- puts " #{script_name} #{(COMMANDS - [:help, :version]).join('|')} --help\n"
418
- puts " provides help for the specified command\n\n"
419
- exit
420
- when :version
421
- puts "R2CORBA Interoprable Naming Service (INS) #{INS_VERSION_MAJOR}.#{INS_VERSION_MINOR}.#{INS_VERSION_RELEASE}"
422
- puts INS_COPYRIGHT
423
- puts ''
424
- exit
425
- when :start, :restart
426
- ARGV.options do |opts|
427
- opts.banner = "Usage: #{script_name} start [options]"
428
-
429
- opts.separator ""
430
-
431
- opts.on("-i FILE", "--ior=FILE", String,
432
- "Specifies filename (incl. path) to write IOR to.",
433
- "Default: ./ins.ior") { |v| OPTIONS[:iorfile]=v }
434
- unless IS_WIN32
435
- opts.on("-p DIR", "--pid=DIR", String,
436
- "Specifies path to write pidfile to.",
437
- "Default: ./") { |v| OPTIONS[:piddir]=v }
438
- unless IS_JRUBY
439
- opts.on("-o DIR", "--output=DIR", String,
440
- "Specifies filename to write logfile to.",
441
- "Default: <piddir>") { |v| OPTIONS[:logdir]=v }
442
- end
443
- else
444
- opts.on("-o DIR", "--output=DIR", String,
445
- "Specifies path to write logfile to.",
446
- "Default: ./") { |v| OPTIONS[:logdir]=v }
447
- end
448
- opts.on("-l PORTNUM", "--listen=PORTNUM", Integer,
449
- "Specifies port number for service endpoint.",
450
- "Default: none") { |v| OPTIONS[:port]=v }
451
- if (IS_JRUBY or R2CORBA::TAO::RUBY_THREAD_SUPPORT)
452
- opts.on("-t THREADNUM", "--threads=THREADNUM", Integer,
453
- "Specifies (minimum) number of threads for service.",
454
- "Default: 5") { |v| OPTIONS[:threads]=v }
455
- end
456
-
457
- unless IS_JRUBY || !INS.daemons_installed
458
- opts.on("-d", "--daemon",
459
- "Run as daemon.",
460
- "Default: off") { |v| OPTIONS[:daemon]=v }
461
- end
462
- opts.on("-v", "--verbose",
463
- "Run verbose.",
464
- "Default: off") { |v| OPTIONS[:verbose]=v }
465
-
466
- opts.on("--debug=LVL", Integer,
467
- "Specifies debug level.",
468
- "Default: 0") { |v| OPTIONS[:debug]=v }
469
-
470
- opts.separator ""
471
-
472
- opts.on("-h", "--help",
473
- "Show this help message.") { puts opts; puts; exit }
474
-
475
- opts.parse!
476
- end
477
- OPTIONS[:iorfile] = File.expand_path(OPTIONS[:iorfile])
478
- when :stop, :status
479
- ARGV.options do |opts|
480
- opts.banner = "Usage: #{script_name} stop [options]"
481
-
482
- opts.separator ""
483
-
484
- unless IS_WIN32
485
- opts.on("-p DIR", "--pid=DIR", String,
486
- "Specifies path where pidfile is stored.",
487
- "Default: ./") { |v| OPTIONS[:piddir]=v }
488
- end
489
-
490
- unless @@command == 'status'
491
- OPTIONS[:daemon] = true unless IS_JRUBY || !INS.daemons_installed
492
- opts.on("--[no-]daemon",
493
- "Do not run in daemon mode.",
494
- "Default: #{OPTIONS[:daemon] ? 'on' : 'off'}") { |v| OPTIONS[:daemon]=v }
495
- end
496
- opts.on("-v", "--verbose",
497
- "Run verbose.",
498
- "Default: off") { |v| OPTIONS[:verbose]=v }
499
-
500
- opts.separator ""
501
-
502
- opts.on("-h", "--help",
503
- "Show this help message.") { puts opts; puts; exit }
504
-
505
- opts.parse!
506
- end
507
- when :install
508
- when :remove
509
- end
510
- OPTIONS[:piddir] = File.expand_path(OPTIONS[:piddir]) if OPTIONS[:piddir]
511
- OPTIONS[:logdir] = File.expand_path(OPTIONS[:logdir]) if OPTIONS[:logdir]
512
- end
513
-
514
- def INS.run
515
- self.parse_arg()
516
-
517
- Controller.new(OPTIONS).send(self.command)
518
- end
519
- end
520
- end
521
-
522
- if __FILE__ == $0
523
-
524
- R2CORBA::INS.run
525
-
526
- end
1
+ #--------------------------------------------------------------------
2
+ # ins.rb - main file for R2CORBA INS service
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
+ require 'corba/svcs/ins/naming_service'
15
+ require 'optparse'
16
+
17
+ module R2CORBA
18
+ module INS
19
+ INS_VERSION_MAJOR = 0.freeze
20
+ INS_VERSION_MINOR = 1.freeze
21
+ INS_VERSION_RELEASE = 1.freeze
22
+ INS_COPYRIGHT = 'Copyright (c) 2011-2013 Remedy IT Expertise BV, The Netherlands'.freeze
23
+
24
+ IS_WIN32 = (RUBY_PLATFORM =~ /win32/ || RUBY_PLATFORM =~ /mingw32/ || ENV['OS'] =~ /windows/i) ? true : false
25
+ IS_JRUBY = defined?(JRUBY_VERSION)
26
+
27
+ @@daemons_installed = false
28
+
29
+ unless IS_WIN32 || IS_JRUBY
30
+ begin
31
+ require 'rubygems'
32
+ require 'daemons'
33
+ @@daemons_installed = true
34
+ rescue LoadError
35
+ STDERR.puts 'Daemon functionality requires installed "daemons" GEM.'
36
+ end
37
+ end
38
+
39
+ def INS.daemons_installed
40
+ @@daemons_installed
41
+ end
42
+
43
+ class Controller
44
+ def initialize(options)
45
+ @options = options
46
+ end
47
+
48
+ def report(msg)
49
+ STDERR.puts msg if @options[:verbose]
50
+ end
51
+ end
52
+
53
+ if IS_WIN32 || IS_JRUBY || !INS.daemons_installed
54
+ class Controller
55
+ def start
56
+ report 'INS - initializing service'
57
+
58
+ if self.pidfile_exists?
59
+ rc, pid = self.check_pidfile
60
+ if rc
61
+ STDERR.puts "ERROR: INS - existing PID file #{self.pidfile} found; service may still be alive"
62
+ exit 1
63
+ else
64
+ File.delete(self.pidfile)
65
+ end
66
+ end
67
+
68
+ begin
69
+ File.open(self.pidfile, File::CREAT|File::EXCL|File::WRONLY) do |f|
70
+ f.write Process.pid
71
+ end
72
+ report "INS - PID \##{Process.pid} written to '#{self.pidfile}'"
73
+ rescue ::Exception
74
+ STDERR.puts "ERROR: INS - failed to write PID file #{self.pidfile}"
75
+ exit 1
76
+ end
77
+
78
+ $ins_service_pid_file = self.pidfile
79
+ at_exit {
80
+ File.delete($ins_service_pid_file)
81
+ }
82
+
83
+ # initialize service
84
+ ins_svc = INS::Service.new(@options)
85
+
86
+ report 'INS - running service'
87
+
88
+ stop_proc = Proc.new do
89
+ report 'INS - shutting down'
90
+ begin; ins_svc.shutdown; rescue ::Exception; STDERR.puts "#{$!}\n#{$!.backtrace.join("\n")}"; end
91
+ end
92
+ Signal.trap('INT', stop_proc)
93
+ Signal.trap('TERM', stop_proc)
94
+
95
+ ins_svc.setup
96
+
97
+ ins_svc.run
98
+
99
+ report 'INS - stopped'
100
+ end
101
+
102
+ def stop
103
+ report 'INS - stopping service'
104
+
105
+ rc, pid = self.check_pidfile()
106
+
107
+ if pid
108
+ report 'INS - signalling service'
109
+ if IS_WIN32
110
+ Kernel.system("taskkill /PID #{pid} /F")
111
+ File.delete(self.pidfile)
112
+ else
113
+ Process.kill(:TERM, pid) rescue nil
114
+ end
115
+ end
116
+ end
117
+
118
+ def status
119
+ report 'INS - retrieving service status'
120
+
121
+ rc, pid = self.check_pidfile()
122
+
123
+ if pid
124
+ if rc
125
+ STDERR.puts "found PID #{pid} in file #{pidfile} : process is alive"
126
+ else
127
+ STDERR.puts "found PID #{pid} in file #{pidfile} : process is not running"
128
+ exit 1
129
+ end
130
+ end
131
+ end
132
+
133
+ protected
134
+ def pidfile
135
+ @pidfile ||= File.join(@options[:piddir], 'ins.rb.pid')
136
+ end
137
+
138
+ def pidfile_exists?
139
+ File.exists?(self.pidfile)
140
+ end
141
+
142
+ def check_pidfile
143
+ pid = nil
144
+ begin
145
+ File.open(self.pidfile, 'r') do |f|
146
+ pid = f.read.to_i
147
+ end
148
+ rescue ::Exception
149
+ STDERR.puts "ERROR: INS - failed to read PID file #{self.pidfile}"
150
+ return [false, nil]
151
+ end
152
+
153
+ begin
154
+ Process.kill(0, pid)
155
+ return [true, pid]
156
+ rescue ::Exception
157
+ return [false, pid]
158
+ end
159
+ end
160
+ end # Controller
161
+ else
162
+ # Service controller for *nix platforms
163
+ #
164
+ require 'rubygems'
165
+ require 'daemons'
166
+
167
+ class ::Daemons::Application
168
+ def exit
169
+ # make exit() call a NOOP here
170
+ # Daemons calls this when shutting down and that messes up our clean shutdown
171
+ # STDERR.puts 'exit NOOP'
172
+ end
173
+ end
174
+
175
+ class Controller
176
+ def start
177
+ report 'INS - initializing service'
178
+ # initialize service
179
+ ins_svc = INS::Service.new(@options)
180
+
181
+ if @options[:daemon]
182
+ report 'INS - starting daemon mode'
183
+
184
+ daemon_opt = {
185
+ :app_name => 'rins',
186
+ :ARGV => ['start'],
187
+ :dir_mode => :normal,
188
+ :dir => @options[:piddir],
189
+ :multiple => true,
190
+ :log_dir => @options[:logdir] || @options[:piddir],
191
+ :log_output => true,
192
+ :stop_proc => Proc.new do
193
+ report 'INS - shutting down'
194
+ ins_svc.shutdown
195
+ end
196
+ }
197
+
198
+ Daemons.run_proc('ins.rb', daemon_opt) do
199
+ report 'INS - daemon started'
200
+
201
+ ins_svc.setup
202
+
203
+ ins_svc.run
204
+
205
+ report 'INS - stopped'
206
+ end
207
+ else
208
+ report 'INS - running service in foreground'
209
+
210
+ if self.pidfile_exists?
211
+ rc, pid = self.check_pidfile
212
+ if rc
213
+ STDERR.puts "ERROR: INS - existing PID file #{self.pidfile} found; service may still be alive"
214
+ exit 1
215
+ else
216
+ File.delete(self.pidfile)
217
+ end
218
+ end
219
+
220
+ begin
221
+ File.open(self.pidfile, File::CREAT|File::EXCL|File::WRONLY) do |f|
222
+ f.write Process.pid
223
+ end
224
+ report "INS - PID \##{Process.pid} written to '#{self.pidfile}'"
225
+ rescue ::Exception
226
+ STDERR.puts "ERROR: INS - failed to write PID file #{self.pidfile}"
227
+ exit 1
228
+ end
229
+
230
+ $ins_service_pid_file = self.pidfile
231
+ at_exit {
232
+ File.delete($ins_service_pid_file)
233
+ }
234
+
235
+ stop_proc = Proc.new do
236
+ report 'INS - shutting down'
237
+ begin; ins_svc.shutdown; rescue ::Exception; STDERR.puts "#{$!}\n#{$!.backtrace.join("\n")}"; end
238
+ end
239
+ Signal.trap('INT', stop_proc)
240
+ Signal.trap('TERM', stop_proc)
241
+
242
+ ins_svc.setup
243
+
244
+ ins_svc.run
245
+
246
+ report 'INS - stopped'
247
+
248
+ exit(0)
249
+ end
250
+ end
251
+
252
+ def stop
253
+ report 'INS - stopping service'
254
+ if @options[:daemon]
255
+ daemon_opt = {
256
+ :app_name => 'rins',
257
+ :ARGV => ['stop'],
258
+ :dir_mode => :normal,
259
+ :dir => @options[:piddir],
260
+ :multiple => true,
261
+ }
262
+
263
+ Daemons.run_proc('ins.rb', daemon_opt) {}
264
+ else
265
+ rc, pid = self.check_pidfile()
266
+
267
+ if pid
268
+ report 'INS - signalling service'
269
+ Process.kill(:TERM, pid) rescue nil
270
+ end
271
+ end
272
+ end
273
+
274
+ def restart
275
+ if @options[:daemon]
276
+ report 'INS - initializing service'
277
+ # initialize service
278
+ ins_svc = INS::Service.new(@options)
279
+
280
+ report 'INS - restarting daemon mode'
281
+
282
+ daemon_opt = {
283
+ :app_name => 'rins',
284
+ :ARGV => ['restart'],
285
+ :dir_mode => :normal,
286
+ :dir => @options[:piddir],
287
+ :multiple => true,
288
+ :log_dir => @options[:logdir] || @options[:piddir],
289
+ :log_output => true,
290
+ :stop_proc => Proc.new do
291
+ report 'INS - shutting down'
292
+ ins_svc.shutdown
293
+ end
294
+ }
295
+
296
+ Daemons.run_proc('ins.rb', daemon_opt) do
297
+ report 'INS - daemon started'
298
+
299
+ ins_svc.setup
300
+
301
+ ins_svc.run
302
+
303
+ report 'INS - stopped'
304
+ end
305
+ else
306
+ STDERR.puts "INS - restart command is only functional in daemon mode"
307
+ exit 1
308
+ end
309
+ end
310
+
311
+ def status
312
+ report 'INS - retrieving service status'
313
+ daemon_opt = {
314
+ :app_name => 'rins',
315
+ :ARGV => ['status'],
316
+ :dir_mode => :normal,
317
+ :dir => @options[:piddir],
318
+ :multiple => true,
319
+ }
320
+
321
+ Daemons.run_proc('ins.rb', daemon_opt) {}
322
+ end
323
+
324
+ protected
325
+ def pidfile
326
+ @pidfile ||= File.join(@options[:piddir], 'ins.rb.pid')
327
+ end
328
+
329
+ def pidfile_exists?
330
+ File.exists?(self.pidfile)
331
+ end
332
+
333
+ def check_pidfile
334
+ pid = nil
335
+ begin
336
+ File.open(self.pidfile, 'r') do |f|
337
+ pid = f.read.to_i
338
+ end
339
+ rescue ::Exception
340
+ STDERR.puts "ERROR: INS - failed to read PID file #{self.pidfile}"
341
+ return [false, nil]
342
+ end
343
+
344
+ begin
345
+ Process.kill(0, pid)
346
+ return [true, pid]
347
+ rescue ::Exception
348
+ return [false, pid]
349
+ end
350
+ end
351
+ end # Controller
352
+ end
353
+
354
+ OPTIONS = {
355
+ :piddir => Dir.getwd,
356
+ :iorfile => 'ins.ior',
357
+ :debug => 0,
358
+ :logdir => nil,
359
+ :threads => 5,
360
+ :orbprop => {},
361
+ :port => 0,
362
+ }
363
+
364
+ COMMANDS = [
365
+ :start,
366
+ :stop,
367
+ :restart,
368
+ :status,
369
+ :help,
370
+ :version
371
+ ]
372
+ if IS_JRUBY
373
+ COMMANDS.delete(:restart)
374
+ end
375
+ if IS_WIN32
376
+ COMMANDS << :install
377
+ COMMANDS << :remove
378
+ end
379
+
380
+ @@command = nil
381
+
382
+ def INS.command
383
+ @@command
384
+ end
385
+
386
+ def INS.parse_arg
387
+ script_name = File.basename($0, '.bat')
388
+ if not script_name =~ /rins/
389
+ script_name = "ruby "+$0
390
+ end
391
+
392
+ @@command = ARGV.shift.to_sym unless ARGV.empty?
393
+ unless COMMANDS.include?(@@command)
394
+ STDERR.puts "ERROR: Invalid command [#{command}]!\n"+
395
+ "Usage: #{script_name} #{COMMANDS.join('|')} [options]\n"
396
+ exit 1
397
+ end
398
+
399
+ # extract -ORBxxx aguments
400
+ f_ = false
401
+ ARGV.collect! { |a|
402
+ if f_
403
+ f_ = false
404
+ OPTIONS[:orbprop] << a
405
+ nil
406
+ else
407
+ f_ = /^-ORB/ =~ a
408
+ OPTIONS[:orbprop] << a if f_
409
+ f_ ? nil : a
410
+ end
411
+ }.compact!
412
+
413
+ case @@command
414
+ when :help
415
+ puts "Usage: #{script_name} #{COMMANDS.join('|')} [options]\n"
416
+ puts "\n"
417
+ puts " #{script_name} #{(COMMANDS - [:help, :version]).join('|')} --help\n"
418
+ puts " provides help for the specified command\n\n"
419
+ exit
420
+ when :version
421
+ puts "R2CORBA Interoprable Naming Service (INS) #{INS_VERSION_MAJOR}.#{INS_VERSION_MINOR}.#{INS_VERSION_RELEASE}"
422
+ puts INS_COPYRIGHT
423
+ puts ''
424
+ exit
425
+ when :start, :restart
426
+ ARGV.options do |opts|
427
+ opts.banner = "Usage: #{script_name} start [options]"
428
+
429
+ opts.separator ""
430
+
431
+ opts.on("-i FILE", "--ior=FILE", String,
432
+ "Specifies filename (incl. path) to write IOR to.",
433
+ "Default: ./ins.ior") { |v| OPTIONS[:iorfile]=v }
434
+ unless IS_WIN32
435
+ opts.on("-p DIR", "--pid=DIR", String,
436
+ "Specifies path to write pidfile to.",
437
+ "Default: ./") { |v| OPTIONS[:piddir]=v }
438
+ unless IS_JRUBY
439
+ opts.on("-o DIR", "--output=DIR", String,
440
+ "Specifies filename to write logfile to.",
441
+ "Default: <piddir>") { |v| OPTIONS[:logdir]=v }
442
+ end
443
+ else
444
+ opts.on("-o DIR", "--output=DIR", String,
445
+ "Specifies path to write logfile to.",
446
+ "Default: ./") { |v| OPTIONS[:logdir]=v }
447
+ end
448
+ opts.on("-l PORTNUM", "--listen=PORTNUM", Integer,
449
+ "Specifies port number for service endpoint.",
450
+ "Default: none") { |v| OPTIONS[:port]=v }
451
+ if (IS_JRUBY or R2CORBA::TAO::RUBY_THREAD_SUPPORT)
452
+ opts.on("-t THREADNUM", "--threads=THREADNUM", Integer,
453
+ "Specifies (minimum) number of threads for service.",
454
+ "Default: 5") { |v| OPTIONS[:threads]=v }
455
+ end
456
+
457
+ unless IS_JRUBY || !INS.daemons_installed
458
+ opts.on("-d", "--daemon",
459
+ "Run as daemon.",
460
+ "Default: off") { |v| OPTIONS[:daemon]=v }
461
+ end
462
+ opts.on("-v", "--verbose",
463
+ "Run verbose.",
464
+ "Default: off") { |v| OPTIONS[:verbose]=v }
465
+
466
+ opts.on("--debug=LVL", Integer,
467
+ "Specifies debug level.",
468
+ "Default: 0") { |v| OPTIONS[:debug]=v }
469
+
470
+ opts.separator ""
471
+
472
+ opts.on("-h", "--help",
473
+ "Show this help message.") { puts opts; puts; exit }
474
+
475
+ opts.parse!
476
+ end
477
+ OPTIONS[:iorfile] = File.expand_path(OPTIONS[:iorfile])
478
+ when :stop, :status
479
+ ARGV.options do |opts|
480
+ opts.banner = "Usage: #{script_name} stop [options]"
481
+
482
+ opts.separator ""
483
+
484
+ unless IS_WIN32
485
+ opts.on("-p DIR", "--pid=DIR", String,
486
+ "Specifies path where pidfile is stored.",
487
+ "Default: ./") { |v| OPTIONS[:piddir]=v }
488
+ end
489
+
490
+ unless @@command == 'status'
491
+ OPTIONS[:daemon] = true unless IS_JRUBY || !INS.daemons_installed
492
+ opts.on("--[no-]daemon",
493
+ "Do not run in daemon mode.",
494
+ "Default: #{OPTIONS[:daemon] ? 'on' : 'off'}") { |v| OPTIONS[:daemon]=v }
495
+ end
496
+ opts.on("-v", "--verbose",
497
+ "Run verbose.",
498
+ "Default: off") { |v| OPTIONS[:verbose]=v }
499
+
500
+ opts.separator ""
501
+
502
+ opts.on("-h", "--help",
503
+ "Show this help message.") { puts opts; puts; exit }
504
+
505
+ opts.parse!
506
+ end
507
+ when :install
508
+ when :remove
509
+ end
510
+ OPTIONS[:piddir] = File.expand_path(OPTIONS[:piddir]) if OPTIONS[:piddir]
511
+ OPTIONS[:logdir] = File.expand_path(OPTIONS[:logdir]) if OPTIONS[:logdir]
512
+ end
513
+
514
+ def INS.run
515
+ self.parse_arg()
516
+
517
+ Controller.new(OPTIONS).send(self.command)
518
+ end
519
+ end
520
+ end
521
+
522
+ if __FILE__ == $0
523
+
524
+ R2CORBA::INS.run
525
+
526
+ end