summaryrefslogtreecommitdiff
path: root/trunk/TAO/tests/Portable_Interceptors/PolicyFactory/IORInterceptor.cpp
blob: 37e62f127daa95de1788c4479d2194a828df9da5 (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
#include "IORInterceptor.h"
#include "testC.h"


ACE_RCSID (PolicyFactory,
           IORInterceptor,
           "$Id$")


IORInterceptor::IORInterceptor (void)
  : success_ (false)
{
}

IORInterceptor::~IORInterceptor (void)
{
  ACE_ASSERT (this->success_);
}

char *
IORInterceptor::name (void)
{
  return CORBA::string_dup ("");
}

void
IORInterceptor::destroy (void)
{
  ACE_ASSERT (this->success_);
}

void
IORInterceptor::establish_components (
    PortableInterceptor::IORInfo_ptr info)
{
  try
    {
      PortableInterceptor::ObjectReferenceTemplate_var t =
        info->adapter_template ();

      PortableInterceptor::AdapterName_var a =
        t->adapter_name ();

      // Only execute if POA is not RootPOA.  The RootPOA will not
      // have our custom policy, but the child POA we created will.
      if (a->length () > 1)
        {
          CORBA::Policy_var policy (
            info->get_effective_policy (Test::POLICY_TYPE));

          Test::Policy_var test_policy (Test::Policy::_narrow (
            policy.in ()));

          this->success_ = true;
        }
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception (
        "EXCEPTION: ""IORInterceptor::establish_components:");

      ACE_ASSERT (false);
    }
}