r2corba 1.4.1
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/ridlc +11 -0
- data/bin/rins +7 -0
- data/ext/ext.mwc +6 -0
- data/ext/extload/extload.c +60 -0
- data/ext/libr2tao/any.cpp +1543 -0
- data/ext/libr2tao/exception.cpp +202 -0
- data/ext/libr2tao/exception.h +104 -0
- data/ext/libr2tao/longdouble.cpp +173 -0
- data/ext/libr2tao/longdouble.h +31 -0
- data/ext/libr2tao/object.cpp +1150 -0
- data/ext/libr2tao/object.h +38 -0
- data/ext/libr2tao/orb.cpp +1029 -0
- data/ext/libr2tao/orb.h +36 -0
- data/ext/libr2tao/r2tao_export.h +45 -0
- data/ext/libr2tao/r2tao_ext.h +38 -0
- data/ext/libr2tao/required.cpp +463 -0
- data/ext/libr2tao/required.h +187 -0
- data/ext/libr2tao/typecode.cpp +888 -0
- data/ext/libr2tao/typecode.h +45 -0
- data/ext/libr2tao/values.cpp +2938 -0
- data/ext/libr2tao/values.h +396 -0
- data/ext/librpoa/iortable.cpp +250 -0
- data/ext/librpoa/poa.cpp +1076 -0
- data/ext/librpoa/poa.h +24 -0
- data/ext/librpoa/rpoa_export.h +44 -0
- data/ext/librpoa/servant.cpp +1338 -0
- data/ext/librpoa/servant.h +116 -0
- data/ext/librpoa/srvreq_fix.cpp +283 -0
- data/ext/librpoa/srvreq_fix.h +149 -0
- data/ext/librpol/policies.cpp +763 -0
- data/ext/librpol/policies.h +15 -0
- data/ext/librpol/rpol_export.h +44 -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/IDL.rb +21 -0
- data/lib/corba/idl/IORTable.pidl +62 -0
- data/lib/corba/idl/TAO_Ext.pidl +46 -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/require.rb +16 -0
- data/lib/ridlbe/ruby/walker.rb +1582 -0
- data/mkrf_conf_srcgem.rb +186 -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.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/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/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/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.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.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.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.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.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.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.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/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.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.rb +119 -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.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.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.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.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.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.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.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.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.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.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.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.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.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 +334 -0
@@ -0,0 +1,116 @@
|
|
1
|
+
/*--------------------------------------------------------------------
|
2
|
+
# servant.h - R2TAO CORBA Servant 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
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
|
+
#------------------------------------------------------------------*/
|
13
|
+
|
14
|
+
#if ((TAO_MAJOR_VERSION < 2) || (TAO_MAJOR_VERSION == 2 && TAO_MINOR_VERSION == 0 && TAO_BETA_VERSION <= 1))
|
15
|
+
# define RPOA_NEED_DSI_FIX 1
|
16
|
+
|
17
|
+
# include "srvreq_fix.h"
|
18
|
+
|
19
|
+
# define R2CORBA_ServerRequest R2CORBA::ServerRequest
|
20
|
+
# define R2CORBA_ServerRequest_ptr R2CORBA::ServerRequest_ptr
|
21
|
+
#else
|
22
|
+
# define R2CORBA_ServerRequest CORBA::ServerRequest
|
23
|
+
# define R2CORBA_ServerRequest_ptr CORBA::ServerRequest_ptr
|
24
|
+
#endif
|
25
|
+
|
26
|
+
//-------------------------------------------------------------------
|
27
|
+
// R2TAO Servant class
|
28
|
+
//
|
29
|
+
//===================================================================
|
30
|
+
|
31
|
+
class DSI_Servant : public PortableServer::DynamicImplementation
|
32
|
+
{
|
33
|
+
public:
|
34
|
+
DSI_Servant (VALUE rbServant);
|
35
|
+
// ctor
|
36
|
+
virtual ~DSI_Servant ();
|
37
|
+
// dtor
|
38
|
+
|
39
|
+
virtual void invoke (CORBA::ServerRequest_ptr request);
|
40
|
+
//ACE_THROW_SPEC ((CORBA::SystemException));
|
41
|
+
#if RPOA_NEED_DSI_FIX
|
42
|
+
void invoke_fix (R2CORBA::ServerRequest_ptr request);
|
43
|
+
#endif
|
44
|
+
|
45
|
+
virtual CORBA::RepositoryId _primary_interface (
|
46
|
+
const PortableServer::ObjectId &oid,
|
47
|
+
PortableServer::POA_ptr poa);
|
48
|
+
|
49
|
+
virtual CORBA::Boolean _is_a (const char *logical_type_id);
|
50
|
+
|
51
|
+
virtual CORBA::Boolean _non_existent (void);
|
52
|
+
|
53
|
+
//virtual CORBA::InterfaceDef_ptr _get_interface (void);
|
54
|
+
|
55
|
+
virtual CORBA::Object_ptr _get_component (void);
|
56
|
+
|
57
|
+
virtual char * _repository_id (void);
|
58
|
+
|
59
|
+
enum METHOD {
|
60
|
+
NONE,
|
61
|
+
IS_A,
|
62
|
+
NON_EXISTENT,
|
63
|
+
GET_INTERFACE,
|
64
|
+
GET_COMPONENT,
|
65
|
+
REPOSITORY_ID
|
66
|
+
};
|
67
|
+
|
68
|
+
VALUE rbServant () {
|
69
|
+
return this->rbServant_;
|
70
|
+
}
|
71
|
+
|
72
|
+
void free_servant ();
|
73
|
+
|
74
|
+
void activate_servant ();
|
75
|
+
|
76
|
+
protected:
|
77
|
+
virtual const char *_interface_repository_id (void) const;
|
78
|
+
|
79
|
+
#if RPOA_NEED_DSI_FIX
|
80
|
+
/// Turns around and calls invoke.
|
81
|
+
virtual void _dispatch (TAO_ServerRequest &request, void *context);
|
82
|
+
#endif
|
83
|
+
|
84
|
+
void register_with_servant ();
|
85
|
+
|
86
|
+
void cleanup_servant ();
|
87
|
+
void inner_cleanup_servant ();
|
88
|
+
|
89
|
+
METHOD method_id (const char* method);
|
90
|
+
|
91
|
+
virtual void inner_invoke (R2CORBA_ServerRequest_ptr request);
|
92
|
+
|
93
|
+
void invoke_SI (R2CORBA_ServerRequest_ptr request);
|
94
|
+
void invoke_DSI (R2CORBA_ServerRequest_ptr request);
|
95
|
+
|
96
|
+
static VALUE _invoke_implementation(VALUE args);
|
97
|
+
|
98
|
+
private:
|
99
|
+
VALUE rbServant_;
|
100
|
+
// The Ruby Servant
|
101
|
+
|
102
|
+
CORBA::String_var repo_id_;
|
103
|
+
|
104
|
+
struct ThreadSafeArg
|
105
|
+
{
|
106
|
+
ThreadSafeArg (DSI_Servant* srv,
|
107
|
+
R2CORBA_ServerRequest_ptr req)
|
108
|
+
: servant_(srv), request_(req) {}
|
109
|
+
DSI_Servant* servant_;
|
110
|
+
R2CORBA_ServerRequest_ptr request_;
|
111
|
+
};
|
112
|
+
|
113
|
+
static void* thread_safe_invoke (void * arg);
|
114
|
+
static void* thread_safe_cleanup (void* arg);
|
115
|
+
};
|
116
|
+
|
@@ -0,0 +1,283 @@
|
|
1
|
+
/*--------------------------------------------------------------------
|
2
|
+
# srvreq_fix.h - R2TAO CORBA Servant 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
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
|
+
#------------------------------------------------------------------*/
|
13
|
+
|
14
|
+
#ifndef __SRVREQ_FIX_CPP__
|
15
|
+
#define __SRVREQ_FIX_CPP__
|
16
|
+
|
17
|
+
#include "tao/DynamicInterface/DII_Arguments.h"
|
18
|
+
#include "tao/DynamicInterface/Unknown_User_Exception.h"
|
19
|
+
#include "tao/PortableServer/Collocated_Arguments_Converter.h"
|
20
|
+
#include "tao/AnyTypeCode/NVList.h"
|
21
|
+
#include "tao/GIOP_Utils.h"
|
22
|
+
#include "tao/AnyTypeCode/Marshal.h"
|
23
|
+
#include "tao/AnyTypeCode/TypeCode.h"
|
24
|
+
#include "tao/AnyTypeCode/Any_Impl.h"
|
25
|
+
#include "tao/operation_details.h"
|
26
|
+
#include "tao/SystemException.h"
|
27
|
+
|
28
|
+
// Reference counting for DSI ServerRequest object.
|
29
|
+
|
30
|
+
CORBA::ULong
|
31
|
+
R2CORBA::ServerRequest::_incr_refcount (void)
|
32
|
+
{
|
33
|
+
return ++this->refcount_;
|
34
|
+
}
|
35
|
+
|
36
|
+
CORBA::ULong
|
37
|
+
R2CORBA::ServerRequest::_decr_refcount (void)
|
38
|
+
{
|
39
|
+
CORBA::ULong const new_count = --this->refcount_;
|
40
|
+
|
41
|
+
if (new_count == 0)
|
42
|
+
delete this;
|
43
|
+
|
44
|
+
return new_count;
|
45
|
+
}
|
46
|
+
|
47
|
+
R2CORBA::ServerRequest::ServerRequest (TAO_ServerRequest &orb_server_request)
|
48
|
+
: lazy_evaluation_ (0),
|
49
|
+
ctx_ (CORBA::Context::_nil ()),
|
50
|
+
params_ (CORBA::NVList::_nil ()),
|
51
|
+
retval_ (0),
|
52
|
+
exception_ (0),
|
53
|
+
refcount_ (1),
|
54
|
+
orb_server_request_ (orb_server_request),
|
55
|
+
sent_gateway_exception_ (false)
|
56
|
+
{
|
57
|
+
this->orb_server_request_.is_dsi ();
|
58
|
+
}
|
59
|
+
|
60
|
+
R2CORBA::ServerRequest::~ServerRequest (void)
|
61
|
+
{
|
62
|
+
if (this->params_ != 0)
|
63
|
+
{
|
64
|
+
::CORBA::release (this->params_);
|
65
|
+
}
|
66
|
+
|
67
|
+
delete this->retval_;
|
68
|
+
delete this->exception_;
|
69
|
+
}
|
70
|
+
|
71
|
+
// Unmarshal in/inout params, and set up to marshal the appropriate
|
72
|
+
// inout/out/return values later on.
|
73
|
+
void
|
74
|
+
R2CORBA::ServerRequest::arguments (CORBA::NVList_ptr &list)
|
75
|
+
{
|
76
|
+
// arguments() must be called before either of these.
|
77
|
+
if (this->params_ != 0 || this->exception_ != 0)
|
78
|
+
{
|
79
|
+
throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 7, CORBA::COMPLETED_NO);
|
80
|
+
}
|
81
|
+
|
82
|
+
// In a collocated situation there will not be an incoming CDR stream
|
83
|
+
// in which case we can get the arguments from the
|
84
|
+
// operation_details using the 'collocated argument converter'.
|
85
|
+
if (this->orb_server_request_.collocated ())
|
86
|
+
{
|
87
|
+
this->params_ = list;
|
88
|
+
|
89
|
+
if (this->orb_server_request_.operation_details ()->cac () != 0)
|
90
|
+
{
|
91
|
+
TAO_OutputCDR output;
|
92
|
+
this->orb_server_request_.operation_details ()->cac (
|
93
|
+
)->dsi_convert_request (this->orb_server_request_,
|
94
|
+
output);
|
95
|
+
|
96
|
+
TAO_InputCDR input(output);
|
97
|
+
this->params_->_tao_decode (input, CORBA::ARG_IN | CORBA::ARG_INOUT);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
else
|
101
|
+
{
|
102
|
+
// Save params for later use when marshaling the reply.
|
103
|
+
this->params_ = list;
|
104
|
+
|
105
|
+
// sometimes there is no incoming stream
|
106
|
+
if (this->orb_server_request_.incoming ())
|
107
|
+
{
|
108
|
+
this->params_->_tao_incoming_cdr (*this->orb_server_request_.incoming (),
|
109
|
+
CORBA::ARG_IN | CORBA::ARG_INOUT,
|
110
|
+
this->lazy_evaluation_);
|
111
|
+
|
112
|
+
// Pass this alignment back to the TAO_ServerRequest.
|
113
|
+
this->orb_server_request_.dsi_nvlist_align (
|
114
|
+
this->params_->_tao_target_alignment ());
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
// Store the result value. There's either an exception, or a result,
|
120
|
+
// but not both of them. Results can be reported (at most once)
|
121
|
+
// only after the parameter list has been provided (maybe empty).
|
122
|
+
void
|
123
|
+
R2CORBA::ServerRequest::set_result (const CORBA::Any &value
|
124
|
+
)
|
125
|
+
{
|
126
|
+
// Setting a result when another result already exists or if an exception
|
127
|
+
// exists or before the args have been processeed is an error.
|
128
|
+
if (this->retval_ != 0 || this->exception_ != 0 || this->params_ == 0)
|
129
|
+
{
|
130
|
+
throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO);
|
131
|
+
}
|
132
|
+
|
133
|
+
ACE_NEW_THROW_EX (this->retval_,
|
134
|
+
CORBA::Any (value),
|
135
|
+
CORBA::NO_MEMORY ());
|
136
|
+
}
|
137
|
+
|
138
|
+
// NOTE: if "" is set, there has been a system exception,
|
139
|
+
// and it will take precedence over exceptions reported using the
|
140
|
+
// set_exception() mechanism of the ServerRequest, which we assume
|
141
|
+
// the application writer will use to report only user exceptions.
|
142
|
+
// If both types of exception happen on the same invocation, the user
|
143
|
+
// exception will be lost.
|
144
|
+
|
145
|
+
// Store the exception value.
|
146
|
+
void
|
147
|
+
R2CORBA::ServerRequest::set_exception (const CORBA::Any &value)
|
148
|
+
{
|
149
|
+
CORBA::TypeCode_var tc = value.type ();
|
150
|
+
|
151
|
+
CORBA::TCKind const kind = tc->kind ();
|
152
|
+
|
153
|
+
// set_exception() can be called at any time, but the Any arg MUST
|
154
|
+
// contain an exception.
|
155
|
+
if (kind != CORBA::tk_except)
|
156
|
+
{
|
157
|
+
throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 21, CORBA::COMPLETED_MAYBE);
|
158
|
+
}
|
159
|
+
|
160
|
+
ACE_NEW_THROW_EX (this->exception_,
|
161
|
+
CORBA::Any (value),
|
162
|
+
CORBA::NO_MEMORY ());
|
163
|
+
|
164
|
+
this->orb_server_request_.reply_status (GIOP::USER_EXCEPTION);
|
165
|
+
}
|
166
|
+
|
167
|
+
// This method will be utilized by the DSI servant to marshal outgoing
|
168
|
+
// parameters.
|
169
|
+
void
|
170
|
+
R2CORBA::ServerRequest::dsi_marshal (void)
|
171
|
+
{
|
172
|
+
// There was a user exception, no need to marshal any parameters.
|
173
|
+
if (this->sent_gateway_exception_)
|
174
|
+
{
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
|
178
|
+
// In a collocated situation there is no outgoing CDR stream.
|
179
|
+
// So, in case of an exception we just raise the UnknownUserException
|
180
|
+
// and for a regular reply we use the 'collocated argument converter'.
|
181
|
+
if (this->orb_server_request_.collocated ())
|
182
|
+
{
|
183
|
+
if (this->orb_server_request_.reply_status () == GIOP::USER_EXCEPTION)
|
184
|
+
{
|
185
|
+
throw CORBA::UnknownUserException (*this->exception_);
|
186
|
+
}
|
187
|
+
else if (this->orb_server_request_.operation_details ()->cac () != 0)
|
188
|
+
{
|
189
|
+
TAO_OutputCDR output;
|
190
|
+
// marshal the return value if any
|
191
|
+
if (this->retval_ != 0)
|
192
|
+
{
|
193
|
+
this->retval_->impl ()->marshal_value (output);
|
194
|
+
}
|
195
|
+
|
196
|
+
// marshal the "inout" and "out" parameters.
|
197
|
+
if (this->params_ != 0)
|
198
|
+
{
|
199
|
+
this->params_->_tao_encode (
|
200
|
+
output,
|
201
|
+
CORBA::ARG_INOUT | CORBA::ARG_OUT);
|
202
|
+
}
|
203
|
+
|
204
|
+
TAO_InputCDR input (output);
|
205
|
+
// set reply parameters
|
206
|
+
this->orb_server_request_.operation_details ()->cac (
|
207
|
+
)->dsi_convert_reply (this->orb_server_request_,
|
208
|
+
input);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
else
|
212
|
+
{
|
213
|
+
if (this->orb_server_request_.reply_status () == GIOP::NO_EXCEPTION)
|
214
|
+
{
|
215
|
+
// In DSI, we can't rely on the skeleton to do this.
|
216
|
+
if (this->retval_ == 0 && this->params_ == 0)
|
217
|
+
{
|
218
|
+
this->orb_server_request_.argument_flag (false);
|
219
|
+
}
|
220
|
+
|
221
|
+
this->orb_server_request_.init_reply ();
|
222
|
+
|
223
|
+
// Send the return value, if any.
|
224
|
+
if (this->retval_ != 0)
|
225
|
+
{
|
226
|
+
this->retval_->impl ()->marshal_value (
|
227
|
+
*this->orb_server_request_.outgoing ());
|
228
|
+
}
|
229
|
+
|
230
|
+
// Send the "inout" and "out" parameters.
|
231
|
+
if (this->params_ != 0)
|
232
|
+
{
|
233
|
+
this->params_->_tao_encode (
|
234
|
+
*this->orb_server_request_.outgoing (),
|
235
|
+
CORBA::ARG_INOUT | CORBA::ARG_OUT);
|
236
|
+
}
|
237
|
+
}
|
238
|
+
else
|
239
|
+
{
|
240
|
+
// This defaults to true, but just to be safe...
|
241
|
+
this->orb_server_request_.argument_flag (true);
|
242
|
+
|
243
|
+
// Write the reply header to the ORB request's outgoing CDR stream.
|
244
|
+
this->orb_server_request_.init_reply ();
|
245
|
+
|
246
|
+
this->exception_->impl ()->marshal_value (
|
247
|
+
*this->orb_server_request_.outgoing ());
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
// do not send in case of deferred reply
|
252
|
+
if (!this->orb_server_request_.deferred_reply ())
|
253
|
+
{
|
254
|
+
this->orb_server_request_.tao_send_reply ();
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
void
|
259
|
+
R2CORBA::ServerRequest::gateway_exception_reply (ACE_CString &raw_exception)
|
260
|
+
{
|
261
|
+
// This defaults to 1, but just to be safe...
|
262
|
+
this->orb_server_request_.argument_flag (true);
|
263
|
+
|
264
|
+
// This reply path handles only user exceptions.
|
265
|
+
this->orb_server_request_.reply_status (GIOP::USER_EXCEPTION);
|
266
|
+
|
267
|
+
this->orb_server_request_.init_reply ();
|
268
|
+
|
269
|
+
// We know nothing about this exception, so we marshal it as a block
|
270
|
+
// of bytes. The outgoing stream's byte order has already been matched
|
271
|
+
// to the original source of the reply.
|
272
|
+
this->orb_server_request_.outgoing ()->write_octet_array (
|
273
|
+
reinterpret_cast<const CORBA::Octet *> (raw_exception.fast_rep ()),
|
274
|
+
static_cast<CORBA::ULong> (raw_exception.length () + ACE_CDR::MAX_ALIGNMENT)
|
275
|
+
);
|
276
|
+
|
277
|
+
// This will prevent the marshaling of any parameters into this reply.
|
278
|
+
this->sent_gateway_exception_ = true;
|
279
|
+
|
280
|
+
this->orb_server_request_.tao_send_reply ();
|
281
|
+
}
|
282
|
+
|
283
|
+
#endif
|
@@ -0,0 +1,149 @@
|
|
1
|
+
/*--------------------------------------------------------------------
|
2
|
+
# srvreq_fix.h - R2TAO CORBA Servant 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
|
+
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
|
+
#------------------------------------------------------------------*/
|
13
|
+
|
14
|
+
#ifndef __SRVREQ_FIX_H__
|
15
|
+
#define __SRVREQ_FIX_H__
|
16
|
+
|
17
|
+
#include "tao/TAO_Server_Request.h"
|
18
|
+
#include "tao/CDR.h"
|
19
|
+
#include "ace/Atomic_Op.h"
|
20
|
+
|
21
|
+
namespace R2CORBA
|
22
|
+
{
|
23
|
+
class ServerRequest;
|
24
|
+
typedef ServerRequest *ServerRequest_ptr;
|
25
|
+
|
26
|
+
typedef TAO_Pseudo_Var_T<ServerRequest> ServerRequest_var;
|
27
|
+
typedef TAO_Pseudo_Out_T<ServerRequest> ServerRequest_out;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* @class ServerRequest
|
31
|
+
*
|
32
|
+
* @brief Class representing the CORBA ServerRequest pseudo-object.
|
33
|
+
*
|
34
|
+
* R2CORBA fixed version for older (< 6.0.2) TAO versions
|
35
|
+
*/
|
36
|
+
class ServerRequest
|
37
|
+
{
|
38
|
+
public:
|
39
|
+
ServerRequest (TAO_ServerRequest &orb_server_request);
|
40
|
+
|
41
|
+
~ServerRequest (void);
|
42
|
+
|
43
|
+
void arguments (CORBA::NVList_ptr &list);
|
44
|
+
|
45
|
+
void set_result (const CORBA::Any &value);
|
46
|
+
|
47
|
+
void set_exception (const CORBA::Any &value);
|
48
|
+
|
49
|
+
void dsi_marshal (void);
|
50
|
+
|
51
|
+
CORBA::Context_ptr ctx (void) const;
|
52
|
+
|
53
|
+
void ctx (CORBA::Context_ptr);
|
54
|
+
|
55
|
+
const char *operation (void) const;
|
56
|
+
|
57
|
+
static ServerRequest_ptr _duplicate (ServerRequest_ptr);
|
58
|
+
static ServerRequest_ptr _nil (void);
|
59
|
+
|
60
|
+
CORBA::ULong _incr_refcount (void);
|
61
|
+
CORBA::ULong _decr_refcount (void);
|
62
|
+
|
63
|
+
void _tao_lazy_evaluation (bool lazy_evaluation);
|
64
|
+
|
65
|
+
int _tao_incoming_byte_order (void) const;
|
66
|
+
|
67
|
+
void _tao_reply_byte_order (int byte_order);
|
68
|
+
|
69
|
+
TAO_ServerRequest & _tao_server_request (void);
|
70
|
+
|
71
|
+
void gateway_exception_reply (ACE_CString &raw_exception);
|
72
|
+
|
73
|
+
typedef R2CORBA::ServerRequest_ptr _ptr_type;
|
74
|
+
typedef R2CORBA::ServerRequest_var _var_type;
|
75
|
+
typedef R2CORBA::ServerRequest_out _out_type;
|
76
|
+
|
77
|
+
private:
|
78
|
+
bool lazy_evaluation_;
|
79
|
+
CORBA::Context_ptr ctx_;
|
80
|
+
CORBA::NVList_ptr params_;
|
81
|
+
CORBA::Any_ptr retval_;
|
82
|
+
CORBA::Any_ptr exception_;
|
83
|
+
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
|
84
|
+
TAO_ServerRequest &orb_server_request_;
|
85
|
+
bool sent_gateway_exception_;
|
86
|
+
};
|
87
|
+
} // End R2CORBA namespace
|
88
|
+
|
89
|
+
inline R2CORBA::ServerRequest_ptr
|
90
|
+
R2CORBA::ServerRequest::_duplicate (R2CORBA::ServerRequest_ptr x)
|
91
|
+
{
|
92
|
+
if (x != 0)
|
93
|
+
{
|
94
|
+
x->_incr_refcount ();
|
95
|
+
}
|
96
|
+
|
97
|
+
return x;
|
98
|
+
}
|
99
|
+
|
100
|
+
inline R2CORBA::ServerRequest_ptr
|
101
|
+
R2CORBA::ServerRequest::_nil (void)
|
102
|
+
{
|
103
|
+
return static_cast <R2CORBA::ServerRequest_ptr>(0);
|
104
|
+
}
|
105
|
+
|
106
|
+
inline CORBA::Context_ptr
|
107
|
+
R2CORBA::ServerRequest::ctx (void) const
|
108
|
+
{
|
109
|
+
return this->ctx_;
|
110
|
+
}
|
111
|
+
|
112
|
+
inline void
|
113
|
+
R2CORBA::ServerRequest::ctx (CORBA::Context_ptr ctx)
|
114
|
+
{
|
115
|
+
this->ctx_ = ctx;
|
116
|
+
}
|
117
|
+
|
118
|
+
inline const char *
|
119
|
+
R2CORBA::ServerRequest::operation (void) const
|
120
|
+
{
|
121
|
+
return this->orb_server_request_.operation ();
|
122
|
+
}
|
123
|
+
|
124
|
+
inline void
|
125
|
+
R2CORBA::ServerRequest::_tao_lazy_evaluation (bool lazy_evaluation)
|
126
|
+
{
|
127
|
+
this->lazy_evaluation_ = lazy_evaluation;
|
128
|
+
}
|
129
|
+
|
130
|
+
inline int
|
131
|
+
R2CORBA::ServerRequest::_tao_incoming_byte_order (void) const
|
132
|
+
{
|
133
|
+
return this->orb_server_request_.incoming ()->byte_order ();
|
134
|
+
}
|
135
|
+
|
136
|
+
inline void
|
137
|
+
R2CORBA::ServerRequest::_tao_reply_byte_order (int byte_order)
|
138
|
+
{
|
139
|
+
this->orb_server_request_.outgoing ()->reset_byte_order (byte_order);
|
140
|
+
}
|
141
|
+
|
142
|
+
|
143
|
+
inline TAO_ServerRequest &
|
144
|
+
R2CORBA::ServerRequest::_tao_server_request (void)
|
145
|
+
{
|
146
|
+
return this->orb_server_request_;
|
147
|
+
}
|
148
|
+
|
149
|
+
#endif
|