00001 #ifndef _GEMFIRE_SYSTEMPROPERTIES_HPP_
00002 #define _GEMFIRE_SYSTEMPROPERTIES_HPP_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "Properties.hpp"
00015 #include "Log.hpp"
00016 #include "AuthInitialize.hpp"
00017
00021 namespace gemfire {
00022
00023
00030
00031 typedef AuthInitialize* ( *LibraryAuthInitializeFn ) ( const char* assemblyPath,
00032 const char* factFuncName );
00033
00040 class CPPCACHE_EXPORT SystemProperties {
00041
00042 public:
00043
00044
00052 SystemProperties(const PropertiesPtr& propertiesPtr,
00053 const char* configFile = NULL);
00054
00055
00059 ~SystemProperties();
00060
00062 void logSettings( );
00063
00064 const uint32_t threadPoolSize() const
00065 { return m_threadPoolSize; }
00066
00067
00072 const uint32_t statisticsSampleInterval() const
00073 { return m_statisticsSampleInterval; }
00074
00075
00079 bool statisticsEnabled() const
00080 { return m_statisticsEnabled; }
00081
00085 bool sslEnabled() const
00086 { return m_sslEnabled; }
00087
00091 bool getEnableTimeStatistics() const
00092 { return m_timestatisticsEnabled; }
00093
00097 const char* sslKeyStore() const
00098 { return m_sslKeyStore; }
00099
00103 const char* sslKeystorePassword() const
00104 { return m_sslKeystorePassword; }
00105
00109 const char* sslTrustStore() const
00110 { return m_sslTrustStore; }
00111
00112
00117 const char* statisticsArchiveFile() const
00118 { return m_statisticsArchiveFile; }
00119
00120
00125 const char* logFilename() const
00126 { return m_logFilename; }
00127
00128
00132 Log::LogLevel logLevel() const
00133 { return m_logLevel; }
00134
00143 const bool heapLRULimitEnabled() const
00144 { return (m_heapLRULimit > 0); }
00145
00153 const size_t heapLRULimit() const
00154 { return m_heapLRULimit; }
00155
00156
00162 const int32_t heapLRUDelta() const
00163 { return m_heapLRUDelta; }
00167 const int32_t maxSocketBufferSize() const { return m_maxSocketBufferSize; }
00168
00172 const int32_t pingInterval() const { return m_pingInterval; }
00176 const int32_t redundancyMonitorInterval() const { return m_redundancyMonitorInterval; }
00177
00181 const int32_t notifyAckInterval() const { return m_notifyAckInterval; }
00182
00186 const int32_t notifyDupCheckLife() const { return m_notifyDupCheckLife; }
00187
00191 const char* durableClientId() const { return m_durableClientId; }
00192
00196 const uint32_t durableTimeout() const { return m_durableTimeout; }
00197
00201 const uint32_t connectTimeout() const { return m_connectTimeout; }
00202
00207 const uint32_t connectWaitTimeout() const { return m_connectWaitTimeout; }
00208
00213 const uint32_t bucketWaitTimeout() const { return m_bucketWaitTimeout; }
00214
00215
00219 char* conflateEvents(){ return m_conflateEvents; }
00220
00224 const bool debugStackTraceEnabled() const
00225 { return m_debugStackTraceEnabled; }
00226
00236 inline const bool crashDumpEnabled() const
00237 {
00238 return m_crashDumpEnabled;
00239 }
00240
00241 const char* name() const
00242 {return m_name;}
00243
00244 const char* cacheXMLFile() const
00245 {return m_cacheXMLFile;}
00246
00250 const uint32_t logFileSizeLimit() const
00251 {return m_logFileSizeLimit;}
00252
00256 const uint32_t logDiskSpaceLimit() const
00257 {return m_logDiskSpaceLimit;}
00258
00262 const uint32_t statsFileSizeLimit() const
00263 {return m_statsFileSizeLimit;}
00264
00268 const uint32_t statsDiskSpaceLimit() const
00269 {return m_statsDiskSpaceLimit;}
00270
00271 const uint32_t maxQueueSize()
00272 {return m_maxQueueSize;}
00273
00274 const uint32_t javaConnectionPoolSize() const
00275 { return m_javaConnectionPoolSize;}
00276 void setjavaConnectionPoolSize(uint32_t size) {
00277 m_javaConnectionPoolSize = size ;
00278 }
00279
00283 bool disableChunkHandlerThread() const
00284 {
00285 return m_disableChunkHandlerThread;
00286 }
00287
00291 bool timeoutUnitInMilliseconds() const
00292 {
00293 return m_timeoutUnitInMilliseconds;
00294 }
00295
00299 void setDisableChunkHandlerThread(bool set) {
00300 m_disableChunkHandlerThread = set ;
00301 }
00302
00307 bool onClientDisconnectClearPdxTypeIds() const
00308 {
00309 return m_onClientDisconnectClearPdxTypeIds;
00310 }
00311
00316 void setOnClientDisconnectClearPdxTypeIds(bool set) {
00317 m_onClientDisconnectClearPdxTypeIds = set ;
00318 }
00319
00321 inline const char* authInitLibrary() const
00322 {
00323 return (m_AuthIniLoaderLibrary == NULLPTR ? "" :
00324 m_AuthIniLoaderLibrary->asChar());
00325 }
00326
00328 inline const char* authInitFactory() const
00329 {
00330 return (m_AuthIniLoaderFactory == NULLPTR ? "" :
00331 m_AuthIniLoaderFactory->asChar());
00332 }
00333
00335 const char* securityClientDhAlgo( ) {
00336 return (m_securityClientDhAlgo == NULLPTR ? "" :
00337 m_securityClientDhAlgo->asChar());
00338 }
00339
00341 const char* securityClientKsPath( ) {
00342 return (m_securityClientKsPath == NULLPTR ? "" :
00343 m_securityClientKsPath->asChar());
00344 }
00345
00349 PropertiesPtr getSecurityProperties() const
00350 {
00351 return m_securityPropertiesPtr;
00352 }
00353
00357 inline bool isSecurityOn() const
00358 {
00359 return (m_AuthIniLoaderFactory != NULLPTR &&
00360 m_AuthIniLoaderLibrary != NULLPTR);
00361 }
00362
00366 inline bool isEndpointShufflingDisabled() const
00367 {
00368 return m_disableShufflingEndpoint;
00369 }
00370
00375 bool isDhOn() {
00376 return isSecurityOn() && m_securityClientDhAlgo != NULLPTR &&
00377 m_securityClientDhAlgo->length() > 0;
00378 }
00379
00395 inline bool isGridClient() const
00396 {
00397 return m_gridClient;
00398 }
00399
00404 inline bool isAppDomainEnabled() const
00405 {
00406 return m_appDomainEnabled;
00407 }
00408
00418 inline bool autoReadyForEvents() const
00419 {
00420 return m_autoReadyForEvents;
00421 }
00422
00426 const uint32_t suspendedTxTimeout() const { return m_suspendedTxTimeout; }
00427
00431 const uint32_t tombstoneTimeoutInMSec() const { return m_tombstoneTimeoutInMSec; }
00432
00433 private:
00434
00435 uint32_t m_statisticsSampleInterval;
00436
00437 bool m_statisticsEnabled;
00438
00439 bool m_appDomainEnabled;
00440
00441 char* m_statisticsArchiveFile;
00442
00443 char* m_logFilename;
00444
00445 Log::LogLevel m_logLevel;
00446
00447 int m_sessions;
00448
00449 char* m_name;
00450
00451 bool m_debugStackTraceEnabled;
00452
00453 bool m_crashDumpEnabled;
00454
00455 bool m_disableShufflingEndpoint;
00456
00457 char* m_cacheXMLFile;
00458
00459 uint32_t m_logFileSizeLimit;
00460 uint32_t m_logDiskSpaceLimit;
00461
00462 uint32_t m_statsFileSizeLimit;
00463 uint32_t m_statsDiskSpaceLimit;
00464
00465 uint32_t m_maxQueueSize;
00466 uint32_t m_javaConnectionPoolSize;
00467
00468 int32_t m_heapLRULimit;
00469 int32_t m_heapLRUDelta;
00470 int32_t m_maxSocketBufferSize;
00471 int32_t m_pingInterval;
00472 int32_t m_redundancyMonitorInterval;
00473
00474 int32_t m_notifyAckInterval;
00475 int32_t m_notifyDupCheckLife;
00476
00477
00478
00479 PropertiesPtr m_securityPropertiesPtr;
00480 CacheableStringPtr m_AuthIniLoaderLibrary;
00481 CacheableStringPtr m_AuthIniLoaderFactory;
00482 CacheableStringPtr m_securityClientDhAlgo;
00483 CacheableStringPtr m_securityClientKsPath;
00484 AuthInitializePtr m_authInitializer;
00485
00486 char * m_durableClientId;
00487 uint32_t m_durableTimeout;
00488
00489 uint32_t m_connectTimeout;
00490 uint32_t m_connectWaitTimeout;
00491 uint32_t m_bucketWaitTimeout;
00492
00493 bool m_gridClient;
00494
00495 bool m_autoReadyForEvents;
00496
00497 bool m_sslEnabled;
00498 bool m_timestatisticsEnabled;
00499 char * m_sslKeyStore;
00500 char * m_sslTrustStore;
00501
00502 char *m_sslKeystorePassword;
00503
00504 char * m_conflateEvents;
00505
00506 uint32_t m_threadPoolSize;
00507 uint32_t m_suspendedTxTimeout;
00508 uint32_t m_tombstoneTimeoutInMSec;
00509 bool m_disableChunkHandlerThread;
00510 bool m_timeoutUnitInMilliseconds;
00511 bool m_onClientDisconnectClearPdxTypeIds;
00512 private:
00513
00514
00519 void processProperty( const char* property, const char* value );
00520
00526 AuthInitializePtr getAuthLoader() ;
00527
00528 private:
00529 SystemProperties(const SystemProperties& rhs);
00530 void operator = (const SystemProperties& rhs);
00531
00532 void throwError( const char* msg );
00533
00534 public:
00535 static LibraryAuthInitializeFn managedAuthInitializeFn;
00536 static LibraryAuthInitializeFn managedAuthInitializeFnGeneric;
00537
00538 friend class DistributedSystemImpl;
00539 };
00540
00541
00542 }
00543
00544
00545 #endif