r2corba 1.5.1-universal-java → 1.6.1-universal-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +5 -5
- data/README.rdoc +62 -0
- data/THANKS +4 -4
- data/lib/corba/cbase/IORMap.rb +0 -1
- data/lib/corba/cbase/ORB.rb +26 -24
- data/lib/corba/cbase/Request.rb +4 -5
- data/lib/corba/cbase/Streams.rb +2 -3
- data/lib/corba/cbase/Stub.rb +0 -1
- data/lib/corba/cbase/Typecode.rb +6 -7
- data/lib/corba/cbase/Values.rb +4 -3
- data/lib/corba/cbase/exception.rb +6 -5
- data/lib/corba/cbase/poa.rb +1 -2
- data/lib/corba/cbase/policies.rb +3 -4
- data/lib/corba/cbase/post_require.rb +1 -2
- data/lib/corba/cbase/require.rb +10 -2
- data/lib/corba/cmds/base.rb +1 -2
- data/lib/corba/cmds/test.rb +0 -1
- data/lib/corba/common/Any.rb +3 -3
- data/lib/corba/common/IDL.rb +6 -10
- data/lib/corba/common/ORB.rb +22 -23
- data/lib/corba/common/Object.rb +18 -15
- data/lib/corba/common/Request.rb +1 -2
- data/lib/corba/common/Servant.rb +4 -5
- data/lib/corba/common/Struct.rb +1 -2
- data/lib/corba/common/Stub.rb +6 -7
- data/lib/corba/common/Typecode.rb +91 -65
- data/lib/corba/common/Union.rb +6 -2
- data/lib/corba/common/Values.rb +2 -2
- data/lib/corba/common/const.rb +2 -3
- data/lib/corba/common/exception.rb +2 -2
- data/lib/corba/common/require.rb +8 -1
- data/lib/corba/common/version.rb +3 -4
- data/lib/corba/idl/BiDirPolicyC.rb +2 -3
- data/lib/corba/idl/CosNamingC.rb +4 -5
- data/lib/corba/idl/CosNamingS.rb +2 -3
- data/lib/corba/idl/IDL.rb +1 -2
- data/lib/corba/idl/IORTable.pidl +0 -1
- data/lib/corba/idl/MessagingC.rb +2 -3
- data/lib/corba/idl/POAC.rb +10 -11
- data/lib/corba/idl/TAO_Ext.pidl +0 -1
- data/lib/corba/idl/r2c_orb.rb +5 -6
- data/lib/corba/idl/require.rb +0 -1
- data/lib/corba/jbase/Any.rb +29 -28
- data/lib/corba/jbase/IORMap.rb +1 -2
- data/lib/corba/jbase/ORB.rb +5 -6
- data/lib/corba/jbase/Object.rb +13 -14
- data/lib/corba/jbase/Request.rb +9 -10
- data/lib/corba/jbase/Servant.rb +11 -12
- data/lib/corba/jbase/ServerRequest.rb +8 -9
- data/lib/corba/jbase/Streams.rb +68 -5
- data/lib/corba/jbase/Stub.rb +0 -1
- data/lib/corba/jbase/Typecode.rb +17 -17
- data/lib/corba/jbase/Values.rb +2 -1
- data/lib/corba/jbase/exception.rb +2 -2
- data/lib/corba/jbase/poa.rb +21 -22
- data/lib/corba/jbase/policies.rb +33 -34
- data/lib/corba/jbase/post_require.rb +0 -1
- data/lib/corba/jbase/require.rb +5 -2
- data/lib/corba/naming.rb +0 -1
- data/lib/corba/naming_service.rb +0 -1
- data/lib/corba/poa.rb +1 -2
- data/lib/corba/policies.rb +1 -2
- data/lib/corba/require.rb +2 -3
- data/lib/corba/svcs/ins/cos_naming.rb +74 -68
- data/lib/corba/svcs/ins/ins.rb +58 -59
- data/lib/corba/svcs/ins/naming_service.rb +9 -10
- data/lib/corba.rb +1 -2
- data/lib/ridlbe/ruby/config.rb +78 -74
- data/lib/ridlbe/ruby/orb.pidlc +0 -0
- data/lib/ridlbe/ruby/require.rb +0 -1
- data/lib/ridlbe/ruby/walker.rb +311 -288
- data/mkrf_conf_bingem.rb +4 -6
- data/rakelib/bin.rake +2 -3
- data/rakelib/bin.rb +4 -5
- data/rakelib/build.rake +22 -22
- data/rakelib/config.rake +2 -3
- data/rakelib/config.rb +32 -34
- data/rakelib/gem.rake +53 -38
- data/rakelib/gem.rb +9 -10
- data/rakelib/package.rake +2 -3
- data/rakelib/test.rake +0 -1
- data/test/BiDirectional/Test.idl +0 -1
- data/test/BiDirectional/client.rb +18 -19
- data/test/BiDirectional/run_test.rb +11 -12
- data/test/BiDirectional/server.rb +21 -23
- data/test/CORBA_Services/Naming/BindingIterator/Test.idl +0 -1
- data/test/CORBA_Services/Naming/BindingIterator/client.rb +17 -18
- data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +13 -14
- data/test/CORBA_Services/Naming/BindingIterator/server.rb +19 -20
- data/test/CORBA_Services/Naming/Corbaname/Test.idl +0 -1
- data/test/CORBA_Services/Naming/Corbaname/client.rb +15 -16
- data/test/CORBA_Services/Naming/Corbaname/run_test.rb +13 -14
- data/test/CORBA_Services/Naming/Corbaname/server.rb +27 -28
- data/test/CORBA_Services/Naming/Simple/Test.idl +0 -1
- data/test/CORBA_Services/Naming/Simple/client.rb +16 -17
- data/test/CORBA_Services/Naming/Simple/run_test.rb +13 -14
- data/test/CORBA_Services/Naming/Simple/server.rb +19 -20
- data/test/Collocation/Diamond.idl +0 -1
- data/test/Collocation/run_test.rb +10 -11
- data/test/Collocation/test.rb +27 -21
- data/test/Connect_Timeout/Test.idl +0 -1
- data/test/Connect_Timeout/client.rb +16 -18
- data/test/Connect_Timeout/run_test.rb +10 -11
- data/test/DII/Test.idl +0 -1
- data/test/DII/client.rb +30 -31
- data/test/DII/run_test.rb +11 -12
- data/test/DII/server.rb +16 -17
- data/test/DSI/Test.idl +0 -1
- data/test/DSI/client.rb +16 -17
- data/test/DSI/run_test.rb +11 -12
- data/test/DSI/server.rb +17 -18
- data/test/Exceptions/Test.idl +0 -1
- data/test/Exceptions/client.rb +22 -23
- data/test/Exceptions/run_test.rb +11 -12
- data/test/Exceptions/server.rb +16 -17
- data/test/Hello/Test.idl +0 -1
- data/test/Hello/client.rb +16 -17
- data/test/Hello/run_test.rb +11 -12
- data/test/Hello/server.rb +17 -18
- data/test/IDL_Test/Test.idl +4 -1
- data/test/IDL_Test/client.rb +24 -23
- data/test/IDL_Test/run_test.rb +11 -12
- data/test/IDL_Test/server.rb +23 -19
- data/test/IORMap/Test.idl +0 -1
- data/test/IORMap/client.rb +14 -15
- data/test/IORMap/run_test.rb +11 -12
- data/test/IORMap/server.rb +23 -24
- data/test/IORTable/Test.idl +0 -1
- data/test/IORTable/client.rb +14 -15
- data/test/IORTable/run_test.rb +11 -12
- data/test/IORTable/server.rb +23 -24
- data/test/Implicit_Conversion/Test.idl +0 -1
- data/test/Implicit_Conversion/client.rb +20 -18
- data/test/Implicit_Conversion/run_test.rb +11 -12
- data/test/Implicit_Conversion/server.rb +16 -17
- data/test/Multi_Threading/Multiple_ORB/Test.idl +0 -1
- data/test/Multi_Threading/Multiple_ORB/client.rb +14 -15
- data/test/Multi_Threading/Multiple_ORB/run_test.rb +12 -13
- data/test/Multi_Threading/Multiple_ORB/server.rb +17 -18
- data/test/Multi_Threading/Simple/Test.idl +0 -1
- data/test/Multi_Threading/Simple/client.rb +17 -18
- data/test/Multi_Threading/Simple/run_test.rb +11 -12
- data/test/Multi_Threading/Simple/server.rb +17 -18
- data/test/Multi_Threading/Threads/Test.idl +0 -4
- data/test/Multi_Threading/Threads/client.rb +23 -26
- data/test/Multi_Threading/Threads/run_test.rb +11 -12
- data/test/Multi_Threading/Threads/server.rb +19 -22
- data/test/Multi_Threading/Threads/watchdog.rb +16 -16
- data/test/Multiple_Servant_Interfaces/Test.idl +0 -1
- data/test/Multiple_Servant_Interfaces/client.rb +14 -15
- data/test/Multiple_Servant_Interfaces/run_test.rb +11 -12
- data/test/Multiple_Servant_Interfaces/server.rb +18 -19
- data/test/Nil/Test.idl +0 -1
- data/test/Nil/run_test.rb +10 -11
- data/test/Nil/test.rb +22 -20
- data/test/OBV/AbstractInterface/client.rb +14 -15
- data/test/OBV/AbstractInterface/run_test.rb +11 -12
- data/test/OBV/AbstractInterface/server.rb +20 -20
- data/test/OBV/AbstractInterface/test.idl +0 -1
- data/test/OBV/Custom/OBV_impl.rb +2 -1
- data/test/OBV/Custom/client.rb +14 -15
- data/test/OBV/Custom/run_test.rb +11 -12
- data/test/OBV/Custom/server.rb +16 -17
- data/test/OBV/Simple/OBV_impl.rb +1 -1
- data/test/OBV/Simple/client.rb +14 -15
- data/test/OBV/Simple/run_test.rb +11 -12
- data/test/OBV/Simple/server.rb +16 -17
- data/test/OBV/Simple_Event/Event_impl.rb +1 -1
- data/test/OBV/Simple_Event/client.rb +14 -15
- data/test/OBV/Simple_Event/run_test.rb +11 -12
- data/test/OBV/Simple_Event/server.rb +16 -17
- data/test/OBV/Supports/client.rb +19 -20
- data/test/OBV/Supports/run_test.rb +11 -12
- data/test/OBV/Supports/server.rb +15 -16
- data/test/OBV/Supports/supports.idl +0 -1
- data/test/OBV/Supports/supports_impl.rb +3 -1
- data/test/OBV/Tree/client.rb +14 -15
- data/test/OBV/Tree/run_test.rb +11 -12
- data/test/OBV/Tree/server.rb +19 -20
- data/test/OBV/Tree/test.idl +0 -1
- data/test/OBV/Truncatable/Extra.idl +0 -1
- data/test/OBV/Truncatable/Truncatable_impl.rb +1 -2
- data/test/OBV/Truncatable/client.rb +57 -58
- data/test/OBV/Truncatable/run_test.rb +11 -12
- data/test/OBV/Truncatable/server.rb +15 -16
- data/test/OBV/ValueBox/client.rb +154 -154
- data/test/OBV/ValueBox/run_test.rb +11 -12
- data/test/OBV/ValueBox/server.rb +42 -42
- data/test/Object/Test.idl +0 -1
- data/test/Object/client.rb +15 -16
- data/test/Object/run_test.rb +11 -12
- data/test/Object/server.rb +19 -20
- data/test/POA/run_test.rb +10 -11
- data/test/POA/test.rb +17 -18
- data/test/Param_Test/client.rb +53 -54
- data/test/Param_Test/run_test.rb +11 -12
- data/test/Param_Test/server.rb +60 -61
- data/test/Performance/Simple/Test.idl +0 -1
- data/test/Performance/Simple/client.rb +16 -17
- data/test/Performance/Simple/run_test.rb +11 -12
- data/test/Performance/Simple/server.rb +16 -17
- data/test/Policies/Test.idl +0 -1
- data/test/Policies/run_test.rb +10 -11
- data/test/Policies/test.rb +23 -25
- data/test/Timeout/client.rb +21 -22
- data/test/Timeout/run_test.rb +11 -12
- data/test/Timeout/server.rb +19 -20
- data/test/Timeout/test.idl +0 -1
- data/test/lib/assert.rb +0 -2
- data/test/lib/test.rb +29 -25
- data/test/test_runner.rb +22 -24
- metadata +27 -64
- data/README +0 -62
- data/jacorb/lib/antlr-2.7.2.jar +0 -0
- data/jacorb/lib/jacorb-3.5.jar +0 -0
- data/jacorb/lib/jacorb-omgapi-3.5.jar +0 -0
- data/jacorb/lib/jacorb-services-3.5.jar +0 -0
- data/jacorb/lib/slf4j-api-1.7.6.jar +0 -0
- data/jacorb/lib/slf4j-jdk14-1.7.6.jar +0 -0
- data/test/BiDirectional/server.ior +0 -1
- data/test/CORBA_Services/Naming/BindingIterator/ins.ior +0 -1
- data/test/CORBA_Services/Naming/Corbaname/corbaname.ior +0 -1
- data/test/CORBA_Services/Naming/Corbaname/ins.ior +0 -1
- data/test/CORBA_Services/Naming/Simple/ins.ior +0 -1
- data/test/DII/server.ior +0 -1
- data/test/DSI/server.ior +0 -1
- data/test/Exceptions/server.ior +0 -1
- data/test/Hello/gateway.ior +0 -1
- data/test/IDL_Test/server.ior +0 -1
- data/test/IORMap/server.ior +0 -1
- data/test/IORTable/server.ior +0 -0
- data/test/Implicit_Conversion/server.ior +0 -1
- data/test/Multi_Threading/Multiple_ORB/server0.ior +0 -1
- data/test/Multi_Threading/Multiple_ORB/server1.ior +0 -1
- data/test/Multi_Threading/Simple/server.ior +0 -1
- data/test/Multi_Threading/Threads/server.ior +0 -1
- data/test/Multi_Threading/Threads/watchdog.ior +0 -1
- data/test/Multiple_Servant_Interfaces/server.ior +0 -1
- data/test/OBV/AbstractInterface/server.ior +0 -1
- data/test/OBV/Custom/server.ior +0 -1
- data/test/OBV/Simple/server.ior +0 -1
- data/test/OBV/Simple_Event/server.ior +0 -1
- data/test/OBV/Supports/server.ior +0 -1
- data/test/OBV/Tree/server.ior +0 -1
- data/test/OBV/Truncatable/server.ior +0 -1
- data/test/OBV/ValueBox/server.ior +0 -1
- data/test/Object/server.ior +0 -1
- data/test/Param_Test/server.ior +0 -1
- data/test/Performance/Simple/server.ior +0 -1
- data/test/Timeout/server.ior +0 -1
- data/test/test.log +0 -20
- data/test/test2.log +0 -5000
@@ -1,21 +1,18 @@
|
|
1
1
|
#--------------------------------------------------------------------
|
2
2
|
# cos_naming.rb - Implementation of CosNaming servants
|
3
|
-
# for full featured naming service
|
3
|
+
# for full featured naming service
|
4
4
|
#
|
5
5
|
# Author: Martin Corino
|
6
6
|
#
|
7
|
-
# $Id: $
|
8
|
-
#
|
9
7
|
# This program is free software; you can redistribute it and/or
|
10
8
|
# modify it under the terms of the R2CORBA LICENSE which is
|
11
9
|
# included with this program.
|
12
10
|
#
|
13
11
|
# Copyright (c) Remedy IT Expertise BV
|
14
|
-
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
15
12
|
#--------------------------------------------------------------------
|
16
13
|
|
17
14
|
require 'corba/naming_service'
|
18
|
-
if
|
15
|
+
if defined?(JRUBY_VERSION) or R2CORBA::TAO::RUBY_THREAD_SUPPORT
|
19
16
|
require 'monitor'
|
20
17
|
end
|
21
18
|
|
@@ -26,15 +23,17 @@ module CosNaming
|
|
26
23
|
def to_key
|
27
24
|
"#{self.r_id}|#{self.kind}"
|
28
25
|
end
|
26
|
+
|
29
27
|
# convert NameComponent to stringified format according to spec
|
30
28
|
def to_string
|
31
29
|
s = ''
|
32
|
-
s = self.r_id.gsub(/([\/\.\\])/,'\\\1') unless self.r_id.to_s.empty?
|
30
|
+
s = self.r_id.gsub(/([\/\.\\])/, '\\\1') unless self.r_id.to_s.empty?
|
33
31
|
s << '.' if s.empty? or !self.kind.to_s.empty?
|
34
|
-
s << self.kind.gsub(/([\/\.\\])/,'\\\1') unless self.kind.to_s.empty?
|
32
|
+
s << self.kind.gsub(/([\/\.\\])/, '\\\1') unless self.kind.to_s.empty?
|
35
33
|
s
|
36
34
|
end
|
37
|
-
|
35
|
+
|
36
|
+
# convert stringified name back to NameComponent
|
38
37
|
def self.from_string(snc)
|
39
38
|
raise CosNaming::NamingContext::InvalidName.new if snc.empty?
|
40
39
|
esc_ = false
|
@@ -46,9 +45,9 @@ module CosNaming
|
|
46
45
|
esc_ = !esc_
|
47
46
|
when '.'
|
48
47
|
unless esc_
|
49
|
-
raise CosNaming::NamingContext::InvalidName.new if off_>0
|
48
|
+
raise CosNaming::NamingContext::InvalidName.new if off_ > 0
|
50
49
|
id_ = snc[0, i].gsub(/\\(\.|\\)/, '\1')
|
51
|
-
off_ = i+1
|
50
|
+
off_ = i + 1
|
52
51
|
end
|
53
52
|
esc_ = false
|
54
53
|
else
|
@@ -63,7 +62,7 @@ end
|
|
63
62
|
|
64
63
|
module R2CORBA
|
65
64
|
module INS
|
66
|
-
|
65
|
+
|
67
66
|
##
|
68
67
|
# Binding iterator servant class
|
69
68
|
#
|
@@ -72,25 +71,25 @@ module R2CORBA
|
|
72
71
|
@rl = reglist
|
73
72
|
@id = iterator_id
|
74
73
|
end
|
75
|
-
|
74
|
+
|
76
75
|
attr_accessor :oid
|
77
|
-
|
76
|
+
|
78
77
|
def next_one
|
79
78
|
reg = @rl.shift
|
80
79
|
[!reg.nil?, reg ? CosNaming::Binding.new(reg[:name], reg[:type]) : nil]
|
81
80
|
end
|
82
|
-
|
81
|
+
|
83
82
|
def next_n(how_many)
|
84
83
|
raise CORBA::BAD_PARAM.new if how_many < 1
|
85
84
|
bindings = []
|
86
|
-
while how_many>0 and !@rl.empty?
|
85
|
+
while how_many > 0 and !@rl.empty?
|
87
86
|
reg = @rl.shift
|
88
87
|
bindings << CosNaming::Binding.new(reg[:name], reg[:type])
|
89
88
|
how_many -= 1
|
90
89
|
end
|
91
90
|
[!bindings.empty?, bindings]
|
92
91
|
end
|
93
|
-
|
92
|
+
|
94
93
|
def destroy
|
95
94
|
poa = self._default_POA
|
96
95
|
poa.deactivate_object(self.oid)
|
@@ -103,16 +102,17 @@ module R2CORBA
|
|
103
102
|
# Naming context servant class
|
104
103
|
#
|
105
104
|
class NamingContext < POA::CosNaming::NamingContextExt
|
106
|
-
|
105
|
+
|
107
106
|
# Map type to store bindings.
|
108
107
|
# Use synchronized version for multithreading capable implementations.
|
109
108
|
#
|
110
|
-
if
|
109
|
+
if defined?(JRUBY_VERSION) or R2CORBA::TAO::RUBY_THREAD_SUPPORT
|
111
110
|
MAP_TYPE = Class.new(Monitor) do
|
112
111
|
def initialize
|
113
112
|
super
|
114
113
|
@map_ = {}
|
115
114
|
end
|
115
|
+
|
116
116
|
def size()
|
117
117
|
rc = 0
|
118
118
|
synchronize do
|
@@ -120,6 +120,7 @@ module R2CORBA
|
|
120
120
|
end
|
121
121
|
return rc
|
122
122
|
end
|
123
|
+
|
123
124
|
def has_key?(key)
|
124
125
|
rc = false
|
125
126
|
synchronize do
|
@@ -127,6 +128,7 @@ module R2CORBA
|
|
127
128
|
end
|
128
129
|
return rc
|
129
130
|
end
|
131
|
+
|
130
132
|
def [](key)
|
131
133
|
rc = nil
|
132
134
|
synchronize do
|
@@ -134,12 +136,14 @@ module R2CORBA
|
|
134
136
|
end
|
135
137
|
return rc
|
136
138
|
end
|
139
|
+
|
137
140
|
def []=(key, value)
|
138
141
|
synchronize do
|
139
142
|
@map_[key] = value
|
140
143
|
end
|
141
144
|
value
|
142
145
|
end
|
146
|
+
|
143
147
|
def delete(key)
|
144
148
|
rc = nil
|
145
149
|
synchronize do
|
@@ -147,6 +151,7 @@ module R2CORBA
|
|
147
151
|
end
|
148
152
|
return rc
|
149
153
|
end
|
154
|
+
|
150
155
|
def values
|
151
156
|
rc = nil
|
152
157
|
synchronize do
|
@@ -154,6 +159,7 @@ module R2CORBA
|
|
154
159
|
end
|
155
160
|
return rc
|
156
161
|
end
|
162
|
+
|
157
163
|
def each(&block)
|
158
164
|
synchronize do
|
159
165
|
@map_.each &block
|
@@ -167,18 +173,18 @@ module R2CORBA
|
|
167
173
|
end
|
168
174
|
end
|
169
175
|
end
|
170
|
-
|
176
|
+
|
171
177
|
@@iterators = MAP_TYPE.new
|
172
178
|
@@iterator_max = 100
|
173
|
-
|
179
|
+
|
174
180
|
def self.set_iterator_max(max)
|
175
181
|
@@iterator_max = max.to_i
|
176
182
|
end
|
177
|
-
|
183
|
+
|
178
184
|
def self.clear_iterator(id)
|
179
|
-
@@iterators.delete(id)
|
185
|
+
@@iterators.delete(id)
|
180
186
|
end
|
181
|
-
|
187
|
+
|
182
188
|
def self.alloc_iterator(reglist)
|
183
189
|
@@iterators.synchronize do
|
184
190
|
unless @@iterators.size < @@iterator_max
|
@@ -189,64 +195,64 @@ module R2CORBA
|
|
189
195
|
return (@@iterators[itid] = INS::BindingIterator.new(reglist, itid))
|
190
196
|
end
|
191
197
|
end
|
192
|
-
|
198
|
+
|
193
199
|
def initialize(orb)
|
194
|
-
@orb = orb
|
200
|
+
@orb = orb
|
195
201
|
@map = MAP_TYPE.new
|
196
202
|
end
|
197
|
-
|
203
|
+
|
198
204
|
attr_accessor :oid
|
199
|
-
|
205
|
+
|
200
206
|
# CosNaming::NamingContext methods
|
201
207
|
#
|
202
208
|
def bind(n, obj)
|
203
|
-
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
204
|
-
if n.size>1
|
209
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size < 1
|
210
|
+
if n.size > 1
|
205
211
|
nc = find_context(n)
|
206
212
|
nc.bind(n, obj)
|
207
213
|
else
|
208
214
|
register_object(n.first, n, CosNaming::Nobject, obj)
|
209
215
|
end
|
210
216
|
end
|
211
|
-
|
217
|
+
|
212
218
|
def rebind(n, obj)
|
213
|
-
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
214
|
-
if n.size>1
|
219
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size < 1
|
220
|
+
if n.size > 1
|
215
221
|
nc = find_context(n)
|
216
222
|
nc.rebind(n, obj)
|
217
223
|
else
|
218
224
|
reregister_object(n.first, n, CosNaming::Nobject, obj)
|
219
225
|
end
|
220
226
|
end
|
221
|
-
|
227
|
+
|
222
228
|
def bind_context(n, nc_new)
|
223
|
-
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
224
|
-
if n.size>1
|
229
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size < 1
|
230
|
+
if n.size > 1
|
225
231
|
nc = find_context(n)
|
226
232
|
nc.bind_context(n, nc_new)
|
227
233
|
else
|
228
234
|
register_object(n.first, n, CosNaming::Ncontext, nc_new)
|
229
235
|
end
|
230
236
|
end
|
231
|
-
|
237
|
+
|
232
238
|
def rebind_context(n, nc_new)
|
233
|
-
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
234
|
-
if n.size>1
|
239
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size < 1
|
240
|
+
if n.size > 1
|
235
241
|
nc = find_context(n)
|
236
242
|
nc.rebind_context(n, nc_new)
|
237
243
|
else
|
238
244
|
reregister_object(n.first, n, CosNaming::Ncontext, nc_new)
|
239
245
|
end
|
240
246
|
end
|
241
|
-
|
247
|
+
|
242
248
|
def resolve(n)
|
243
|
-
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
249
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size < 1
|
244
250
|
find_object(n)
|
245
251
|
end
|
246
|
-
|
252
|
+
|
247
253
|
def unbind(n)
|
248
|
-
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
249
|
-
if n.size>1
|
254
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size < 1
|
255
|
+
if n.size > 1
|
250
256
|
nc = find_context(n)
|
251
257
|
nc.unbind(n)
|
252
258
|
else
|
@@ -257,33 +263,33 @@ module R2CORBA
|
|
257
263
|
end
|
258
264
|
end
|
259
265
|
end
|
260
|
-
|
266
|
+
|
261
267
|
def new_context()
|
262
268
|
poa = self._default_POA
|
263
269
|
naming_srv = NamingContext.new(@orb)
|
264
270
|
naming_srv.oid = poa.activate_object(naming_srv)
|
265
271
|
::CosNaming::NamingContextExt::_narrow(poa.id_to_reference(naming_srv.oid))
|
266
272
|
end
|
267
|
-
|
273
|
+
|
268
274
|
def bind_new_context(n)
|
269
|
-
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
275
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size < 1
|
270
276
|
nc = self.new_context()
|
271
277
|
self.bind_context(n, nc)
|
272
278
|
nc
|
273
279
|
end
|
274
|
-
|
280
|
+
|
275
281
|
def destroy()
|
276
|
-
raise CosNaming::NamingContext::NotEmpty.new if @map.size>0
|
282
|
+
raise CosNaming::NamingContext::NotEmpty.new if @map.size > 0
|
277
283
|
return if self.oid.nil? ## no oid for root context
|
278
284
|
poa = self._default_POA
|
279
285
|
poa.deactivate_object(self.oid)
|
280
286
|
@orb = nil
|
281
287
|
end
|
282
|
-
|
288
|
+
|
283
289
|
def list(how_many)
|
284
290
|
reglist = @map.values
|
285
291
|
bindings = []
|
286
|
-
while how_many>0 and !reglist.empty?
|
292
|
+
while how_many > 0 and !reglist.empty?
|
287
293
|
reg = reglist.shift
|
288
294
|
bindings << CosNaming::Binding.new(reg[:name], reg[:type])
|
289
295
|
how_many -= 1
|
@@ -297,27 +303,27 @@ module R2CORBA
|
|
297
303
|
end
|
298
304
|
[bindings, CosNaming::BindingIterator._narrow(bi_obj)]
|
299
305
|
end
|
300
|
-
|
306
|
+
|
301
307
|
# CosNaming::NamingContextExt methods
|
302
308
|
#
|
303
309
|
def to_string(n)
|
304
|
-
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
310
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size < 1
|
305
311
|
n.collect { |nc| nc.to_string }.join('/')
|
306
312
|
end
|
307
|
-
|
313
|
+
|
308
314
|
def to_name(sn)
|
309
315
|
raise CosNaming::NamingContext::InvalidName.new if sn.to_s.empty?
|
310
316
|
snc_arr = []
|
311
317
|
off_ = 0
|
312
318
|
esc_ = false
|
313
319
|
sn.size.times do |i|
|
314
|
-
case sn[i,1]
|
320
|
+
case sn[i, 1]
|
315
321
|
when '\\'
|
316
|
-
esc_ = !esc_
|
322
|
+
esc_ = !esc_
|
317
323
|
when '/'
|
318
324
|
unless esc_
|
319
|
-
snc_arr << sn[off_, i-off_]
|
320
|
-
off_ = i+1
|
325
|
+
snc_arr << sn[off_, i - off_]
|
326
|
+
off_ = i + 1
|
321
327
|
end
|
322
328
|
esc_ = false
|
323
329
|
else
|
@@ -327,10 +333,10 @@ module R2CORBA
|
|
327
333
|
snc_arr << sn[off_, sn.size]
|
328
334
|
[snc_arr.collect { |snc| CosNaming::NameComponent.from_string(snc) }]
|
329
335
|
end
|
330
|
-
|
336
|
+
|
331
337
|
def to_url(addr, sn)
|
332
338
|
raise CosNaming::NamingContext::InvalidName.new if addr.to_s.empty? or sn.to_s.empty?
|
333
|
-
url = 'corbaname:'+addr+'#'
|
339
|
+
url = 'corbaname:' + addr + '#'
|
334
340
|
sn.scan(/./) do |ch|
|
335
341
|
if /[a-zA-Z0-9;\/:\?@=+\$,\-_\.!~*\'\(\)]/ =~ ch
|
336
342
|
url << ch
|
@@ -340,7 +346,7 @@ module R2CORBA
|
|
340
346
|
end
|
341
347
|
url
|
342
348
|
end
|
343
|
-
|
349
|
+
|
344
350
|
def resolve_str(sn)
|
345
351
|
self.resolve(self.to_name(sn).first)
|
346
352
|
end
|
@@ -348,7 +354,7 @@ module R2CORBA
|
|
348
354
|
# Helper methods
|
349
355
|
#
|
350
356
|
protected
|
351
|
-
|
357
|
+
|
352
358
|
# register the object reference for a certain NameComponent id
|
353
359
|
# no reregistering or duplicates allowed
|
354
360
|
#
|
@@ -363,7 +369,7 @@ module R2CORBA
|
|
363
369
|
}
|
364
370
|
end
|
365
371
|
end
|
366
|
-
|
372
|
+
|
367
373
|
# reregister the object reference for a certain NameComponent id
|
368
374
|
#
|
369
375
|
def reregister_object(name, full_name, type, obj)
|
@@ -380,7 +386,7 @@ module R2CORBA
|
|
380
386
|
}
|
381
387
|
end
|
382
388
|
end
|
383
|
-
|
389
|
+
|
384
390
|
# walk all segments of the given CosNaming::Name to find the object
|
385
391
|
# bound by this full name
|
386
392
|
# NOTE that #find_context is used when the Name contains > 1 level
|
@@ -388,7 +394,7 @@ module R2CORBA
|
|
388
394
|
# resolving the context levels
|
389
395
|
#
|
390
396
|
def find_object(n)
|
391
|
-
if n.size>1
|
397
|
+
if n.size > 1
|
392
398
|
nc = find_context(n)
|
393
399
|
nc.resolve(n)
|
394
400
|
else
|
@@ -400,7 +406,7 @@ module R2CORBA
|
|
400
406
|
end
|
401
407
|
end
|
402
408
|
end
|
403
|
-
|
409
|
+
|
404
410
|
# check if there exists a naming context in the current context
|
405
411
|
# with the id from the first segment of the given CosNaming::Name
|
406
412
|
# return the object reference to the naming context if found
|
@@ -419,8 +425,8 @@ module R2CORBA
|
|
419
425
|
@map[key_][:object]
|
420
426
|
end
|
421
427
|
end
|
422
|
-
|
423
|
-
end #of NamingContext servant
|
424
|
-
|
428
|
+
|
429
|
+
end # of NamingContext servant
|
430
|
+
|
425
431
|
end
|
426
432
|
end
|
data/lib/corba/svcs/ins/ins.rb
CHANGED
@@ -8,7 +8,6 @@
|
|
8
8
|
# included with this program.
|
9
9
|
#
|
10
10
|
# Copyright (c) Remedy IT Expertise BV
|
11
|
-
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
11
|
#--------------------------------------------------------------------
|
13
12
|
|
14
13
|
require 'corba/svcs/ins/naming_service'
|
@@ -16,12 +15,12 @@ require 'optparse'
|
|
16
15
|
|
17
16
|
module R2CORBA
|
18
17
|
module INS
|
19
|
-
INS_VERSION_MAJOR = 0
|
20
|
-
INS_VERSION_MINOR = 1
|
21
|
-
INS_VERSION_RELEASE = 1
|
22
|
-
INS_COPYRIGHT =
|
18
|
+
INS_VERSION_MAJOR = 0
|
19
|
+
INS_VERSION_MINOR = 1
|
20
|
+
INS_VERSION_RELEASE = 1
|
21
|
+
INS_COPYRIGHT = "Copyright (c) 2011-#{Time.now.year} Remedy IT Expertise BV, The Netherlands".freeze
|
23
22
|
|
24
|
-
IS_WIN32 = (RUBY_PLATFORM =~ /win32/ || RUBY_PLATFORM =~ /
|
23
|
+
IS_WIN32 = (RUBY_PLATFORM =~ /win32/ || RUBY_PLATFORM =~ /mingw/ || ENV['OS'] =~ /windows/i) ? true : false
|
25
24
|
IS_JRUBY = defined?(JRUBY_VERSION)
|
26
25
|
|
27
26
|
@@daemons_installed = false
|
@@ -66,7 +65,7 @@ module R2CORBA
|
|
66
65
|
end
|
67
66
|
|
68
67
|
begin
|
69
|
-
File.open(self.pidfile, File::CREAT|File::EXCL|File::WRONLY) do |f|
|
68
|
+
File.open(self.pidfile, File::CREAT | File::EXCL | File::WRONLY) do |f|
|
70
69
|
f.write Process.pid
|
71
70
|
end
|
72
71
|
report "INS - PID \##{Process.pid} written to '#{self.pidfile}'"
|
@@ -136,7 +135,7 @@ module R2CORBA
|
|
136
135
|
end
|
137
136
|
|
138
137
|
def pidfile_exists?
|
139
|
-
File.
|
138
|
+
File.exist?(self.pidfile)
|
140
139
|
end
|
141
140
|
|
142
141
|
def check_pidfile
|
@@ -218,7 +217,7 @@ module R2CORBA
|
|
218
217
|
end
|
219
218
|
|
220
219
|
begin
|
221
|
-
File.open(self.pidfile, File::CREAT|File::EXCL|File::WRONLY) do |f|
|
220
|
+
File.open(self.pidfile, File::CREAT | File::EXCL | File::WRONLY) do |f|
|
222
221
|
f.write Process.pid
|
223
222
|
end
|
224
223
|
report "INS - PID \##{Process.pid} written to '#{self.pidfile}'"
|
@@ -303,7 +302,7 @@ module R2CORBA
|
|
303
302
|
report 'INS - stopped'
|
304
303
|
end
|
305
304
|
else
|
306
|
-
STDERR.puts
|
305
|
+
STDERR.puts 'INS - restart command is only functional in daemon mode'
|
307
306
|
exit 1
|
308
307
|
end
|
309
308
|
end
|
@@ -327,7 +326,7 @@ module R2CORBA
|
|
327
326
|
end
|
328
327
|
|
329
328
|
def pidfile_exists?
|
330
|
-
File.
|
329
|
+
File.exist?(self.pidfile)
|
331
330
|
end
|
332
331
|
|
333
332
|
def check_pidfile
|
@@ -386,12 +385,12 @@ module R2CORBA
|
|
386
385
|
def INS.parse_arg
|
387
386
|
script_name = File.basename($0, '.bat')
|
388
387
|
if not script_name =~ /rins/
|
389
|
-
script_name =
|
388
|
+
script_name = 'ruby ' + $0
|
390
389
|
end
|
391
390
|
|
392
391
|
@@command = ARGV.shift.to_sym unless ARGV.empty?
|
393
392
|
unless COMMANDS.include?(@@command)
|
394
|
-
STDERR.puts "ERROR: Invalid command [#{command}]!\n"+
|
393
|
+
STDERR.puts "ERROR: Invalid command [#{command}]!\n" +
|
395
394
|
"Usage: #{script_name} #{COMMANDS.join('|')} [options]\n"
|
396
395
|
exit 1
|
397
396
|
end
|
@@ -418,7 +417,7 @@ module R2CORBA
|
|
418
417
|
puts " provides help for the specified command\n\n"
|
419
418
|
exit
|
420
419
|
when :version
|
421
|
-
puts "R2CORBA
|
420
|
+
puts "R2CORBA Interoperable Naming Service (INS) #{INS_VERSION_MAJOR}.#{INS_VERSION_MINOR}.#{INS_VERSION_RELEASE}"
|
422
421
|
puts INS_COPYRIGHT
|
423
422
|
puts ''
|
424
423
|
exit
|
@@ -426,51 +425,51 @@ module R2CORBA
|
|
426
425
|
ARGV.options do |opts|
|
427
426
|
opts.banner = "Usage: #{script_name} start [options]"
|
428
427
|
|
429
|
-
opts.separator
|
428
|
+
opts.separator ''
|
430
429
|
|
431
|
-
opts.on(
|
432
|
-
|
433
|
-
|
430
|
+
opts.on('-i FILE', '--ior=FILE', String,
|
431
|
+
'Specifies filename (incl. path) to write IOR to.',
|
432
|
+
'Default: ./ins.ior') { |v| OPTIONS[:iorfile] = v }
|
434
433
|
unless IS_WIN32
|
435
|
-
opts.on(
|
436
|
-
|
437
|
-
|
434
|
+
opts.on('-p DIR', '--pid=DIR', String,
|
435
|
+
'Specifies path to write pidfile to.',
|
436
|
+
'Default: ./') { |v| OPTIONS[:piddir] = v }
|
438
437
|
unless IS_JRUBY
|
439
|
-
opts.on(
|
440
|
-
|
441
|
-
|
438
|
+
opts.on('-o DIR', '--output=DIR', String,
|
439
|
+
'Specifies filename to write logfile to.',
|
440
|
+
'Default: <piddir>') { |v| OPTIONS[:logdir] = v }
|
442
441
|
end
|
443
442
|
else
|
444
|
-
opts.on(
|
445
|
-
|
446
|
-
|
443
|
+
opts.on('-o DIR', '--output=DIR', String,
|
444
|
+
'Specifies path to write logfile to.',
|
445
|
+
'Default: ./') { |v| OPTIONS[:logdir] = v }
|
447
446
|
end
|
448
|
-
opts.on(
|
449
|
-
|
450
|
-
|
451
|
-
if
|
452
|
-
opts.on(
|
453
|
-
|
454
|
-
|
447
|
+
opts.on('-l PORTNUM', '--listen=PORTNUM', Integer,
|
448
|
+
'Specifies port number for service endpoint.',
|
449
|
+
'Default: none') { |v| OPTIONS[:port] = v }
|
450
|
+
if IS_JRUBY or R2CORBA::TAO::RUBY_THREAD_SUPPORT
|
451
|
+
opts.on('-t THREADNUM', '--threads=THREADNUM', Integer,
|
452
|
+
'Specifies (minimum) number of threads for service.',
|
453
|
+
'Default: 5') { |v| OPTIONS[:threads] = v }
|
455
454
|
end
|
456
455
|
|
457
456
|
unless IS_JRUBY || !INS.daemons_installed
|
458
|
-
opts.on(
|
459
|
-
|
460
|
-
|
457
|
+
opts.on('-d', '--daemon',
|
458
|
+
'Run as daemon.',
|
459
|
+
'Default: off') { |v| OPTIONS[:daemon] = v }
|
461
460
|
end
|
462
|
-
opts.on(
|
463
|
-
|
464
|
-
|
461
|
+
opts.on('-v', '--verbose',
|
462
|
+
'Run verbose.',
|
463
|
+
'Default: off') { |v| OPTIONS[:verbose] = v }
|
465
464
|
|
466
|
-
opts.on(
|
467
|
-
|
468
|
-
|
465
|
+
opts.on('--debug=LVL', Integer,
|
466
|
+
'Specifies debug level.',
|
467
|
+
'Default: 0') { |v| OPTIONS[:debug] = v }
|
469
468
|
|
470
|
-
opts.separator
|
469
|
+
opts.separator ''
|
471
470
|
|
472
|
-
opts.on(
|
473
|
-
|
471
|
+
opts.on('-h', '--help',
|
472
|
+
'Show this help message.') { puts opts; puts; exit }
|
474
473
|
|
475
474
|
opts.parse!
|
476
475
|
end
|
@@ -479,28 +478,28 @@ module R2CORBA
|
|
479
478
|
ARGV.options do |opts|
|
480
479
|
opts.banner = "Usage: #{script_name} stop [options]"
|
481
480
|
|
482
|
-
opts.separator
|
481
|
+
opts.separator ''
|
483
482
|
|
484
483
|
unless IS_WIN32
|
485
|
-
opts.on(
|
486
|
-
|
487
|
-
|
484
|
+
opts.on('-p DIR', '--pid=DIR', String,
|
485
|
+
'Specifies path where pidfile is stored.',
|
486
|
+
'Default: ./') { |v| OPTIONS[:piddir] = v }
|
488
487
|
end
|
489
488
|
|
490
489
|
unless @@command == 'status'
|
491
490
|
OPTIONS[:daemon] = true unless IS_JRUBY || !INS.daemons_installed
|
492
|
-
opts.on(
|
493
|
-
|
494
|
-
"Default: #{OPTIONS[:daemon] ? 'on' : 'off'}") { |v| OPTIONS[:daemon]=v }
|
491
|
+
opts.on('--[no-]daemon',
|
492
|
+
'Do not run in daemon mode.',
|
493
|
+
"Default: #{OPTIONS[:daemon] ? 'on' : 'off'}") { |v| OPTIONS[:daemon] = v }
|
495
494
|
end
|
496
|
-
opts.on(
|
497
|
-
|
498
|
-
|
495
|
+
opts.on('-v', '--verbose',
|
496
|
+
'Run verbose.',
|
497
|
+
'Default: off') { |v| OPTIONS[:verbose] = v }
|
499
498
|
|
500
|
-
opts.separator
|
499
|
+
opts.separator ''
|
501
500
|
|
502
|
-
opts.on(
|
503
|
-
|
501
|
+
opts.on('-h', '--help',
|
502
|
+
'Show this help message.') { puts opts; puts; exit }
|
504
503
|
|
505
504
|
opts.parse!
|
506
505
|
end
|