summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.cpp
blob: 189319af74622f73915f82b7e0d471240f4d584b (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// $Id$

#include "RT_Notify_Service.h"

ACE_RCSID(RT_Notify, TAO_Notify_RT_Notify_Service, "$Id$")

#include "ace/Dynamic_Service.h"
#include "Properties.h"
#include "RT_Properties.h"
#include "RT_Factory.h"
#include "RT_Builder.h"

TAO_RT_Notify_Service::TAO_RT_Notify_Service (void)
{
}

TAO_RT_Notify_Service::~TAO_RT_Notify_Service ()
{
}

void
TAO_RT_Notify_Service::init_service (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL)
{
  ACE_DEBUG ((LM_DEBUG, "Loading the Real-Time Notification Service...\n"));

  this->init_i (orb ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
}

void
TAO_RT_Notify_Service::init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL)
{
  //Init the base class.
  TAO_CosNotify_Service::init_i (orb ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  TAO_Notify_RT_Properties* properties = TAO_Notify_RT_PROPERTIES::instance();

  // Resolve RTORB
  CORBA::Object_var object =
    orb->resolve_initial_references ("RTORB"
                                      ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  RTCORBA::RTORB_var rt_orb =
    RTCORBA::RTORB::_narrow (object.in ()
                             ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  // Resolve RTCurrent
  object =
    orb->resolve_initial_references ("RTCurrent"
                                     ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  RTCORBA::Current_var current =
    RTCORBA::Current::_narrow (object.in ()
                               ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

 /// Set the properties
  properties->rt_orb (rt_orb.in ());
  properties->current (current.in ());
}

TAO_Notify_Factory*
TAO_RT_Notify_Service::create_factory (ACE_ENV_SINGLE_ARG_DECL)
{
  TAO_Notify_Factory* factory =
    ACE_Dynamic_Service<TAO_Notify_Factory>::instance ("TAO_Notify_Factory");

  if (factory == 0)
    {
      ACE_NEW_THROW_EX (factory,
                        TAO_Notify_RT_Factory (),
                        CORBA::NO_MEMORY ());
      ACE_CHECK_RETURN(0);
    }
  return factory;
}

TAO_Notify_Builder*
TAO_RT_Notify_Service::create_builder (ACE_ENV_SINGLE_ARG_DECL)
{
  TAO_Notify_Builder* builder = 0;
  ACE_NEW_THROW_EX (builder,
                    TAO_Notify_RT_Builder (),
                    CORBA::NO_MEMORY ());
  ACE_CHECK_RETURN(0);

  return builder;
}

ACE_FACTORY_DEFINE (TAO_RT_Notify,TAO_RT_Notify_Service)