summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/Notify/Lanes/ORB_Objects.cpp
blob: 860d6097f94885729d9f0ed911d5668d0d9cf52c (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
// $Id$

#include "ORB_Objects.h"

ACE_RCSID(Notify, TAO_NS_ORB_Objects, "$id$")

TAO_NS_ORB_Objects::TAO_NS_ORB_Objects (void)
{
}

void
TAO_NS_ORB_Objects::init (CORBA::ORB_var& orb ACE_ENV_ARG_DECL)
{
  this->orb_ = orb;

  CORBA::Object_var object =  this->orb_->resolve_initial_references("RootPOA"
                                                                     ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  this->root_poa_ = PortableServer::POA::_narrow (object.in () ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  // Resolve the RTORB.
  object = this->orb_->resolve_initial_references ("RTORB"
                                                       ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  this->rt_orb_ = RTCORBA::RTORB::_narrow (object.in ()
                                           ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  // Resolve the Current
  object = this->orb_->resolve_initial_references ("RTCurrent"
                                                   ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  this->current_ = RTCORBA::Current::_narrow (object.in ()
                                              ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  // Resolve the Naming service
  object = this->orb_->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  this->naming_ = CosNaming::NamingContextExt::_narrow (object.in ()
                                                                    ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
}

TAO_NS_ORB_Objects::~TAO_NS_ORB_Objects ()
{
}

CosNotifyChannelAdmin::EventChannelFactory_ptr
TAO_NS_ORB_Objects::notify_factory (ACE_ENV_SINGLE_ARG_DECL)
{
  CosNotifyChannelAdmin::EventChannelFactory_var ecf;

  // Look for the Notification Service
  CosNaming::Name name (1);
  name.length (1);
  name[0].id = CORBA::string_dup ("NotifyEventChannelFactory");

  CORBA::Object_var object = this->naming_->resolve (name ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (ecf._retn ());

  ecf = CosNotifyChannelAdmin::EventChannelFactory::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (ecf._retn ());

  return ecf._retn ();
}