summaryrefslogtreecommitdiff
path: root/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.cpp
blob: bcfa7a8dbe616c10133e44b59951e1174dcf43b6 (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
// $Id$

#include "RT_Object_Adapter_Factory.h"

#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0

#include "tao/PortableServer/Object_Adapter.h"
#include "tao/ORB_Core.h"
#include "RT_Servant_Dispatcher.h"
#include "RT_Policy_Validator.h"
#include "RT_Collocation_Resolver.h"

ACE_RCSID (RTPortableServer,
           RT_Object_Adapter_Factory,
           "$Id$")


TAO_RT_Object_Adapter_Factory::TAO_RT_Object_Adapter_Factory (void)
{
}

TAO_Adapter*
TAO_RT_Object_Adapter_Factory::create (TAO_ORB_Core *orb_core)
{
  // Setup the POA_Current object in the ORB
  CORBA::Object_var current = new TAO_POA_Current;
  orb_core->poa_current (current.in ());

  if (!orb_core->orb_params ()->disable_rt_collocation_resolver ())
    {
      // Set the name of the collocation resolver to be RT_Collocation_Resolver.
      TAO_ORB_Core::set_collocation_resolver (
          "RT_Collocation_Resolver");
      ACE_Service_Config::process_directive (
          ace_svc_desc_TAO_RT_Collocation_Resolver);
    }

  TAO_Object_Adapter *object_adapter = 0;
  ACE_NEW_RETURN (object_adapter,
                  TAO_Object_Adapter (orb_core->server_factory ()->
                                        active_object_map_creation_parameters (),
                                      *orb_core),
                  0);

  // Create and register the RT servant dispatcher.
  TAO_RT_Servant_Dispatcher *rt_servant_dispatcher;
  ACE_NEW_RETURN (rt_servant_dispatcher,
                  TAO_RT_Servant_Dispatcher,
                  0);
  object_adapter->servant_dispatcher (rt_servant_dispatcher);

  // Create and add the RT policy validator.
  TAO_POA_RT_Policy_Validator *rt_validator;
  ACE_NEW_RETURN (rt_validator,
                  TAO_POA_RT_Policy_Validator (*orb_core),
                  0);
  object_adapter->validator ().add_validator (rt_validator);

  return object_adapter;
}

ACE_FACTORY_DEFINE (TAO_RTPortableServer, TAO_RT_Object_Adapter_Factory)
ACE_STATIC_SVC_DEFINE (TAO_RT_Object_Adapter_Factory,
                       ACE_TEXT ("TAO_RT_Object_Adapter_Factory"),
                       ACE_SVC_OBJ_T,
                       &ACE_SVC_NAME (TAO_RT_Object_Adapter_Factory),
                       ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
                       0)

#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */