summaryrefslogtreecommitdiff
path: root/trunk/CIAO/ciao/Dynamic_Component_Activator.cpp
blob: ba1dae03d74d962323f9553b8c741bfdd3daf210 (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
#include "ciao/Dynamic_Component_Activator.h"
#include "ciao/Dynamic_Component_Servant_Base.h"
#include "ciao/CIAO_common.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"

ACE_RCSID (ciao,
           Dynamic_Component_Activator,
           "$Id$")

namespace CIAO
{
  Dynamic_Component_Activator::Dynamic_Component_Activator (CORBA::ORB_ptr o)
    : orb_ (CORBA::ORB::_duplicate (o))
  {
  }

  Dynamic_Component_Activator::~Dynamic_Component_Activator (void)
  {
  }

  PortableServer::Servant
  Dynamic_Component_Activator::incarnate (const PortableServer::ObjectId &oid,
                                          PortableServer::POA_ptr)
  {
    Dynamic_Component_Servant_Base* servant = 0;
    PortableServer::ObjectId new_oid (oid);

    if (this->servant_map_.find (oid, servant) == 0)
      {
        return servant->create (new_oid);
      }

    return 0;
  }

  void
  Dynamic_Component_Activator::etherealize (
    const PortableServer::ObjectId &,
    PortableServer::POA_ptr ,
    PortableServer::Servant ,
    CORBA::Boolean ,
    CORBA::Boolean)
  {
  }

  void Dynamic_Component_Activator::add_servant_to_map
    (PortableServer::ObjectId &oid,
     Dynamic_Component_Servant_Base* servant)
  {
    this->servant_map_.bind (oid, servant);
  }

  void Dynamic_Component_Activator::delete_servant_from_map
    (PortableServer::ObjectId &oid)
  {
    Dynamic_Component_Servant_Base* servant = 0;
    if (this->servant_map_.unbind (oid, servant) != 0)
      {
        ACE_DEBUG ((LM_DEBUG, "Invalid object reference\n"));
      }
  }
}