#include <Default_Policy_Validator.h>
Inheritance diagram for TAO_POA_Default_Policy_Validator:
Public Member Functions | |
TAO_POA_Default_Policy_Validator (TAO_ORB_Core &orb_core) | |
Constructor. | |
~TAO_POA_Default_Policy_Validator (void) | |
Destructor. | |
Protected Member Functions | |
void | validate_impl (TAO_Policy_Set &policies) |
void | merge_policies_impl (TAO_Policy_Set &policies) |
Add/merge policies. | |
virtual CORBA::Boolean | legal_policy_impl (CORBA::PolicyType type) |
Definition at line 31 of file Default_Policy_Validator.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_POA_Default_Policy_Validator::TAO_POA_Default_Policy_Validator | ( | TAO_ORB_Core & | orb_core | ) |
Constructor.
Definition at line 16 of file Default_Policy_Validator.cpp.
00018 : TAO_Policy_Validator (orb_core) 00019 { 00020 }
TAO_POA_Default_Policy_Validator::~TAO_POA_Default_Policy_Validator | ( | void | ) |
CORBA::Boolean TAO_POA_Default_Policy_Validator::legal_policy_impl | ( | CORBA::PolicyType | type | ) | [protected, virtual] |
Return whether the specified policy type is legal for the current configuration. This is needed since the user can potentially specify policies that are unknown to an validate () routine, and these need to be caught.
Implements TAO_Policy_Validator.
Definition at line 95 of file Default_Policy_Validator.cpp.
References TAO_Policy_Validator::orb_core_, and TAO_ORB_Core::policy_factory_registry().
00096 { 00097 // Check known POA policies, or if given PolicyType has a 00098 // corresponding PolicyFactory. The PolicyFactory check is mandated 00099 // by the CORBA specification. 00100 return 00101 ( 00102 # if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) 00103 type == PortableServer::THREAD_POLICY_ID || 00104 # endif 00105 # if ! defined (CORBA_E_MICRO) 00106 type == PortableServer::LIFESPAN_POLICY_ID || 00107 type == PortableServer::ID_UNIQUENESS_POLICY_ID || 00108 type == PortableServer::ID_ASSIGNMENT_POLICY_ID || 00109 # endif 00110 # if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) 00111 type == PortableServer::IMPLICIT_ACTIVATION_POLICY_ID || 00112 type == PortableServer::SERVANT_RETENTION_POLICY_ID || 00113 type == PortableServer::REQUEST_PROCESSING_POLICY_ID || 00114 # endif 00115 (this->orb_core_.policy_factory_registry () != 0 && 00116 this->orb_core_.policy_factory_registry ()->factory_exists (type))); 00117 }
void TAO_POA_Default_Policy_Validator::merge_policies_impl | ( | TAO_Policy_Set & | policies | ) | [protected, virtual] |
Add/merge policies.
Implements TAO_Policy_Validator.
Definition at line 120 of file Default_Policy_Validator.cpp.
void TAO_POA_Default_Policy_Validator::validate_impl | ( | TAO_Policy_Set & | policies | ) | [protected, virtual] |
Validate that the policies in the specified set are consistent and legal. Throw an appropriate exception if that is not the case.
Implements TAO_Policy_Validator.
Definition at line 27 of file Default_Policy_Validator.cpp.
References TAO_Policy_Set::get_cached_policy(), TAO_Objref_Var_T< T >::in(), TAO_CACHED_POLICY_ID_ASSIGNMENT, TAO_CACHED_POLICY_ID_UNIQUENESS, TAO_CACHED_POLICY_IMPLICIT_ACTIVATION, TAO_CACHED_POLICY_REQUEST_PROCESSING, and TAO_CACHED_POLICY_SERVANT_RETENTION.
00028 { 00029 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) 00030 CORBA::Policy_var policy = 00031 policies.get_cached_policy (TAO_CACHED_POLICY_SERVANT_RETENTION); 00032 00033 PortableServer::ServantRetentionPolicy_var srp = 00034 PortableServer::ServantRetentionPolicy::_narrow (policy.in ()); 00035 PortableServer::ServantRetentionPolicyValue servant_retention = 00036 srp->value (); 00037 00038 policy = policies.get_cached_policy (TAO_CACHED_POLICY_REQUEST_PROCESSING); 00039 00040 PortableServer::RequestProcessingPolicy_var rpp = 00041 PortableServer::RequestProcessingPolicy::_narrow (policy.in ()); 00042 PortableServer::RequestProcessingPolicyValue request_processing = 00043 rpp->value (); 00044 00045 // The NON_RETAIN policy requires either the USE_DEFAULT_SERVANT or 00046 // USE_SERVANT_MANAGER policies. 00047 if (servant_retention == PortableServer::NON_RETAIN) 00048 if (request_processing != PortableServer::USE_SERVANT_MANAGER && 00049 request_processing != PortableServer::USE_DEFAULT_SERVANT) 00050 throw PortableServer::POA::InvalidPolicy (); 00051 00052 // USE_ACTIVE_OBJECT_MAP_ONLY requires the RETAIN policy. 00053 if (request_processing == PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY) 00054 if (servant_retention != PortableServer::RETAIN) 00055 throw PortableServer::POA::InvalidPolicy (); 00056 00057 policy = policies.get_cached_policy (TAO_CACHED_POLICY_ID_UNIQUENESS); 00058 00059 PortableServer::IdUniquenessPolicy_var iup = 00060 PortableServer::IdUniquenessPolicy::_narrow (policy.in ()); 00061 PortableServer::IdUniquenessPolicyValue id_uniqueness = 00062 iup->value (); 00063 00064 policy = 00065 policies.get_cached_policy (TAO_CACHED_POLICY_IMPLICIT_ACTIVATION); 00066 00067 PortableServer::ImplicitActivationPolicy_var iap = 00068 PortableServer::ImplicitActivationPolicy::_narrow (policy.in ()); 00069 PortableServer::ImplicitActivationPolicyValue implicit_activation = 00070 iap->value (); 00071 00072 policy = policies.get_cached_policy (TAO_CACHED_POLICY_ID_ASSIGNMENT); 00073 00074 PortableServer::IdAssignmentPolicy_var idap = 00075 PortableServer::IdAssignmentPolicy::_narrow (policy.in ()); 00076 PortableServer::IdAssignmentPolicyValue id_assignment = 00077 idap->value (); 00078 00079 // USE_DEFAULT_SERVANT requires the MULTIPLE_ID policy. 00080 if (request_processing == PortableServer::USE_DEFAULT_SERVANT) 00081 if (id_uniqueness != PortableServer::MULTIPLE_ID) 00082 throw PortableServer::POA::InvalidPolicy (); 00083 00084 // IMPLICIT_ACTIVATION requires the SYSTEM_ID and RETAIN policies. 00085 if (implicit_activation == PortableServer::IMPLICIT_ACTIVATION) 00086 if (servant_retention != PortableServer::RETAIN || 00087 id_assignment != PortableServer::SYSTEM_ID) 00088 throw PortableServer::POA::InvalidPolicy (); 00089 #else /* TAO_HAS_MINIMUM_POA == 0 */ 00090 ACE_UNUSED_ARG (policies); 00091 #endif /* TAO_HAS_MINIMUM_POA == 0 */ 00092 }