summaryrefslogtreecommitdiff
path: root/trunk/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec.h
blob: bdafdd2ed94a36075d6d410001a5268fcd2f9f28 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
//$Id$

//===================================================================
/**
 * @file TSEC_CheckPoint_exec.h
 *
 * Header file for the Executor implementation.
 */
//===================================================================

#ifndef TSEC_CheckPoint_EXEC_H
#define TSEC_CheckPoint_EXEC_H

//-------------------------------------------------------------------
// Includes
//-------------------------------------------------------------------

#include "ace/Thread_Manager.h"
#include "ace/Task.h"

#include "tao/LocalObject.h"

#include "ciao/Session_Container.h"

#include "ENWS.h"
#include "TSEC_CheckPointEIC.h"
#include "TSEC_CheckPoint_exec_export.h"


//-------------------------------------------------------------------
// Defines
//-------------------------------------------------------------------

#define TSEC_SESSION_ID_MAX    0xffffffff
#define TSEC_SESSION_MAX_IDENT 2


//-------------------------------------------------------------------
// Type definitions
//-------------------------------------------------------------------


//-------------------------------------------------------------------
// Forward declarations
//-------------------------------------------------------------------


//-------------------------------------------------------------------
// Classes
//-------------------------------------------------------------------

namespace Impl
{
  typedef ACE_SYNCH_MUTEX TMutex;

  class TSEC_CheckPoint_exec_i;

  class TSEC_Session_impl :
    public virtual POA_ENW::TSession,
    public virtual TAO_Local_RefCounted_Object
  {
  public:

    TSEC_Session_impl
    (
      TSEC_CheckPoint_exec_i& Parent,
      CORBA::Long             Ident
    );

    virtual ~TSEC_Session_impl();

    CORBA::Long getIdent();
    CORBA::Boolean isInUse();
    void isInUse( CORBA::Boolean Flag ) { _isInUse = Flag; }

  protected:
    CORBA::Boolean _isInUse;
    CORBA::Long    _ident;

    TSEC_CheckPoint_exec_i& _parent;

    CORBA::ULong hash
    (
      CORBA::ULong Maximum
    );

    TSEC_CheckPoint_exec_i& getParent() { return _parent; }

  };

  struct TSEC_SessionEntry
  {
    TSEC_SessionEntry();

    TSEC_SessionEntry
    (
      TSEC_Session_impl* pSessionImpl,
      ENW::TSession_ptr  Session
    );

    TSEC_Session_impl* _p_sessionImpl;
    ENW::TSession_var  _session;
  };

  class TSEC_CHECKPOINT_EXEC_Export TSEC_CheckPoint_exec_i :
    public virtual ENW::TSEC_CheckPoint_Exec,
    public virtual TAO_Local_RefCounted_Object
  {
  public:
    TSEC_CheckPoint_exec_i();
    TSEC_CheckPoint_exec_i( const char* Version );

    virtual ~TSEC_CheckPoint_exec_i();

    // Attribute Operationen:
    //


    // Interface ISessionService
    //

    virtual ENW::CCM_ISessionService_ptr get_sessionService
    (
    );


    virtual ENW::TSession_ptr createSession
    (
    );

    virtual CORBA::Boolean destroySession
    (
      ENW::TSession_ptr Session
    );

    virtual ENW::TSession_ptr acquireSession
    (
      CORBA::Long Ident
    );

    virtual CORBA::Boolean releaseSession
    (
      CORBA::Long       Ident,
      ENW::TSession_ptr Session
    );


    // Events
    //

    virtual void push_lifeTokenIn
    (
      ENW::ET_LifeToken* Event
    );


    // Operations from Components::SessionComponent
    //

    virtual void set_session_context
    (
      Components::SessionContext_ptr ctx
    );

    virtual void ciao_preactivate
    (
    );

    virtual void ccm_activate
    (
    );

    virtual void ciao_postactivate
    (
    );


    virtual void ccm_passivate
    (
    );

    virtual void ccm_remove
    (
    );

    CORBA::Object_ptr getObjRef
    (
      PortableServer::Servant Servant
    );

    int init(
    );

    CORBA::Object_ptr installServant
    (
      PortableServer::Servant Servant
    );

    void uninstallServant
    (
      CORBA::Object_ptr ObjRef
    );

    TMutex& getMutex() { return _mutex; }

  protected:
    // Copmponent specific context

    ENW::CCM_TSEC_CheckPoint_Context_var _context;
    ::CIAO::Session_Container*           _p_sessionContainer;
    TMutex                               _mutex;
    CORBA::ORB_var                       _orb;

  private:
    bool              _awaitingLifeToken;
    bool              _isActivated;

    //TSEC_Session_impl* sessionVector[TSEC_SESSION_MAX_IDENT];
    TSEC_SessionEntry sessionVector[TSEC_SESSION_MAX_IDENT];
  };

  /**
    *  home executor implementation class.
    */
  class TSEC_CHECKPOINT_EXEC_Export TSEC_CheckPointHome_exec_i :
    public virtual ENW::CCM_TSEC_CheckPointHome,
    public virtual TAO_Local_RefCounted_Object
  {
  public:

    TSEC_CheckPointHome_exec_i();

    virtual ~TSEC_CheckPointHome_exec_i();

    // Explicit home operations.
    virtual ::Components::EnterpriseComponent_ptr new_TSEC_CheckPoint
    (
      const char* Version
      );

    // Implicit home operations.
    virtual ::Components::EnterpriseComponent_ptr create
    (
    );
  };
}  // Impl

extern "C" TSEC_CHECKPOINT_EXEC_Export ::Components::HomeExecutorBase_ptr
createTSEC_CheckPointHome_Impl();

#endif // TSEC_CheckPoint_EXEC_H