H:/gfcppsancout/product/include/gfcpp/SystemProperties.hpp

Go to the documentation of this file.
00001 #ifndef _GEMFIRE_SYSTEMPROPERTIES_HPP_
00002 #define _GEMFIRE_SYSTEMPROPERTIES_HPP_
00003 
00004 
00005 /*=========================================================================
00006  * (c) Copyright 2004-2007, GemStone Systems, Inc. All Rights Reserved.
00007  * 1260 NW Waterhouse Ave., Suite 200,  Beaverton, OR 97006
00008  *=========================================================================
00009  */
00010 
00011 
00012 #include "Properties.hpp"
00013 #include "Log.hpp"
00014 #include "AuthInitialize.hpp"
00015 
00019 namespace gemfire {
00020 
00021 
00028 // Factory function typedefs to register the managed authInitialize
00029 typedef AuthInitialize* ( *LibraryAuthInitializeFn ) ( const char* assemblyPath,
00030                                                  const char* factFuncName );
00031 
00038 class CPPCACHE_EXPORT SystemProperties {
00039 
00040 public:
00041 
00042 
00050   SystemProperties(const PropertiesPtr& propertiesPtr, const char* configFile = NULL,bool useMemType=true );
00051 
00052 
00056   ~SystemProperties();
00057 
00059   void logSettings( );
00060 
00061 
00066   const uint32_t statisticsSampleInterval() const
00067     { return m_statisticsSampleInterval; }
00068 
00069 
00073   bool statisticsEnabled() const
00074     { return m_statisticsEnabled; }
00075 
00076 
00081   const char* statisticsArchiveFile() const
00082     { return m_statisticsArchiveFile; }
00083 
00084 
00089   const char* logFilename() const
00090     { return m_logFilename; }
00091 
00092 
00096   Log::LogLevel logLevel() const
00097     { return m_logLevel; }
00098 
00107   const bool heapLRULimitEnabled() const
00108   { return (m_heapLRULimit > 0); }  
00109   
00117     const int32_t heapLRULimit() const
00118     { return m_heapLRULimit; }  
00119   
00120   
00126       const int32_t heapLRUDelta() const
00127       { return m_heapLRUDelta; }      
00131   const int32_t maxSocketBufferSize() const { return m_maxSocketBufferSize; }
00132 
00136   const int32_t pingInterval() const { return m_pingInterval; }
00140   const int32_t redundancyMonitorInterval() const { return m_redundancyMonitorInterval; }
00141 
00145   const int32_t notifyAckInterval() const { return m_notifyAckInterval; }
00146 
00150   const int32_t notifyDupCheckLife() const { return m_notifyDupCheckLife; }
00151     
00155   const char* durableClientId() const { return m_durableClientId; }
00156 
00160   const uint32_t durableTimeout() const { return m_durableTimeout; }
00161 
00165   char* conflateEvents(){ return m_conflateEvents; }
00166 
00170   const bool debugStackTraceEnabled() const
00171     { return m_debugStackTraceEnabled; }
00172 
00182   inline const bool crashDumpEnabled() const
00183   {
00184     return m_crashDumpEnabled;
00185   }
00186 
00187   const char* name() const
00188      {return m_name;}
00189 
00190   inline const char* licenseFilename() const
00191   {
00192     return (m_licenseFilename != NULL ? m_licenseFilename : "");
00193   }
00194 
00195   const char* licenseType() const
00196      {return m_licenseType;}
00197 
00198   const char* cacheXMLFile() const
00199      {return m_cacheXMLFile;}
00200 
00201   const uint32_t logFileSizeLimit() const
00202      {return m_logFileSizeLimit;}
00203 
00204   const uint32_t statsFileSizeLimit() const
00205      {return m_statsFileSizeLimit;}
00206 
00207   const uint32_t maxQueueSize()
00208      {return m_maxQueueSize;}
00209 
00210   const uint32_t javaConnectionPoolSize() const
00211      { return m_javaConnectionPoolSize;}
00212   void setjavaConnectionPoolSize(uint32_t size) {
00213     m_javaConnectionPoolSize = size ;
00214   }
00215 
00216   // Returns the Gemfire Cache Server version for use with native clients.
00217   const char* gemfireCacheServerVersion() const
00218      { return m_gemfireCacheServerVersion;}
00219 
00221   inline const char* authInitLibrary() const
00222   {
00223     return ( m_AuthIniLoaderLibrary == NULL ? "" :
00224         m_AuthIniLoaderLibrary->asChar( ) );
00225   }
00226 
00228   inline const char* authInitFactory() const
00229   {
00230     return ( m_AuthIniLoaderFactory == NULL ? "" :
00231         m_AuthIniLoaderFactory->asChar( ) );
00232   }
00233   
00235   const char* securityClientDhAlgo( ) {
00236     return ( m_securityClientDhAlgo == NULL ? "" :
00237     m_securityClientDhAlgo->asChar( ) );
00238   }
00239   
00241   const char* securityClientKsPath( ) {
00242     return ( m_securityClientKsPath == NULL ? "" :
00243     m_securityClientKsPath->asChar( ) );
00244   }
00245     
00249   PropertiesPtr getSecurityProperties() const
00250   { 
00251     return m_securityPropertiesPtr;
00252   }
00253 
00257   inline bool isSecurityOn() const
00258   {
00259     return (m_AuthIniLoaderFactory != NULL && m_AuthIniLoaderLibrary != NULL);
00260   }
00261 
00266   bool isDhOn() {
00267     return isSecurityOn() && m_securityClientDhAlgo != NULL && m_securityClientDhAlgo->length() > 0;
00268   }
00269 
00270 private:
00271 
00272   uint32_t m_statisticsSampleInterval;
00273 
00274   bool m_statisticsEnabled;
00275 
00276   char* m_statisticsArchiveFile;
00277 
00278   char* m_logFilename;
00279 
00280   Log::LogLevel m_logLevel;
00281 
00282   int m_sessions;
00283 
00284   char* m_name;
00285 
00286   bool m_debugStackTraceEnabled;
00287 
00288   bool m_crashDumpEnabled;
00289 
00290   char* m_licenseFilename;
00291 
00292   char* m_licenseType;
00293 
00294   char* m_cacheXMLFile;
00295 
00296   uint32_t m_logFileSizeLimit;
00297 
00298   uint32_t m_statsFileSizeLimit;
00299 
00300   uint32_t m_maxQueueSize;
00301   uint32_t m_javaConnectionPoolSize;
00302 
00303   char *m_gemfireCacheServerVersion;
00304   int32_t m_heapLRULimit;
00305   int32_t m_heapLRUDelta;
00306   int32_t m_maxSocketBufferSize;
00307   int32_t m_pingInterval;
00308   int32_t m_redundancyMonitorInterval;
00309 
00310   int32_t m_notifyAckInterval;
00311   int32_t m_notifyDupCheckLife;
00312 
00313   PropertiesPtr m_securityPropertiesPtr;
00314   CacheableStringPtr m_AuthIniLoaderLibrary;
00315   CacheableStringPtr m_AuthIniLoaderFactory;
00316   CacheableStringPtr m_securityClientDhAlgo;
00317   CacheableStringPtr m_securityClientKsPath;
00318   AuthInitializePtr  m_authInitializer;
00319   
00320   char * m_durableClientId;
00321   uint32_t m_durableTimeout;
00322 
00323   char * m_conflateEvents;
00324 
00325 private:
00326 
00327 
00332    void processProperty( const char* property, const char* value );
00333 
00339   AuthInitializePtr getAuthLoader() ;
00340 
00341 private:
00342   SystemProperties(const SystemProperties& rhs); // never defined
00343   void operator = (const SystemProperties& rhs); // never defined
00344 
00345   void throwError( const char* msg );
00346 
00347 public:
00348   static LibraryAuthInitializeFn managedAuthInitializeFn;
00349 
00350 friend class DistributedSystemImpl;
00351 };
00352 
00353 
00354 } // namespace
00355 
00356 
00357 #endif

GemFire C++ Cache API Documentation