TAO_Policy_Validator Class Reference

An abstract class for plugging in different Policy Validator mechanisms. More...

#include <Policy_Validator.h>

Collaboration diagram for TAO_Policy_Validator:

Collaboration graph
[legend]
List of all members.

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_Coreorb_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_Coreorb_core_

Private Attributes

TAO_Policy_Validatornext_

Detailed Description

An abstract class for plugging in different Policy Validator mechanisms.

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 55 of file Policy_Validator.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Policy_Validator::TAO_Policy_Validator TAO_ORB_Core orb_core  ) 
 

Constructor.

Definition at line 16 of file Policy_Validator.cpp.

00017   : orb_core_ (orb_core),
00018     next_ (0)
00019 {
00020 }

TAO_Policy_Validator::~TAO_Policy_Validator void   )  [virtual]
 

Destructor.

Definition at line 22 of file Policy_Validator.cpp.

00023 {
00024   delete this->next_;
00025 }


Member Function Documentation

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 34 of file Policy_Validator.cpp.

References ACE_ASSERT, ACE_DEBUG, ACE_TEXT, LM_DEBUG, next_, and TAO_debug_level.

00035 {
00036   // The validator we're adding can't be part of another list
00037   ACE_ASSERT (validator->next_ == 0);
00038 
00039   // Why would we want to add ourself to our list
00040   if (this != validator)
00041     {
00042       // Get to the end of the list and make sure that the
00043       // new validator isn't already part of our list
00044       TAO_Policy_Validator* current = this;
00045       while (current->next_ != 0)
00046         {
00047           if (current->next_ == validator)
00048             {
00049               if (TAO_debug_level > 3)
00050                 {
00051                   ACE_DEBUG ((LM_DEBUG,
00052                               ACE_TEXT ("(%P|%t) Skipping validator [0x%x] ")
00053                               ACE_TEXT ("since it would create a circular list\n"),
00054                               validator));
00055                 }
00056 
00057               return;
00058             }
00059           current = current->next_;
00060         }
00061 
00062       // Add the new validator to the end of the list
00063       current->next_ = validator;
00064     }
00065 }

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 97 of file Policy_Validator.cpp.

References legal_policy_impl(), and CORBA::PolicyType.

00098 {
00099   return (this->legal_policy_impl (type)
00100           || ((this->next_ != 0)
00101               && this->next_->legal_policy_impl (type)));
00102 }

virtual CORBA::Boolean TAO_Policy_Validator::legal_policy_impl CORBA::PolicyType  type  )  [protected, pure virtual]
 

Referenced by legal_policy().

void TAO_Policy_Validator::merge_policies TAO_Policy_Set policies  ) 
 

Add/merge policies.

Definition at line 83 of file Policy_Validator.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and merge_policies_impl().

00085 {
00086   this->merge_policies_impl (policies ACE_ENV_ARG_PARAMETER);
00087   ACE_CHECK;
00088 
00089   if (this->next_)
00090     {
00091       this->next_->merge_policies (policies ACE_ENV_ARG_PARAMETER);
00092       ACE_CHECK;
00093     }
00094 }

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 28 of file Policy_Validator.cpp.

00029 { 
00030   return this->orb_core_;
00031 }

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 69 of file Policy_Validator.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and validate_impl().

00071 {
00072   this->validate_impl (policies ACE_ENV_ARG_PARAMETER);
00073   ACE_CHECK;
00074 
00075   if (this->next_ != 0)
00076     {
00077       this->next_->validate (policies ACE_ENV_ARG_PARAMETER);
00078       ACE_CHECK;
00079     }
00080 }

virtual void TAO_Policy_Validator::validate_impl TAO_Policy_Set policies  )  [protected, pure virtual]
 

Referenced by validate().


Member Data Documentation

TAO_Policy_Validator* TAO_Policy_Validator::next_ [private]
 

Definition at line 113 of file Policy_Validator.h.

Referenced by add_validator().

TAO_ORB_Core& TAO_Policy_Validator::orb_core_ [protected]
 

Definition at line 110 of file Policy_Validator.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:23:08 2006 for TAO by doxygen 1.3.6