summaryrefslogtreecommitdiff
path: root/DAnCE/tools/System_Health/Daemon/SHS_Daemon_Impl.cpp
blob: 03ec916dc5774f9979a0cc47a66e25ef42d1c646 (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
// -*- C++ -*-
// TAO_IDL - Generated from
// be/be_codegen.cpp:1756

#include "SHS_Daemon_Impl.h"

#include "dance/Logger/Log_Macros.h"

#include <sstream>

namespace DAnCE
{
  // Implementation skeleton constructor
  SHS_Daemon_i::SHS_Daemon_i (CORBA::ORB_ptr orb)
    : orb_ (CORBA::ORB::_duplicate (orb))
  {
    DANCE_TRACE ("SHS_Daemon_i::constructor");
  }

  // Implementation skeleton destructor
  SHS_Daemon_i::~SHS_Daemon_i (void)
  {
    DANCE_TRACE ("SHS_Daemon_i::destructor");
  }

  void
  SHS_Daemon_i::update (const ::DAnCE::SHS::Status_Update & update)
  {
    DANCE_TRACE ("SHS_Daemon_i::update");

    DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO
                     ACE_TEXT ("SHS_Daemon_i::update - ")
                     ACE_TEXT ("Received status update from <%C>\n"),
                     update.id.in ()));

    std::stringstream str;

    str << "Instance with ID <" << update.id.in () << "> "
        << "and type <" << update.type.in () << ">: ";

    switch (update.new_status)
      {
      case ::DAnCE::SHS::INST_INSTALLED:
        str << "INSTALLED.";
        break;

      case ::DAnCE::SHS::INST_ACTIVE:
        str << "ACTIVE.";
        break;

      case ::DAnCE::SHS::INST_PASSIVE:
        str << "PASSIVE.";
        break;

      case ::DAnCE::SHS::INST_ERROR:
        str << "ERROR.";
        break;

      case ::DAnCE::SHS::INST_DEFUNCT:
        str << "DEFUNCT.";
        break;
      }

    std::cerr << str.str () << std::endl;
  }

  void SHS_Daemon_i::shutdown (void)
  {
    DANCE_TRACE ("SHS_Daemon_i::shutdown");

    this->orb_->shutdown ();
  }

}