/export/rook1/users/build/gfcppsancout64/product/include/gfcpp/RegionAttributes.hpp

Go to the documentation of this file.
00001 #ifndef __GEMFIRE_REGIONATTRIBUTES_H__
00002 #define __GEMFIRE_REGIONATTRIBUTES_H__
00003 /*=========================================================================
00004  * (c) Copyright 2002-2007, GemStone Systems, Inc. All Rights Reserved.
00005  * 1260 NW Waterhouse Ave., Suite 200,  Beaverton, OR 97006
00006  *========================================================================
00007  */
00008 
00013 #include "gfcpp_globals.hpp"
00014 #include "gf_types.hpp"
00015 #include "CacheLoader.hpp"
00016 #include "ScopeType.hpp"
00017 #include "ExpirationAttributes.hpp"
00018 #include "CacheWriter.hpp"
00019 #include "CacheListener.hpp"
00020 #include "PartitionResolver.hpp"
00021 #include "Properties.hpp"
00022 #include "Serializable.hpp"
00023 #include "DiskPolicyType.hpp"
00024 #include "PersistenceManager.hpp"
00025 
00026 namespace gemfire {
00027 class CacheImpl;
00028 
00049 class AttributesFactory;
00050 class AttributesMutator;
00051 class Cache;
00052 class Region;
00053 
00054 class CPPCACHE_EXPORT RegionAttributes: public Serializable {
00055 
00059  public:
00060 
00066   CacheLoaderPtr getCacheLoader() ;
00067 
00073   CacheWriterPtr getCacheWriter() ;
00074 
00080   CacheListenerPtr getCacheListener() ;
00081 
00087   PartitionResolverPtr getPartitionResolver() ;
00088 
00092   int getRegionTimeToLive() ;
00093   ExpirationAction::Action getRegionTimeToLiveAction() ;
00094 
00099   int getRegionIdleTimeout() ;
00100   ExpirationAction::Action getRegionIdleTimeoutAction() ;
00101 
00105   int getEntryTimeToLive() ;
00106   ExpirationAction::Action getEntryTimeToLiveAction() ;
00107 
00111   int getEntryIdleTimeout() ;
00112   ExpirationAction::Action getEntryIdleTimeoutAction() ;
00113 
00114 
00115 
00120   ScopeType::Scope getScope() const;
00121 
00126   inline bool getCachingEnabled() const
00127   {
00128     return m_caching;
00129   }
00130 
00131   // MAP ATTRIBUTES
00132 
00133 
00137   int getInitialCapacity() const;
00138 
00142   float getLoadFactor() const;
00143 
00148   uint8_t getConcurrencyLevel() const;
00149 
00154   uint32_t getLruEntriesLimit( ) const;
00155 
00160   DiskPolicyType::PolicyType getDiskPolicy() const;
00161 
00165   const ExpirationAction::Action getLruEvictionAction( ) const;
00166 
00170   const char* getPoolName() const;
00171 
00172   /*destructor
00173    *
00174    */
00175   virtual ~RegionAttributes();
00176 
00178   virtual void toData(DataOutput& out) const;
00179 
00181   virtual Serializable* fromData( DataInput& in );
00182 
00184   static Serializable* createDeserializable( );
00185 
00187   virtual int32_t classId( ) const;
00188 
00190   virtual int8_t typeId( ) const;
00191 
00192   //return zero deliberately
00193   virtual uint32_t objectSize() const {
00194     return 0;
00195   }
00196 
00201   const char* getCacheLoaderLibrary();
00202 
00207   const char* getCacheLoaderFactory();
00208 
00213   const char* getCacheListenerLibrary();
00214 
00219   const char* getCacheListenerFactory();
00220 
00225   const char* getCacheWriterLibrary();
00226 
00231   const char* getCacheWriterFactory();
00232 
00237   const char* getPartitionResolverLibrary();
00238 
00243   const char* getPartitionResolverFactory();
00244 
00246   bool operator == ( const RegionAttributes& other ) const;
00247 
00249   bool operator != ( const RegionAttributes& other ) const;
00250 
00255   void validateSerializableAttributes( );
00256 
00260   const char* getEndpoints();
00261 
00265   bool getClientNotificationEnabled() const;
00266 
00271   const char* getPersistenceLibrary();
00272 
00277   const char* getPersistenceFactory();
00278 
00282   PropertiesPtr getPersistenceProperties();
00283 
00289   PersistenceManagerPtr getPersistenceManager() ;
00290 
00296   const char* getPoolName() { return m_poolName; }
00297   bool getCloningEnabled( ) { return m_isClonable; }
00298   private:
00299   //Helper function that safely compares two attribute string
00300   //taking into consideration the fact the one or the other
00301   //might be NULL
00302   static int32_t compareStringAttribute(char* attributeA, char* attributeB);
00303 
00304   //Helper function that safely copies one string attribute to
00305   //another.
00306   static void copyStringAttribute(char*& lhs, const char* rhs);
00307 
00308   void setCacheListener(const char* libpath, const char* factoryFuncName);
00309   void setCacheLoader  (const char* libpath, const char* factoryFuncName);
00310   void setCacheWriter  (const char* libpath, const char* factoryFuncName);
00311   void setPartitionResolver(const char* libpath, const char* factoryFuncName);
00312   void setEndpoints( const char* endpoints );
00313   void setPoolName( const char* poolName );
00314   void setCloningEnabled( bool isClonable );
00315   void setCachingEnabled( bool enable);
00316   void setLruEntriesLimit(int limit);
00317   void setDiskPolicy(DiskPolicyType::PolicyType diskPolicy);
00318   void setScope(ScopeType::Scope scope);
00319   inline bool getEntryExpiryEnabled() const
00320   {
00321     return (m_entryTimeToLive != 0 || m_entryIdleTimeout != 0);
00322   }
00323 
00324   inline bool getRegionExpiryEnabled() const
00325   {
00326     return (m_regionTimeToLive != 0 || m_regionIdleTimeout != 0);
00327   }
00328 
00329   //will be created by the factory
00330    RegionAttributes(const RegionAttributes& rhs);
00331    RegionAttributes();
00332 
00333    ExpirationAction::Action m_regionTimeToLiveExpirationAction;
00334    ExpirationAction::Action m_regionIdleTimeoutExpirationAction;
00335    ExpirationAction::Action m_entryTimeToLiveExpirationAction;
00336    ExpirationAction::Action m_entryIdleTimeoutExpirationAction;
00337    ExpirationAction::Action m_lruEvictionAction;
00338    CacheWriterPtr m_cacheWriter;
00339    CacheLoaderPtr m_cacheLoader;
00340    CacheListenerPtr m_cacheListener;
00341    PartitionResolverPtr m_partitionResolver;
00342    uint32_t m_lruEntriesLimit;
00343    bool m_caching;
00344    uint32_t  m_maxValueDistLimit;
00345    uint32_t m_entryIdleTimeout;
00346    uint32_t m_entryTimeToLive;
00347    uint32_t m_regionIdleTimeout;
00348    uint32_t m_regionTimeToLive;
00349    ScopeType::Scope m_scope;
00350    uint32_t m_initialCapacity;
00351    float m_loadFactor;
00352    uint8_t m_concurrencyLevel;
00353    char* m_cacheLoaderLibrary;
00354    char* m_cacheWriterLibrary;
00355    char* m_cacheListenerLibrary;
00356    char* m_partitionResolverLibrary;
00357    char* m_cacheLoaderFactory;
00358    char* m_cacheWriterFactory;
00359    char* m_cacheListenerFactory;
00360    char* m_partitionResolverFactory;
00361    DiskPolicyType::PolicyType m_diskPolicy;
00362    char* m_endpoints;
00363    bool m_clientNotificationEnabled;
00364    char* m_persistenceLibrary;
00365    char* m_persistenceFactory;
00366    PropertiesPtr m_persistenceProperties;
00367    PersistenceManagerPtr m_persistenceManager;
00368    char *m_poolName;
00369    bool m_isClonable;
00370   friend class AttributesFactory;
00371   friend class AttributesMutator;
00372   friend class Cache;
00373   friend class CacheImpl;
00374   friend class Region;
00375   friend class RegionInternal;
00376   friend class RegionXmlCreation;
00377 };
00378 
00379 } //namespace gemfire
00380 
00381 #endif //ifndef __GEMFIRE_REGIONATTRIBUTES_H__

GemFire C++ Cache API Documentation