Module: R2CORBA::CORBA::ORB
- Defined in:
- lib/corba/cbase/ORB.rb,
lib/corba/jbase/ORB.rb,
lib/corba/common/ORB.rb,
lib/corba/cbase/policies.rb,
lib/corba/jbase/policies.rb
Constant Summary collapse
- @@_default_args =
[]
- @@vf_queue =
custom
(Class.new(Monitor) do def initialize @q_ = [] super end def push(vfklass) synchronize do @q_ << vfklass end end def process_all(&block) synchronize do @q_.each { |vf| block.call(vf) } @q_.clear end end def empty?() f = false synchronize do f = @q_.empty? end f end end).new
- @@wrapper_klass =
Class.new do include ::R2CORBA::CORBA::ORB def initialize(norb) @orb_ = norb end attr_reader :orb_ end
- @@cached_orb =
nil
Class Method Summary collapse
- ._check_value_factory(vfklass) ⇒ Object
- ._orb ⇒ Object
- ._wrap_native(norb) ⇒ Object
-
.init(*args) ⇒ Object
init() or init(orb_id, prop = {}) or init(argv, orb_id, prop={}) or init(argv, prop={}).
Instance Method Summary collapse
- #==(other) ⇒ Object
- #clone ⇒ Object
-
#create_abstract_interface_tc(id, name) ⇒ Object
RepositoryId id Identifier name ret TypeCode.
-
#create_alias_tc(id, name, original_type) ⇒ Object
String id String name TypeCode original_type ret TypeCode.
-
#create_array_tc(length, element_type) ⇒ Object
Integer length TypeCode element_type ret TypeCode.
-
#create_enum_tc(id, name, *members) ⇒ Object
String id String name [] members ret TypeCode.
-
#create_exception_tc(id, name, *members) ⇒ Object
String id String name [] members ret TypeCode.
-
#create_fixed_tc(digits, scale) ⇒ Object
Integer(ushort) digits Integer(short) scale ret TypeCode.
-
#create_interface_tc(id, name) ⇒ Object
String id String name ret TypeCode.
-
#create_list(count) ⇒ Object
str ::Integer ret ::CORBA::NVList.
-
#create_native_tc(id, name) ⇒ Object
RepositoryId id Identifier name ret TypeCode.
-
#create_operation_list(oper) ⇒ Object
str OperationDef ret ::CORBA::NVList.
-
#create_policy(type, val) ⇒ Object
PolicyType type any val ret Policy raises PolicyError.
-
#create_recursive_tc(id) ⇒ Object
String id ret TypeCode.
-
#create_sequence_tc(bound, element_type) ⇒ Object
Integer bound TypeCode element_type ret TypeCode.
-
#create_string_tc(bound = nil) ⇒ Object
Integer bound ret TypeCode.
-
#create_struct_tc(id, name, *members) ⇒ Object
String id String name [] members ret TypeCode.
-
#create_union_tc(id, name, discriminator_type, *members) ⇒ Object
String id String name TypeCode discriminator_type [] members ret TypeCode.
-
#create_value_box_tc(id, name, boxed_type) ⇒ Object
RepositoryId id Identifier name TypeCode boxed_type ret TypeCode.
-
#create_value_tc(id, name, type_modifier, concrete_base, members) ⇒ Object
RepositoryId id Identifier name ValueModifier type_modifier TypeCode concrete_base ValueMemberSeq members ret TypeCode.
-
#create_wstring_tc(bound = nil) ⇒ Object
Integer bound ret TypeCode.
-
#destroy ⇒ Object
ret void.
- #dup ⇒ Object
-
#get_default_context ⇒ Object
ret Context.
-
#get_next_response ⇒ Object
ret Request.
-
#get_service_information(service_type) ⇒ Object
ServiceType service_type ret [boolean, ServiceInformation].
- #hash ⇒ Object
-
#ior_map ⇒ Object
custom R2CORBA extension : IORMap.
-
#list_initial_services ⇒ Object
ret [::String, …].
-
#lookup_value_factory(id) ⇒ Object
RepositoryId id ret ValueFactory.
-
#object_to_string(obj) ⇒ Object
obj ::CORBA::Object ret ::String.
-
#perform_work ⇒ Object
ret void.
-
#poll_next_response ⇒ Object
ret boolean.
-
#register_initial_reference(identifier, obj) ⇒ Object
::String identifier CORBA::Object obj ret void raises InvalidName.
-
#register_value_factory(id, factory) ⇒ Object
RepositoryId id ValueFactory factory ret ValueFactory.
-
#resolve_initial_references(identifier) ⇒ Object
::String identifier ret Object raises InvalidName.
-
#run ⇒ Object
ret void.
-
#run_blocked(timeout = nil) ⇒ Object
starts blocking ORB event loop in MRI Ruby 1.8, i.e.
-
#send_multiple_request_deferred(req) ⇒ Object
req RequestSeq ret void.
-
#send_multiple_request_oneway(req) ⇒ Object
req RequestSeq ret void.
-
#shutdown(wait_for_completion = false) ⇒ Object
boolean wait_for_completion ret void.
-
#string_to_object(str) ⇒ Object
str ::String ret ::CORBA::Object.
-
#unregister_value_factory(id) ⇒ Object
RepositoryId id ret void.
-
#work_pending ⇒ Object
ret boolean.
Class Method Details
._check_value_factory(vfklass) ⇒ Object
168 169 170 171 172 173 174 |
# File 'lib/corba/cbase/ORB.rb', line 168 def self._check_value_factory(vfklass) if @@cached_orb.nil? @@vf_queue.push(vfklass) else vfklass._check_factory end end |
._orb ⇒ Object
44 45 46 |
# File 'lib/corba/common/ORB.rb', line 44 def self._orb @@cached_orb || _singleton_orb_init end |
._wrap_native(norb) ⇒ Object
32 33 34 35 |
# File 'lib/corba/common/ORB.rb', line 32 def self._wrap_native(norb) raise ArgumentError, 'Expected org.omg.CORBA.ORB' unless norb.nil? || norb.is_a?(Native::ORB) norb.nil?() ? norb : @@wrapper_klass.new(norb) end |
.init(*args) ⇒ Object
init() or init(orb_id, prop = {}) or init(argv, orb_id, prop={}) or init(argv, prop={})
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/corba/cbase/ORB.rb', line 36 def self.init(*args) n_orb = if args.empty? && @@_default_args.empty? _singleton_orb_init else argv = [] orb_id = nil prop = nil a1, a2, a3 = args if Array === a1 raise ArgumentError, "Incorrect nr. of arguments; #{args.size}" if args.size>3 argv = a1 orb_id = (Hash === a2 ? nil : a2) prop = (Hash === a2 ? a2 : a3) elsif args.size == 1 || Hash === a2 raise ArgumentError, "Incorrect nr. of arguments; #{args.size}" if args.size>2 orb_id = a1 prop = a2 else argv = args end raise ArgumentError, "Invalid argument #{prop.class}; expected Hash" unless prop.nil? || Hash === prop unless prop.nil?() prop.inject(argv) {|a,(k,v)| a << k; a << v; a} end @@cached_orb = CORBA::Native::ORB.init(argv.collect {|a| a.to_s }.concat(@@_default_args), orb_id.nil?() ? nil : orb_id.to_s) end unless n_orb.nil?() || @@vf_queue.empty?() @@vf_queue.process_all { |vfklass| vfklass._check_factory } end @@wrapper_klass.new(n_orb) end |
Instance Method Details
#==(other) ⇒ Object
48 49 50 |
# File 'lib/corba/common/ORB.rb', line 48 def ==(other) self.class == other.class && self.orb_.eql?(other.orb_) end |
#clone ⇒ Object
60 61 62 |
# File 'lib/corba/common/ORB.rb', line 60 def clone self end |
#create_abstract_interface_tc(id, name) ⇒ Object
RepositoryId id Identifier name ret TypeCode
278 279 280 |
# File 'lib/corba/common/ORB.rb', line 278 def create_abstract_interface_tc(id, name) return CORBA::TypeCode::AbstractInterface.new(id.to_s.freeze, name.to_s, nil) end |
#create_alias_tc(id, name, original_type) ⇒ Object
String id String name TypeCode original_type ret TypeCode
199 200 201 |
# File 'lib/corba/common/ORB.rb', line 199 def create_alias_tc(id, name, original_type) return CORBA::TypeCode::Alias.new(id.to_s.freeze, name.to_s, nil, original_type) end |
#create_array_tc(length, element_type) ⇒ Object
Integer length TypeCode element_type ret TypeCode
239 240 241 |
# File 'lib/corba/common/ORB.rb', line 239 def create_array_tc(length, element_type) return CORBA::TypeCode::Array.new(element_type, length) end |
#create_enum_tc(id, name, *members) ⇒ Object
String id String name
-
members
ret TypeCode
191 192 193 |
# File 'lib/corba/common/ORB.rb', line 191 def create_enum_tc(id, name, *members) return CORBA::TypeCode::Enum.new(id.to_s.freeze, name.to_s, members) end |
#create_exception_tc(id, name, *members) ⇒ Object
String id String name
-
members
ret TypeCode
174 175 176 |
# File 'lib/corba/common/ORB.rb', line 174 def create_exception_tc(id, name, *members) return CORBA::TypeCode::Except.new(id.to_s.freeze, name.to_s, nil, members) end |
#create_fixed_tc(digits, scale) ⇒ Object
Integer(ushort) digits Integer(short) scale ret TypeCode
225 226 227 |
# File 'lib/corba/common/ORB.rb', line 225 def create_fixed_tc(digits, scale) return CORBA::TypeCode::Fixed.new(digits, scale) end |
#create_interface_tc(id, name) ⇒ Object
String id String name ret TypeCode
206 207 208 |
# File 'lib/corba/common/ORB.rb', line 206 def create_interface_tc(id, name) return CORBA::TypeCode::ObjectRef.new(id.to_s.freeze, name.to_s, nil) end |
#create_list(count) ⇒ Object
str ::Integer ret ::CORBA::NVList
87 88 89 |
# File 'lib/corba/common/ORB.rb', line 87 def create_list(count) raise CORBA::NO_IMPLEMENT end |
#create_native_tc(id, name) ⇒ Object
RepositoryId id Identifier name ret TypeCode
270 271 272 273 |
# File 'lib/corba/common/ORB.rb', line 270 def create_native_tc(id, name) # TODO ORB::create_native_tc raise ::CORBA::NO_IMPLEMENT end |
#create_operation_list(oper) ⇒ Object
str OperationDef ret ::CORBA::NVList
93 94 95 |
# File 'lib/corba/common/ORB.rb', line 93 def create_operation_list(oper) raise CORBA::NO_IMPLEMENT end |
#create_policy(type, val) ⇒ Object
PolicyType type any val ret Policy raises PolicyError
340 341 342 |
# File 'lib/corba/common/ORB.rb', line 340 def create_policy(type, val) raise ::CORBA::NO_IMPLEMENT end |
#create_recursive_tc(id) ⇒ Object
String id ret TypeCode
245 246 247 |
# File 'lib/corba/common/ORB.rb', line 245 def create_recursive_tc(id) return CORBA::TypeCode::Recursive.new(id.to_s.freeze) end |
#create_sequence_tc(bound, element_type) ⇒ Object
Integer bound TypeCode element_type ret TypeCode
232 233 234 |
# File 'lib/corba/common/ORB.rb', line 232 def create_sequence_tc(bound, element_type) return CORBA::TypeCode::Sequence.new(element_type, bound) end |
#create_string_tc(bound = nil) ⇒ Object
Integer bound ret TypeCode
212 213 214 |
# File 'lib/corba/common/ORB.rb', line 212 def create_string_tc(bound=nil) return CORBA::TypeCode::String.new(bound) end |
#create_struct_tc(id, name, *members) ⇒ Object
String id String name
-
members
ret TypeCode
166 167 168 |
# File 'lib/corba/common/ORB.rb', line 166 def create_struct_tc(id, name, *members) return CORBA::TypeCode::Struct.new(id.to_s.freeze, name.to_s, nil, members) end |
#create_union_tc(id, name, discriminator_type, *members) ⇒ Object
String id String name TypeCode discriminator_type
-
members
ret TypeCode
183 184 185 |
# File 'lib/corba/common/ORB.rb', line 183 def create_union_tc(id, name, discriminator_type, *members) return CORBA::TypeCode::Union.new(id.to_s.freeze, name.to_s, nil, discriminator_type, members) end |
#create_value_box_tc(id, name, boxed_type) ⇒ Object
RepositoryId id Identifier name TypeCode boxed_type ret TypeCode
263 264 265 |
# File 'lib/corba/common/ORB.rb', line 263 def create_value_box_tc (id, name, boxed_type) return CORBA::TypeCode::Valuebox.new(id, name, boxed_type) end |
#create_value_tc(id, name, type_modifier, concrete_base, members) ⇒ Object
RepositoryId id Identifier name ValueModifier type_modifier TypeCode concrete_base ValueMemberSeq members ret TypeCode
255 256 257 |
# File 'lib/corba/common/ORB.rb', line 255 def create_value_tc(id, name, type_modifier, concrete_base, members) return CORBA::TypeCode::Valuetype.new(id, name, type_modifier, concrete_base, members) end |
#create_wstring_tc(bound = nil) ⇒ Object
Integer bound ret TypeCode
218 219 220 |
# File 'lib/corba/common/ORB.rb', line 218 def create_wstring_tc(bound=nil) return CORBA::TypeCode::WString.new(bound) end |
#destroy ⇒ Object
ret void
324 325 326 327 328 329 330 |
# File 'lib/corba/common/ORB.rb', line 324 def destroy() begin self.orb_.destroy() rescue ::NativeException CORBA::Exception.native2r($!) end end |
#dup ⇒ Object
56 57 58 |
# File 'lib/corba/common/ORB.rb', line 56 def dup self end |
#get_default_context ⇒ Object
ret Context
98 99 100 |
# File 'lib/corba/common/ORB.rb', line 98 def get_default_context() raise CORBA::NO_IMPLEMENT end |
#get_next_response ⇒ Object
ret Request
120 121 122 |
# File 'lib/corba/common/ORB.rb', line 120 def get_next_response() raise CORBA::NO_IMPLEMENT end |
#get_service_information(service_type) ⇒ Object
ServiceType service_type ret [boolean, ServiceInformation]
128 129 130 |
# File 'lib/corba/common/ORB.rb', line 128 def get_service_information(service_type) raise CORBA::NO_IMPLEMENT end |
#hash ⇒ Object
52 53 54 |
# File 'lib/corba/common/ORB.rb', line 52 def hash self.orb_.hash end |
#ior_map ⇒ Object
custom R2CORBA extension : IORMap
178 179 180 |
# File 'lib/corba/cbase/ORB.rb', line 178 def ior_map @iormap ||= R2CORBA::IORMap.new(self) end |
#list_initial_services ⇒ Object
ret [::String, …]
133 134 135 |
# File 'lib/corba/common/ORB.rb', line 133 def list_initial_services() self.orb_.list_initial_services() end |
#lookup_value_factory(id) ⇒ Object
RepositoryId id ret ValueFactory
362 363 364 |
# File 'lib/corba/common/ORB.rb', line 362 def lookup_value_factory(id) self.orb_().lookup_value_factory(id) end |
#object_to_string(obj) ⇒ Object
obj ::CORBA::Object ret ::String
66 67 68 69 70 71 72 73 |
# File 'lib/corba/common/ORB.rb', line 66 def object_to_string(obj) raise CORBA::BAD_PARAM.new('CORBA::Object required', 0, CORBA::COMPLETED_NO) unless obj.is_a?(CORBA::Object) begin self.orb_.object_to_string(obj.objref_) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#perform_work ⇒ Object
ret void
82 83 84 85 86 87 88 |
# File 'lib/corba/cbase/ORB.rb', line 82 def perform_work(timeout = nil) begin self.orb_.perform_work(timeout) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#poll_next_response ⇒ Object
ret boolean
115 116 117 |
# File 'lib/corba/common/ORB.rb', line 115 def poll_next_response() raise CORBA::NO_IMPLEMENT end |
#register_initial_reference(identifier, obj) ⇒ Object
::String identifier CORBA::Object obj ret void raises InvalidName
155 156 157 |
# File 'lib/corba/common/ORB.rb', line 155 def register_initial_reference(identifier, obj) raise ::CORBA::NO_IMPLEMENT end |
#register_value_factory(id, factory) ⇒ Object
RepositoryId id ValueFactory factory ret ValueFactory
350 351 352 |
# File 'lib/corba/common/ORB.rb', line 350 def register_value_factory(id, factory) self.orb_().register_value_factory(id, factory) end |
#resolve_initial_references(identifier) ⇒ Object
::String identifier ret Object raises InvalidName
143 144 145 146 147 148 149 |
# File 'lib/corba/common/ORB.rb', line 143 def resolve_initial_references(identifier) begin Object._wrap_native(self.orb_.resolve_initial_references(identifier)) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#run ⇒ Object
ret void
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/corba/cbase/ORB.rb', line 92 def run(timeout = nil) if R2CORBA::TAO::RUBY_THREAD_SUPPORT begin self.orb_.run(timeout) rescue ::NativeException CORBA::Exception.native2r($!) end else @running ||= true raise CORBA::BAD_INV_ORDER.new('ORB has been shutdown', 0, CORBA::COMPLETED_NO) if @shutdown while (timeout.nil? or timeout>0) and !@shutdown to = timeout || 0.05 f, to = self.work_pending(to) timeout = to unless timeout.nil? if f and !@shutdown and (timeout.nil? or timeout>0) to = timeout || 0.05 to = self.perform_work(to) timeout = to unless timeout.nil? end Thread.pass unless @shutdown end end end |
#run_blocked(timeout = nil) ⇒ Object
starts blocking ORB event loop in MRI Ruby 1.8, i.e. no thread support ret <time left> if !timeout.nil? else void
119 120 121 122 123 124 125 |
# File 'lib/corba/cbase/ORB.rb', line 119 def run_blocked(timeout = nil) begin self.orb_.run(timeout) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#send_multiple_request_deferred(req) ⇒ Object
req RequestSeq ret void
110 111 112 |
# File 'lib/corba/common/ORB.rb', line 110 def send_multiple_request_deferred(req) raise CORBA::NO_IMPLEMENT end |
#send_multiple_request_oneway(req) ⇒ Object
req RequestSeq ret void
104 105 106 |
# File 'lib/corba/common/ORB.rb', line 104 def send_multiple_request_oneway(req) raise CORBA::NO_IMPLEMENT end |
#shutdown(wait_for_completion = false) ⇒ Object
boolean wait_for_completion ret void
130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/corba/cbase/ORB.rb', line 130 def shutdown(wait_for_completion = false) if R2CORBA::TAO::RUBY_THREAD_SUPPORT or !@running begin self.orb_.shutdown(wait_for_completion) rescue ::NativeException CORBA::Exception.native2r($!) end else @shutdown = true end end |
#string_to_object(str) ⇒ Object
str ::String ret ::CORBA::Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/corba/jbase/ORB.rb', line 64 def string_to_object(str) begin begin Object._wrap_native(self.orb_.string_to_object(str)) rescue ::NativeException CORBA::Exception.native2r($!) end rescue CORBA::BAD_PARAM ## JacORB throws MARSHAL exception on invalid IORs which is not spec compliant return nil end end |
#unregister_value_factory(id) ⇒ Object
RepositoryId id ret void
356 357 358 |
# File 'lib/corba/common/ORB.rb', line 356 def unregister_value_factory(id) self.orb_().unregister_value_factory(id) end |
#work_pending ⇒ Object
ret boolean
73 74 75 76 77 78 79 |
# File 'lib/corba/cbase/ORB.rb', line 73 def work_pending(timeout = nil) begin self.orb_.work_pending(timeout) rescue ::NativeException CORBA::Exception.native2r($!) end end |