summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp
blob: c0476c1ee98206f09337834a48c80dc007471a8d (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
// $Id$

#include "orbsvcs/Notify/Notify_EventChannelFactory_i.h"

#include "orbsvcs/Notify/Service.h"
#include "ace/Dynamic_Service.h"
#include "tao/PortableServer/Root_POA.h"
#include "tao/ORB_Core.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

CosNotifyChannelAdmin::EventChannelFactory_ptr
TAO_Notify_EventChannelFactory_i::create (PortableServer::POA_ptr default_POA)
{
  CosNotifyChannelAdmin::EventChannelFactory_var notify_factory;

  TAO_Notify_Service* notify_service = ACE_Dynamic_Service<TAO_Notify_Service>::instance (TAO_COS_NOTIFICATION_SERVICE_NAME);

  if (notify_service == 0)
  {
    ACE_DEBUG ((LM_DEBUG, "Service not found! check conf. file\n"));
    return notify_factory._retn ();
  }

  TAO_Root_POA *poa = dynamic_cast <TAO_Root_POA*> (default_POA);

  if (poa == 0)
    return notify_factory._retn ();

  CORBA::ORB_ptr orb = poa->orb_core ().orb () ;

  notify_service->init_service (orb);

  notify_factory = notify_service->create (default_POA);

  return notify_factory._retn ();
}

TAO_END_VERSIONED_NAMESPACE_DECL