blob: 78ffea927788a54556ee6038f0aa42a21d26f30a (
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
|
// This may look like C, but it's really -*- C++ -*-
//=============================================================================
/**
* @file CSD_Strategy_Proxy.h
*
* $Id$
*
* @author Tim Bradley <bradley_t@ociweb.com>
*/
//=============================================================================
#ifndef TAO_SERVANT_DISPATCHING_STRATEGY_PROXY_H
#define TAO_SERVANT_DISPATCHING_STRATEGY_PROXY_H
#include /**/ "ace/pre.h"
#include "CSD_FW_Export.h"
#include "tao/PortableServer/PortableServer.h"
#include "tao/PortableServer/Servant_Upcall.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "CSD_Strategy_Base.h"
class TAO_ServerRequest;
namespace TAO
{
namespace CSD
{
/**
* @class Strategy_Proxy
*
* @brief Proxy class for the Custom Servant Dispatching Strategy.
*
* If no custom servant dispatching strategy is provided to the proxy,
* then the "default servant dispatching strategy" logic is used.
*/
class TAO_CSD_FW_Export Strategy_Proxy
{
public:
/// Default Constructor.
Strategy_Proxy();
/// Destructor.
~Strategy_Proxy();
/// Mutator to provide the proxy with a CSD Strategy object.
/// A return value of true indicates success, and false indicates
/// failure to set the custom strategy on the proxy object.
bool custom_strategy(CSD_Framework::Strategy_ptr strategy);
/// Invoked by the Object_Adapter using an ORB thread.
///
/// If the proxy object holds a custom strategy object, then this method
/// will simply delegate to the custom strategy object. Otherwise,
/// this method will perform the "default servant dispatching strategy"
/// logic, preserving the original logic path as it was prior to the
/// introduction of the Custom Servant Dispatching feature.
///
/// This method will be inlined (if inlining is turned on during the build).
///
/// The added cost to the original logic path will be this method
/// invocation + one conditional (an is_nil() call/comparison for truth on
/// the smart pointer to the custom dispatching strategy object).
void dispatch_request(TAO_ServerRequest& server_request,
TAO::Portable_Server::Servant_Upcall& upcall
ACE_ENV_ARG_DECL);
/// Event - The POA has been (or is being) activated.
bool poa_activated_event();
/// Event - The POA has been deactivated.
void poa_deactivated_event();
/// Event - A servant has been activated.
void servant_activated_event(PortableServer::Servant servant,
const PortableServer::ObjectId& oid
ACE_ENV_ARG_DECL);
/// Event - A servant has been deactivated.
void servant_deactivated_event(PortableServer::Servant servant,
const PortableServer::ObjectId& oid
ACE_ENV_ARG_DECL);
private:
/// Smart Pointer to a custom servant dispatching strategy object.
/// This smart pointer will be in the "nil" state when the "default"
/// strategy is to be applied.
CSD_Framework::Strategy_var strategy_;
TAO::CSD::Strategy_Base *strategy_impl_;
};
}
}
#if defined (__ACE_INLINE__)
# include "CSD_Strategy_Proxy.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif
|