r2corba 1.4.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +159 -0
- data/LICENSE +59 -0
- data/README +62 -0
- data/THANKS +52 -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 +33 -0
- data/lib/corba/cbase/ORB.rb +231 -0
- data/lib/corba/cbase/Request.rb +134 -0
- data/lib/corba/cbase/Streams.rb +129 -0
- data/lib/corba/cbase/Stub.rb +19 -0
- data/lib/corba/cbase/Typecode.rb +441 -0
- data/lib/corba/cbase/Values.rb +129 -0
- data/lib/corba/cbase/exception.rb +66 -0
- data/lib/corba/cbase/poa.rb +23 -0
- data/lib/corba/cbase/policies.rb +78 -0
- data/lib/corba/cbase/post_require.rb +14 -0
- data/lib/corba/cbase/require.rb +28 -0
- data/lib/corba/cmds/base.rb +85 -0
- data/lib/corba/cmds/test.rb +30 -0
- data/lib/corba/common/Any.rb +91 -0
- data/lib/corba/common/IDL.rb +104 -0
- data/lib/corba/common/ORB.rb +368 -0
- data/lib/corba/common/Object.rb +208 -0
- data/lib/corba/common/Request.rb +20 -0
- data/lib/corba/common/Servant.rb +108 -0
- data/lib/corba/common/Struct.rb +22 -0
- data/lib/corba/common/Stub.rb +79 -0
- data/lib/corba/common/Typecode.rb +1121 -0
- data/lib/corba/common/Union.rb +56 -0
- data/lib/corba/common/Values.rb +92 -0
- data/lib/corba/common/const.rb +22 -0
- data/lib/corba/common/exception.rb +68 -0
- data/lib/corba/common/require.rb +27 -0
- data/lib/corba/common/version.rb +22 -0
- data/lib/corba/idl/BiDirPolicyC.rb +63 -0
- data/lib/corba/idl/CosNamingC.rb +461 -0
- data/lib/corba/idl/CosNamingS.rb +309 -0
- data/lib/corba/idl/IDL.rb +21 -0
- data/lib/corba/idl/IORTable.pidl +62 -0
- data/lib/corba/idl/IORTableC.rb +117 -0
- data/lib/corba/idl/MessagingC.rb +904 -0
- data/lib/corba/idl/POAC.rb +930 -0
- data/lib/corba/idl/TAO_Ext.pidl +46 -0
- data/lib/corba/idl/TAO_ExtC.rb +179 -0
- data/lib/corba/idl/r2c_orb.rb +572 -0
- data/lib/corba/idl/require.rb +20 -0
- data/lib/corba/jbase/Any.rb +273 -0
- data/lib/corba/jbase/IORMap.rb +36 -0
- data/lib/corba/jbase/ORB.rb +99 -0
- data/lib/corba/jbase/Object.rb +98 -0
- data/lib/corba/jbase/Request.rb +226 -0
- data/lib/corba/jbase/Servant.rb +247 -0
- data/lib/corba/jbase/ServerRequest.rb +128 -0
- data/lib/corba/jbase/Streams.rb +671 -0
- data/lib/corba/jbase/Stub.rb +38 -0
- data/lib/corba/jbase/Typecode.rb +520 -0
- data/lib/corba/jbase/Values.rb +173 -0
- data/lib/corba/jbase/exception.rb +106 -0
- data/lib/corba/jbase/poa.rb +229 -0
- data/lib/corba/jbase/policies.rb +300 -0
- data/lib/corba/jbase/post_require.rb +14 -0
- data/lib/corba/jbase/require.rb +86 -0
- data/lib/corba/naming.rb +14 -0
- data/lib/corba/naming_service.rb +15 -0
- data/lib/corba/poa.rb +15 -0
- data/lib/corba/policies.rb +18 -0
- data/lib/corba/require.rb +17 -0
- data/lib/corba/svcs/ins/cos_naming.rb +426 -0
- data/lib/corba/svcs/ins/ins.rb +526 -0
- data/lib/corba/svcs/ins/naming_service.rb +119 -0
- data/lib/corba.rb +16 -0
- data/lib/ridlbe/ruby/config.rb +336 -0
- data/lib/ridlbe/ruby/orb.pidlc +0 -0
- data/lib/ridlbe/ruby/require.rb +16 -0
- data/lib/ridlbe/ruby/walker.rb +1582 -0
- data/mkrf_conf_bingem.rb +101 -0
- data/rakelib/bin.rake +80 -0
- data/rakelib/bin.rb +146 -0
- data/rakelib/build.rake +87 -0
- data/rakelib/config.rake +52 -0
- data/rakelib/config.rb +450 -0
- data/rakelib/ext.rake +242 -0
- data/rakelib/ext.rb +308 -0
- data/rakelib/ext_r2tao.rb +232 -0
- data/rakelib/gem.rake +212 -0
- data/rakelib/gem.rb +146 -0
- data/rakelib/package.rake +26 -0
- data/rakelib/test.rake +23 -0
- data/test/BiDirectional/Test.idl +34 -0
- data/test/BiDirectional/client.rb +132 -0
- data/test/BiDirectional/run_test.rb +68 -0
- data/test/BiDirectional/server.ior +1 -0
- data/test/BiDirectional/server.rb +169 -0
- data/test/CORBA_Services/Naming/BindingIterator/Test.idl +27 -0
- data/test/CORBA_Services/Naming/BindingIterator/client.rb +121 -0
- data/test/CORBA_Services/Naming/BindingIterator/ins.ior +1 -0
- data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +82 -0
- data/test/CORBA_Services/Naming/BindingIterator/server.rb +109 -0
- data/test/CORBA_Services/Naming/Corbaname/Test.idl +27 -0
- data/test/CORBA_Services/Naming/Corbaname/client.rb +85 -0
- data/test/CORBA_Services/Naming/Corbaname/corbaname.ior +1 -0
- data/test/CORBA_Services/Naming/Corbaname/ins.ior +1 -0
- data/test/CORBA_Services/Naming/Corbaname/run_test.rb +88 -0
- data/test/CORBA_Services/Naming/Corbaname/server.rb +135 -0
- data/test/CORBA_Services/Naming/Simple/Test.idl +27 -0
- data/test/CORBA_Services/Naming/Simple/client.rb +84 -0
- data/test/CORBA_Services/Naming/Simple/ins.ior +1 -0
- data/test/CORBA_Services/Naming/Simple/run_test.rb +82 -0
- data/test/CORBA_Services/Naming/Simple/server.rb +109 -0
- data/test/Collocation/Diamond.idl +39 -0
- data/test/Collocation/run_test.rb +52 -0
- data/test/Collocation/test.rb +195 -0
- data/test/Connect_Timeout/Test.idl +27 -0
- data/test/Connect_Timeout/client.rb +111 -0
- data/test/Connect_Timeout/run_test.rb +52 -0
- data/test/DII/Test.idl +27 -0
- data/test/DII/client.rb +115 -0
- data/test/DII/run_test.rb +69 -0
- data/test/DII/server.ior +1 -0
- data/test/DII/server.rb +95 -0
- data/test/DSI/Test.idl +27 -0
- data/test/DSI/client.rb +66 -0
- data/test/DSI/run_test.rb +69 -0
- data/test/DSI/server.ior +1 -0
- data/test/DSI/server.rb +106 -0
- data/test/Exceptions/Test.idl +48 -0
- data/test/Exceptions/client.rb +118 -0
- data/test/Exceptions/run_test.rb +69 -0
- data/test/Exceptions/server.ior +1 -0
- data/test/Exceptions/server.rb +131 -0
- data/test/Hello/Test.idl +27 -0
- data/test/Hello/client.rb +78 -0
- data/test/Hello/run_test.rb +71 -0
- data/test/Hello/server.rb +95 -0
- data/test/IDL_Test/Test.idl +113 -0
- data/test/IDL_Test/Test_inc.idl +17 -0
- data/test/IDL_Test/client.rb +102 -0
- data/test/IDL_Test/run_test.rb +69 -0
- data/test/IDL_Test/server.ior +1 -0
- data/test/IDL_Test/server.rb +99 -0
- data/test/IORMap/Test.idl +27 -0
- data/test/IORMap/client.rb +73 -0
- data/test/IORMap/run_test.rb +69 -0
- data/test/IORMap/server.ior +1 -0
- data/test/IORMap/server.rb +114 -0
- data/test/IORTable/Test.idl +27 -0
- data/test/IORTable/client.rb +75 -0
- data/test/IORTable/run_test.rb +69 -0
- data/test/IORTable/server.ior +1 -0
- data/test/IORTable/server.rb +130 -0
- data/test/Implicit_Conversion/Test.idl +31 -0
- data/test/Implicit_Conversion/client.rb +110 -0
- data/test/Implicit_Conversion/run_test.rb +69 -0
- data/test/Implicit_Conversion/server.ior +1 -0
- data/test/Implicit_Conversion/server.rb +99 -0
- data/test/Multi_Threading/Multiple_ORB/Test.idl +27 -0
- data/test/Multi_Threading/Multiple_ORB/client.rb +82 -0
- data/test/Multi_Threading/Multiple_ORB/run_test.rb +71 -0
- data/test/Multi_Threading/Multiple_ORB/server.rb +108 -0
- data/test/Multi_Threading/Multiple_ORB/server0.ior +1 -0
- data/test/Multi_Threading/Multiple_ORB/server1.ior +1 -0
- data/test/Multi_Threading/Simple/Test.idl +27 -0
- data/test/Multi_Threading/Simple/client.rb +88 -0
- data/test/Multi_Threading/Simple/run_test.rb +69 -0
- data/test/Multi_Threading/Simple/server.ior +1 -0
- data/test/Multi_Threading/Simple/server.rb +118 -0
- data/test/Multi_Threading/Threads/Test.idl +31 -0
- data/test/Multi_Threading/Threads/client.rb +80 -0
- data/test/Multi_Threading/Threads/run_test.rb +76 -0
- data/test/Multi_Threading/Threads/server.ior +1 -0
- data/test/Multi_Threading/Threads/server.rb +119 -0
- data/test/Multi_Threading/Threads/watchdog.ior +1 -0
- data/test/Multi_Threading/Threads/watchdog.rb +87 -0
- data/test/Multiple_Servant_Interfaces/Test.idl +34 -0
- data/test/Multiple_Servant_Interfaces/client.rb +70 -0
- data/test/Multiple_Servant_Interfaces/run_test.rb +69 -0
- data/test/Multiple_Servant_Interfaces/server.ior +1 -0
- data/test/Multiple_Servant_Interfaces/server.rb +102 -0
- data/test/Nil/Test.idl +27 -0
- data/test/Nil/run_test.rb +52 -0
- data/test/Nil/test.rb +78 -0
- data/test/OBV/AbstractInterface/client.rb +179 -0
- data/test/OBV/AbstractInterface/run_test.rb +69 -0
- data/test/OBV/AbstractInterface/server.ior +1 -0
- data/test/OBV/AbstractInterface/server.rb +149 -0
- data/test/OBV/AbstractInterface/test.idl +53 -0
- data/test/OBV/Custom/OBV.idl +18 -0
- data/test/OBV/Custom/OBV_impl.rb +40 -0
- data/test/OBV/Custom/client.rb +86 -0
- data/test/OBV/Custom/run_test.rb +69 -0
- data/test/OBV/Custom/server.ior +1 -0
- data/test/OBV/Custom/server.rb +100 -0
- data/test/OBV/Simple/OBV.idl +15 -0
- data/test/OBV/Simple/OBV_impl.rb +26 -0
- data/test/OBV/Simple/client.rb +86 -0
- data/test/OBV/Simple/run_test.rb +69 -0
- data/test/OBV/Simple/server.ior +1 -0
- data/test/OBV/Simple/server.rb +100 -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 +86 -0
- data/test/OBV/Simple_Event/run_test.rb +69 -0
- data/test/OBV/Simple_Event/server.ior +1 -0
- data/test/OBV/Simple_Event/server.rb +100 -0
- data/test/OBV/Supports/client.rb +116 -0
- data/test/OBV/Supports/run_test.rb +69 -0
- data/test/OBV/Supports/server.ior +1 -0
- data/test/OBV/Supports/server.rb +103 -0
- data/test/OBV/Supports/supports.idl +33 -0
- data/test/OBV/Supports/supports_impl.rb +57 -0
- data/test/OBV/Tree/client.rb +116 -0
- data/test/OBV/Tree/run_test.rb +69 -0
- data/test/OBV/Tree/server.ior +1 -0
- data/test/OBV/Tree/server.rb +117 -0
- data/test/OBV/Tree/test.idl +32 -0
- data/test/OBV/Truncatable/Extra.idl +27 -0
- data/test/OBV/Truncatable/Truncatable.idl +105 -0
- data/test/OBV/Truncatable/Truncatable_impl.rb +86 -0
- data/test/OBV/Truncatable/client.rb +279 -0
- data/test/OBV/Truncatable/run_test.rb +69 -0
- data/test/OBV/Truncatable/server.ior +1 -0
- data/test/OBV/Truncatable/server.rb +89 -0
- data/test/OBV/ValueBox/client.rb +497 -0
- data/test/OBV/ValueBox/run_test.rb +69 -0
- data/test/OBV/ValueBox/server.ior +1 -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 +27 -0
- data/test/Object/client.rb +103 -0
- data/test/Object/run_test.rb +69 -0
- data/test/Object/server.ior +1 -0
- data/test/Object/server.rb +126 -0
- data/test/POA/Test.idl +27 -0
- data/test/POA/run_test.rb +52 -0
- data/test/POA/test.rb +112 -0
- data/test/Param_Test/Test.idl +182 -0
- data/test/Param_Test/client.rb +277 -0
- data/test/Param_Test/run_test.rb +69 -0
- data/test/Param_Test/server.ior +1 -0
- data/test/Param_Test/server.rb +296 -0
- data/test/Performance/Simple/Test.idl +27 -0
- data/test/Performance/Simple/client.rb +90 -0
- data/test/Performance/Simple/run_test.rb +69 -0
- data/test/Performance/Simple/server.ior +1 -0
- data/test/Performance/Simple/server.rb +95 -0
- data/test/Policies/Test.idl +27 -0
- data/test/Policies/run_test.rb +52 -0
- data/test/Policies/test.rb +144 -0
- data/test/Timeout/client.rb +207 -0
- data/test/Timeout/run_test.rb +69 -0
- data/test/Timeout/server.ior +1 -0
- data/test/Timeout/server.rb +109 -0
- data/test/Timeout/test.idl +19 -0
- data/test/lib/assert.rb +43 -0
- data/test/lib/test.rb +542 -0
- data/test/test_runner.rb +193 -0
- metadata +342 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# require.rb - R2CORBA 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
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
|
+
#--------------------------------------------------------------------
|
13
|
+
require 'rbconfig'
|
14
|
+
require 'java'
|
15
|
+
|
16
|
+
module R2CORBA
|
17
|
+
if ENV['JACORB_HOME'] && File.exists?(File.join(ENV['JACORB_HOME'], 'lib', 'jacorb.jar'))
|
18
|
+
JACORB_HOME = ENV['JACORB_HOME']
|
19
|
+
else
|
20
|
+
# find jacorb.jar in library search path
|
21
|
+
JACORB_HOME = File.dirname(($:.find { |path| File.exists?(File.join(path, 'jacorb.jar')) }).to_s)
|
22
|
+
end
|
23
|
+
|
24
|
+
$LOAD_PATH << File.join(JACORB_HOME, 'lib')
|
25
|
+
module JavaLang
|
26
|
+
include_package 'java.lang'
|
27
|
+
prop = System.getProperties['java.endorsed.dirs']
|
28
|
+
System.setProperty('java.endorsed.dirs', "#{File.join(R2CORBA::JACORB_HOME, 'lib')}:#{prop}")
|
29
|
+
System.setProperty('jacorb.home', "#{R2CORBA::JACORB_HOME}")
|
30
|
+
System.setProperty('org.omg.CORBA.ORBClass', 'org.jacorb.orb.ORB')
|
31
|
+
System.setProperty('org.omg.CORBA.ORBSingletonClass', 'org.jacorb.orb.ORBSingleton')
|
32
|
+
System.setProperty('jacorb.orb.print_version', $VERBOSE ? 'on' : 'off')
|
33
|
+
System.setProperty('jacorb.log.default.verbosity', $VERBOSE ? '3' : '1')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# add required JAR files for JacORB from searchpath
|
38
|
+
Dir.glob(File.join(R2CORBA::JACORB_HOME, 'lib', '*.jar')).each do |jar|
|
39
|
+
require File.basename(jar)
|
40
|
+
end
|
41
|
+
|
42
|
+
module R2CORBA
|
43
|
+
module CORBA
|
44
|
+
module Native
|
45
|
+
# first include CORBA::Object separately to avoid 'Object' replacement warnings
|
46
|
+
java_import 'org.omg.CORBA.Object'
|
47
|
+
include_package 'org.omg.CORBA'
|
48
|
+
module Portable
|
49
|
+
include_package 'org.omg.CORBA.portable'
|
50
|
+
end
|
51
|
+
module V2_3
|
52
|
+
include_package 'org.omg.CORBA_2_3'
|
53
|
+
module Portable
|
54
|
+
include_package 'org.omg.CORBA.portable'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
module V2_5
|
58
|
+
include_package 'org.omg.CORBA_2_5'
|
59
|
+
end
|
60
|
+
module V3_0
|
61
|
+
include_package 'org.omg.CORBA_3_0'
|
62
|
+
end
|
63
|
+
module Jacorb
|
64
|
+
module Util
|
65
|
+
java_import org.jacorb.util.Version
|
66
|
+
end
|
67
|
+
VERSION = Util::Version.version
|
68
|
+
va = VERSION.split('.')
|
69
|
+
MAJOR_VERSION = va.shift.to_i
|
70
|
+
MINOR_VERSION = va.shift.to_i
|
71
|
+
RELEASE_NR = va.shift.to_i
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
[ 'exception',
|
78
|
+
'Object',
|
79
|
+
'ORB',
|
80
|
+
'Request',
|
81
|
+
'Stub',
|
82
|
+
'Typecode',
|
83
|
+
'Any',
|
84
|
+
'Values',
|
85
|
+
'Streams'
|
86
|
+
].each { |f| require "corba/jbase/#{f}.rb" }
|
data/lib/corba/naming.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# naming.rb - R2CORBA CosNaming client definitions 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
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
|
+
#--------------------------------------------------------------------
|
13
|
+
|
14
|
+
require 'corba/idl/CosNamingC'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# naming_service.rb - R2CORBA CosNaming server definitions 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
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
|
+
#--------------------------------------------------------------------
|
13
|
+
|
14
|
+
require 'corba/naming.rb'
|
15
|
+
require 'corba/idl/CosNamingS'
|
data/lib/corba/poa.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# poa.rb - 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
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
|
+
#--------------------------------------------------------------------
|
13
|
+
|
14
|
+
require 'corba.rb'
|
15
|
+
require "corba/#{defined?(JRUBY_VERSION)?'jbase':'cbase'}/poa.rb"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# policies.rb - R2CORBA Policy support 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
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
|
+
#--------------------------------------------------------------------
|
13
|
+
|
14
|
+
require 'corba.rb'
|
15
|
+
require 'corba/poa.rb'
|
16
|
+
require 'corba/idl/BiDirPolicyC'
|
17
|
+
require 'corba/idl/MessagingC'
|
18
|
+
require "corba/#{defined?(JRUBY_VERSION)?'jbase':'cbase'}/policies.rb"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# require.rb - R2CORBA 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
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
|
+
#--------------------------------------------------------------------
|
13
|
+
|
14
|
+
require 'corba/common/require'
|
15
|
+
require "corba/#{defined?(JRUBY_VERSION)?'jbase':'cbase'}/require"
|
16
|
+
require 'corba/idl/require'
|
17
|
+
require "corba/#{defined?(JRUBY_VERSION)?'jbase':'cbase'}/post_require"
|
@@ -0,0 +1,426 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# cos_naming.rb - Implementation of CosNaming servants
|
3
|
+
# for full featured naming service
|
4
|
+
#
|
5
|
+
# Author: Martin Corino
|
6
|
+
#
|
7
|
+
# $Id: $
|
8
|
+
#
|
9
|
+
# This program is free software; you can redistribute it and/or
|
10
|
+
# modify it under the terms of the R2CORBA LICENSE which is
|
11
|
+
# included with this program.
|
12
|
+
#
|
13
|
+
# Copyright (c) Remedy IT Expertise BV
|
14
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
15
|
+
#--------------------------------------------------------------------
|
16
|
+
|
17
|
+
require 'corba/naming_service'
|
18
|
+
if (defined?(JRUBY_VERSION) or R2CORBA::TAO::RUBY_THREAD_SUPPORT)
|
19
|
+
require 'monitor'
|
20
|
+
end
|
21
|
+
|
22
|
+
module CosNaming
|
23
|
+
# add some useful methods to CosNaming::NameComponent
|
24
|
+
class NameComponent
|
25
|
+
# create key value for registering in context map
|
26
|
+
def to_key
|
27
|
+
"#{self.r_id}|#{self.kind}"
|
28
|
+
end
|
29
|
+
# convert NameComponent to stringified format according to spec
|
30
|
+
def to_string
|
31
|
+
s = ''
|
32
|
+
s = self.r_id.gsub(/([\/\.\\])/,'\\\1') unless self.r_id.to_s.empty?
|
33
|
+
s << '.' if s.empty? or !self.kind.to_s.empty?
|
34
|
+
s << self.kind.gsub(/([\/\.\\])/,'\\\1') unless self.kind.to_s.empty?
|
35
|
+
s
|
36
|
+
end
|
37
|
+
# convert stringified name back to NameComponent
|
38
|
+
def self.from_string(snc)
|
39
|
+
raise CosNaming::NamingContext::InvalidName.new if snc.empty?
|
40
|
+
esc_ = false
|
41
|
+
id_ = ''
|
42
|
+
off_ = 0
|
43
|
+
snc.size.times do |i|
|
44
|
+
case snc[i, 1]
|
45
|
+
when '\\'
|
46
|
+
esc_ = !esc_
|
47
|
+
when '.'
|
48
|
+
unless esc_
|
49
|
+
raise CosNaming::NamingContext::InvalidName.new if off_>0
|
50
|
+
id_ = snc[0, i].gsub(/\\(\.|\\)/, '\1')
|
51
|
+
off_ = i+1
|
52
|
+
end
|
53
|
+
esc_ = false
|
54
|
+
else
|
55
|
+
esc_ = false
|
56
|
+
end
|
57
|
+
end
|
58
|
+
kind_ = snc[off_, snc.size].gsub(/\\(\.|\\)/, '\1')
|
59
|
+
self.new(id_, kind_)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
module R2CORBA
|
65
|
+
module INS
|
66
|
+
|
67
|
+
##
|
68
|
+
# Binding iterator servant class
|
69
|
+
#
|
70
|
+
class BindingIterator < POA::CosNaming::BindingIterator
|
71
|
+
def initialize(reglist, iterator_id)
|
72
|
+
@rl = reglist
|
73
|
+
@id = iterator_id
|
74
|
+
end
|
75
|
+
|
76
|
+
attr_accessor :oid
|
77
|
+
|
78
|
+
def next_one
|
79
|
+
reg = @rl.shift
|
80
|
+
[!reg.nil?, reg ? CosNaming::Binding.new(reg[:name], reg[:type]) : nil]
|
81
|
+
end
|
82
|
+
|
83
|
+
def next_n(how_many)
|
84
|
+
raise CORBA::BAD_PARAM.new if how_many < 1
|
85
|
+
bindings = []
|
86
|
+
while how_many>0 and !@rl.empty?
|
87
|
+
reg = @rl.shift
|
88
|
+
bindings << CosNaming::Binding.new(reg[:name], reg[:type])
|
89
|
+
how_many -= 1
|
90
|
+
end
|
91
|
+
[!bindings.empty?, bindings]
|
92
|
+
end
|
93
|
+
|
94
|
+
def destroy
|
95
|
+
poa = self._default_POA
|
96
|
+
poa.deactivate_object(self.oid)
|
97
|
+
@rl.clear
|
98
|
+
INS::NamingContext.clear_iterator(@id)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Naming context servant class
|
104
|
+
#
|
105
|
+
class NamingContext < POA::CosNaming::NamingContextExt
|
106
|
+
|
107
|
+
# Map type to store bindings.
|
108
|
+
# Use synchronized version for multithreading capable implementations.
|
109
|
+
#
|
110
|
+
if (defined?(JRUBY_VERSION) or R2CORBA::TAO::RUBY_THREAD_SUPPORT)
|
111
|
+
MAP_TYPE = Class.new(Monitor) do
|
112
|
+
def initialize
|
113
|
+
super
|
114
|
+
@map_ = {}
|
115
|
+
end
|
116
|
+
def size()
|
117
|
+
rc = 0
|
118
|
+
synchronize do
|
119
|
+
rc = @map_.size
|
120
|
+
end
|
121
|
+
return rc
|
122
|
+
end
|
123
|
+
def has_key?(key)
|
124
|
+
rc = false
|
125
|
+
synchronize do
|
126
|
+
rc = @map_.has_key?(key)
|
127
|
+
end
|
128
|
+
return rc
|
129
|
+
end
|
130
|
+
def [](key)
|
131
|
+
rc = nil
|
132
|
+
synchronize do
|
133
|
+
rc = @map_[key]
|
134
|
+
end
|
135
|
+
return rc
|
136
|
+
end
|
137
|
+
def []=(key, value)
|
138
|
+
synchronize do
|
139
|
+
@map_[key] = value
|
140
|
+
end
|
141
|
+
value
|
142
|
+
end
|
143
|
+
def delete(key)
|
144
|
+
rc = nil
|
145
|
+
synchronize do
|
146
|
+
rc = @map_.delete(key)
|
147
|
+
end
|
148
|
+
return rc
|
149
|
+
end
|
150
|
+
def values
|
151
|
+
rc = nil
|
152
|
+
synchronize do
|
153
|
+
rc = @map_.values
|
154
|
+
end
|
155
|
+
return rc
|
156
|
+
end
|
157
|
+
def each(&block)
|
158
|
+
synchronize do
|
159
|
+
@map_.each &block
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
else
|
164
|
+
MAP_TYPE = Class.new(::Hash) do
|
165
|
+
def synchronize(&block)
|
166
|
+
yield
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
@@iterators = MAP_TYPE.new
|
172
|
+
@@iterator_max = 100
|
173
|
+
|
174
|
+
def self.set_iterator_max(max)
|
175
|
+
@@iterator_max = max.to_i
|
176
|
+
end
|
177
|
+
|
178
|
+
def self.clear_iterator(id)
|
179
|
+
@@iterators.delete(id)
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.alloc_iterator(reglist)
|
183
|
+
@@iterators.synchronize do
|
184
|
+
unless @@iterators.size < @@iterator_max
|
185
|
+
oldest_id, oldest_it = @iterators.min
|
186
|
+
oldest_it.destroy
|
187
|
+
end
|
188
|
+
itid = Time.now
|
189
|
+
return (@@iterators[itid] = INS::BindingIterator.new(reglist, itid))
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def initialize(orb)
|
194
|
+
@orb = orb
|
195
|
+
@map = MAP_TYPE.new
|
196
|
+
end
|
197
|
+
|
198
|
+
attr_accessor :oid
|
199
|
+
|
200
|
+
# CosNaming::NamingContext methods
|
201
|
+
#
|
202
|
+
def bind(n, obj)
|
203
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
204
|
+
if n.size>1
|
205
|
+
nc = find_context(n)
|
206
|
+
nc.bind(n, obj)
|
207
|
+
else
|
208
|
+
register_object(n.first, n, CosNaming::Nobject, obj)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def rebind(n, obj)
|
213
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
214
|
+
if n.size>1
|
215
|
+
nc = find_context(n)
|
216
|
+
nc.rebind(n, obj)
|
217
|
+
else
|
218
|
+
reregister_object(n.first, n, CosNaming::Nobject, obj)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def bind_context(n, nc_new)
|
223
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
224
|
+
if n.size>1
|
225
|
+
nc = find_context(n)
|
226
|
+
nc.bind_context(n, nc_new)
|
227
|
+
else
|
228
|
+
register_object(n.first, n, CosNaming::Ncontext, nc_new)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def rebind_context(n, nc_new)
|
233
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
234
|
+
if n.size>1
|
235
|
+
nc = find_context(n)
|
236
|
+
nc.rebind_context(n, nc_new)
|
237
|
+
else
|
238
|
+
reregister_object(n.first, n, CosNaming::Ncontext, nc_new)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def resolve(n)
|
243
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
244
|
+
find_object(n)
|
245
|
+
end
|
246
|
+
|
247
|
+
def unbind(n)
|
248
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
249
|
+
if n.size>1
|
250
|
+
nc = find_context(n)
|
251
|
+
nc.unbind(n)
|
252
|
+
else
|
253
|
+
@map.synchronize do
|
254
|
+
raise CosNaming::NamingContext::NotFound.new(CosNaming::NamingContext::Missing_node,
|
255
|
+
n) if !@map.has_key?(n.first.r_id)
|
256
|
+
@map.delete(n.last.r_id)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
def new_context()
|
262
|
+
poa = self._default_POA
|
263
|
+
naming_srv = NamingContext.new(@orb)
|
264
|
+
naming_srv.oid = poa.activate_object(naming_srv)
|
265
|
+
::CosNaming::NamingContextExt::_narrow(poa.id_to_reference(naming_srv.oid))
|
266
|
+
end
|
267
|
+
|
268
|
+
def bind_new_context(n)
|
269
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
270
|
+
nc = self.new_context()
|
271
|
+
self.bind_context(n, nc)
|
272
|
+
nc
|
273
|
+
end
|
274
|
+
|
275
|
+
def destroy()
|
276
|
+
raise CosNaming::NamingContext::NotEmpty.new if @map.size>0
|
277
|
+
return if self.oid.nil? ## no oid for root context
|
278
|
+
poa = self._default_POA
|
279
|
+
poa.deactivate_object(self.oid)
|
280
|
+
@orb = nil
|
281
|
+
end
|
282
|
+
|
283
|
+
def list(how_many)
|
284
|
+
reglist = @map.values
|
285
|
+
bindings = []
|
286
|
+
while how_many>0 and !reglist.empty?
|
287
|
+
reg = reglist.shift
|
288
|
+
bindings << CosNaming::Binding.new(reg[:name], reg[:type])
|
289
|
+
how_many -= 1
|
290
|
+
end
|
291
|
+
bi_obj = nil
|
292
|
+
if !reglist.empty?
|
293
|
+
bi = INS::NamingContext.alloc_iterator(reglist)
|
294
|
+
poa = self._default_POA
|
295
|
+
bi.oid = poa.activate_object(bi)
|
296
|
+
bi_obj = poa.id_to_reference(bi.oid)
|
297
|
+
end
|
298
|
+
[bindings, CosNaming::BindingIterator._narrow(bi_obj)]
|
299
|
+
end
|
300
|
+
|
301
|
+
# CosNaming::NamingContextExt methods
|
302
|
+
#
|
303
|
+
def to_string(n)
|
304
|
+
raise CosNaming::NamingContext::InvalidName.new if n.size<1
|
305
|
+
n.collect { |nc| nc.to_string }.join('/')
|
306
|
+
end
|
307
|
+
|
308
|
+
def to_name(sn)
|
309
|
+
raise CosNaming::NamingContext::InvalidName.new if sn.to_s.empty?
|
310
|
+
snc_arr = []
|
311
|
+
off_ = 0
|
312
|
+
esc_ = false
|
313
|
+
sn.size.times do |i|
|
314
|
+
case sn[i,1]
|
315
|
+
when '\\'
|
316
|
+
esc_ = !esc_
|
317
|
+
when '/'
|
318
|
+
unless esc_
|
319
|
+
snc_arr << sn[off_, i-off_]
|
320
|
+
off_ = i+1
|
321
|
+
end
|
322
|
+
esc_ = false
|
323
|
+
else
|
324
|
+
esc_ = false
|
325
|
+
end
|
326
|
+
end
|
327
|
+
snc_arr << sn[off_, sn.size]
|
328
|
+
[snc_arr.collect { |snc| CosNaming::NameComponent.from_string(snc) }]
|
329
|
+
end
|
330
|
+
|
331
|
+
def to_url(addr, sn)
|
332
|
+
raise CosNaming::NamingContext::InvalidName.new if addr.to_s.empty? or sn.to_s.empty?
|
333
|
+
url = 'corbaname:'+addr+'#'
|
334
|
+
sn.scan(/./) do |ch|
|
335
|
+
if /[a-zA-Z0-9;\/:\?@=+\$,\-_\.!~*\'\(\)]/ =~ ch
|
336
|
+
url << ch
|
337
|
+
else
|
338
|
+
url << '%' << ch.unpack('H2').first
|
339
|
+
end
|
340
|
+
end
|
341
|
+
url
|
342
|
+
end
|
343
|
+
|
344
|
+
def resolve_str(sn)
|
345
|
+
self.resolve(self.to_name(sn).first)
|
346
|
+
end
|
347
|
+
|
348
|
+
# Helper methods
|
349
|
+
#
|
350
|
+
protected
|
351
|
+
|
352
|
+
# register the object reference for a certain NameComponent id
|
353
|
+
# no reregistering or duplicates allowed
|
354
|
+
#
|
355
|
+
def register_object(name, full_name, type, obj)
|
356
|
+
key_ = name.to_key
|
357
|
+
@map.synchronize do
|
358
|
+
raise CosNaming::NamingContext::AlreadyBound.new if @map.has_key?(key_)
|
359
|
+
@map[key_] = {
|
360
|
+
:name => full_name,
|
361
|
+
:type => type,
|
362
|
+
:object => obj
|
363
|
+
}
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# reregister the object reference for a certain NameComponent id
|
368
|
+
#
|
369
|
+
def reregister_object(name, full_name, type, obj)
|
370
|
+
key_ = name.to_key
|
371
|
+
@map.synchronize do
|
372
|
+
if @map.has_key?(key_) and @map[key_][:type] != type
|
373
|
+
why = (type == CosNaming::Nobject ? CosNaming::NamingContext::Not_object : CosNaming::NamingContext::Not_context)
|
374
|
+
raise CosNaming::NamingContext::NotFound.new(why, [])
|
375
|
+
end
|
376
|
+
@map[key_] = {
|
377
|
+
:name => full_name,
|
378
|
+
:type => type,
|
379
|
+
:object => obj
|
380
|
+
}
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
# walk all segments of the given CosNaming::Name to find the object
|
385
|
+
# bound by this full name
|
386
|
+
# NOTE that #find_context is used when the Name contains > 1 level
|
387
|
+
# which will automatically shift the segments of Name 1 level while
|
388
|
+
# resolving the context levels
|
389
|
+
#
|
390
|
+
def find_object(n)
|
391
|
+
if n.size>1
|
392
|
+
nc = find_context(n)
|
393
|
+
nc.resolve(n)
|
394
|
+
else
|
395
|
+
key_ = n.first.to_key
|
396
|
+
@map.synchronize do
|
397
|
+
raise CosNaming::NamingContext::NotFound.new(CosNaming::NamingContext::Missing_node,
|
398
|
+
n) if !@map.has_key?(key_)
|
399
|
+
@map[key_][:object]
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
# check if there exists a naming context in the current context
|
405
|
+
# with the id from the first segment of the given CosNaming::Name
|
406
|
+
# return the object reference to the naming context if found
|
407
|
+
# NOTE that #shift is used to get AND remove the first Name segment
|
408
|
+
# if the naming context is found so that after this call the
|
409
|
+
# first segment of the Name is shifted one level
|
410
|
+
#
|
411
|
+
def find_context(n)
|
412
|
+
key_ = n.first.to_key
|
413
|
+
@map.synchronize do
|
414
|
+
raise CosNaming::NamingContext::NotFound.new(CosNaming::NamingContext::Missing_node,
|
415
|
+
n) if !@map.has_key?(key_)
|
416
|
+
raise CosNaming::NamingContext::NotFound.new(CosNaming::NamingContext::Not_context,
|
417
|
+
n) if @map[key_][:type] != CosNaming::Ncontext
|
418
|
+
n.shift
|
419
|
+
@map[key_][:object]
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
end #of NamingContext servant
|
424
|
+
|
425
|
+
end
|
426
|
+
end
|