summaryrefslogtreecommitdiff
path: root/TAO/tao/PortableServer/Adapter_Activator.cpp
blob: 32981d41e676597a35e34972f3d3f7d7c2ec4a7e (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
// $Id$

#include "tao/PortableServer/Adapter_Activator.h"

ACE_RCSID (PortableServer,
           Adapter_Activator,
           "$Id$")

#if (TAO_HAS_MINIMUM_POA == 0)
#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)

#include "tao/PortableServer/AdapterActivatorC.h"
#include "tao/PortableServer/POAManagerC.h"
#include "tao/PortableServer/PortableServer.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace Portable_Server
  {
    Adapter_Activator::Adapter_Activator (
      PortableServer::POAManager_ptr pm)
      : poa_manager_ (PortableServer::POAManager::_duplicate (pm))
    {
    }

    CORBA::Boolean
    Adapter_Activator::unknown_adapter (PortableServer::POA_ptr parent,
                                        const char *name)
    {
      // Default policies
      CORBA::PolicyList default_policies;

      // This assumes that the lock on the parent is recursive
      PortableServer::POA_var child =
        parent->create_POA (name,
                            this->poa_manager_.in (),
                            default_policies);

      try
        {
          child->the_activator (this);
        }
      catch (const ::CORBA::Exception&)
        {
          (void) child->destroy (1, 1);

          return false;
        }

      // Finally everything is fine
      return true;
    }
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL

#endif
#endif /* TAO_HAS_MINIMUM_POA == 0 */