r2corba 1.6.1-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +173 -0
- data/LICENSE +59 -0
- data/README.rdoc +62 -0
- data/THANKS +54 -0
- data/bin/r2corba +8 -0
- data/bin/r2corba.bat +20 -0
- data/bin/ridlc +11 -0
- data/bin/ridlc.bat +23 -0
- data/bin/rins +7 -0
- data/bin/rins.bat +19 -0
- data/ext/.keep +0 -0
- data/lib/corba/cbase/IORMap.rb +32 -0
- data/lib/corba/cbase/ORB.rb +239 -0
- data/lib/corba/cbase/Request.rb +133 -0
- data/lib/corba/cbase/Streams.rb +128 -0
- data/lib/corba/cbase/Stub.rb +18 -0
- data/lib/corba/cbase/Typecode.rb +440 -0
- data/lib/corba/cbase/Values.rb +130 -0
- data/lib/corba/cbase/exception.rb +67 -0
- data/lib/corba/cbase/poa.rb +22 -0
- data/lib/corba/cbase/policies.rb +77 -0
- data/lib/corba/cbase/post_require.rb +13 -0
- data/lib/corba/cbase/require.rb +36 -0
- data/lib/corba/cmds/base.rb +84 -0
- data/lib/corba/cmds/test.rb +29 -0
- data/lib/corba/common/Any.rb +91 -0
- data/lib/corba/common/IDL.rb +100 -0
- data/lib/corba/common/ORB.rb +367 -0
- data/lib/corba/common/Object.rb +211 -0
- data/lib/corba/common/Request.rb +19 -0
- data/lib/corba/common/Servant.rb +107 -0
- data/lib/corba/common/Struct.rb +21 -0
- data/lib/corba/common/Stub.rb +78 -0
- data/lib/corba/common/Typecode.rb +1147 -0
- data/lib/corba/common/Union.rb +60 -0
- data/lib/corba/common/Values.rb +92 -0
- data/lib/corba/common/const.rb +21 -0
- data/lib/corba/common/exception.rb +68 -0
- data/lib/corba/common/require.rb +34 -0
- data/lib/corba/common/version.rb +21 -0
- data/lib/corba/idl/BiDirPolicyC.rb +62 -0
- data/lib/corba/idl/CosNamingC.rb +460 -0
- data/lib/corba/idl/CosNamingS.rb +308 -0
- data/lib/corba/idl/IDL.rb +20 -0
- data/lib/corba/idl/IORTable.pidl +61 -0
- data/lib/corba/idl/IORTableC.rb +116 -0
- data/lib/corba/idl/MessagingC.rb +903 -0
- data/lib/corba/idl/POAC.rb +929 -0
- data/lib/corba/idl/TAO_Ext.pidl +45 -0
- data/lib/corba/idl/TAO_ExtC.rb +178 -0
- data/lib/corba/idl/r2c_orb.rb +571 -0
- data/lib/corba/idl/require.rb +19 -0
- data/lib/corba/jbase/Any.rb +274 -0
- data/lib/corba/jbase/IORMap.rb +35 -0
- data/lib/corba/jbase/ORB.rb +111 -0
- data/lib/corba/jbase/Object.rb +98 -0
- data/lib/corba/jbase/Request.rb +225 -0
- data/lib/corba/jbase/Servant.rb +247 -0
- data/lib/corba/jbase/ServerRequest.rb +127 -0
- data/lib/corba/jbase/Streams.rb +734 -0
- data/lib/corba/jbase/Stub.rb +37 -0
- data/lib/corba/jbase/Typecode.rb +520 -0
- data/lib/corba/jbase/Values.rb +174 -0
- data/lib/corba/jbase/exception.rb +106 -0
- data/lib/corba/jbase/poa.rb +228 -0
- data/lib/corba/jbase/policies.rb +299 -0
- data/lib/corba/jbase/post_require.rb +13 -0
- data/lib/corba/jbase/require.rb +92 -0
- data/lib/corba/naming.rb +13 -0
- data/lib/corba/naming_service.rb +14 -0
- data/lib/corba/poa.rb +14 -0
- data/lib/corba/policies.rb +17 -0
- data/lib/corba/require.rb +16 -0
- data/lib/corba/svcs/ins/cos_naming.rb +432 -0
- data/lib/corba/svcs/ins/ins.rb +525 -0
- data/lib/corba/svcs/ins/naming_service.rb +118 -0
- data/lib/corba.rb +15 -0
- data/lib/ridlbe/ruby/config.rb +340 -0
- data/lib/ridlbe/ruby/orb.pidlc +0 -0
- data/lib/ridlbe/ruby/require.rb +15 -0
- data/lib/ridlbe/ruby/walker.rb +1605 -0
- data/mkrf_conf_bingem.rb +149 -0
- data/rakelib/bin.rake +79 -0
- data/rakelib/bin.rb +145 -0
- data/rakelib/build.rake +87 -0
- data/rakelib/config.rake +51 -0
- data/rakelib/config.rb +542 -0
- data/rakelib/ext.rake +183 -0
- data/rakelib/ext.rb +277 -0
- data/rakelib/ext_r2tao.rb +208 -0
- data/rakelib/gem.rake +251 -0
- data/rakelib/gem.rb +145 -0
- data/rakelib/package.rake +25 -0
- data/rakelib/test.rake +22 -0
- data/test/BiDirectional/Test.idl +33 -0
- data/test/BiDirectional/client.rb +131 -0
- data/test/BiDirectional/run_test.rb +67 -0
- data/test/BiDirectional/server.rb +167 -0
- data/test/CORBA_Services/Naming/BindingIterator/Test.idl +26 -0
- data/test/CORBA_Services/Naming/BindingIterator/client.rb +120 -0
- data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +81 -0
- data/test/CORBA_Services/Naming/BindingIterator/server.rb +108 -0
- data/test/CORBA_Services/Naming/Corbaname/Test.idl +26 -0
- data/test/CORBA_Services/Naming/Corbaname/client.rb +84 -0
- data/test/CORBA_Services/Naming/Corbaname/run_test.rb +87 -0
- data/test/CORBA_Services/Naming/Corbaname/server.rb +134 -0
- data/test/CORBA_Services/Naming/Simple/Test.idl +26 -0
- data/test/CORBA_Services/Naming/Simple/client.rb +83 -0
- data/test/CORBA_Services/Naming/Simple/run_test.rb +81 -0
- data/test/CORBA_Services/Naming/Simple/server.rb +108 -0
- data/test/Collocation/Diamond.idl +38 -0
- data/test/Collocation/run_test.rb +51 -0
- data/test/Collocation/test.rb +201 -0
- data/test/Connect_Timeout/Test.idl +26 -0
- data/test/Connect_Timeout/client.rb +109 -0
- data/test/Connect_Timeout/run_test.rb +51 -0
- data/test/DII/Test.idl +26 -0
- data/test/DII/client.rb +114 -0
- data/test/DII/run_test.rb +68 -0
- data/test/DII/server.rb +94 -0
- data/test/DSI/Test.idl +26 -0
- data/test/DSI/client.rb +65 -0
- data/test/DSI/run_test.rb +68 -0
- data/test/DSI/server.rb +105 -0
- data/test/Exceptions/Test.idl +47 -0
- data/test/Exceptions/client.rb +117 -0
- data/test/Exceptions/run_test.rb +68 -0
- data/test/Exceptions/server.rb +130 -0
- data/test/Hello/Test.idl +26 -0
- data/test/Hello/client.rb +77 -0
- data/test/Hello/run_test.rb +70 -0
- data/test/Hello/server.rb +94 -0
- data/test/IDL_Test/Test.idl +116 -0
- data/test/IDL_Test/Test_inc.idl +17 -0
- data/test/IDL_Test/client.rb +103 -0
- data/test/IDL_Test/run_test.rb +68 -0
- data/test/IDL_Test/server.rb +103 -0
- data/test/IORMap/Test.idl +26 -0
- data/test/IORMap/client.rb +72 -0
- data/test/IORMap/run_test.rb +68 -0
- data/test/IORMap/server.rb +113 -0
- data/test/IORTable/Test.idl +26 -0
- data/test/IORTable/client.rb +74 -0
- data/test/IORTable/run_test.rb +68 -0
- data/test/IORTable/server.rb +129 -0
- data/test/Implicit_Conversion/Test.idl +30 -0
- data/test/Implicit_Conversion/client.rb +112 -0
- data/test/Implicit_Conversion/run_test.rb +68 -0
- data/test/Implicit_Conversion/server.rb +98 -0
- data/test/Multi_Threading/Multiple_ORB/Test.idl +26 -0
- data/test/Multi_Threading/Multiple_ORB/client.rb +81 -0
- data/test/Multi_Threading/Multiple_ORB/run_test.rb +70 -0
- data/test/Multi_Threading/Multiple_ORB/server.rb +107 -0
- data/test/Multi_Threading/Simple/Test.idl +26 -0
- data/test/Multi_Threading/Simple/client.rb +92 -0
- data/test/Multi_Threading/Simple/run_test.rb +68 -0
- data/test/Multi_Threading/Simple/server.rb +117 -0
- data/test/Multi_Threading/Threads/Test.idl +27 -0
- data/test/Multi_Threading/Threads/client.rb +77 -0
- data/test/Multi_Threading/Threads/run_test.rb +75 -0
- data/test/Multi_Threading/Threads/server.rb +116 -0
- data/test/Multi_Threading/Threads/watchdog.rb +87 -0
- data/test/Multiple_Servant_Interfaces/Test.idl +33 -0
- data/test/Multiple_Servant_Interfaces/client.rb +69 -0
- data/test/Multiple_Servant_Interfaces/run_test.rb +68 -0
- data/test/Multiple_Servant_Interfaces/server.rb +101 -0
- data/test/Nil/Test.idl +26 -0
- data/test/Nil/run_test.rb +51 -0
- data/test/Nil/test.rb +80 -0
- data/test/OBV/AbstractInterface/client.rb +178 -0
- data/test/OBV/AbstractInterface/run_test.rb +68 -0
- data/test/OBV/AbstractInterface/server.rb +149 -0
- data/test/OBV/AbstractInterface/test.idl +52 -0
- data/test/OBV/Custom/OBV.idl +18 -0
- data/test/OBV/Custom/OBV_impl.rb +41 -0
- data/test/OBV/Custom/client.rb +85 -0
- data/test/OBV/Custom/run_test.rb +68 -0
- data/test/OBV/Custom/server.rb +99 -0
- data/test/OBV/Simple/OBV.idl +15 -0
- data/test/OBV/Simple/OBV_impl.rb +26 -0
- data/test/OBV/Simple/client.rb +85 -0
- data/test/OBV/Simple/run_test.rb +68 -0
- data/test/OBV/Simple/server.rb +99 -0
- data/test/OBV/Simple_Event/Event.idl +15 -0
- data/test/OBV/Simple_Event/Event_impl.rb +26 -0
- data/test/OBV/Simple_Event/client.rb +85 -0
- data/test/OBV/Simple_Event/run_test.rb +68 -0
- data/test/OBV/Simple_Event/server.rb +99 -0
- data/test/OBV/Supports/client.rb +115 -0
- data/test/OBV/Supports/run_test.rb +68 -0
- data/test/OBV/Supports/server.rb +102 -0
- data/test/OBV/Supports/supports.idl +32 -0
- data/test/OBV/Supports/supports_impl.rb +59 -0
- data/test/OBV/Tree/client.rb +115 -0
- data/test/OBV/Tree/run_test.rb +68 -0
- data/test/OBV/Tree/server.rb +116 -0
- data/test/OBV/Tree/test.idl +31 -0
- data/test/OBV/Truncatable/Extra.idl +26 -0
- data/test/OBV/Truncatable/Truncatable.idl +105 -0
- data/test/OBV/Truncatable/Truncatable_impl.rb +85 -0
- data/test/OBV/Truncatable/client.rb +278 -0
- data/test/OBV/Truncatable/run_test.rb +68 -0
- data/test/OBV/Truncatable/server.rb +88 -0
- data/test/OBV/ValueBox/client.rb +497 -0
- data/test/OBV/ValueBox/run_test.rb +68 -0
- data/test/OBV/ValueBox/server.rb +271 -0
- data/test/OBV/ValueBox/valuebox.idl +101 -0
- data/test/OBV/ValueBox/vb_basic.idl +75 -0
- data/test/OBV/ValueBox/vb_struct.idl +68 -0
- data/test/OBV/ValueBox/vb_union.idl +21 -0
- data/test/Object/Test.idl +26 -0
- data/test/Object/client.rb +111 -0
- data/test/Object/run_test.rb +68 -0
- data/test/Object/server.rb +125 -0
- data/test/POA/Test.idl +27 -0
- data/test/POA/run_test.rb +51 -0
- data/test/POA/test.rb +111 -0
- data/test/Param_Test/Test.idl +182 -0
- data/test/Param_Test/client.rb +276 -0
- data/test/Param_Test/run_test.rb +68 -0
- data/test/Param_Test/server.rb +295 -0
- data/test/Performance/Simple/Test.idl +26 -0
- data/test/Performance/Simple/client.rb +89 -0
- data/test/Performance/Simple/run_test.rb +68 -0
- data/test/Performance/Simple/server.rb +94 -0
- data/test/Policies/Test.idl +26 -0
- data/test/Policies/run_test.rb +51 -0
- data/test/Policies/test.rb +142 -0
- data/test/Timeout/client.rb +206 -0
- data/test/Timeout/run_test.rb +68 -0
- data/test/Timeout/server.rb +108 -0
- data/test/Timeout/test.idl +18 -0
- data/test/lib/assert.rb +41 -0
- data/test/lib/test.rb +546 -0
- data/test/test_runner.rb +191 -0
- metadata +318 -0
@@ -0,0 +1,174 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# Values.rb - Java/JacORB CORBA Value and ValueBox support
|
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
|
+
#--------------------------------------------------------------------
|
12
|
+
|
13
|
+
module R2CORBA
|
14
|
+
module CORBA
|
15
|
+
module AbstractValueBase
|
16
|
+
def self.included(mod)
|
17
|
+
mod.module_eval do
|
18
|
+
def self.===(obj)
|
19
|
+
obj.kind_of?(self)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module ValueBase
|
26
|
+
def self.included(mod)
|
27
|
+
mod.module_eval do
|
28
|
+
include CORBA::Native::Portable::StreamableValue unless self.include?(CORBA::Native::Portable::StreamableValue)
|
29
|
+
# this defines the following methods to be implemented
|
30
|
+
# String[] _truncatable_ids();
|
31
|
+
# TypeCode _type();
|
32
|
+
# void _read(org.omg.CORBA.portable.InputStream is);
|
33
|
+
# void _write(org.omg.CORBA.portable.OutputStream os);
|
34
|
+
include CORBA::AbstractValueBase unless self.include?(CORBA::AbstractValueBase)
|
35
|
+
|
36
|
+
def _truncatable_ids
|
37
|
+
self.class::TRUNCATABLE_IDS.to_java(:string)
|
38
|
+
end
|
39
|
+
|
40
|
+
def _type
|
41
|
+
self.class._tc.tc_ # return Java TypeCode here
|
42
|
+
end
|
43
|
+
|
44
|
+
def _read(jis)
|
45
|
+
do_unmarshal(CORBA::Portable::InputStream._wrap_native(jis))
|
46
|
+
end
|
47
|
+
|
48
|
+
def _write(jos)
|
49
|
+
do_marshal(CORBA::Portable::OutputStream._wrap_native(jos))
|
50
|
+
end
|
51
|
+
|
52
|
+
def kind_of?(mod)
|
53
|
+
if mod < CORBA::AbstractValueBase && mod.const_defined?(:Intf)
|
54
|
+
super(mod::Intf)
|
55
|
+
else
|
56
|
+
super
|
57
|
+
end
|
58
|
+
end
|
59
|
+
alias :is_a? :kind_of?
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def _marshal_with(os, &block)
|
64
|
+
self.instance_eval(&block)
|
65
|
+
end
|
66
|
+
|
67
|
+
def _unmarshal_with(is, &block)
|
68
|
+
self.instance_eval(&block)
|
69
|
+
end
|
70
|
+
end # ValueBase
|
71
|
+
|
72
|
+
module Portable
|
73
|
+
class ValueFactoryBase
|
74
|
+
include CORBA::Native::Portable::ValueFactory
|
75
|
+
## defines: java.io.Serializable read_value(InputStream is)
|
76
|
+
|
77
|
+
def self.inherited(value_factory_base)
|
78
|
+
# value_factory_base is the <valuetype>Factory base class
|
79
|
+
# generated from IDL
|
80
|
+
value_factory_base.module_eval do
|
81
|
+
def self.value_id
|
82
|
+
self::VALUE_ID
|
83
|
+
end
|
84
|
+
|
85
|
+
# overload
|
86
|
+
def read_value(jis)
|
87
|
+
vt = self._create_default
|
88
|
+
vt._read(jis)
|
89
|
+
vt
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end # ValueFactoryBase
|
94
|
+
|
95
|
+
module CustomValueBase
|
96
|
+
def self.included(mod)
|
97
|
+
mod.module_eval do
|
98
|
+
include CORBA::ValueBase unless self.include?(CORBA::ValueBase)
|
99
|
+
|
100
|
+
def do_marshal(os)
|
101
|
+
self.marshal(os)
|
102
|
+
end
|
103
|
+
|
104
|
+
def do_unmarshal(is)
|
105
|
+
self.unmarshal(is)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end # CustomValueBase
|
110
|
+
|
111
|
+
module BoxedValueBase
|
112
|
+
class FactoryBase < CORBA::Portable::ValueFactoryBase
|
113
|
+
## generic factory base
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.included(mod)
|
117
|
+
mod.module_eval do
|
118
|
+
include CORBA::ValueBase unless self.include?(CORBA::ValueBase)
|
119
|
+
|
120
|
+
def _write(jos)
|
121
|
+
CORBA::Portable::OutputStream._wrap_native(jos).write_member(
|
122
|
+
self.class._tc.content_type.resolved_tc, self.value)
|
123
|
+
end
|
124
|
+
|
125
|
+
def _read(jis)
|
126
|
+
self.value = CORBA::Portable::InputStream._wrap_native(jis).read_member(
|
127
|
+
self.class._tc.content_type.resolved_tc)
|
128
|
+
end
|
129
|
+
|
130
|
+
self.const_set(:Factory, Class.new(CORBA::Portable::BoxedValueBase::FactoryBase))
|
131
|
+
self::Factory.class_eval(%Q{
|
132
|
+
@@_reg = false
|
133
|
+
def self._check_factory(jorb)
|
134
|
+
return if @@_reg
|
135
|
+
self.get_factory(jorb)
|
136
|
+
@@_reg = true
|
137
|
+
end
|
138
|
+
|
139
|
+
def self.value_id
|
140
|
+
#{self.name}::TRUNCATABLE_IDS.first
|
141
|
+
end
|
142
|
+
|
143
|
+
def _create_default
|
144
|
+
#{self.name}.new
|
145
|
+
end
|
146
|
+
})
|
147
|
+
|
148
|
+
self.const_set(:Helper, Class.new)
|
149
|
+
self::Helper.class_eval(%Q{
|
150
|
+
include CORBA::Native::Portable::BoxedValueHelper unless self.include?(CORBA::Native::Portable::BoxedValueHelper)
|
151
|
+
|
152
|
+
def get_id()
|
153
|
+
#{self.name}::TRUNCATABLE_IDS.first
|
154
|
+
end
|
155
|
+
|
156
|
+
def read_value(jis)
|
157
|
+
#{self.name}.new._read(jis)
|
158
|
+
end
|
159
|
+
|
160
|
+
def write_value(jos, value)
|
161
|
+
value._write(jos)
|
162
|
+
end
|
163
|
+
})
|
164
|
+
|
165
|
+
def self.boxedvalue_helper
|
166
|
+
@@helper ||= Helper.new
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
end # Portable
|
173
|
+
end # CORBA
|
174
|
+
end # R2CORBA
|
@@ -0,0 +1,106 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# exception.rb - Java/JacORB specific CORBA Exception 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
|
+
#--------------------------------------------------------------------
|
12
|
+
|
13
|
+
# import all java CORBA exceptions into the R2CORBA::CORBA namespace
|
14
|
+
module R2CORBA
|
15
|
+
module CORBA
|
16
|
+
class Exception
|
17
|
+
def self.native2r(jex)
|
18
|
+
if ::NativeException === jex
|
19
|
+
if jex.cause.is_a? Native::SystemException
|
20
|
+
SystemException._raise(jex)
|
21
|
+
elsif jex.cause.is_a? Native::UserException
|
22
|
+
UserException._raise(jex)
|
23
|
+
else
|
24
|
+
raise CORBA::InternalError.new(jex)
|
25
|
+
end
|
26
|
+
else
|
27
|
+
raise jex
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class UserException
|
33
|
+
def self._raise(jex)
|
34
|
+
STDERR.puts "#{jex}\n#{jex.backtrace.join("\n")}" if $VERBOSE and (NativeException === jex)
|
35
|
+
if (NativeException === jex and jex.cause.is_a?(Native::UnknownUserException)) or jex.is_a?(Native::UnknownUserException)
|
36
|
+
java_ex = jex.is_a?(Native::UnknownUserException) ? jex : jex.cause
|
37
|
+
ex = Any.from_java(java_ex.except)
|
38
|
+
ex.set_backtrace(jex.backtrace) if NativeException === jex
|
39
|
+
raise ex
|
40
|
+
elsif (NativeException === jex and jex.cause.is_a?(Native::UserException)) or jex.is_a?(Native::UserException)
|
41
|
+
java_ex = jex.is_a?(Native::UserException) ? jex : jex.cause
|
42
|
+
exname = java_ex.class.name.split('::').last
|
43
|
+
tcs = CORBA::TypeCode.typecodes_for_name(exname) || []
|
44
|
+
extc = tcs.detect {|tc| tc.is_a?(TypeCode::Except) && tc.is_compatible?(java_ex)}
|
45
|
+
if extc
|
46
|
+
ex = extc.from_java(java_ex)
|
47
|
+
ex.set_backtrace(jex.backtrace) if NativeException === jex
|
48
|
+
raise ex
|
49
|
+
end
|
50
|
+
end
|
51
|
+
raise CORBA::UNKNOWN.new("#{jex}", 0, CORBA::COMPLETED_MAYBE)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class InternalError
|
56
|
+
def initialize(jex)
|
57
|
+
@ex_ = jex
|
58
|
+
super(@ex_.message)
|
59
|
+
self.set_backtrace(@ex_.backtrace)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class SystemException
|
64
|
+
def self._raise(jex)
|
65
|
+
raise ArgumentError unless (NativeException === jex and jex.cause.is_a?(Native::SystemException)) or jex.is_a?(Native::SystemException)
|
66
|
+
java_ex = jex.is_a?(Native::SystemException) ? jex : jex.cause
|
67
|
+
exname = java_ex.class.name.split('::').last
|
68
|
+
exklass = CORBA.const_get(exname.to_sym)
|
69
|
+
unless exklass
|
70
|
+
# define hitherto unknown CORBA system exception
|
71
|
+
CORBA.define_system_exception(exname)
|
72
|
+
CORBA.const_get(exname.to_sym) || InternalError
|
73
|
+
end
|
74
|
+
raise exklass.new(jex)
|
75
|
+
end
|
76
|
+
|
77
|
+
def initialize(*args)
|
78
|
+
if (NativeException === args.first and args.first.cause.is_a? Native::SystemException) or args.first.is_a?(Native::SystemException)
|
79
|
+
java_ex = args.first.is_a?(Native::SystemException) ? args.first : args.first.cause
|
80
|
+
super(java_ex.getMessage)
|
81
|
+
@minor = java_ex.minor
|
82
|
+
@completed = java_ex.completed.value
|
83
|
+
self.set_backtrace(args.first.backtrace) if NativeException === args.first
|
84
|
+
else
|
85
|
+
super(args.shift.to_s)
|
86
|
+
@minor, @completed = (args + [0, 0][args.size..2])
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end # CORBA
|
91
|
+
end # R2CORBA
|
92
|
+
|
93
|
+
# extend Ruby wrapper for Native java exceptions
|
94
|
+
class NativeException
|
95
|
+
alias method_missing_corba_backup method_missing
|
96
|
+
def method_missing(method, *args)
|
97
|
+
if self.cause.is_a?(R2CORBA::CORBA::Native::SystemException) and args.empty?
|
98
|
+
return self.cause.minor if method == :minor
|
99
|
+
return self.cause.completed.value if method == :completed
|
100
|
+
return self.cause.getMessage if method == :reason
|
101
|
+
elsif self.cause.is_a? R2CORBA::CORBA::Native::UserException
|
102
|
+
return self.cause.send(method, *args)
|
103
|
+
end
|
104
|
+
self.method_missing_corba_backup
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,228 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# poa.rb - Java/JacORB R2CORBA POA loader
|
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
|
+
#--------------------------------------------------------------------
|
12
|
+
|
13
|
+
module R2CORBA
|
14
|
+
module PortableServer
|
15
|
+
module Native
|
16
|
+
include_package 'org.omg.PortableServer'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'corba/common/Servant.rb'
|
22
|
+
require 'corba/idl/POAC.rb'
|
23
|
+
require 'corba/jbase/Servant.rb'
|
24
|
+
require 'corba/jbase/ServerRequest.rb'
|
25
|
+
|
26
|
+
module R2CORBA
|
27
|
+
module PortableServer
|
28
|
+
def self.string_to_ObjectId(s)
|
29
|
+
raise CORBA::NO_IMPLEMENT
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.ObjectId_to_string(oid)
|
33
|
+
raise CORBA::NO_IMPLEMENT
|
34
|
+
end
|
35
|
+
|
36
|
+
module POA
|
37
|
+
def destroy(etherealize_objects, wait_for_completion)
|
38
|
+
begin
|
39
|
+
self.objref_.destroy(etherealize_objects != false, wait_for_completion != false)
|
40
|
+
rescue ::NativeException
|
41
|
+
CORBA::Exception.native2r($!)
|
42
|
+
end
|
43
|
+
end # of operation destroy
|
44
|
+
|
45
|
+
def the_name()
|
46
|
+
begin
|
47
|
+
self.objref_.the_name()
|
48
|
+
rescue ::NativeException
|
49
|
+
CORBA::Exception.native2r($!)
|
50
|
+
end
|
51
|
+
end # of attribute get_the_name
|
52
|
+
|
53
|
+
def the_POAManager()
|
54
|
+
begin
|
55
|
+
PortableServer::POAManager._narrow(CORBA::Object._wrap_native(self.objref_.the_POAManager()))
|
56
|
+
rescue ::NativeException
|
57
|
+
CORBA::Exception.native2r($!)
|
58
|
+
end
|
59
|
+
end # of attribute get_the_POAManager
|
60
|
+
|
61
|
+
def the_parent()
|
62
|
+
begin
|
63
|
+
PortableServer::POA._narrow(CORBA::Object._wrap_native(self.objref_.the_parent()))
|
64
|
+
rescue ::NativeException
|
65
|
+
CORBA::Exception.native2r($!)
|
66
|
+
end
|
67
|
+
end # of attribute get_the_parent
|
68
|
+
|
69
|
+
def the_children()
|
70
|
+
begin
|
71
|
+
self.objref_.the_children().collect {|c| PortableServer::POA._narrow(CORBA::Object._wrap_native(c)) }
|
72
|
+
rescue ::NativeException
|
73
|
+
CORBA::Exception.native2r($!)
|
74
|
+
end
|
75
|
+
end # of attribute get_the_children
|
76
|
+
|
77
|
+
def activate_object(p_servant)
|
78
|
+
begin
|
79
|
+
String.from_java_bytes(self.objref_.activate_object(p_servant.srvref_))
|
80
|
+
rescue ::NativeException
|
81
|
+
CORBA::Exception.native2r($!)
|
82
|
+
end
|
83
|
+
end # of operation activate_object
|
84
|
+
|
85
|
+
def activate_object_with_id(r_id, p_servant)
|
86
|
+
begin
|
87
|
+
self.objref_.activate_object_with_id(r_id.to_s.to_java_bytes, p_servant.srvref_)
|
88
|
+
rescue ::NativeException
|
89
|
+
CORBA::Exception.native2r($!)
|
90
|
+
end
|
91
|
+
end # of operation activate_object_with_id
|
92
|
+
|
93
|
+
def deactivate_object(oid)
|
94
|
+
begin
|
95
|
+
self.objref_.deactivate_object(oid.to_s.to_java_bytes)
|
96
|
+
rescue ::NativeException
|
97
|
+
CORBA::Exception.native2r($!)
|
98
|
+
end
|
99
|
+
end # of operation deactivate_object
|
100
|
+
|
101
|
+
def create_reference(intf)
|
102
|
+
begin
|
103
|
+
CORBA::Object._wrap_native(self.objref_.create_reference(intf.to_s))
|
104
|
+
rescue ::NativeException
|
105
|
+
CORBA::Exception.native2r($!)
|
106
|
+
end
|
107
|
+
end # of operation create_reference
|
108
|
+
|
109
|
+
def create_reference_with_id(oid, intf)
|
110
|
+
begin
|
111
|
+
CORBA::Object._wrap_native(self.objref_.create_reference_with_id(oid.to_s.to_java_bytes, intf.to_s))
|
112
|
+
rescue ::NativeException
|
113
|
+
CORBA::Exception.native2r($!)
|
114
|
+
end
|
115
|
+
end # of operation create_reference_with_id
|
116
|
+
|
117
|
+
def servant_to_id(p_servant)
|
118
|
+
begin
|
119
|
+
String.from_java_bytes(self.objref_.servant_to_id(p_servant.srvref_))
|
120
|
+
rescue ::NativeException
|
121
|
+
CORBA::Exception.native2r($!)
|
122
|
+
end
|
123
|
+
end # of operation servant_to_id
|
124
|
+
|
125
|
+
def servant_to_reference(p_servant)
|
126
|
+
begin
|
127
|
+
CORBA::Object._wrap_native(self.objref_.servant_to_reference(p_servant.srvref_))
|
128
|
+
rescue ::NativeException
|
129
|
+
CORBA::Exception.native2r($!)
|
130
|
+
end
|
131
|
+
end # of operation servant_to_reference
|
132
|
+
|
133
|
+
def reference_to_servant(reference)
|
134
|
+
begin
|
135
|
+
self.objref_.reference_to_servant(reference.objref_).rbServant
|
136
|
+
rescue ::NativeException
|
137
|
+
CORBA::Exception.native2r($!)
|
138
|
+
end
|
139
|
+
end # of operation reference_to_servant
|
140
|
+
|
141
|
+
def reference_to_id(reference)
|
142
|
+
begin
|
143
|
+
String.from_java_bytes(self.objref_.reference_to_id(reference.objref_))
|
144
|
+
rescue ::NativeException
|
145
|
+
CORBA::Exception.native2r($!)
|
146
|
+
end
|
147
|
+
end # of operation reference_to_id
|
148
|
+
|
149
|
+
def id_to_servant(oid)
|
150
|
+
begin
|
151
|
+
self.objref_.id_to_servant(oid.to_s.to_java_bytes).rbServant
|
152
|
+
rescue ::NativeException
|
153
|
+
CORBA::Exception.native2r($!)
|
154
|
+
end
|
155
|
+
end # of operation id_to_servant
|
156
|
+
|
157
|
+
def id_to_reference(oid)
|
158
|
+
begin
|
159
|
+
CORBA::Object._wrap_native(self.objref_.id_to_reference(oid.to_s.to_java_bytes))
|
160
|
+
rescue ::NativeException
|
161
|
+
CORBA::Exception.native2r($!)
|
162
|
+
end
|
163
|
+
end # of operation id_to_reference
|
164
|
+
|
165
|
+
def create_POA(adapter_name, a_POAManager, policies)
|
166
|
+
raise CORBA::BAD_PARAM.new('expected POAManager', 0, CORBA::COMPLETED_NO) unless a_POAManager.is_a?(PortableServer::POAManager)
|
167
|
+
CORBA::PolicyList._tc.validate(policies) unless policies.nil? || policies.empty?
|
168
|
+
jpolicies = CORBA::Native::Reflect::Array.newInstance(CORBA::Native::Policy.java_class, policies.nil? ? 0 : policies.size)
|
169
|
+
policies.each_with_index {|p, i| jpolicies[i] = p.objref_ } unless policies.nil?
|
170
|
+
begin
|
171
|
+
PortableServer::POA._narrow(CORBA::Object._wrap_native(self.objref_.create_POA(adapter_name, a_POAManager.objref_, jpolicies)))
|
172
|
+
rescue ::NativeException
|
173
|
+
CORBA::Exception.native2r($!)
|
174
|
+
end
|
175
|
+
end # of operation create_POA
|
176
|
+
|
177
|
+
def find_POA(adapter_name, activate_it)
|
178
|
+
begin
|
179
|
+
PortableServer::POA._narrow(CORBA::Object._wrap_native(self.objref_.find_POA(adapter_name, activate_it)))
|
180
|
+
rescue ::NativeException
|
181
|
+
CORBA::Exception.native2r($!)
|
182
|
+
end
|
183
|
+
end # of operation find_POA
|
184
|
+
end # POA
|
185
|
+
|
186
|
+
module POAManager
|
187
|
+
def activate()
|
188
|
+
begin
|
189
|
+
self.objref_.activate()
|
190
|
+
rescue ::NativeException
|
191
|
+
CORBA::Exception.native2r($!)
|
192
|
+
end
|
193
|
+
end # activate
|
194
|
+
|
195
|
+
def hold_requests(wait_for_completion)
|
196
|
+
begin
|
197
|
+
self.objref_.hold_requests(wait_for_completion)
|
198
|
+
rescue ::NativeException
|
199
|
+
CORBA::Exception.native2r($!)
|
200
|
+
end
|
201
|
+
end # hold_requests
|
202
|
+
|
203
|
+
def discard_requests(wait_for_completion)
|
204
|
+
begin
|
205
|
+
self.objref_.discard_requests(wait_for_completion)
|
206
|
+
rescue ::NativeException
|
207
|
+
CORBA::Exception.native2r($!)
|
208
|
+
end
|
209
|
+
end # discard_requests
|
210
|
+
|
211
|
+
def deactivate(etherealize_objects, wait_for_completion)
|
212
|
+
begin
|
213
|
+
self.objref_.deactivate(etherealize_objects, wait_for_completion)
|
214
|
+
rescue ::NativeException
|
215
|
+
CORBA::Exception.native2r($!)
|
216
|
+
end
|
217
|
+
end # deactivate
|
218
|
+
|
219
|
+
def get_state()
|
220
|
+
begin
|
221
|
+
self.objref_.get_state().value()
|
222
|
+
rescue ::NativeException
|
223
|
+
CORBA::Exception.native2r($!)
|
224
|
+
end
|
225
|
+
end # get_state
|
226
|
+
end # POAManager
|
227
|
+
end
|
228
|
+
end
|