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
100
101
102
103
104
105
106
107
108
109
110
|
// $Id$
#ifndef CIAO_DYNAMIC_COMPONENT_SERVANT_T_C
#define CIAO_DYNAMIC_COMPONENT_SERVANT_T_C
#include "Dynamic_Component_Servant_T.h"
namespace CIAO
{
template <typename COMP_SVNT,
typename COMP_EXEC,
typename COMP_EXEC_VAR,
typename EXEC,
typename EXEC_VAR,
typename COMP>
Dynamic_Component_Servant<COMP_SVNT, COMP_EXEC, COMP_EXEC_VAR,
EXEC, EXEC_VAR, COMP>
::Dynamic_Component_Servant
(Components::EnterpriseComponent_ptr ec,
Components::CCMHome_ptr home,
Home_Servant_Impl_Base *home_servant,
Session_Container *c)
:Dynamic_Component_Servant_Base (c),
executor_ (Components::EnterpriseComponent::_duplicate (ec)),
home_servant_ (home_servant),
home_ (Components::CCMHome::_duplicate (home)),
component_removed_ (0)
{
}
template <typename COMP_SVNT,
typename COMP_EXEC,
typename COMP_EXEC_VAR,
typename EXEC,
typename EXEC_VAR,
typename COMP>
void Dynamic_Component_Servant<COMP_SVNT, COMP_EXEC, COMP_EXEC_VAR,
EXEC, EXEC_VAR, COMP>::update_destroy_count ()
{
component_removed_ = 1;
}
template <typename COMP_SVNT,
typename COMP_EXEC,
typename COMP_EXEC_VAR,
typename EXEC,
typename EXEC_VAR,
typename COMP>
Dynamic_Component_Servant<COMP_SVNT, COMP_EXEC, COMP_EXEC_VAR,
EXEC, EXEC_VAR, COMP>::~Dynamic_Component_Servant (void)
{
}
template <typename COMP_SVNT,
typename COMP_EXEC,
typename COMP_EXEC_VAR,
typename EXEC,
typename EXEC_VAR,
typename COMP>
void Dynamic_Component_Servant
<COMP_SVNT, COMP_EXEC, COMP_EXEC_VAR,
EXEC, EXEC_VAR, COMP>::destroy (PortableServer::ObjectId &oid)
{
COMP_SVNT *servant;
if (this->servant_map_.find (oid, servant) == 0)
{
servant->remove ();
component_removed_ = 1;
}
}
template <typename COMP_SVNT,
typename COMP_EXEC,
typename COMP_EXEC_VAR,
typename EXEC,
typename EXEC_VAR,
typename COMP>
PortableServer::Servant Dynamic_Component_Servant
<COMP_SVNT, COMP_EXEC, COMP_EXEC_VAR,
EXEC, EXEC_VAR, COMP>::create (PortableServer::ObjectId &oid)
{
CIAO::Swap_Exec_var swap_exec = CIAO::Swap_Exec::_narrow
(this->executor_.in ()
ACE_ENV_ARG_PARAMETER);
::Components::EnterpriseComponent_var ciao_ec =
swap_exec->incarnate (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (COMP::_nil ());
COMP_EXEC_VAR ciao_comp = COMP_EXEC::_narrow (ciao_ec.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (COMP::_nil ());
COMP_SVNT *svt = new COMP_SVNT(ciao_comp.in (), this->home_.in (),
this->home_servant_,
this->container_);
if (component_removed_ == 1)
{
svt->ciao_preactivate ();
svt->ciao_activate ();
svt->ciao_postactivate ();
component_removed_ = 0;
}
PortableServer::ServantBase_var safe (svt);
this->servant_map_.bind (oid, svt);
return safe._retn ();
}
}
#endif /* CIAO_DYNAMIC_COMPONENT_SERVANT_T_C */
|