00001 #include "tao/Messaging/Messaging_PolicyFactory.h" 00002 00003 ACE_RCSID (Messaging, 00004 Messaging_PolicyFactory, 00005 "$Id: Messaging_PolicyFactory.cpp 79231 2007-08-06 18:32:54Z johnnyw $") 00006 00007 #include "tao/Messaging/Messaging_Policy_i.h" 00008 #include "tao/Messaging/Connection_Timeout_Policy_i.h" 00009 #include "tao/Messaging/Buffering_Constraint_Policy.h" 00010 00011 #include "tao/PolicyC.h" 00012 #include "tao/AnyTypeCode/Any.h" 00013 00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 CORBA::Policy_ptr 00017 TAO_Messaging_PolicyFactory::create_policy ( 00018 CORBA::PolicyType type, 00019 const CORBA::Any &value) 00020 { 00021 #if (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1) 00022 if (type == Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE) 00023 return TAO_RelativeRoundtripTimeoutPolicy::create (value); 00024 #endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */ 00025 00026 #if (TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1) 00027 if (type == TAO::CONNECTION_TIMEOUT_POLICY_TYPE) 00028 return TAO_ConnectionTimeoutPolicy::create (value); 00029 #endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */ 00030 00031 #if (TAO_HAS_SYNC_SCOPE_POLICY == 1) 00032 if (type == Messaging::SYNC_SCOPE_POLICY_TYPE) 00033 return TAO_Sync_Scope_Policy::create (value); 00034 #endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */ 00035 00036 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) 00037 if (type == TAO::BUFFERING_CONSTRAINT_POLICY_TYPE) 00038 return TAO_Buffering_Constraint_Policy::create (value); 00039 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */ 00040 00041 if ( 00042 #if (TAO_HAS_REBIND_POLICY == 1) 00043 type == Messaging::REBIND_POLICY_TYPE || 00044 #endif /* TAO_HAS_REBIND_POLICY == 1 */ 00045 #if (TAO_HAS_PRIORITY_POLICIES == 1) 00046 type == Messaging::REQUEST_PRIORITY_POLICY_TYPE || 00047 type == Messaging::REPLY_PRIORITY_POLICY_TYPE || 00048 #endif /* TAO_HAS_PRIORITY_POLICIES == 1 */ 00049 #if (TAO_HAS_REQUEST_START_TIME_POLICY == 1) 00050 type == Messaging::REQUEST_START_TIME_POLICY_TYPE || 00051 #endif /* TAO_HAS_REQUEST_START_TIME_POLICY == 1 */ 00052 #if (TAO_HAS_REQUEST_END_TIME_POLICY == 1) 00053 type == Messaging::REQUEST_END_TIME_POLICY_TYPE || 00054 #endif /* TAO_HAS_REQUEST_END_TIME_POLICY == 1 */ 00055 #if (TAO_HAS_REPLY_START_TIME_POLICY == 1) 00056 type == Messaging::REPLY_START_TIME_POLICY_TYPE || 00057 #endif /* TAO_HAS_REPLY_START_TIME_POLICY == 1 */ 00058 #if (TAO_HAS_REPLY_END_TIME_POLICY == 1) 00059 type == Messaging::REPLY_END_TIME_POLICY_TYPE || 00060 #endif /* TAO_HAS_REPLY_END_TIME_POLICY == 1 */ 00061 #if (TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1) 00062 type == Messaging::RELATIVE_REQ_TIMEOUT_POLICY_TYPE || 00063 #endif /* TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1 */ 00064 #if (TAO_HAS_ROUTING_POLICY == 1) 00065 type == Messaging::ROUTING_POLICY_TYPE || 00066 #endif /* TAO_HAS_ROUTING_POLICY == 1 */ 00067 #if (TAO_HAS_MAX_HOPS_POLICY == 1) 00068 type == Messaging::MAX_HOPS_POLICY_TYPE || 00069 #endif /* TAO_HAS_MAX_HOPS_POLICY == 1 */ 00070 type == Messaging::QUEUE_ORDER_POLICY_TYPE) 00071 throw ::CORBA::PolicyError (CORBA::UNSUPPORTED_POLICY); 00072 00073 ACE_UNUSED_ARG (value); 00074 00075 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE); 00076 } 00077 00078 TAO_END_VERSIONED_NAMESPACE_DECL