Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include "POAUtility.h"
00041
00042 PortableServer::POA_ptr
00043 POAUtility::create_basic_POA(
00044 PortableServer::POA_ptr parentPOAP,
00045 PortableServer::POAManager_ptr POAManagerP,
00046 const char * POAName,
00047 CORBA::Boolean isMultiThread,
00048 CORBA::Boolean isPersistent
00049 )
00050 {
00051
00052 CORBA::PolicyList policies;
00053 policies.length(4);
00054 CORBA::ULong i = 0;
00055
00056
00057 PortableServer::ThreadPolicyValue threadPolicy;
00058
00059 if (isMultiThread) {
00060 threadPolicy = PortableServer::ORB_CTRL_MODEL;
00061 }
00062 else {
00063 threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
00064 }
00065 policies[i] = parentPOAP->create_thread_policy(threadPolicy);
00066
00067
00068 PortableServer::LifespanPolicyValue lifeSpanPolicy;
00069 PortableServer::IdAssignmentPolicyValue idAssignPolicy;
00070 PortableServer::ImplicitActivationPolicyValue implicitActivationPolicy;
00071
00072 if (isPersistent) {
00073
00074 lifeSpanPolicy = PortableServer::PERSISTENT;
00075 idAssignPolicy = PortableServer::USER_ID;
00076 }
00077 else {
00078
00079 lifeSpanPolicy = PortableServer::TRANSIENT;
00080 idAssignPolicy = PortableServer::SYSTEM_ID;
00081 }
00082
00083 implicitActivationPolicy = PortableServer::IMPLICIT_ACTIVATION;
00084
00085
00086 i++;
00087 policies[i] = parentPOAP->create_lifespan_policy(lifeSpanPolicy);
00088
00089
00090 i++;
00091 policies[i] = parentPOAP->create_id_assignment_policy(idAssignPolicy);
00092
00093
00094
00095
00096
00097 i++;
00098 policies[i] = parentPOAP->create_implicit_activation_policy(implicitActivationPolicy);
00099
00100
00101
00102
00103
00104
00105 return parentPOAP->create_POA(POAName, POAManagerP, policies);
00106 }
00107
00108
00109 PortableServer::POA_ptr
00110 POAUtility::create_service_POA(
00111 PortableServer::POA_ptr parentPOAP,
00112 PortableServer::POAManager_ptr POAManagerP,
00113 const char * POAName,
00114 CORBA::Boolean isMultiThread
00115 )
00116 {
00117
00118 CORBA::PolicyList policies;
00119 policies.length(2);
00120 CORBA::ULong i = 0;
00121
00122
00123 PortableServer::ThreadPolicyValue threadPolicy;
00124
00125 if (isMultiThread) {
00126 threadPolicy = PortableServer::ORB_CTRL_MODEL;
00127 }
00128 else {
00129 threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
00130 }
00131 policies[i] = parentPOAP->create_thread_policy(threadPolicy);
00132
00133
00134
00135
00136
00137
00138 i++;
00139 policies[i] = parentPOAP->create_id_uniqueness_policy(
00140 PortableServer::MULTIPLE_ID
00141 );
00142
00143
00144
00145
00146
00147
00148
00149 return parentPOAP->create_POA(POAName, POAManagerP, policies);
00150 }
00151
00152
00153 PortableServer::POA_ptr
00154 POAUtility::create_servant_activator_POA(
00155 PortableServer::POA_ptr parentPOAP,
00156 PortableServer::POAManager_ptr POAManagerP,
00157 const char * POAName,
00158 CORBA::Boolean isMultiThread,
00159 CORBA::Boolean isPersistent
00160 )
00161 {
00162
00163 CORBA::PolicyList policies;
00164 policies.length(4);
00165 CORBA::ULong i = 0;
00166
00167
00168 PortableServer::ThreadPolicyValue threadPolicy;
00169
00170 if (isMultiThread) {
00171 threadPolicy = PortableServer::ORB_CTRL_MODEL;
00172 }
00173 else {
00174 threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
00175 }
00176 policies[i] = parentPOAP->create_thread_policy(threadPolicy);
00177
00178 PortableServer::LifespanPolicyValue lifeSpanPolicy;
00179 PortableServer::IdAssignmentPolicyValue idAssignPolicy;
00180
00181
00182 if (isPersistent) {
00183
00184 lifeSpanPolicy = PortableServer::PERSISTENT;
00185 idAssignPolicy = PortableServer::USER_ID;
00186 }
00187 else {
00188
00189 lifeSpanPolicy = PortableServer::TRANSIENT;
00190 idAssignPolicy = PortableServer::SYSTEM_ID;
00191 }
00192
00193
00194 i++;
00195 policies[i] = parentPOAP->create_lifespan_policy(lifeSpanPolicy);
00196
00197
00198 i++;
00199 policies[i] = parentPOAP->create_id_assignment_policy(idAssignPolicy);
00200
00201
00202
00203
00204
00205
00206 i++;
00207 policies[i] = parentPOAP->create_request_processing_policy(
00208 PortableServer::USE_SERVANT_MANAGER
00209 );
00210
00211
00212
00213 return parentPOAP->create_POA(POAName, POAManagerP, policies);
00214 }
00215
00216
00217 PortableServer::POA_ptr
00218 POAUtility::create_servant_locator_POA(
00219 PortableServer::POA_ptr parentPOAP,
00220 PortableServer::POAManager_ptr POAManagerP,
00221 const char * POAName,
00222 CORBA::Boolean isMultiThread,
00223 CORBA::Boolean isPersistent
00224 )
00225 {
00226
00227 CORBA::PolicyList policies;
00228 policies.length(5);
00229 CORBA::ULong i = 0;
00230
00231
00232 PortableServer::ThreadPolicyValue threadPolicy;
00233
00234 if (isMultiThread) {
00235 threadPolicy = PortableServer::ORB_CTRL_MODEL;
00236 }
00237 else {
00238 threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
00239 }
00240 policies[i] = parentPOAP->create_thread_policy(threadPolicy);
00241
00242 PortableServer::LifespanPolicyValue lifeSpanPolicy;
00243 PortableServer::IdAssignmentPolicyValue idAssignPolicy;
00244
00245
00246 if (isPersistent) {
00247
00248 lifeSpanPolicy = PortableServer::PERSISTENT;
00249 idAssignPolicy = PortableServer::USER_ID;
00250 }
00251 else {
00252
00253 lifeSpanPolicy = PortableServer::TRANSIENT;
00254 idAssignPolicy = PortableServer::SYSTEM_ID;
00255 }
00256
00257
00258 i++;
00259 policies[i] = parentPOAP->create_lifespan_policy(lifeSpanPolicy);
00260
00261
00262 i++;
00263 policies[i] = parentPOAP->create_id_assignment_policy(idAssignPolicy);
00264
00265
00266
00267
00268
00269
00270 i++;
00271 policies[i] = parentPOAP->create_request_processing_policy(
00272 PortableServer::USE_SERVANT_MANAGER
00273 );
00274
00275
00276 i++;
00277 policies[i] = parentPOAP->create_servant_retention_policy(
00278 PortableServer::NON_RETAIN
00279 );
00280
00281 return parentPOAP->create_POA(POAName, POAManagerP, policies);
00282 }
00283
00284
00285 PortableServer::POA_ptr
00286 POAUtility::create_default_servant_POA(
00287 PortableServer::POA_ptr parentPOAP,
00288 PortableServer::POAManager_ptr POAManagerP,
00289 const char * POAName,
00290 CORBA::Boolean isMultiThread
00291 )
00292 {
00293
00294 CORBA::PolicyList policies;
00295 policies.length(3);
00296 CORBA::ULong i = 0;
00297
00298
00299 PortableServer::ThreadPolicyValue threadPolicy;
00300
00301 if (isMultiThread) {
00302 threadPolicy = PortableServer::ORB_CTRL_MODEL;
00303 }
00304 else {
00305 threadPolicy = PortableServer::SINGLE_THREAD_MODEL;
00306 }
00307 policies[i] = parentPOAP->create_thread_policy(threadPolicy);
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318 i++;
00319 policies[i] = parentPOAP->create_request_processing_policy(
00320 PortableServer::USE_DEFAULT_SERVANT
00321 );
00322
00323
00324 i++;
00325 policies[i] = parentPOAP->create_servant_retention_policy(
00326 PortableServer::NON_RETAIN
00327 );
00328
00329 return parentPOAP->create_POA(POAName, POAManagerP, policies);
00330 }
00331
00332