Policy_Validator.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Policy_Validator.h
00006  *
00007  *  Policy_Validator.h,v 1.9 2005/11/02 11:03:26 ossama Exp
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 #include "ace/CORBA_macros.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #include "tao/TAO_Export.h"
00028 #include "tao/Basic_Types.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   class Environment;
00041 }
00042 
00043 /**
00044  * @class TAO_Policy_Validator
00045  *
00046  * @brief An abstract class for plugging in different Policy Validator
00047  *  mechanisms.
00048  *
00049  *  This class was moved from the PortableServer library. The Portable
00050  *  Serever library used this abstraction to add policy validators to
00051  *  for the policies in the POA. This class seems so much useful for
00052  *  passing policy information between different loaded libraries.
00053  */
00054 
00055 class TAO_Export TAO_Policy_Validator
00056 {
00057 public:
00058   /// Constructor.
00059   TAO_Policy_Validator (TAO_ORB_Core &orb_core);
00060 
00061   /// Destructor.
00062   virtual ~TAO_Policy_Validator (void);
00063 
00064   /**
00065    * Validate that the policies in the specified set
00066    * are consistent and legal.  Throw an appropriate exception
00067    * if that is not the case.
00068    */
00069   void validate (TAO_Policy_Set &policies
00070                  ACE_ENV_ARG_DECL);
00071 
00072   /**
00073    * Add/merge policies.
00074    **/
00075   void merge_policies (TAO_Policy_Set &policies
00076                        ACE_ENV_ARG_DECL);
00077 
00078   /**
00079    * Return whether the specified policy type is legal for the
00080    * current configuration.  This is needed since the user can
00081    * potentially specify policies that are unknown to an
00082    * validate () routine, and these need to be caught.
00083    */
00084   CORBA::Boolean legal_policy (CORBA::PolicyType type);
00085 
00086   /**
00087    * Adds a validator to the "chain of validators". The <code>
00088    * TAO_POA_Policy_Validator </code> implements something that looks
00089    * like a chain of responsability in which different member of the
00090    * chain have the responsability of validating a given set of
00091    * policies.
00092    */
00093   void add_validator (TAO_Policy_Validator *validator);
00094 
00095 
00096  /**
00097   * Accessor for the stored ORB core reference
00098   */
00099  TAO_ORB_Core & orb_core() const;
00100 
00101 protected:
00102   virtual void validate_impl (TAO_Policy_Set &policies
00103                               ACE_ENV_ARG_DECL) = 0;
00104 
00105   virtual void merge_policies_impl (TAO_Policy_Set &policies
00106                                     ACE_ENV_ARG_DECL) = 0;
00107 
00108   virtual CORBA::Boolean legal_policy_impl (CORBA::PolicyType type) = 0;
00109 
00110   TAO_ORB_Core &orb_core_;
00111 
00112 private:
00113   TAO_Policy_Validator *next_;
00114 };
00115 
00116 TAO_END_VERSIONED_NAMESPACE_DECL
00117 
00118 #include /**/ "ace/post.h"
00119 
00120 #endif /* TAO_POLICY_VALIDATOR_H */

Generated on Thu Nov 9 11:54:20 2006 for TAO by doxygen 1.3.6