blob: 9de4075a3ab8b77b71be6665aa7d4335d678418d (
plain)
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
|
// $Id$
#include "tao/BiDir_GIOP/BiDir_ORBInitializer.h"
#include "tao/BiDir_GIOP/BiDir_PolicyFactory.h"
#include "tao/BiDir_GIOP/BiDirGIOP.h"
#include "tao/BiDir_GIOP/BiDir_Service_Context_Handler.h"
#include "tao/PI/ORBInitInfo.h"
#include "tao/ORB_Constants.h"
#include "tao/ORB_Core.h"
#include "ace/CORBA_macros.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
void
TAO_BiDir_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info)
{
// Narrow to a TAO_ORBInitInfo object to get access to the
// orb_core() TAO extension.
TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);
if (CORBA::is_nil (tao_info.in ()))
{
if (TAO_debug_level > 0)
ACE_ERROR ((LM_ERROR,
"(%P|%t) TAO_Bidir_ORBInitializer::pre_init:\n"
"(%P|%t) Unable to narrow "
"\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
"(%P|%t) \"TAO_ORBInitInfo *.\"\n"));
throw ::CORBA::INTERNAL ();
}
// Bind the service context handler for BiDIR GIOP
TAO_BiDIR_Service_Context_Handler* h = 0;
ACE_NEW (h,
TAO_BiDIR_Service_Context_Handler());
tao_info->orb_core ()->service_context_registry ().bind (IOP::BI_DIR_IIOP, h);
}
void
TAO_BiDir_ORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info)
{
this->register_policy_factories (info);
}
void
TAO_BiDir_ORBInitializer::register_policy_factories (
PortableInterceptor::ORBInitInfo_ptr info)
{
/// Register the BiDir policy factories.
PortableInterceptor::PolicyFactory_ptr temp_factory =
PortableInterceptor::PolicyFactory_ptr ();
/// This policy factory is used for all BiDir related policies.
ACE_NEW_THROW_EX (temp_factory,
TAO_BiDir_PolicyFactory,
CORBA::NO_MEMORY (
CORBA::SystemException::_tao_minor_code (
TAO::VMCID,
ENOMEM),
CORBA::COMPLETED_NO));
PortableInterceptor::PolicyFactory_var policy_factory = temp_factory;
/// Bind the same policy factory to all BiDir related policy
/// types since a single policy factory is used to create each of
/// the different types of BiDir policies.
info->register_policy_factory (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
policy_factory.in ());
}
TAO_END_VERSIONED_NAMESPACE_DECL
|