summaryrefslogtreecommitdiff
path: root/CIAO/ciao/FTComponentServer/CIAO_Container_Impl.h
blob: c12026b2a6fdb0a65cfccbc0692993a9733b4d4f (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/**
 * @file CIAO_Container.h
 * @author William R. Otte <wotte@dre.vanderbilt.edu>
 */

#ifndef CIAO_CONTAINER_H_
#define CIAO_CONTAINER_H_

#include "CIAO_ComponentServerS.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ciao/Containers/FTSession/FT_Session_Container.h"

#include "CIAO_FTComponentServer_svnt_export.h"

namespace CIAO
{
  namespace Deployment
  {
    /**
     * @class CIAO_Container
     * @brief Implements external interface for CIAO container.
     */
    class CIAO_FTComponentServer_svnt_Export CIAO_Container_i
      : public virtual POA_CIAO::Deployment::Container
    {
    public:
      // Constructor
      CIAO_Container_i (const Components::ConfigValues &config,
			const Static_Config_EntryPoints_Maps *,
			const char *,
			const CORBA::PolicyList *,
			CORBA::ORB_ptr,
			PortableServer::POA_ptr);
      // Destructor
      virtual ~CIAO_Container_i (void);

      virtual
	::Components::CCMObject_ptr install_component (const char * id,
						       const char * entrypt,
						       const ::Components::ConfigValues & config);

      virtual
	void remove_component (::Components::CCMObject_ptr cref);

      virtual
	::CIAO::Deployment::CCMObjects * get_components (void);

      virtual
	::Components::ConfigValues * configuration (void);

      virtual
	::Components::Deployment::ComponentServer_ptr get_component_server (void);

      virtual
	::Components::CCMHome_ptr install_home (const char * id,
						const char * entrypt,
						const ::Components::ConfigValues & config);

      virtual
	void remove_home (::Components::CCMHome_ptr href);

      virtual
	::Components::CCMHomes * get_homes (void);

      virtual
	void remove (void);

      virtual void activate_component (::Components::CCMObject_ptr comp);

      virtual void passivate_component (::Components::CCMObject_ptr comp);

      virtual PortableServer::POA_ptr _default_POA (void);

    private:
      /// Keep a pointer to the managing ORB serving this servant.
      CORBA::ORB_var orb_;

      PortableServer::POA_var poa_;

      CIAO::Container_var container_;

      Components::ConfigValues config_;

      const Static_Config_EntryPoints_Maps* static_entrypts_maps_;

      /// To store all created CCMHome object
      typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
	Components::CCMHome_var,
	ACE_Hash<ACE_CString>,
	ACE_Equal_To<ACE_CString>,
	ACE_Null_Mutex> CCMHome_Map;
      typedef CCMHome_Map::iterator Home_Iterator;
      CCMHome_Map home_map_;

      /// To store all created Component object.
      // @@Gan, see how this caching is duplicated..
      typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
	Components::CCMObject_var,
	ACE_Hash<ACE_CString>,
	ACE_Equal_To<ACE_CString>,
	ACE_Null_Mutex> CCMComponent_Map;
      typedef CCMComponent_Map::iterator Component_Iterator;
      CCMComponent_Map component_map_;

      typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
				      ACE_CString,
				      ACE_Hash<ACE_CString>,
				      ACE_Equal_To<ACE_CString>,
				      ACE_Null_Mutex> CCMNaming_Map;
      CCMNaming_Map naming_map_;

    };
  }
}
#endif /* CIAO_CONTAINER_H_ */