1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
//$Id$
// -- PortableServer Include --
#include "tao/PortableServer/Collocated_Object_Proxy_Broker.h"
#include "tao/PortableServer/Object_Adapter.h"
#include "tao/PortableServer/Servant_Upcall.h"
#include "tao/PortableServer/Servant_Base.h"
// -- TAO Include --
#include "tao/Stub.h"
#include "tao/ORB_Core.h"
#include "tao/Profile.h"
ACE_RCSID (PortableServer,
Collocated_Object_Proxy_Broker,
"$Id$")
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
namespace TAO
{
CORBA::Boolean
Collocated_Object_Proxy_Broker::_is_a (CORBA::Object_ptr target,
const char *type_id)
{
TAO_Stub *stub = target->_stubobj ();
// Which collocation strategy should we use?
if (stub != 0 &&
stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ()
== TAO_ORB_Core::THRU_POA)
{
TAO::Portable_Server::Servant_Upcall servant_upcall (
stub->servant_orb_var ()->orb_core ());
CORBA::Object_var forward_to;
servant_upcall.prepare_for_upcall (
stub->profile_in_use ()->object_key (),
"_is_a",
forward_to.out ());
servant_upcall.pre_invoke_collocated_request ();
return servant_upcall.servant ()->_is_a (type_id);
}
// Direct collocation strategy is used.
if (target->_servant () != 0)
{
return target->_servant ()->_is_a (type_id);
}
return 0;
}
#if (TAO_HAS_MINIMUM_CORBA == 0)
char *
Collocated_Object_Proxy_Broker::_repository_id (CORBA::Object_ptr target)
{
TAO_Stub *stub = target->_stubobj ();
char * _tao_retval = 0;
try
{
// Which collocation strategy should we use?
if (stub != 0 &&
stub->servant_orb_var ()->orb_core ()
->get_collocation_strategy () == TAO_ORB_Core::THRU_POA)
{
TAO::Portable_Server::Servant_Upcall servant_upcall (
stub->servant_orb_var ()->orb_core ());
CORBA::Object_var forward_to;
servant_upcall.prepare_for_upcall (
stub->profile_in_use ()->object_key (),
"_repository_id",
forward_to.out ());
_tao_retval =
servant_upcall.servant ()->_repository_id ();
}
// Direct collocation strategy is used.
else if (target->_servant () != 0)
{
_tao_retval = target->_servant ()->_repository_id ();
}
}
catch (const ::CORBA::OBJECT_NOT_EXIST&)
{
// Ignore this exception.
}
return _tao_retval;
}
CORBA::Boolean
Collocated_Object_Proxy_Broker::_non_existent (CORBA::Object_ptr target)
{
CORBA::Boolean _tao_retval = true;
TAO_Stub *stub = target->_stubobj ();
// Which collocation strategy should we use?
if (stub != 0 &&
stub->servant_orb_var ()->orb_core ()
->get_collocation_strategy () == TAO_ORB_Core::THRU_POA)
{
TAO::Portable_Server::Servant_Upcall servant_upcall (
target->_stubobj ()->servant_orb_var ()->orb_core ());
CORBA::Object_var forward_to;
servant_upcall.prepare_for_upcall (
target->_stubobj ()->object_key (),
"_non_existent",
forward_to.out ());
servant_upcall.pre_invoke_collocated_request ();
_tao_retval = servant_upcall.servant ()->_non_existent ();
}
// Direct collocation strategy is used.
else if (target->_servant () != 0)
{
_tao_retval = target->_servant ()->_non_existent ();
}
return _tao_retval;
}
CORBA::Object_ptr
Collocated_Object_Proxy_Broker::_get_component (CORBA::Object_ptr target)
{
CORBA::Object_var _tao_retval (CORBA::Object::_nil ());
TAO_Stub *stub = target->_stubobj ();
try
{
// Which collocation strategy should we use?
if (stub != 0 &&
stub->servant_orb_var ()->orb_core ()
->get_collocation_strategy () == TAO_ORB_Core::THRU_POA)
{
TAO::Portable_Server::Servant_Upcall servant_upcall (
stub->servant_orb_var ()->orb_core ());
CORBA::Object_var forward_to;
servant_upcall.prepare_for_upcall (
stub->profile_in_use ()->object_key (),
"_component",
forward_to.out ());
_tao_retval = servant_upcall.servant ()->_get_component ();
}
// Direct collocation strategy is used.
else if (target->_servant () != 0)
{
_tao_retval = target->_servant ()->_get_component ();
}
}
catch (const ::CORBA::OBJECT_NOT_EXIST&)
{
// Ignore this exception.
}
return _tao_retval._retn ();
}
CORBA::InterfaceDef_ptr
Collocated_Object_Proxy_Broker::_get_interface (CORBA::Object_ptr target)
{
CORBA::InterfaceDef_ptr _tao_retval = 0;
TAO_Stub *stub = target->_stubobj ();
try
{
// Which collocation strategy should we use?
if (stub != 0 &&
stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ()
== TAO_ORB_Core::THRU_POA)
{
TAO::Portable_Server::Servant_Upcall servant_upcall (
target->_stubobj ()->servant_orb_var ()->orb_core ());
CORBA::Object_var forward_to;
servant_upcall.prepare_for_upcall (
target->_stubobj ()->object_key (),
"_interface",
forward_to.out ());
servant_upcall.pre_invoke_collocated_request ();
_tao_retval =
servant_upcall.servant ()->_get_interface ();
}
// Direct collocation strategy is used.
else if (target->_servant () != 0)
{
_tao_retval = target->_servant ()->_get_interface ();
}
}
catch (const ::CORBA::OBJECT_NOT_EXIST&)
{
// Ignore this exception.
}
return _tao_retval;
}
#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
}
// -----------------------------------------------------
TAO::Collocated_Object_Proxy_Broker *
the_tao_collocated_object_proxy_broker (void)
{
static TAO::Collocated_Object_Proxy_Broker the_broker;
return &the_broker;
}
TAO::Object_Proxy_Broker * _TAO_collocation_Object_Proxy_Broker_Factory (void)
{
return the_tao_collocated_object_proxy_broker ();
}
int
_TAO_collocation_Object_Proxy_Broker_Factory_Initializer (size_t)
{
_TAO_Object_Proxy_Broker_Factory_function_pointer =
_TAO_collocation_Object_Proxy_Broker_Factory;
return 0;
}
static int
_TAO_collocation_Object_Proxy_Broker_Factory_Initializer_Scarecrow =
_TAO_collocation_Object_Proxy_Broker_Factory_Initializer (
reinterpret_cast<size_t> (_TAO_collocation_Object_Proxy_Broker_Factory_Initializer
)
);
TAO_END_VERSIONED_NAMESPACE_DECL
|