00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Policy_Validator.h 00006 * 00007 * $Id: Policy_Validator.h 80823 2008-03-04 10:11:35Z johnnyw $ 00008 * 00009 * This file contains the declaration for the POA policy validator 00010 * interface. 00011 * 00012 * @author Angelo Corsaro <corsaro@cs.wustl.edu> 00013 * @author Frank Hunleth <fhuntleth@cs.wustl.edu> 00014 */ 00015 //============================================================================= 00016 00017 #ifndef TAO_POLICY_VALIDATOR_H 00018 #define TAO_POLICY_VALIDATOR_H 00019 00020 #include /**/ "ace/pre.h" 00021 00022 #include "tao/Basic_Types.h" 00023 00024 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00025 # pragma once 00026 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00027 00028 #include /**/ "tao/TAO_Export.h" 00029 00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00031 00032 // Forward declarations. 00033 class TAO_Policy_Set; 00034 class TAO_ORB_Core; 00035 00036 namespace CORBA 00037 { 00038 typedef ULong PolicyType; 00039 } 00040 00041 /** 00042 * @class TAO_Policy_Validator 00043 * 00044 * @brief An abstract class for plugging in different Policy Validator 00045 * mechanisms. 00046 * 00047 * This class was moved from the PortableServer library. The Portable 00048 * Serever library used this abstraction to add policy validators to 00049 * for the policies in the POA. This class seems so much useful for 00050 * passing policy information between different loaded libraries. 00051 */ 00052 class TAO_Export TAO_Policy_Validator 00053 { 00054 public: 00055 /// Constructor. 00056 TAO_Policy_Validator (TAO_ORB_Core &orb_core); 00057 00058 /// Destructor. 00059 virtual ~TAO_Policy_Validator (void); 00060 00061 /** 00062 * Validate that the policies in the specified set 00063 * are consistent and legal. Throw an appropriate exception 00064 * if that is not the case. 00065 */ 00066 void validate (TAO_Policy_Set &policies); 00067 00068 /** 00069 * Add/merge policies. 00070 **/ 00071 void merge_policies (TAO_Policy_Set &policies); 00072 00073 /** 00074 * Return whether the specified policy type is legal for the 00075 * current configuration. This is needed since the user can 00076 * potentially specify policies that are unknown to an 00077 * validate () routine, and these need to be caught. 00078 */ 00079 CORBA::Boolean legal_policy (CORBA::PolicyType type); 00080 00081 /** 00082 * Adds a validator to the "chain of validators". The <code> 00083 * TAO_POA_Policy_Validator </code> implements something that looks 00084 * like a chain of responsability in which different member of the 00085 * chain have the responsability of validating a given set of 00086 * policies. 00087 */ 00088 void add_validator (TAO_Policy_Validator *validator); 00089 00090 /** 00091 * Accessor for the stored ORB core reference 00092 */ 00093 TAO_ORB_Core & orb_core() const; 00094 00095 protected: 00096 virtual void validate_impl (TAO_Policy_Set &policies) = 0; 00097 00098 virtual void merge_policies_impl (TAO_Policy_Set &policies) = 0; 00099 00100 virtual CORBA::Boolean legal_policy_impl (CORBA::PolicyType type) = 0; 00101 00102 TAO_ORB_Core &orb_core_; 00103 00104 private: 00105 TAO_Policy_Validator *next_; 00106 }; 00107 00108 TAO_END_VERSIONED_NAMESPACE_DECL 00109 00110 #include /**/ "ace/post.h" 00111 00112 #endif /* TAO_POLICY_VALIDATOR_H */