2 * @file Async_Table_Adapter.cpp
4 * @author Phil Mesnier <mesnier_p@ociweb.com>
7 #include "tao/IORTable/Async_Table_Adapter.h"
8 #include "tao/IORTable/Async_IOR_Table_Impl.h"
9 #include "tao/IORTable/Locate_ResponseHandler.h"
11 #include "tao/ORB_Core.h"
12 #include "tao/Server_Strategy_Factory.h"
13 #include "tao/Object.h"
16 #include "tao/Profile.h"
17 #include "tao/TAO_Server_Request.h"
19 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
21 TAO_Async_Table_Adapter::TAO_Async_Table_Adapter (TAO_ORB_Core
&orb_core
)
22 : TAO_Table_Adapter (orb_core
)
26 TAO_Async_Table_Adapter::~TAO_Async_Table_Adapter ()
31 TAO_Async_Table_Adapter::open ()
33 ACE_GUARD (ACE_Lock
, ace_mon
, *this->lock_
);
34 TAO_Async_IOR_Table_Impl
*impl
= 0;
35 ACE_NEW_THROW_EX (impl
,
36 TAO_Async_IOR_Table_Impl (),
40 this->closed_
= false;
44 TAO_Async_Table_Adapter::dispatch (TAO::ObjectKey
&key
,
45 TAO_ServerRequest
&request
,
46 CORBA::Object_out forward_to
)
48 TAO_IOR_Table_Impl_var rootref
;
50 ACE_GUARD_RETURN (ACE_Lock
,
53 TAO_Adapter::DS_MISMATCHED_KEY
);
56 return TAO_Adapter::DS_MISMATCHED_KEY
;
58 rootref
= this->root_
;
61 if (this->root_
->async_available ())
63 // construct a callback handler
64 TAO_AMH_Locate_ResponseHandler_ptr rhp
;
66 TAO_AMH_Locate_ResponseHandler (request
),
68 TAO_AMH_Locate_ResponseHandler_var
rh (rhp
);
69 this->find_object (rh
, key
);
73 if (this->TAO_Table_Adapter::find_object (key
, forward_to
))
75 request
.forward_location (forward_to
);
76 return TAO_Adapter::DS_FORWARD
;
79 return TAO_Adapter::DS_MISMATCHED_KEY
;
83 TAO_Async_Table_Adapter::find_object (IORTable::Locate_ResponseHandler rh
,
86 CORBA::String_var object_key
;
87 TAO::ObjectKey::encode_sequence_to_string (object_key
.out (), key
);
88 TAO_Async_IOR_Table_Impl
* aroot
=
89 dynamic_cast<TAO_Async_IOR_Table_Impl
*>(this->root_
.ptr());
92 aroot
->async_find (rh
, object_key
.in ());
96 rh
->raise_excep (IORTable::NotFound ());
100 // ****************************************************************
102 TAO_Async_Table_Adapter_Factory::TAO_Async_Table_Adapter_Factory ()
107 TAO_Async_Table_Adapter_Factory::create (TAO_ORB_Core
*oc
)
109 TAO_Adapter
* ptr
= 0;
111 TAO_Async_Table_Adapter (*oc
),
116 TAO_END_VERSIONED_NAMESPACE_DECL
118 ACE_FACTORY_DEFINE (TAO_Async_IORTable
, TAO_Async_Table_Adapter_Factory
)
119 ACE_STATIC_SVC_DEFINE (TAO_Async_Table_Adapter_Factory
,
120 ACE_TEXT ("TAO_Async_IORTable"),
122 &ACE_SVC_NAME (TAO_Async_Table_Adapter_Factory
),
123 ACE_Service_Type::DELETE_THIS
| ACE_Service_Type::DELETE_OBJ
,