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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
// -*- C++ -*-
//=============================================================================
/**
* @file Swapping_Container.h
*
* $Id$
*
* Header file for CIAO's Dynamic Swapping container implementations
*
* @author Jaiganesh Balasubramanian <jai@dre.vanderbilt.edu>
* Balachandran Natarajan <bala@dre.vanderbilt.edu>
*/
//=============================================================================
#ifndef CIAO_SWAPPING_CONTAINER_H
#define CIAO_SWAPPING_CONTAINER_H
#include /**/ "ace/pre.h"
// @@ Jai, are all these inclusions necessary? Please cut down on them
// to a minimum
#include "tao/ORB.h"
#include "tao/PortableServer/PortableServer.h"
#include "tao/PortableServer/Servant_Base.h"
#include "ciao/CCM_ContainerC.h"
#include "ciao/Container_Base.h"
#include "ciao/Deployment_CoreC.h"
#include "ciao/Dynamic_Component_Activator.h"
#include "ciao/CIAO_Server_Export.h"
#include "ciao/Servant_Activator.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
namespace CIAO
{
class Dynamic_Component_Servant_Base;
class CIAO_SERVER_Export Swapping_Container : public Session_Container
{
public:
Swapping_Container (CORBA::ORB_ptr o, Container_Impl *container_impl);
virtual ~Swapping_Container (void);
/// Initialize the container with a name.
virtual int init (const char *name = 0,
const CORBA::PolicyList *more_policies = 0
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual CORBA::Object_ptr install_servant (PortableServer::Servant p,
Container::OA_Type t
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual CORBA::Object_ptr get_objref (PortableServer::Servant p
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual void ciao_uninstall_home (Components::CCMHome_ptr homeref
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual CORBA::Object_ptr get_home_objref (PortableServer::Servant p
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual void add_servant_map (PortableServer::ObjectId &oid,
Dynamic_Component_Servant_Base* servant);
virtual void delete_servant_map (PortableServer::ObjectId &oid);
virtual void deactivate_facet (const PortableServer::ObjectId &oid
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
PortableServer::POA_ptr the_home_servant_POA (void) const;
private:
/// Create POA for the component.
void create_servant_POA (const char *name,
const CORBA::PolicyList *p,
PortableServer::POA_ptr root
ACE_ENV_ARG_DECL);
void create_home_servant_POA (const char *name,
const CORBA::PolicyList *p,
PortableServer::POA_ptr root
ACE_ENV_ARG_DECL);
void create_connections_POA (PortableServer::POA_ptr root
ACE_ENV_ARG_DECL);
protected:
unsigned long number_;
/// Static variable to store the highest number we have given out until
/// now
static ACE_Atomic_Op <ACE_SYNCH_MUTEX, unsigned long> serial_number_;
Dynamic_Component_Activator *dsa_;
};
}
// Macro for registration of an OBV factory in the generated
// servant class. Similar to the macro for TAO in
// tao/ValueType/ValueFactory.h but here we take advantage of
// the fact that we have access to the current ORB indirectly
// through the context and container.
// @@Jai, is this macro required here?
#define CIAO_REGISTER_OBV_FACTORY(FACTORY, VALUETYPE) \
{ \
CORBA::ValueFactory factory = new FACTORY; \
CORBA::ORB_ptr orb = \
this->context_->_ciao_the_Container ()->the_ORB (); \
CORBA::ValueFactory prev_factory = \
orb->register_value_factory ( \
VALUETYPE::_tao_obv_static_repository_id (), \
factory); \
CORBA::remove_ref (prev_factory); \
CORBA::add_ref (factory); \
}
#if defined (__ACE_INLINE__)
# include "Swapping_Container.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* CIAO_SWAPPING_CONTAINER_H */
|