summaryrefslogtreecommitdiff
path: root/modules/CIAO/DAnCE/tests/CIAO/CommandlinePassage/CommandlinePassage_exec.cpp
blob: bb39ab4e3a376e9654731f0d20b8413ef6f5dc43 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// -*- C++ -*-
// $Id$

#include "CommandlinePassage_exec.h"
#include "DAnCE/Logger/Log_Macros.h"
#include "tao/ORB_Core.h"
#include "tao/Transport_Cache_Manager.h"
#include "tao/Thread_Lane_Resources.h"

namespace CIAO_command_line_test_A_Impl
{
  //============================================================
  // Pulse generator
  //============================================================

  Component_exec_i::Component_exec_i  (void)
    : tc_max_ (3)
  {
  }

  Component_exec_i::~Component_exec_i  (void)
  {
  }

  // Port operations.
  void Component_exec_i::tc_max (CORBA::Long tc_max)
  {
    this->tc_max_ = tc_max;
  }

  CORBA::Long Component_exec_i::tc_max (void)
  {
    return this->tc_max_;
  }
  // Operations from Components::SessionComponent.
  void
  Component_exec_i::set_session_context (
    ::Components::SessionContext_ptr ctx)
  {
    this->context_ =
      ::command_line_test::CCM_A_Context::_narrow (ctx);

    if ( ::CORBA::is_nil (this->context_.in ()))
      {
        throw ::CORBA::INTERNAL ();
      }
  }

  void
  Component_exec_i::configuration_complete (void)
  {
  }

  void
  Component_exec_i::ccm_activate (void)
  {
  }

  void
  Component_exec_i::ccm_passivate (void)
  {
  }

  void
  Component_exec_i::ccm_remove (void)
  {
    try
      {
        long tc =
          this->context_->get_CCM_object ()->_get_orb ()->orb_core ()->lane_resources ().transport_cache ().total_size ();
        ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Transport cache : set <%d>, current_size <%d>\n"),
              this->tc_max_, tc));
        if (this->tc_max_ != tc)
          {
            ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR : Commandline parameter isn't not passed properly ")
                                   ACE_TEXT ("should be <%d>, is <%d>\n"),
                                   this->tc_max_, tc));
          }
      }
    catch (...)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR : Exception caught while checking transport cache.\n")));
      }
  }

  extern "C" COMMANDLINEPASSAGE_EXEC_Export ::Components::EnterpriseComponent_ptr
  create_Component_Impl (void)
  {
    ::Components::EnterpriseComponent_ptr retval =
      ::Components::EnterpriseComponent::_nil ();

    ACE_NEW_NORETURN (
      retval,
      Component_exec_i );

    return retval;
  }
}