summaryrefslogtreecommitdiff
path: root/CIAO/DAnCE/LocalityManager/Scheduler/Events/Configured.cpp
blob: 2d9c92c65c153650e7af245c83ddedd51af27481 (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
// $Id$
#include "Configured.h"

#include "tao/AnyTypeCode/ExceptionA.h"
#include "Logger/Log_Macros.h"
#include "Deployment/Deployment_StartErrorC.h"
#include "DAnCE/DAnCE_DeploymentInterceptorsC.h"
#include "DAnCE/DAnCE_LocalityManagerC.h"
#include "DAnCE/DAnCE_Utility.h"
#include "LocalityManager/Scheduler/Deployment_Event.h"
#include "LocalityManager/Scheduler/Plugin_Manager.h"

namespace DAnCE
{
  Instance_Configured::Instance_Configured (::Deployment::DeploymentPlan & plan,
                                  ::CORBA::ULong instanceRef,
                                  const char *inst_type,
                                  Event_Future holder)
    : Deployment_Event (holder,  
                        plan.instance[instanceRef].name.in (),
                        inst_type),
      Action_Base (holder,  
                   plan.instance[instanceRef].name.in (),
                   inst_type),
      plan_ (plan),
      instanceRef_ (instanceRef)
  {
  }
    
  Instance_Configured::~Instance_Configured (void)
  {
  }
  

  void
  Instance_Configured::invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &)
  {
    DANCE_TRACE ("Instance_Configured::invoke_pre_interceptor");
    
    //no-op
  }
  
    
  void
  Instance_Configured::invoke (::DAnCE::InstanceDeploymentHandler_ptr handler)
  {
    DANCE_TRACE ("Instance_Configured::invoke");
    
    DANCE_DEBUG (10, (LM_TRACE, DLINFO
                      ACE_TEXT ("Instance_Configured::invoke - ")
                      ACE_TEXT ("Invoking instance_configured on handler for type <%C>\n"),
                      this->instance_type_.c_str ()));
    handler->instance_configured (this->plan_,
                                  this->instanceRef_);
    DANCE_DEBUG (10, (LM_TRACE, DLINFO
                      ACE_TEXT ("Instance_Configured::invoke - ")
                      ACE_TEXT ("instance_configured completed\n")));
  }
  
  
  void
  Instance_Configured::invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i)
  {
    DANCE_TRACE ("Instance_Configured::invoke_post_interceptor");
    
    (*i)->instance_post_configured (this->plan_,
                                    this->instanceRef_,
                                    this->instance_excep_.in ());
  }
  
  
  void
  Instance_Configured::create_unexpected_exception (const std::string &name,
                                                 const std::string &reason)
  {
    DANCE_TRACE ("Instance_Configured::create_unexpected_exception");
    
    ::Deployment::StartError ex_tmp (name.c_str (),
                                     reason.c_str ());
    this->instance_excep_ =
      DAnCE::Utility::create_any_from_exception (ex_tmp);
  }
  
  void
  Instance_Configured::create_valid_result (Event_Result &)
  {
    DANCE_TRACE ("Instance_Configured::create_valid_result");
    // no-op
  }
}