Go to the documentation of this file.00001
00002 #include "tao/PI_Server/PortableServer_PolicyFactory.h"
00003
00004 #include "tao/PortableServer/ThreadPolicy.h"
00005 #include "tao/PortableServer/LifespanPolicy.h"
00006 #include "tao/PortableServer/IdAssignmentPolicy.h"
00007 #include "tao/PortableServer/IdUniquenessPolicy.h"
00008 #include "tao/PortableServer/ImplicitActivationPolicy.h"
00009 #include "tao/PortableServer/RequestProcessingPolicy.h"
00010 #include "tao/PortableServer/ServantRetentionPolicy.h"
00011 #include "tao/PortableServer/PortableServer.h"
00012 #include "tao/PI_Server/Policy_Creator_T.h"
00013
00014 ACE_RCSID (PI_Server,
00015 PortableServer_PolicyFactory,
00016 "$Id: PortableServer_PolicyFactory.cpp 76995 2007-02-11 12:51:42Z johnnyw $")
00017
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020 CORBA::Policy_ptr
00021 TAO_PortableServer_PolicyFactory::create_policy (
00022 CORBA::PolicyType type,
00023 const CORBA::Any &value)
00024 {
00025 #if !defined (CORBA_E_MICRO)
00026 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT)
00027
00028 if (type == ::PortableServer::THREAD_POLICY_ID)
00029 {
00030 TAO::Portable_Server::ThreadPolicy *thread_policy = 0;
00031 PortableServer::ThreadPolicyValue thr_value;
00032
00033 TAO::Portable_Server::create_policy (thread_policy, thr_value, value);
00034
00035 return thread_policy;
00036 }
00037
00038 #endif
00039 if (type == PortableServer::LIFESPAN_POLICY_ID)
00040 {
00041 TAO::Portable_Server::LifespanPolicy *lifespan_policy = 0;
00042 PortableServer::LifespanPolicyValue lifespan_value;
00043
00044 TAO::Portable_Server::create_policy (lifespan_policy, lifespan_value, value);
00045
00046 return lifespan_policy;
00047 }
00048
00049 if (type == PortableServer::ID_UNIQUENESS_POLICY_ID)
00050 {
00051 TAO::Portable_Server::IdUniquenessPolicy *id_uniqueness_policy = 0;
00052 PortableServer::IdUniquenessPolicyValue id_uniqueness_value;
00053
00054 TAO::Portable_Server::create_policy (id_uniqueness_policy, id_uniqueness_value, value);
00055
00056 return id_uniqueness_policy;
00057 }
00058
00059 if (type == PortableServer::ID_ASSIGNMENT_POLICY_ID)
00060 {
00061 TAO::Portable_Server::IdAssignmentPolicy *id_assignment_policy = 0;
00062 PortableServer::IdAssignmentPolicyValue id_assignment_value;
00063
00064 TAO::Portable_Server::create_policy (id_assignment_policy, id_assignment_value, value);
00065
00066 return id_assignment_policy;
00067 }
00068
00069 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT)
00070
00071 if (type == PortableServer::IMPLICIT_ACTIVATION_POLICY_ID)
00072 {
00073 TAO::Portable_Server::ImplicitActivationPolicy *implicit_activatation_policy = 0;
00074 PortableServer::ImplicitActivationPolicyValue implicit_activation_value;
00075
00076 TAO::Portable_Server::create_policy (implicit_activatation_policy, implicit_activation_value, value);
00077
00078 return implicit_activatation_policy;
00079 }
00080
00081 if (type == PortableServer::SERVANT_RETENTION_POLICY_ID)
00082 {
00083 TAO::Portable_Server::ServantRetentionPolicy *servant_retention_policy = 0;
00084 PortableServer::ServantRetentionPolicyValue servant_retention_value;
00085
00086 TAO::Portable_Server::create_policy (servant_retention_policy, servant_retention_value, value);
00087
00088 return servant_retention_policy;
00089 }
00090
00091 if (type == PortableServer::REQUEST_PROCESSING_POLICY_ID)
00092 {
00093 TAO::Portable_Server::RequestProcessingPolicy *request_processing_policy = 0;
00094 PortableServer::RequestProcessingPolicyValue request_processing_value;
00095
00096 TAO::Portable_Server::create_policy (request_processing_policy, request_processing_value, value);
00097
00098 return request_processing_policy;
00099 }
00100
00101 #endif
00102
00103 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
00104 #else
00105 ACE_UNUSED_ARG (value);
00106 ACE_UNUSED_ARG (type);
00107
00108 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
00109 #endif
00110 }
00111
00112 TAO_END_VERSIONED_NAMESPACE_DECL