00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Policy_Validator.h 00006 * 00007 * $Id: Policy_Validator.h 76995 2007-02-11 12:51:42Z 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 00053 class TAO_Export TAO_Policy_Validator 00054 { 00055 public: 00056 /// Constructor. 00057 TAO_Policy_Validator (TAO_ORB_Core &orb_core); 00058 00059 /// Destructor. 00060 virtual ~TAO_Policy_Validator (void); 00061 00062 /** 00063 * Validate that the policies in the specified set 00064 * are consistent and legal. Throw an appropriate exception 00065 * if that is not the case. 00066 */ 00067 void validate (TAO_Policy_Set &policies); 00068 00069 /** 00070 * Add/merge policies. 00071 **/ 00072 void merge_policies (TAO_Policy_Set &policies); 00073 00074 /** 00075 * Return whether the specified policy type is legal for the 00076 * current configuration. This is needed since the user can 00077 * potentially specify policies that are unknown to an 00078 * validate () routine, and these need to be caught. 00079 */ 00080 CORBA::Boolean legal_policy (CORBA::PolicyType type); 00081 00082 /** 00083 * Adds a validator to the "chain of validators". The <code> 00084 * TAO_POA_Policy_Validator </code> implements something that looks 00085 * like a chain of responsability in which different member of the 00086 * chain have the responsability of validating a given set of 00087 * policies. 00088 */ 00089 void add_validator (TAO_Policy_Validator *validator); 00090 00091 00092 /** 00093 * Accessor for the stored ORB core reference 00094 */ 00095 TAO_ORB_Core & orb_core() const; 00096 00097 protected: 00098 virtual void validate_impl (TAO_Policy_Set &policies) = 0; 00099 00100 virtual void merge_policies_impl (TAO_Policy_Set &policies) = 0; 00101 00102 virtual CORBA::Boolean legal_policy_impl (CORBA::PolicyType type) = 0; 00103 00104 TAO_ORB_Core &orb_core_; 00105 00106 private: 00107 TAO_Policy_Validator *next_; 00108 }; 00109 00110 TAO_END_VERSIONED_NAMESPACE_DECL 00111 00112 #include /**/ "ace/post.h" 00113 00114 #endif /* TAO_POLICY_VALIDATOR_H */