POAUtility.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: FMTC do nov 2 13:06:20 CET 2006 POAUtility.cpp
3 
4  POAUtility.cpp - description
5  -------------------
6  begin : do november 02 2006
7  copyright : (C) 2006 FMTC
8  email : peter.soetens@fmtc.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 
39 
40 #include "POAUtility.h"
41 
42 PortableServer::POA_ptr
44  PortableServer::POA_ptr parentPOAP,
45  PortableServer::POAManager_ptr POAManagerP,
46  const char * POAName,
47  CORBA::Boolean isMultiThread,
48  CORBA::Boolean isPersistent
49 )
50 {
51  // Create a policy list.
52  CORBA::PolicyList policies;
53  policies.length(4);
54  CORBA::ULong i = 0;
55 
56  // Thread Policy
57  PortableServer::ThreadPolicyValue threadPolicy;
58 
59  if (isMultiThread) {
60  threadPolicy = PortableServer::ORB_CTRL_MODEL;
61  }
62  else {
63  threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
64  }
65  policies[i] = parentPOAP->create_thread_policy(threadPolicy);
66 
67  // Lifespan and IdAssignment Policies
68  PortableServer::LifespanPolicyValue lifeSpanPolicy;
69  PortableServer::IdAssignmentPolicyValue idAssignPolicy;
70  PortableServer::ImplicitActivationPolicyValue implicitActivationPolicy;
71 
72  if (isPersistent) {
73  // Policies for 'Entity' objects
74  lifeSpanPolicy = PortableServer::PERSISTENT;
75  idAssignPolicy = PortableServer::USER_ID;
76  }
77  else {
78  // Policies for 'Session' objects
79  lifeSpanPolicy = PortableServer::TRANSIENT;
80  idAssignPolicy = PortableServer::SYSTEM_ID;
81  }
82 
83  implicitActivationPolicy = PortableServer::IMPLICIT_ACTIVATION;
84 
85  // Lifespan Policy
86  i++;
87  policies[i] = parentPOAP->create_lifespan_policy(lifeSpanPolicy);
88 
89  // IdAssignment Policy
90  i++;
91  policies[i] = parentPOAP->create_id_assignment_policy(idAssignPolicy);
92 
93  // IdUniqueness Policy - Default = UNIQUE_ID
94 
95  // ImplicitActivation Policy - Default = NO_IMPLICIT_ACTIVATION
96  // Override by PS:
97  i++;
98  policies[i] = parentPOAP->create_implicit_activation_policy(implicitActivationPolicy);
99 
100 
101  // RequestProcessing Policy - Default = USE_ACTIVE_OBJECT_MAP_ONLY
102 
103  // ServantRetention Policy - Default = RETAIN
104 
105  return parentPOAP->create_POA(POAName, POAManagerP, policies);
106 }
107 
108 
109 PortableServer::POA_ptr
111  PortableServer::POA_ptr parentPOAP,
112  PortableServer::POAManager_ptr POAManagerP,
113  const char * POAName,
114  CORBA::Boolean isMultiThread
115 )
116 {
117  // Create a policy list.
118  CORBA::PolicyList policies;
119  policies.length(2);
120  CORBA::ULong i = 0;
121 
122  // Thread Policy
123  PortableServer::ThreadPolicyValue threadPolicy;
124 
125  if (isMultiThread) {
126  threadPolicy = PortableServer::ORB_CTRL_MODEL;
127  }
128  else {
129  threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
130  }
131  policies[i] = parentPOAP->create_thread_policy(threadPolicy);
132 
133  // LifeSpan Policy - Default = TRANSIENT
134 
135  // IdAssignment Policy - Default = SYSTEM_ID
136 
137  // IdUniqueness Policy
138  i++;
139  policies[i] = parentPOAP->create_id_uniqueness_policy(
140  PortableServer::MULTIPLE_ID
141  );
142 
143  // ImplicitActivation Policy - Default = NO_IMPLICIT_ACTIVATION
144 
145  // RequestProcessing Policy - Default = USE_ACTIVE_OBJECT_MAP_ONLY
146 
147  // ServantRetention Policy - Default = RETAIN
148 
149  return parentPOAP->create_POA(POAName, POAManagerP, policies);
150 }
151 
152 
153 PortableServer::POA_ptr
155  PortableServer::POA_ptr parentPOAP,
156  PortableServer::POAManager_ptr POAManagerP,
157  const char * POAName,
158  CORBA::Boolean isMultiThread,
159  CORBA::Boolean isPersistent
160 )
161 {
162  // Create a policy list.
163  CORBA::PolicyList policies;
164  policies.length(4);
165  CORBA::ULong i = 0;
166 
167  // Thread Policy
168  PortableServer::ThreadPolicyValue threadPolicy;
169 
170  if (isMultiThread) {
171  threadPolicy = PortableServer::ORB_CTRL_MODEL;
172  }
173  else {
174  threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
175  }
176  policies[i] = parentPOAP->create_thread_policy(threadPolicy);
177 
178  PortableServer::LifespanPolicyValue lifeSpanPolicy;
179  PortableServer::IdAssignmentPolicyValue idAssignPolicy;
180 
181  // Lifespan and IdAssignment Policies
182  if (isPersistent) {
183  // Policies for 'Entity' objects
184  lifeSpanPolicy = PortableServer::PERSISTENT;
185  idAssignPolicy = PortableServer::USER_ID;
186  }
187  else {
188  // Policies for 'Session' objects
189  lifeSpanPolicy = PortableServer::TRANSIENT;
190  idAssignPolicy = PortableServer::SYSTEM_ID;
191  }
192 
193  // Lifespan Policy
194  i++;
195  policies[i] = parentPOAP->create_lifespan_policy(lifeSpanPolicy);
196 
197  // IdAssignment Policy
198  i++;
199  policies[i] = parentPOAP->create_id_assignment_policy(idAssignPolicy);
200 
201  // IdUniqueness Policy - Default = UNIQUE_ID
202 
203  // ImplicitActivation Policy - Default = NO_IMPLICIT_ACTIVATION
204 
205  // RequestProcessing Policy
206  i++;
207  policies[i] = parentPOAP->create_request_processing_policy(
208  PortableServer::USE_SERVANT_MANAGER
209  );
210 
211  // ServantRetention Policy - Default = RETAIN
212 
213  return parentPOAP->create_POA(POAName, POAManagerP, policies);
214 }
215 
216 
217 PortableServer::POA_ptr
219  PortableServer::POA_ptr parentPOAP,
220  PortableServer::POAManager_ptr POAManagerP,
221  const char * POAName,
222  CORBA::Boolean isMultiThread,
223  CORBA::Boolean isPersistent
224 )
225 {
226  // Create a policy list.
227  CORBA::PolicyList policies;
228  policies.length(5);
229  CORBA::ULong i = 0;
230 
231  // Thread Policy
232  PortableServer::ThreadPolicyValue threadPolicy;
233 
234  if (isMultiThread) {
235  threadPolicy = PortableServer::ORB_CTRL_MODEL;
236  }
237  else {
238  threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
239  }
240  policies[i] = parentPOAP->create_thread_policy(threadPolicy);
241 
242  PortableServer::LifespanPolicyValue lifeSpanPolicy;
243  PortableServer::IdAssignmentPolicyValue idAssignPolicy;
244 
245  // Lifespan and IdAssignment Policies
246  if (isPersistent) {
247  // Policies for 'Entity' objects
248  lifeSpanPolicy = PortableServer::PERSISTENT;
249  idAssignPolicy = PortableServer::USER_ID;
250  }
251  else {
252  // Policies for 'Session' objects
253  lifeSpanPolicy = PortableServer::TRANSIENT;
254  idAssignPolicy = PortableServer::SYSTEM_ID;
255  }
256 
257  // Lifespan Policy
258  i++;
259  policies[i] = parentPOAP->create_lifespan_policy(lifeSpanPolicy);
260 
261  // IdAssignment Policy
262  i++;
263  policies[i] = parentPOAP->create_id_assignment_policy(idAssignPolicy);
264 
265  // IdUniqueness Policy - Default = UNIQUE_ID
266 
267  // ImplicitActivation Policy - Default = NO_IMPLICIT_ACTIVATION
268 
269  // RequestProcessing Policy
270  i++;
271  policies[i] = parentPOAP->create_request_processing_policy(
272  PortableServer::USE_SERVANT_MANAGER
273  );
274 
275  // ServantRetention Policy
276  i++;
277  policies[i] = parentPOAP->create_servant_retention_policy(
278  PortableServer::NON_RETAIN
279  );
280 
281  return parentPOAP->create_POA(POAName, POAManagerP, policies);
282 }
283 
284 
285 PortableServer::POA_ptr
287  PortableServer::POA_ptr parentPOAP,
288  PortableServer::POAManager_ptr POAManagerP,
289  const char * POAName,
290  CORBA::Boolean isMultiThread
291 )
292 {
293  // Create a policy list.
294  CORBA::PolicyList policies;
295  policies.length(3);
296  CORBA::ULong i = 0;
297 
298  // Thread Policy
299  PortableServer::ThreadPolicyValue threadPolicy;
300 
301  if (isMultiThread) {
302  threadPolicy = PortableServer::ORB_CTRL_MODEL;
303  }
304  else {
305  threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
306  }
307  policies[i] = parentPOAP->create_thread_policy(threadPolicy);
308 
309  // LifeSpan Policy - Default = TRANSIENT
310 
311  // IdAssignment Policy - Default = SYSTEM_ID
312 
313  // IdUniqueness Policy - Default = UNIQUE_ID
314 
315  // ImplicitActivation Policy - Default = NO_IMPLICIT_ACTIVATION
316 
317  // RequestProcessing Policy
318  i++;
319  policies[i] = parentPOAP->create_request_processing_policy(
320  PortableServer::USE_DEFAULT_SERVANT
321  );
322 
323  // ServantRetention Policy
324  i++;
325  policies[i] = parentPOAP->create_servant_retention_policy(
326  PortableServer::NON_RETAIN
327  );
328 
329  return parentPOAP->create_POA(POAName, POAManagerP, policies);
330 }
331 
332 
static PortableServer::POA_ptr create_service_POA(PortableServer::POA_ptr parentPOAP, PortableServer::POAManager_ptr POAManagerP, const char *POAName, CORBA::Boolean isMultiThread)
Definition: POAUtility.cpp:110
static PortableServer::POA_ptr create_servant_activator_POA(PortableServer::POA_ptr parentPOAP, PortableServer::POAManager_ptr POAManagerP, const char *POAName, CORBA::Boolean isMultiThread, CORBA::Boolean isPersistent)
Definition: POAUtility.cpp:154
static PortableServer::POA_ptr create_default_servant_POA(PortableServer::POA_ptr parentPOAP, PortableServer::POAManager_ptr POAManagerP, const char *POAName, CORBA::Boolean isMultiThread)
Definition: POAUtility.cpp:286
static PortableServer::POA_ptr create_basic_POA(PortableServer::POA_ptr parentPOAP, PortableServer::POAManager_ptr POAManagerP, const char *POAName, CORBA::Boolean isMultiThread, CORBA::Boolean isPersistent)
Definition: POAUtility.cpp:43
static PortableServer::POA_ptr create_servant_locator_POA(PortableServer::POA_ptr parentPOAP, PortableServer::POAManager_ptr POAManagerP, const char *POAName, CORBA::Boolean isMultiThread, CORBA::Boolean isPersistent)
Definition: POAUtility.cpp:218


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:34