#include <Policy_Validator.h>
Collaboration diagram for TAO_Policy_Validator:
Public Member Functions | |
TAO_Policy_Validator (TAO_ORB_Core &orb_core) | |
Constructor. | |
virtual | ~TAO_Policy_Validator (void) |
Destructor. | |
void | validate (TAO_Policy_Set &policies) |
void | merge_policies (TAO_Policy_Set &policies) |
CORBA::Boolean | legal_policy (CORBA::PolicyType type) |
void | add_validator (TAO_Policy_Validator *validator) |
TAO_ORB_Core & | orb_core () const |
Protected Member Functions | |
virtual void | validate_impl (TAO_Policy_Set &policies)=0 |
virtual void | merge_policies_impl (TAO_Policy_Set &policies)=0 |
virtual CORBA::Boolean | legal_policy_impl (CORBA::PolicyType type)=0 |
Protected Attributes | |
TAO_ORB_Core & | orb_core_ |
Private Attributes | |
TAO_Policy_Validator * | next_ |
This class was moved from the PortableServer library. The Portable Serever library used this abstraction to add policy validators to for the policies in the POA. This class seems so much useful for passing policy information between different loaded libraries.
Definition at line 52 of file Policy_Validator.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Policy_Validator::TAO_Policy_Validator | ( | TAO_ORB_Core & | orb_core | ) |
TAO_Policy_Validator::~TAO_Policy_Validator | ( | void | ) | [virtual] |
Destructor.
Definition at line 21 of file Policy_Validator.cpp.
References next_.
00022 { 00023 delete this->next_; 00024 }
void TAO_Policy_Validator::add_validator | ( | TAO_Policy_Validator * | validator | ) |
Adds a validator to the "chain of validators". The TAO_POA_Policy_Validator
implements something that looks like a chain of responsability in which different member of the chain have the responsability of validating a given set of policies.
Definition at line 33 of file Policy_Validator.cpp.
References ACE_ASSERT, ACE_DEBUG, ACE_TEXT, LM_DEBUG, next_, and TAO_debug_level.
00034 { 00035 // The validator we're adding can't be part of another list 00036 ACE_ASSERT (validator->next_ == 0); 00037 00038 // Why would we want to add ourself to our list 00039 if (this != validator) 00040 { 00041 // Get to the end of the list and make sure that the 00042 // new validator isn't already part of our list 00043 TAO_Policy_Validator* current = this; 00044 while (current->next_ != 0) 00045 { 00046 if (current->next_ == validator) 00047 { 00048 if (TAO_debug_level > 3) 00049 { 00050 ACE_DEBUG ((LM_DEBUG, 00051 ACE_TEXT ("(%P|%t) Skipping validator [0x%x] ") 00052 ACE_TEXT ("since it would create a circular list\n"), 00053 validator)); 00054 } 00055 00056 return; 00057 } 00058 current = current->next_; 00059 } 00060 00061 // Add the new validator to the end of the list 00062 current->next_ = validator; 00063 } 00064 }
CORBA::Boolean TAO_Policy_Validator::legal_policy | ( | CORBA::PolicyType | type | ) |
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.
Definition at line 90 of file Policy_Validator.cpp.
References next_.
00091 { 00092 return (this->legal_policy_impl (type) 00093 || ((this->next_ != 0) 00094 && this->next_->legal_policy_impl (type))); 00095 }
virtual CORBA::Boolean TAO_Policy_Validator::legal_policy_impl | ( | CORBA::PolicyType | type | ) | [protected, pure virtual] |
void TAO_Policy_Validator::merge_policies | ( | TAO_Policy_Set & | policies | ) |
Add/merge policies.
Definition at line 79 of file Policy_Validator.cpp.
References merge_policies(), merge_policies_impl(), and next_.
Referenced by merge_policies().
00080 { 00081 this->merge_policies_impl (policies); 00082 00083 if (this->next_) 00084 { 00085 this->next_->merge_policies (policies); 00086 } 00087 }
virtual void TAO_Policy_Validator::merge_policies_impl | ( | TAO_Policy_Set & | policies | ) | [protected, pure virtual] |
Referenced by merge_policies().
TAO_ORB_Core & TAO_Policy_Validator::orb_core | ( | ) | const |
Accessor for the stored ORB core reference
Definition at line 27 of file Policy_Validator.cpp.
References orb_core_.
00028 { 00029 return this->orb_core_; 00030 }
void TAO_Policy_Validator::validate | ( | TAO_Policy_Set & | policies | ) |
Validate that the policies in the specified set are consistent and legal. Throw an appropriate exception if that is not the case.
Definition at line 68 of file Policy_Validator.cpp.
References next_, validate(), and validate_impl().
Referenced by validate().
00069 { 00070 this->validate_impl (policies); 00071 00072 if (this->next_ != 0) 00073 { 00074 this->next_->validate (policies); 00075 } 00076 }
virtual void TAO_Policy_Validator::validate_impl | ( | TAO_Policy_Set & | policies | ) | [protected, pure virtual] |
Referenced by validate().
TAO_Policy_Validator* TAO_Policy_Validator::next_ [private] |
Definition at line 105 of file Policy_Validator.h.
Referenced by add_validator(), legal_policy(), merge_policies(), validate(), and ~TAO_Policy_Validator().
TAO_ORB_Core& TAO_Policy_Validator::orb_core_ [protected] |