summaryrefslogtreecommitdiff
path: root/trunk/TAO/tao/PortableServer/POA_Cached_Policies.cpp
blob: d531f09197fb7dc24c129b0bc9aaccad5d865306 (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
// $Id$

#include "tao/PortableServer/POA_Cached_Policies.h"
#include "tao/PortableServer/POA_Policy_Set.h"
#include "tao/PortableServer/IdAssignmentPolicyC.h"
#include "tao/PortableServer/IdUniquenessPolicyC.h"
#include "tao/PortableServer/ImplicitActivationPolicyC.h"
#include "tao/PortableServer/LifespanPolicyC.h"
#include "tao/PortableServer/RequestProcessingPolicyC.h"
#include "tao/PortableServer/ServantRetentionPolicyC.h"
#include "tao/PortableServer/ThreadPolicyC.h"

#if !defined (__ACE_INLINE__)
# include "tao/PortableServer/POA_Cached_Policies.inl"
#endif /* ! __ACE_INLINE__ */

ACE_RCSID(PortableServer,
          POA_Cached_Policies,
          "$Id$")

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace Portable_Server
  {
    Cached_Policies::Cached_Policies () :
        thread_ (::PortableServer::ORB_CTRL_MODEL),
        lifespan_ (::PortableServer::TRANSIENT),
        id_uniqueness_ (::PortableServer::UNIQUE_ID),
        id_assignment_ (::PortableServer::SYSTEM_ID),
        implicit_activation_ (::PortableServer::NO_IMPLICIT_ACTIVATION),
        servant_retention_ (::PortableServer::RETAIN),
        request_processing_ (::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY),
        priority_model_ (Cached_Policies::NOT_SPECIFIED),
        server_priority_ (TAO_INVALID_PRIORITY),
        network_priority_model_ (Cached_Policies::NO_NETWORK_PRIORITY),
        request_diffserv_codepoint_ (0),
        reply_diffserv_codepoint_ (0)
    {
    }


    Cached_Policies::~Cached_Policies (void)
    {
    }

    void
    Cached_Policies::update (TAO_POA_Policy_Set &policy_set
                                     )
    {
      for (CORBA::ULong i = 0; i < policy_set.num_policies (); i++)
        {
          CORBA::Policy_var policy = policy_set.get_policy_by_index (i);

          this->update_policy (policy.in ()
                              );
        }
    }

    void
    Cached_Policies::update_policy (const CORBA::Policy_ptr policy
                                    )
    {

    #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
      ::PortableServer::ThreadPolicy_var thread
        = ::PortableServer::ThreadPolicy::_narrow (policy
                                                  );

      if (!CORBA::is_nil (thread.in ()))
        {
          this->thread_ = thread->value ();

          return;
        }
    #endif /* TAO_HAS_MINIMUM_POA == 0 */

    #if !defined (CORBA_E_MICRO)
      ::PortableServer::LifespanPolicy_var lifespan
        = ::PortableServer::LifespanPolicy::_narrow (policy
                                                    );

      if (!CORBA::is_nil (lifespan.in ()))
        {
          this->lifespan_ = lifespan->value ();

          return;
        }
    #endif

    #if !defined (CORBA_E_MICRO)
      ::PortableServer::IdUniquenessPolicy_var id_uniqueness
        = ::PortableServer::IdUniquenessPolicy::_narrow (policy
                                                        );

      if (!CORBA::is_nil (id_uniqueness.in ()))
        {
          this->id_uniqueness_ = id_uniqueness->value ();

          return;
        }
    #endif

    #if !defined (CORBA_E_MICRO)
      ::PortableServer::IdAssignmentPolicy_var id_assignment
        = ::PortableServer::IdAssignmentPolicy::_narrow (policy
                                                        );

      if (!CORBA::is_nil (id_assignment.in ()))
        {
          this->id_assignment_ = id_assignment->value ();

          return;
        }
    #endif

    #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)

      ::PortableServer::ImplicitActivationPolicy_var implicit_activation
        = ::PortableServer::ImplicitActivationPolicy::_narrow (policy
                                                              );

      if (!CORBA::is_nil (implicit_activation.in ()))
        {
          this->implicit_activation_ = implicit_activation->value ();

          return;
        }

      ::PortableServer::ServantRetentionPolicy_var servant_retention
        = ::PortableServer::ServantRetentionPolicy::_narrow (policy
                                                            );

      if (!CORBA::is_nil (servant_retention.in ()))
        {
          this->servant_retention_ = servant_retention->value ();

          return;
        }

      ::PortableServer::RequestProcessingPolicy_var request_processing
        = ::PortableServer::RequestProcessingPolicy::_narrow (policy
                                                             );

      if (!CORBA::is_nil (request_processing.in ()))
        {
          this->request_processing_ = request_processing->value ();

          return;
        }

    #endif /* TAO_HAS_MINIMUM_POA == 0 */

    #if defined (CORBA_E_MICRO)
      ACE_UNUSED_ARG (policy);
    #endif
    }
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL