Page Speed Optimization Libraries  1.5.27.2
net/instaweb/apache/apache_config.h
Go to the documentation of this file.
00001 // Copyright 2010 Google Inc.
00016 
00017 #ifndef NET_INSTAWEB_APACHE_APACHE_CONFIG_H_
00018 #define NET_INSTAWEB_APACHE_APACHE_CONFIG_H_
00019 
00020 #include "net/instaweb/rewriter/public/rewrite_options.h"
00021 #include "net/instaweb/system/public/system_rewrite_options.h"
00022 #include "net/instaweb/util/public/basictypes.h"
00023 #include "net/instaweb/util/public/string.h"
00024 #include "net/instaweb/util/public/string_util.h"
00025 
00026 namespace net_instaweb {
00027 
00028 class ThreadSystem;
00029 
00032 class ApacheConfig : public SystemRewriteOptions {
00033  public:
00034   static void Initialize();
00035   static void Terminate();
00036 
00037   ApacheConfig(const StringPiece& dir, ThreadSystem* thread_system);
00038   explicit ApacheConfig(ThreadSystem* thread_system);
00039   ~ApacheConfig() {}
00040 
00044   StringPiece description() const { return description_; }
00045   void set_description(const StringPiece& x) { x.CopyToString(&description_); }
00046 
00047   int64 slurp_flush_limit() const {
00048     return slurp_flush_limit_.value();
00049   }
00050   void set_slurp_flush_limit(int64 x) {
00051     set_option(x, &slurp_flush_limit_);
00052   }
00053   bool slurp_read_only() const {
00054     return slurp_read_only_.value();
00055   }
00056   void set_slurp_read_only(bool x) {
00057     set_option(x, &slurp_read_only_);
00058   }
00059   bool rate_limit_background_fetches() const {
00060     return rate_limit_background_fetches_.value();
00061   }
00062   const GoogleString& slurp_directory() const {
00063     return slurp_directory_.value();
00064   }
00065   void set_slurp_directory(GoogleString x) {
00066     set_option(x, &slurp_directory_);
00067   }
00068 
00072   bool test_proxy() const {
00073     return test_proxy_.value();
00074   }
00075   void set_test_proxy(bool x) {
00076     set_option(x, &test_proxy_);
00077   }
00078 
00086   GoogleString test_proxy_slurp() const {
00087     return test_proxy_slurp_.value();
00088   }
00089 
00091   bool slurping_enabled() const {
00092     return !slurp_directory().empty();
00093   }
00094 
00095   bool slurping_enabled_read_only() const {
00096     return slurping_enabled() && slurp_read_only();
00097   }
00098 
00099   bool experimental_fetch_from_mod_spdy() const {
00100     return experimental_fetch_from_mod_spdy_.value();
00101   }
00102 
00104   virtual ApacheConfig* Clone() const;
00105 
00107   virtual ApacheConfig* NewOptions() const;
00108 
00111   static const ApacheConfig* DynamicCast(const RewriteOptions* instance);
00112   static ApacheConfig* DynamicCast(RewriteOptions* instance);
00113 
00114  private:
00117   static Properties* apache_properties_;
00118 
00120   template<class RewriteOptionsSubclass, class OptionClass>
00121   static void AddApacheProperty(typename OptionClass::ValueType default_value,
00122                                 OptionClass RewriteOptionsSubclass::*offset,
00123                                 const char* id,
00124                                 OptionEnum option_enum,
00125                                 const char* help) {
00126     AddProperty(default_value, offset, id, option_enum,
00127                 RewriteOptions::kServerScope, help,
00128                 apache_properties_);
00129   }
00130 
00131   void InitializeSignaturesAndDefaults();
00132   static void AddProperties();
00133   void Init();
00134 
00135   GoogleString description_;
00136 
00137   Option<GoogleString> slurp_directory_;
00138   Option<GoogleString> test_proxy_slurp_;
00139 
00140   Option<bool> slurp_read_only_;
00141   Option<bool> test_proxy_;
00142   Option<bool> rate_limit_background_fetches_;
00143   Option<bool> experimental_fetch_from_mod_spdy_;
00144 
00145   Option<int64> slurp_flush_limit_;
00146 
00147   DISALLOW_COPY_AND_ASSIGN(ApacheConfig);
00148 };
00149 
00150 }  
00151 
00152 #endif  ///< NET_INSTAWEB_APACHE_APACHE_CONFIG_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines