You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/03/05 16:40:36 UTC
[geode-native] branch develop updated: GEODE-4411 Normalize
AttributesFactory to match other factories (#228)
This is an automated email from the ASF dual-hosted git repository.
jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push:
new a386e9c GEODE-4411 Normalize AttributesFactory to match other factories (#228)
a386e9c is described below
commit a386e9ca9ff0f3c8e8637af859e7b977aa0bdd89
Author: M. Oleske <mo...@users.noreply.github.com>
AuthorDate: Mon Mar 5 08:40:34 2018 -0800
GEODE-4411 Normalize AttributesFactory to match other factories (#228)
* Rename AttributesFactory to RegionAttributesFactory
* Rename createRegionAttributes to create
* Use consistent variable names for readability
* Create returns value
* Make parameter to RegionAttributesFactory ctor not a shared_ptr.
* Use const for getters
* Use mutable until future issue deals with lazy loading
Signed-off-by: Michael Oleske <mo...@pivotal.io>
Signed-off-by: Blake Bender <bb...@pivotal.io>
Signed-off-by: Jacob Barrett <jb...@pivotal.io>
---
.../integration-test/AttributesMutatorTestsN.cs | 8 +-
clicache/integration-test/CacheHelperN.cs | 12 +-
clicache/integration-test/NetTests.cs | 32 ++---
clicache/integration-test/OverflowTestsN.cs | 12 +-
...yTestsN.cs => RegionAttributesFactoryTestsN.cs} | 16 +--
clicache/integration-test/ThinClientDeltaTestN.cs | 47 ++-----
clicache/integration-test/UnitTests.csproj.in | 2 +-
clicache/src/AttributesMutator.hpp | 4 +-
clicache/src/DiskPolicyType.hpp | 2 +-
clicache/src/ICacheListener.hpp | 2 +-
clicache/src/ICacheLoader.hpp | 2 +-
clicache/src/ICacheWriter.hpp | 2 +-
clicache/src/ICqAttributes.hpp | 2 +-
clicache/src/ICqEvent.hpp | 2 +-
clicache/src/ICqListener.hpp | 2 +-
clicache/src/IFixedPartitionResolver.hpp | 2 +-
clicache/src/IPartitionResolver.hpp | 2 +-
clicache/src/ISubscriptionService.hpp | 56 ++++----
clicache/src/LocalRegion.cpp | 3 +-
clicache/src/Region.cpp | 2 +-
clicache/src/RegionAttributes.hpp | 18 +--
...utesFactory.cpp => RegionAttributesFactory.cpp} | 90 ++++++-------
...utesFactory.hpp => RegionAttributesFactory.hpp} | 74 +++++-----
clicache/src/RegionFactory.hpp | 2 +-
clicache/src/geode_defs.hpp | 6 +-
clicache/src/geodeclicache.vcxproj.filters | 4 +-
cppcache/include/geode/AttributesMutator.hpp | 4 +-
cppcache/include/geode/CacheListener.hpp | 2 +-
cppcache/include/geode/CacheLoader.hpp | 2 +-
cppcache/include/geode/CacheWriter.hpp | 2 +-
cppcache/include/geode/DiskPolicyType.hpp | 2 +-
cppcache/include/geode/ExpirationAttributes.hpp | 2 +-
cppcache/include/geode/Region.hpp | 114 ++++++++--------
cppcache/include/geode/RegionAttributes.hpp | 81 ++++++-----
...utesFactory.hpp => RegionAttributesFactory.hpp} | 68 +++++-----
cppcache/include/geode/RegionFactory.hpp | 4 +-
cppcache/integration-test/CMakeLists.txt | 2 +-
cppcache/integration-test/CacheHelper.cpp | 130 ++++++++----------
cppcache/integration-test/CacheHelper.hpp | 2 +-
cppcache/integration-test/CacheImplHelper.hpp | 15 +--
cppcache/integration-test/ThinClientHelper.hpp | 14 +-
.../integration-test/ThinClientListenerInit.hpp | 4 +-
.../ThinClientLocalCacheLoader.hpp | 4 +-
.../ThinClientRIwithlocalRegionDestroy.hpp | 10 +-
.../integration-test/testAttributesMutator.cpp | 8 +-
cppcache/integration-test/testCache.cpp | 23 ++--
cppcache/integration-test/testCacheless.cpp | 2 -
cppcache/integration-test/testExpiration.cpp | 121 +++++++++--------
cppcache/integration-test/testLinkage.cpp | 4 +-
.../integration-test/testOverflowPutGetSqLite.cpp | 69 +++++-----
.../testRegionAccessThreadSafe.cpp | 6 +-
...Factory.cpp => testRegionAttributesFactory.cpp} | 14 +-
.../integration-test/testRegionTemplateArgs.cpp | 6 +-
.../testThinClientAfterRegionLive.cpp | 40 +++---
.../testThinClientCacheableStringArray.cpp | 3 +-
.../integration-test/testThinClientClearRegion.cpp | 40 +++---
cppcache/integration-test/testThinClientCq.cpp | 6 +-
.../integration-test/testThinClientCqDurable.cpp | 6 +-
.../integration-test/testThinClientCqFailover.cpp | 6 +-
.../testThinClientCqHAFailover.cpp | 6 +-
cppcache/integration-test/testThinClientCqIR.cpp | 6 +-
.../testThinClientLRUExpiration.cpp | 34 ++---
.../testThinClientPoolAttrTest.cpp | 2 +-
.../testThinClientRemoteQueryRS.cpp | 3 +-
.../testThinClientRemoteQuerySS.cpp | 3 +-
.../testThinClientRemoteQueryTimeout.cpp | 3 +-
.../testThinClientRemoteRegionQuery.cpp | 3 +-
.../testThinClientSecurityAuthorizationMU.cpp | 2 +-
.../testThinClientSecurityCQAuthorizationMU.cpp | 6 +-
...tThinClientSecurityDurableCQAuthorizationMU.cpp | 8 +-
.../testXmlCacheCreationWithOverFlow.cpp | 31 +++--
.../testXmlCacheCreationWithPools.cpp | 15 +--
.../testXmlCacheCreationWithRefid.cpp | 56 ++++----
cppcache/src/Cache.cpp | 4 +-
cppcache/src/CacheImpl.cpp | 85 ++++++------
cppcache/src/CacheImpl.hpp | 10 +-
cppcache/src/CacheXmlParser.cpp | 139 ++++++++++---------
cppcache/src/CacheXmlParser.hpp | 2 +-
cppcache/src/ClientMetadataService.cpp | 6 +-
cppcache/src/EntriesMapFactory.cpp | 16 +--
cppcache/src/EntriesMapFactory.hpp | 2 +-
cppcache/src/EntryExpiryHandler.cpp | 2 +-
cppcache/src/LocalRegion.cpp | 121 ++++++++---------
cppcache/src/LocalRegion.hpp | 12 +-
cppcache/src/MapSegment.cpp | 2 +-
cppcache/src/PoolManagerImpl.cpp | 2 +-
cppcache/src/PoolXmlCreation.hpp | 2 +-
cppcache/src/ProxyCache.cpp | 4 +-
cppcache/src/ProxyRegion.hpp | 6 +-
cppcache/src/RegionAttributes.cpp | 48 ++++---
...utesFactory.cpp => RegionAttributesFactory.cpp} | 75 ++++++-----
cppcache/src/RegionExpiryHandler.cpp | 2 +-
cppcache/src/RegionFactory.cpp | 69 +++++-----
cppcache/src/RegionInternal.cpp | 78 +++--------
cppcache/src/RegionInternal.hpp | 10 +-
cppcache/src/RegionXmlCreation.cpp | 16 +--
cppcache/src/RegionXmlCreation.hpp | 10 +-
cppcache/src/TcrDistributionManager.cpp | 4 +-
cppcache/src/TcrMessage.cpp | 8 +-
cppcache/src/ThinClientHARegion.cpp | 8 +-
cppcache/src/ThinClientHARegion.hpp | 4 +-
cppcache/src/ThinClientPoolRegion.cpp | 4 +-
cppcache/src/ThinClientPoolRegion.hpp | 2 +-
cppcache/src/ThinClientRegion.cpp | 36 ++---
cppcache/src/ThinClientRegion.hpp | 2 +-
cppcache/test/AttributesFactoryTest.cpp | 80 -----------
cppcache/test/RegionAttributesFactoryTest.cpp | 78 +++++++++++
tests/cli/FwkUtil/FwkData.cs | 46 +++----
tests/cli/NewFwkLib/EventTest/EventTests.cs | 8 +-
tests/cpp/fwklib/FrameworkTest.cpp | 2 +-
tests/cpp/fwklib/FwkObjects.hpp | 12 +-
tests/cpp/fwklib/RegionHelper.hpp | 150 ++++++++++-----------
112 files changed, 1232 insertions(+), 1335 deletions(-)
diff --git a/clicache/integration-test/AttributesMutatorTestsN.cs b/clicache/integration-test/AttributesMutatorTestsN.cs
index 9b1565a..8ef25de 100644
--- a/clicache/integration-test/AttributesMutatorTestsN.cs
+++ b/clicache/integration-test/AttributesMutatorTestsN.cs
@@ -142,10 +142,10 @@ namespace Apache.Geode.Client.UnitTests
//m_reg3Loader1 = new TallyLoader<string, string>();
m_reg3Loader1 = new ThinClientTallyLoader();
m_reg3Writer1 = new TallyWriter<string, string>();
- AttributesFactory<string, string> af = new AttributesFactory<string, string>();
+ var regionAttributesFactory = new RegionAttributesFactory<string, string>();
GIRegion region = CacheHelper.CreateRegion<string, string>(PeerRegionName,
- af.CreateRegionAttributes());
+ regionAttributesFactory.Create());
SetCacheListener(PeerRegionName, m_reg3Listener1);
SetCacheLoader(PeerRegionName, m_reg3Loader1);
@@ -164,10 +164,10 @@ namespace Apache.Geode.Client.UnitTests
public void StepTwoCallbacks()
{
- AttributesFactory<string, string> af = new AttributesFactory<string, string>();
+ var regionAttributesFactory = new RegionAttributesFactory<string, string>();
GIRegion region = CacheHelper.CreateRegion<string, string>(PeerRegionName,
- af.CreateRegionAttributes());
+ regionAttributesFactory.Create());
CreateEntry(RegionNames[0], m_keys[1], m_vals[1]);
CreateEntry(RegionNames[1], m_keys[3], m_vals[3]);
diff --git a/clicache/integration-test/CacheHelperN.cs b/clicache/integration-test/CacheHelperN.cs
index 0a9394e..4d7eeec 100644
--- a/clicache/integration-test/CacheHelperN.cs
+++ b/clicache/integration-test/CacheHelperN.cs
@@ -660,7 +660,7 @@ namespace Apache.Geode.Client.UnitTests
public static void CloseUserCache(bool keepAlive)
{
- //TODO: need to look
+ //TODO: need to look
m_cacheForMultiUser.Close();
}
@@ -816,11 +816,11 @@ namespace Apache.Geode.Client.UnitTests
{
Init();
CreateCachingRegion<TKey, TValue>(rootName, true);
- AttributesFactory<TKey, TValue> af = new AttributesFactory<TKey, TValue>();
- af.SetLruEntriesLimit(0);
- af.SetInitialCapacity(size);
- Apache.Geode.Client.RegionAttributes<TKey, TValue> rattrs = af.CreateRegionAttributes();
- IRegion<TKey, TValue> region = ((Region<TKey, TValue>)m_currRegion).CreateSubRegion(name, rattrs);
+ var regionAttributesFactory = new RegionAttributesFactory<TKey, TValue>();
+ regionAttributesFactory.SetLruEntriesLimit(0);
+ regionAttributesFactory.SetInitialCapacity(size);
+ var regionAttributes = regionAttributesFactory.Create();
+ IRegion<TKey, TValue> region = ((Region<TKey, TValue>)m_currRegion).CreateSubRegion(name, regionAttributes);
Assert.IsNotNull(region, "SubRegion {0} was not created.", name);
return region;
}
diff --git a/clicache/integration-test/NetTests.cs b/clicache/integration-test/NetTests.cs
index e31d9b4..c3abea6 100644
--- a/clicache/integration-test/NetTests.cs
+++ b/clicache/integration-test/NetTests.cs
@@ -59,13 +59,13 @@ namespace Apache.Geode.Client.UnitTests
public void CreateRegionWithTallyLoader(ScopeType scope)
{
- AttributesFactory af = new AttributesFactory();
- af.SetCacheLoader(m_ldr);
- af.SetScope(scope);
- af.SetCachingEnabled(true);
-
+ var regionAttributesFactory = new RegionAttributesFactory();
+ regionAttributesFactory.SetCacheLoader(m_ldr);
+ regionAttributesFactory.SetScope(scope);
+ regionAttributesFactory.SetCachingEnabled(true);
+
m_region = CacheHelper.CreateRegion(TestRegion,
- af.CreateRegionAttributes());
+ regionAttributesFactory.Create());
}
public void CreateRegionAndGetNEntries(int num)
@@ -89,10 +89,10 @@ namespace Apache.Geode.Client.UnitTests
public void RegionThreeLoadEntries(int num)
{
- AttributesFactory af = new AttributesFactory();
- af.SetScope(ScopeType.Local);
- af.SetCacheLoader(m_ldr);
- m_region = CacheHelper.CreateRegion(TestRegion, af.CreateRegionAttributes());
+ var regionAttributesFactory = new RegionAttributesFactory();
+ regionAttributesFactory.SetScope(ScopeType.Local);
+ regionAttributesFactory.SetCacheLoader(m_ldr);
+ m_region = CacheHelper.CreateRegion(TestRegion, regionAttributesFactory.Create());
m_ldr.Reset();
Thread.Sleep(100);
DoGets(m_region, num);
@@ -103,13 +103,13 @@ namespace Apache.Geode.Client.UnitTests
public void CreateRegionWithTallyWriter(ScopeType scope)
{
- AttributesFactory af = new AttributesFactory();
- af.SetCacheWriter(m_lwr);
- af.SetScope(scope);
- af.SetCachingEnabled(true);
-
+ var regionAttributesFactory = new RegionAttributesFactory();
+ regionAttributesFactory.SetCacheWriter(m_lwr);
+ regionAttributesFactory.SetScope(scope);
+ regionAttributesFactory.SetCachingEnabled(true);
+
m_netWriteRegion = CacheHelper.CreateRegion(TestRegionWrite,
- af.CreateRegionAttributes());
+ regionAttributesFactory.Create());
}
public void RegionTwoCreateEntries(int num)
diff --git a/clicache/integration-test/OverflowTestsN.cs b/clicache/integration-test/OverflowTestsN.cs
index 7215c26..e655d71 100644
--- a/clicache/integration-test/OverflowTestsN.cs
+++ b/clicache/integration-test/OverflowTestsN.cs
@@ -129,15 +129,15 @@ namespace Apache.Geode.Client.UnitTests
private IRegion<object, object> CreateSubRegion(IRegion<object, object> region, string subRegionName, string libraryName, string factoryFunctionName)
{
- AttributesFactory<object, object> attrsFact = new AttributesFactory<object, object>(region.Attributes);
+ var regionAttributesFactory = new RegionAttributesFactory<object, object>(region.Attributes);
Properties<string, string> sqliteProperties = new Properties<string, string>();
sqliteProperties.Insert("PageSize", "65536");
sqliteProperties.Insert("MaxPageCount", "512000000");
String sqlite_dir = "SqLiteDir" + Process.GetCurrentProcess().Id.ToString();
sqliteProperties.Insert("PersistenceDirectory", sqlite_dir);
- attrsFact.SetPersistenceManager(libraryName, factoryFunctionName, sqliteProperties);
+ regionAttributesFactory.SetPersistenceManager(libraryName, factoryFunctionName, sqliteProperties);
IRegion<object, object> subRegion = region.CreateSubRegion(subRegionName,
- attrsFact.CreateRegionAttributes());
+ regionAttributesFactory.Create());
Assert.IsNotNull(subRegion, "Expected region to be non null");
Assert.IsTrue(File.Exists(GetSqLiteFileName(sqlite_dir, subRegionName)), "Persistence file is not present");
DoNput(subRegion, 50);
@@ -270,7 +270,7 @@ namespace Apache.Geode.Client.UnitTests
TestGetOp(region, 100);
//Console.WriteLine("TEST-4");
- // test to verify same region repeatedly to ensure that the persistece
+ // test to verify same region repeatedly to ensure that the persistece
// files are created and destroyed correctly
IRegion<object, object> subRegion;
@@ -308,7 +308,7 @@ namespace Apache.Geode.Client.UnitTests
TestGetOp(region, 100);
//Console.WriteLine("TEST-4");
- // test to verify same region repeatedly to ensure that the persistece
+ // test to verify same region repeatedly to ensure that the persistece
// files are created and destroyed correctly
IRegion<object, object> subRegion;
@@ -404,7 +404,7 @@ namespace Apache.Geode.Client.UnitTests
TestGetOp(region, 100);
//Console.WriteLine("TEST-4");
- // test to verify same region repeatedly to ensure that the persistece
+ // test to verify same region repeatedly to ensure that the persistece
// files are created and destroyed correctly
IRegion<object, object> subRegion;
diff --git a/clicache/integration-test/AttributesFactoryTestsN.cs b/clicache/integration-test/RegionAttributesFactoryTestsN.cs
similarity index 75%
rename from clicache/integration-test/AttributesFactoryTestsN.cs
rename to clicache/integration-test/RegionAttributesFactoryTestsN.cs
index 6574ddb..304c6ee 100644
--- a/clicache/integration-test/AttributesFactoryTestsN.cs
+++ b/clicache/integration-test/RegionAttributesFactoryTestsN.cs
@@ -24,14 +24,14 @@ namespace Apache.Geode.Client.UnitTests
{
using NUnit.Framework;
using Apache.Geode.DUnitFramework;
-
-
+
+
[TestFixture]
[Category("group1")]
[Category("unicast_only")]
[Category("generics")]
- public class AttributesFactoryTests : UnitTests
+ public class RegionAttributesFactoryTests : UnitTests
{
private UnitProcess m_client1, m_client2;
@@ -45,11 +45,11 @@ namespace Apache.Geode.Client.UnitTests
[Test]
public void fluentModeltest()
{
- AttributesFactory<string, string> af = new AttributesFactory<string, string>();
- Apache.Geode.Client.RegionAttributes<string, string> rattrs = af.SetLruEntriesLimit(2).SetInitialCapacity(5).CreateRegionAttributes();
- Assert.IsNotNull(rattrs);
- Assert.True(rattrs.LruEntriesLimit == 2);
- Assert.True(rattrs.InitialCapacity == 5);
+ var regionAttributesFactory = new RegionAttributesFactory<string, string>();
+ var regionAttributes = regionAttributesFactory.SetLruEntriesLimit(2).SetInitialCapacity(5).Create();
+ Assert.IsNotNull(regionAttributes);
+ Assert.True(regionAttributes.LruEntriesLimit == 2);
+ Assert.True(regionAttributes.InitialCapacity == 5);
}
}
}
diff --git a/clicache/integration-test/ThinClientDeltaTestN.cs b/clicache/integration-test/ThinClientDeltaTestN.cs
index 66c56b6..0067942 100644
--- a/clicache/integration-test/ThinClientDeltaTestN.cs
+++ b/clicache/integration-test/ThinClientDeltaTestN.cs
@@ -243,38 +243,13 @@ namespace Apache.Geode.Client.UnitTests
}
public void CreateRegion(string name, bool enableNotification, bool cloningEnabled)
{
- Apache.Geode.Client.RegionAttributes<object, object> attrs;
- AttributesFactory<object, object> attrFac = new AttributesFactory<object, object>();
- attrFac.SetCacheListener(new SimpleCacheListener<object, object>());
- attrFac.SetCloningEnabled(cloningEnabled);
- attrs = attrFac.CreateRegionAttributes();
- CacheHelper.CreateRegion<object, object>(name, attrs);
+ var regionAttributesFactory = new RegionAttributesFactory<object, object>();
+ regionAttributesFactory.SetCacheListener(new SimpleCacheListener<object, object>());
+ regionAttributesFactory.SetCloningEnabled(cloningEnabled);
+ var regionAttributes = regionAttributesFactory.Create();
+ CacheHelper.CreateRegion<object, object>(name, regionAttributes);
}
- //public void CreateOverflowRegion(string name, uint entriesLimit)
- //{
- // AttributesFactory af = new AttributesFactory();
- // af.SetScope(ScopeType.DistributedAck);
- // af.SetCachingEnabled(true);
- // af.SetClientNotificationEnabled(true);
- // af.SetLruEntriesLimit(entriesLimit);// LRU Entry limit set to 3
-
- // af.SetDiskPolicy(DiskPolicyType.Overflows);
- // Properties bdbProperties = Properties.Create();
- // bdbProperties.Insert("CacheSizeGb", "0");
- // bdbProperties.Insert("CacheSizeMb", "512");
- // bdbProperties.Insert("PageSize", "65536");
- // bdbProperties.Insert("MaxFileSize", "512000000");
- // String wdPath = Directory.GetCurrentDirectory();
- // String absPersistenceDir = wdPath + "/absBDB";
- // String absEnvDir = wdPath + "/absBDBEnv";
- // bdbProperties.Insert("PersistenceDirectory", absPersistenceDir);
- // bdbProperties.Insert("EnvironmentDirectory", absEnvDir);
- // af.SetPersistenceManager("BDBImpl", "createBDBInstance", bdbProperties);
-
- // CacheHelper.CreateRegion(name, af.CreateRegionAttributes());
- //}
-
void DoPutWithDelta()
{
try
@@ -344,12 +319,12 @@ namespace Apache.Geode.Client.UnitTests
DeltaEx.FromDataCount = 0;
DeltaEx.FromDeltaCount = 0;
- // Try Contains with key & value that are present. Result should be true.
+ // Try Contains with key & value that are present. Result should be true.
KeyValuePair<object, object> myentry = new KeyValuePair<object, object>(cKey, val1);
bool containsOpflag = reg.Contains(myentry);
Assert.IsTrue(containsOpflag, "Result should be true as key & value are present");
- // Try Remove with key & value that are present. Result should be true.
+ // Try Remove with key & value that are present. Result should be true.
bool removeOpflag = reg.Remove(cKey);
Assert.IsTrue(removeOpflag, "Result should be true as key & value are present");
@@ -456,7 +431,7 @@ namespace Apache.Geode.Client.UnitTests
DeltaEx.ToDeltaCount = 0;
DeltaEx.ToDataCount = 0;
}
-
+
void DoCqWithDelta()
{
string cKey1 = "key1";
@@ -541,7 +516,7 @@ namespace Apache.Geode.Client.UnitTests
// m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, false);
// m_client1.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__");
}
-
+
m_client1.Call(initializeDeltaClientAD);
m_client2.Call(initializeDeltaClientAD);
@@ -603,7 +578,7 @@ namespace Apache.Geode.Client.UnitTests
//do nothing
}
IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
-
+
reg.GetSubscriptionService().RegisterRegex(".*");
AttributesMutator<object, object> attrMutator = reg.AttributesMutator;
attrMutator.SetCacheListener(new SimpleCacheListener<object, object>());
@@ -672,7 +647,7 @@ namespace Apache.Geode.Client.UnitTests
string cKey = m_keys[0];
IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
DeltaTestImpl val = reg[cKey] as DeltaTestImpl;
-
+
if (val.GetIntVar() != 2)
Assert.Fail("Int value after cloning should be 2, is " + val.GetIntVar());
if (DeltaTestImpl.GetFromDataCount() != 2)
diff --git a/clicache/integration-test/UnitTests.csproj.in b/clicache/integration-test/UnitTests.csproj.in
index 4e9c743..9c003ec 100644
--- a/clicache/integration-test/UnitTests.csproj.in
+++ b/clicache/integration-test/UnitTests.csproj.in
@@ -161,7 +161,7 @@
<Link>ThinClientPdxTests.cs</Link>
</Compile>
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientSecurityAuthSetAuthInitializeTests.cs" />
- <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\AttributesFactoryTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\RegionAttributesFactoryTestsN.cs" />
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\AttributesMutatorTestsN.cs" />
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\CacheHelperN.cs" />
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\CachelessTestsN.cs" />
diff --git a/clicache/src/AttributesMutator.hpp b/clicache/src/AttributesMutator.hpp
index b407c0b..ec46857 100644
--- a/clicache/src/AttributesMutator.hpp
+++ b/clicache/src/AttributesMutator.hpp
@@ -46,7 +46,7 @@ namespace Apache
/// <remarks>
/// <para>
/// It is required that the attributes be completely initialized using an
- /// <see cref="AttributesFactory" /> before creating the region.
+ /// <see cref="RegionAttributesFactory" /> before creating the region.
/// AttributesMutator can be applied to adjusting and tuning a subset of
/// attributes that are modifiable at runtime.
/// </para><para>
@@ -55,7 +55,7 @@ namespace Apache
/// </remarks>
/// <seealso cref="Region.AttributesMutator" />
/// <seealso cref="RegionAttributes" />
- /// <seealso cref="AttributesFactory" />
+ /// <seealso cref="RegionAttributesFactory" />
generic<class TKey, class TValue>
public ref class AttributesMutator sealed
{
diff --git a/clicache/src/DiskPolicyType.hpp b/clicache/src/DiskPolicyType.hpp
index c421721..1b2d6ee 100644
--- a/clicache/src/DiskPolicyType.hpp
+++ b/clicache/src/DiskPolicyType.hpp
@@ -54,7 +54,7 @@ namespace Apache
/// Static class containing convenience methods for <c>DiskPolicyType</c>.
/// </summary>
/// <seealso cref="RegionAttributes.DiskPolicy" />
- /// <seealso cref="AttributesFactory.SetDiskPolicy" />
+ /// <seealso cref="RegionAttributesFactory.SetDiskPolicy" />
public ref class DiskPolicy STATICCLASS
{
public:
diff --git a/clicache/src/ICacheListener.hpp b/clicache/src/ICacheListener.hpp
index ca1095a..5654367 100644
--- a/clicache/src/ICacheListener.hpp
+++ b/clicache/src/ICacheListener.hpp
@@ -72,7 +72,7 @@ namespace Apache
/// first case where listeners are invoked only when the region update
/// operation succeeds.
/// </remarks>
- /// <seealso cref="AttributesFactory.SetCacheListener" />
+ /// <seealso cref="RegionAttributesFactory.SetCacheListener" />
/// <seealso cref="RegionAttributes.CacheListener" />
/// <seealso cref="ICacheLoader" />
/// <seealso cref="ICacheWriter" />
diff --git a/clicache/src/ICacheLoader.hpp b/clicache/src/ICacheLoader.hpp
index 432b3de..70870fe 100644
--- a/clicache/src/ICacheLoader.hpp
+++ b/clicache/src/ICacheLoader.hpp
@@ -64,7 +64,7 @@ namespace Apache
/// creates the value for the desired key by performing an operation such
/// as a database query.
/// </remarks>
- /// <seealso cref="AttributesFactory.SetCacheLoader" />
+ /// <seealso cref="RegionAttributesFactory.SetCacheLoader" />
/// <seealso cref="RegionAttributes.CacheLoader" />
/// <seealso cref="ICacheListener" />
/// <seealso cref="ICacheWriter" />
diff --git a/clicache/src/ICacheWriter.hpp b/clicache/src/ICacheWriter.hpp
index 137c6cf..4096e79 100644
--- a/clicache/src/ICacheWriter.hpp
+++ b/clicache/src/ICacheWriter.hpp
@@ -75,7 +75,7 @@ namespace Apache
/// of whether the initiator is in the same process as the <c>ICacheWriter</c>.
/// </para>
/// </remarks>
- /// <seealso cref="AttributesFactory.SetCacheWriter" />
+ /// <seealso cref="RegionAttributesFactory.SetCacheWriter" />
/// <seealso cref="RegionAttributes.CacheWriter" />
/// <seealso cref="ICacheLoader" />
/// <seealso cref="ICacheListener" />
diff --git a/clicache/src/ICqAttributes.hpp b/clicache/src/ICqAttributes.hpp
index 6c42f77..8e8c1fc 100644
--- a/clicache/src/ICqAttributes.hpp
+++ b/clicache/src/ICqAttributes.hpp
@@ -54,7 +54,7 @@ namespace Apache
/// implementation may choose to hand off the event to a thread pool that then processes
/// the event on its thread rather than the listener thread
/// </remarks>
- /// <seealso cref="AttributesFactory.SetCacheListener" />
+ /// <seealso cref="RegionAttributesFactory.SetCacheListener" />
/// <seealso cref="RegionAttributes.CacheListener" />
/// <seealso cref="ICacheLoader" />
/// <seealso cref="ICacheWriter" />
diff --git a/clicache/src/ICqEvent.hpp b/clicache/src/ICqEvent.hpp
index eea1fc6..f60a7fd 100644
--- a/clicache/src/ICqEvent.hpp
+++ b/clicache/src/ICqEvent.hpp
@@ -60,7 +60,7 @@ namespace Apache
/// implementation may choose to hand off the event to a thread pool that then processes
/// the event on its thread rather than the listener thread
/// </remarks>
- /// <seealso cref="AttributesFactory.SetCacheListener" />
+ /// <seealso cref="RegionAttributesFactory.SetCacheListener" />
/// <seealso cref="RegionAttributes.CacheListener" />
/// <seealso cref="ICacheLoader" />
/// <seealso cref="ICacheWriter" />
diff --git a/clicache/src/ICqListener.hpp b/clicache/src/ICqListener.hpp
index e6b2732..67b44cf 100644
--- a/clicache/src/ICqListener.hpp
+++ b/clicache/src/ICqListener.hpp
@@ -55,7 +55,7 @@ namespace Apache
/// implementation may choose to hand off the event to a thread pool that then processes
/// the event on its thread rather than the listener thread
/// </remarks>
- /// <seealso cref="AttributesFactory.SetCacheListener" />
+ /// <seealso cref="RegionAttributesFactory.SetCacheListener" />
/// <seealso cref="RegionAttributes.CacheListener" />
/// <seealso cref="ICacheLoader" />
/// <seealso cref="ICacheWriter" />
diff --git a/clicache/src/IFixedPartitionResolver.hpp b/clicache/src/IFixedPartitionResolver.hpp
index 210519f..1a98dac 100644
--- a/clicache/src/IFixedPartitionResolver.hpp
+++ b/clicache/src/IFixedPartitionResolver.hpp
@@ -72,7 +72,7 @@ namespace Apache
/// @see PartitionResolver
///
/// </remarks>
- /// <seealso cref="AttributesFactory.SetPartitionResolver" />
+ /// <seealso cref="RegionAttributesFactory.SetPartitionResolver" />
/// <seealso cref="RegionAttributes.PartitionResolver" />
generic<class TKey, class TValue>
public interface class IFixedPartitionResolver : public IPartitionResolver<TKey, TValue>
diff --git a/clicache/src/IPartitionResolver.hpp b/clicache/src/IPartitionResolver.hpp
index 08eaf74..d859a3e 100644
--- a/clicache/src/IPartitionResolver.hpp
+++ b/clicache/src/IPartitionResolver.hpp
@@ -70,7 +70,7 @@ namespace Apache
/// In the example above, all trade entries with the same month and year are
/// guaranteed to be colocated.
/// </remarks>
- /// <seealso cref="AttributesFactory.SetPartitionResolver" />
+ /// <seealso cref="RegionAttributesFactory.SetPartitionResolver" />
/// <seealso cref="RegionAttributes.PartitionResolver" />
generic<class TKey, class TValue>
public interface class IPartitionResolver
diff --git a/clicache/src/ISubscriptionService.hpp b/clicache/src/ISubscriptionService.hpp
index 26b3eb0..1ab5fff 100644
--- a/clicache/src/ISubscriptionService.hpp
+++ b/clicache/src/ISubscriptionService.hpp
@@ -43,7 +43,7 @@ namespace Apache
/// <summary>
/// Registers a collection of keys for getting updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// </summary>
/// <param name="keys">a collection of keys</param>
/// <exception cref="IllegalArgumentException">
@@ -66,7 +66,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -77,7 +77,7 @@ namespace Apache
/// <summary>
/// Registers a collection of keys for getting updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// Should only be called for durable clients and with cache server version 5.5 onwards.
/// </summary>
/// <param name="keys">a collection of keys</param>
@@ -106,7 +106,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -117,7 +117,7 @@ namespace Apache
/// <summary>
/// Registers a collection of keys for getting updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// Should only be called for durable clients and with cache server version 5.5 onwards.
/// </summary>
/// <param name="keys">a collection of keys</param>
@@ -147,7 +147,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -158,7 +158,7 @@ namespace Apache
/// <summary>
/// Unregisters a collection of keys to stop getting updates for them.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// </summary>
/// <param name="keys">the collection of keys</param>
/// <exception cref="IllegalArgumentException">
@@ -181,7 +181,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -193,7 +193,7 @@ namespace Apache
/// Register interest for all the keys of the region to get
/// updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// </summary>
/// <exception cref="CacheServerException">
/// If an exception is received from the Java cache server.
@@ -209,7 +209,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -221,7 +221,7 @@ namespace Apache
/// Register interest for all the keys of the region to get
/// updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// Should only be called for durable clients and with cache server version 5.5 onwards.
/// </summary>
/// <param name="isDurable">whether the registration should be durable</param>
@@ -239,7 +239,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -251,7 +251,7 @@ namespace Apache
/// Register interest for all the keys of the region to get
/// updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// Should only be called for durable clients and with cache server version 5.5 onwards.
/// </summary>
/// <param name="isDurable">whether the registration should be durable</param>
@@ -273,7 +273,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -286,7 +286,7 @@ namespace Apache
/// Register interest for all the keys of the region to get
/// updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// Should only be called for durable clients and with cache server version 5.5 onwards.
/// </summary>
/// <param name="isDurable">whether the registration should be durable</param>
@@ -309,7 +309,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -333,7 +333,7 @@ namespace Apache
/// Unregister interest for all the keys of the region to stop
/// getting updates for them.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// </summary>
/// <exception cref="IllegalStateException">
/// If not previously registered all keys.
@@ -352,7 +352,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -364,7 +364,7 @@ namespace Apache
/// Register interest for the keys of the region that match the
/// given regular expression to get updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// </summary>
/// <exception cref="IllegalArgumentException">
/// If the regular expression string is empty.
@@ -388,7 +388,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -400,7 +400,7 @@ namespace Apache
/// Register interest for the keys of the region that match the
/// given regular expression to get updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// Should only be called for durable clients and with cache server version 5.5 onwards.
/// </summary>
/// <param name="regex">the regular expression to register</param>
@@ -427,7 +427,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -439,7 +439,7 @@ namespace Apache
/// Register interest for the keys of the region that match the
/// given regular expression to get updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// Should only be called for durable clients and with cache server version 5.5 onwards.
/// </summary>
/// <param name="regex">the regular expression to register</param>
@@ -470,7 +470,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -482,7 +482,7 @@ namespace Apache
/// Register interest for the keys of the region that match the
/// given regular expression to get updates from the server.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// Should only be called for durable clients and with cache server version 5.5 onwards.
/// </summary>
/// <param name="regex">the regular expression to register</param>
@@ -514,7 +514,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
@@ -529,7 +529,7 @@ namespace Apache
/// The regular expression must have been registered previously using
/// a <c>RegisterRegex</c> call.
/// Valid only for a Native Client region when client notification
- /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// ( <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> ) is true.
/// </summary>
/// <exception cref="IllegalArgumentException">
/// If the regular expression string is empty.
@@ -552,7 +552,7 @@ namespace Apache
/// </exception>
/// <exception cref="UnsupportedOperationException">
/// If the region is not a Native Client region or
- /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// <see cref="RegionAttributesFactory.SetClientNotificationEnabled" /> is false.
/// </exception>
/// <exception cref="TimeoutException">
/// if the operation timed out
diff --git a/clicache/src/LocalRegion.cpp b/clicache/src/LocalRegion.cpp
index 77d1a92..c3957f5 100644
--- a/clicache/src/LocalRegion.cpp
+++ b/clicache/src/LocalRegion.cpp
@@ -734,8 +734,9 @@ namespace Apache
try
{
+ native::RegionAttributes regionAttributes;
return Region<TKey, TValue>::Create(m_nativeptr->get()->createSubregion(
- marshal_as<std::string>(subRegionName), __nullptr))->GetLocalView();
+ marshal_as<std::string>(subRegionName), regionAttributes))->GetLocalView();
}
finally
{
diff --git a/clicache/src/Region.cpp b/clicache/src/Region.cpp
index 909599a..327efe2 100644
--- a/clicache/src/Region.cpp
+++ b/clicache/src/Region.cpp
@@ -915,7 +915,7 @@ namespace Apache
try
{
auto p_attrs = attributes->GetNative();
- return Region::Create(m_nativeptr->get()->createSubregion(marshal_as<std::string>(subRegionName), p_attrs));
+ return Region::Create(m_nativeptr->get()->createSubregion(marshal_as<std::string>(subRegionName), *p_attrs));
}
finally
{
diff --git a/clicache/src/RegionAttributes.hpp b/clicache/src/RegionAttributes.hpp
index 911c0f7..6d0c0ee 100644
--- a/clicache/src/RegionAttributes.hpp
+++ b/clicache/src/RegionAttributes.hpp
@@ -56,14 +56,14 @@ namespace Apache
/// and whether statistics are enabled for the region and its entries.
///
/// To create an instance of this interface, use
- /// <see cref="AttributesFactory.CreateRegionAttributes" />.
+ /// <see cref="RegionAttributesFactory.Create" />.
///
- /// For compatibility rules and default values, see <see cref="AttributesFactory" />.
+ /// For compatibility rules and default values, see <see cref="RegionAttributesFactory" />.
/// <para>
/// Note that the <c>RegionAttributes</c> are not distributed with the region.
/// </para>
/// </remarks>
- /// <seealso cref="AttributesFactory" />
+ /// <seealso cref="RegionAttributesFactory" />
/// <seealso cref="AttributesMutator" />
/// <seealso cref="Region.Attributes" />
generic <class TKey, class TValue>
@@ -222,7 +222,7 @@ namespace Apache
/// Returns the concurrency level of the entry's local cache.
/// </summary>
/// <returns>the concurrency level</returns>
- /// <seealso cref="AttributesFactory" />
+ /// <seealso cref="RegionAttributesFactory" />
property System::Int32 ConcurrencyLevel
{
System::Int32 get();
@@ -427,7 +427,7 @@ namespace Apache
/// Returns the concurrency check enabled flag of the region
/// </summary>
/// <returns>the concurrency check enabled flag</returns>
- /// <seealso cref="AttributesFactory" />
+ /// <seealso cref="RegionAttributesFactory" />
property bool ConcurrencyChecksEnabled
{
bool get();
@@ -481,10 +481,9 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static RegionAttributes<TKey, TValue>^ Create(std::shared_ptr<native::RegionAttributes> nativeptr)
+ inline static RegionAttributes<TKey, TValue>^ Create(native::RegionAttributes nativeptr)
{
- return __nullptr == nativeptr ? nullptr :
- gcnew RegionAttributes<TKey, TValue>( nativeptr );
+ return gcnew RegionAttributes<TKey, TValue>( nativeptr );
}
std::shared_ptr<native::RegionAttributes> GetNative()
@@ -498,8 +497,9 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline RegionAttributes<TKey, TValue>(std::shared_ptr<native::RegionAttributes> nativeptr)
+ inline RegionAttributes<TKey, TValue>(native::RegionAttributes nativeobj)
{
+ const std::shared_ptr<native::RegionAttributes> nativeptr = std::make_shared<native::RegionAttributes>(nativeobj);
m_nativeptr = gcnew native_shared_ptr<native::RegionAttributes>(nativeptr);
}
diff --git a/clicache/src/AttributesFactory.cpp b/clicache/src/RegionAttributesFactory.cpp
similarity index 75%
rename from clicache/src/AttributesFactory.cpp
rename to clicache/src/RegionAttributesFactory.cpp
index bf74cec..e8bd4aa 100644
--- a/clicache/src/AttributesFactory.cpp
+++ b/clicache/src/RegionAttributesFactory.cpp
@@ -16,7 +16,7 @@
*/
-#include "AttributesFactory.hpp"
+#include "RegionAttributesFactory.hpp"
#include "Region.hpp"
#include "impl/ManagedCacheLoader.hpp"
#include "impl/ManagedPersistenceManager.hpp"
@@ -57,16 +57,16 @@ namespace Apache
namespace native = apache::geode::client;
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>::AttributesFactory( Apache::Geode::Client::RegionAttributes<TKey, TValue>^ regionAttributes )
+ RegionAttributesFactory<TKey, TValue>::RegionAttributesFactory( Apache::Geode::Client::RegionAttributes<TKey, TValue>^ regionAttributes )
{
auto attribptr = regionAttributes->GetNative();
- m_nativeptr = gcnew native_unique_ptr<native::AttributesFactory>(std::make_unique<native::AttributesFactory>(attribptr));
+ m_nativeptr = gcnew native_unique_ptr<native::RegionAttributesFactory>(std::make_unique<native::RegionAttributesFactory>(*attribptr));
}
// CALLBACKS
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader )
{
std::shared_ptr<native::CacheLoader> loaderptr;
if ( cacheLoader != nullptr ) {
@@ -87,7 +87,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter )
{
std::shared_ptr<native::CacheWriter> writerptr;
if ( cacheWriter != nullptr ) {
@@ -108,7 +108,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener )
{
std::shared_ptr<native::CacheListener> listenerptr;
if ( cacheListener != nullptr ) {
@@ -129,24 +129,24 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver )
{
std::shared_ptr<native::PartitionResolver> resolverptr;
if ( partitionresolver != nullptr ) {
- Client::IFixedPartitionResolver<TKey, TValue>^ resolver =
+ Client::IFixedPartitionResolver<TKey, TValue>^ resolver =
dynamic_cast<Client::IFixedPartitionResolver<TKey, TValue>^>(partitionresolver);
- if (resolver != nullptr) {
+ if (resolver != nullptr) {
FixedPartitionResolverGeneric<TKey, TValue>^ prg = gcnew FixedPartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(partitionresolver);
- resolverptr = std::shared_ptr<native::ManagedFixedPartitionResolverGeneric>(new native::ManagedFixedPartitionResolverGeneric(partitionresolver));
+ resolverptr = std::shared_ptr<native::ManagedFixedPartitionResolverGeneric>(new native::ManagedFixedPartitionResolverGeneric(partitionresolver));
((native::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
}
- else {
+ else {
PartitionResolverGeneric<TKey, TValue>^ prg = gcnew PartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(partitionresolver);
resolverptr = std::shared_ptr<native::ManagedPartitionResolverGeneric>(new native::ManagedPartitionResolverGeneric(partitionresolver));
- ((native::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
- }
+ ((native::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ }
}
try
{
@@ -160,7 +160,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetCacheLoader( String^ libPath, String^ factoryFunctionName )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetCacheLoader( String^ libPath, String^ factoryFunctionName )
{
throw gcnew System::NotSupportedException;
@@ -176,7 +176,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetCacheWriter( String^ libPath, String^ factoryFunctionName )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetCacheWriter( String^ libPath, String^ factoryFunctionName )
{
throw gcnew System::NotSupportedException;
@@ -192,7 +192,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetCacheListener( String^ libPath, String^ factoryFunctionName )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetCacheListener( String^ libPath, String^ factoryFunctionName )
{
throw gcnew System::NotSupportedException;
@@ -208,7 +208,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetPartitionResolver( String^ libPath, String^ factoryFunctionName )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetPartitionResolver( String^ libPath, String^ factoryFunctionName )
{
throw gcnew System::NotSupportedException;
@@ -226,7 +226,7 @@ namespace Apache
// EXPIRATION ATTRIBUTES
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetEntryIdleTimeout( ExpirationAction action, TimeSpan idleTimeout )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetEntryIdleTimeout( ExpirationAction action, TimeSpan idleTimeout )
{
try
{
@@ -240,7 +240,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetEntryTimeToLive( ExpirationAction action, TimeSpan timeToLive )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetEntryTimeToLive( ExpirationAction action, TimeSpan timeToLive )
{
try
{
@@ -254,7 +254,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetRegionIdleTimeout( ExpirationAction action, TimeSpan idleTimeout )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetRegionIdleTimeout( ExpirationAction action, TimeSpan idleTimeout )
{
try
{
@@ -268,7 +268,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetRegionTimeToLive( ExpirationAction action, TimeSpan timeToLive )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetRegionTimeToLive( ExpirationAction action, TimeSpan timeToLive )
{
try
{
@@ -283,7 +283,7 @@ namespace Apache
// PERSISTENCE
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager, Properties<String^, String^>^ config )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager, Properties<String^, String^>^ config )
{
std::shared_ptr<native::PersistenceManager> persistenceManagerptr;
if ( persistenceManager != nullptr ) {
@@ -302,26 +302,26 @@ namespace Apache
}
return this;
}
-
+
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager )
{
SetPersistenceManager(persistenceManager, nullptr);
return this;
}
-
+
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetPersistenceManager( String^ libPath,
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetPersistenceManager( String^ libPath,
String^ factoryFunctionName )
- {
+ {
SetPersistenceManager( libPath, factoryFunctionName, nullptr );
return this;
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetPersistenceManager( String^ libPath,
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetPersistenceManager( String^ libPath,
String^ factoryFunctionName, Properties<String^, String^>^ config )
- {
+ {
try
{
@@ -332,13 +332,13 @@ namespace Apache
GC::KeepAlive(m_nativeptr);
}
return this;
-
+
}
// STORAGE ATTRIBUTES
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetPoolName( String^ poolName )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetPoolName( String^ poolName )
{
try
@@ -355,7 +355,7 @@ namespace Apache
// MAP ATTRIBUTES
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetInitialCapacity( System::Int32 initialCapacity )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetInitialCapacity( System::Int32 initialCapacity )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
@@ -369,12 +369,12 @@ namespace Apache
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
-
+
return this;
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetLoadFactor( Single loadFactor )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetLoadFactor( Single loadFactor )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
@@ -388,12 +388,12 @@ namespace Apache
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
-
+
return this;
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetConcurrencyLevel( System::Int32 concurrencyLevel )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetConcurrencyLevel( System::Int32 concurrencyLevel )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
@@ -407,12 +407,12 @@ namespace Apache
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
-
+
return this;
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetLruEntriesLimit( System::UInt32 entriesLimit )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetLruEntriesLimit( System::UInt32 entriesLimit )
{
try
{
@@ -426,7 +426,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetDiskPolicy( DiskPolicyType diskPolicy )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetDiskPolicy( DiskPolicyType diskPolicy )
{
try
{
@@ -440,7 +440,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetCachingEnabled( bool cachingEnabled )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetCachingEnabled( bool cachingEnabled )
{
try
{
@@ -454,7 +454,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetCloningEnabled( bool cloningEnabled )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetCloningEnabled( bool cloningEnabled )
{
try
{
@@ -468,7 +468,7 @@ namespace Apache
}
generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ AttributesFactory<TKey, TValue>::SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled )
+ RegionAttributesFactory<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled )
{
try
{
@@ -483,14 +483,14 @@ namespace Apache
// FACTORY METHOD
generic<class TKey, class TValue>
- Apache::Geode::Client::RegionAttributes<TKey, TValue>^ AttributesFactory<TKey, TValue>::CreateRegionAttributes()
+ Apache::Geode::Client::RegionAttributes<TKey, TValue>^ RegionAttributesFactory<TKey, TValue>::Create()
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
try
{
- std::shared_ptr<native::RegionAttributes> nativeptr = m_nativeptr->get()->createRegionAttributes();
- return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr);
+ auto nativeRegionAttributes = m_nativeptr->get()->create();
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeRegionAttributes);
}
finally
{
diff --git a/clicache/src/AttributesFactory.hpp b/clicache/src/RegionAttributesFactory.hpp
similarity index 85%
rename from clicache/src/AttributesFactory.hpp
rename to clicache/src/RegionAttributesFactory.hpp
index a7ddd5d..0e35fd1 100644
--- a/clicache/src/AttributesFactory.hpp
+++ b/clicache/src/RegionAttributesFactory.hpp
@@ -20,7 +20,7 @@
#include "geode_defs.hpp"
#include "begin_native.hpp"
-#include <geode/AttributesFactory.hpp>
+#include <geode/RegionAttributesFactory.hpp>
#include "end_native.hpp"
#include "ExpirationAction.hpp"
@@ -52,10 +52,10 @@ namespace Apache
/// Factory class to create instances of <see cref="RegionAttributes" />.
/// </summary>
/// <remarks>
- /// An <see cref="AttributesFactory" />
+ /// An <see cref="RegionAttributesFactory" />
/// instance maintains state for creating <see cref="RegionAttributes" /> instances.
/// The setter methods are used to change the settings that will be used for
- /// creating the next attributes instance with the <see cref="CreateRegionAttributes" />
+ /// creating the next attributes instance with the <see cref="Create" />
/// method. If you create a factory with the default constructor, then the
/// factory is set up to create attributes with all default settings. You can
/// also create a factory by providing a preset <see cref="RegionAttributes" />.
@@ -152,28 +152,28 @@ namespace Apache
/// <seealso cref="AttributesMutator" />
/// <seealso cref="Region.CreateSubRegion" />
generic<class TKey, class TValue>
- public ref class AttributesFactory sealed
+ public ref class RegionAttributesFactory sealed
{
public:
/// <summary>
- /// Creates a new <c>AttributesFactory</c> ready to create
+ /// Creates a new <c>RegionAttributesFactory</c> ready to create
/// a <c>RegionAttributes</c> with default settings.
/// </summary>
- inline AttributesFactory<TKey, TValue>( )
+ inline RegionAttributesFactory<TKey, TValue>( )
{
- m_nativeptr = gcnew native_unique_ptr<native::AttributesFactory>(std::make_unique<native::AttributesFactory>());
+ m_nativeptr = gcnew native_unique_ptr<native::RegionAttributesFactory>(std::make_unique<native::RegionAttributesFactory>());
}
/// <summary>
- /// Creates a new instance of <c>AttributesFactory</c> ready to create
+ /// Creates a new instance of <c>RegionAttributesFactory</c> ready to create
/// a <c>RegionAttributes</c> with the same settings as those in the
/// specified <c>RegionAttributes</c>.
/// </summary>
/// <param name="regionAttributes">
- /// attributes used to initialize this AttributesFactory
+ /// attributes used to initialize this RegionAttributesFactory
/// </param>
- AttributesFactory<TKey, TValue>(RegionAttributes<TKey, TValue>^ regionAttributes);
+ RegionAttributesFactory<TKey, TValue>(RegionAttributes<TKey, TValue>^ regionAttributes);
// CALLBACKS
@@ -184,7 +184,7 @@ namespace Apache
/// a user-defined cache loader, or null for no cache loader
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader );
+ RegionAttributesFactory<TKey, TValue>^ SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader );
/// <summary>
/// Sets the cache writer for the <c>RegionAttributes</c> being created.
@@ -193,7 +193,7 @@ namespace Apache
/// user-defined cache writer, or null for no cache writer
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter );
+ RegionAttributesFactory<TKey, TValue>^ SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter );
/// <summary>
/// Sets the CacheListener for the <c>RegionAttributes</c> being created.
@@ -202,7 +202,7 @@ namespace Apache
/// user-defined cache listener, or null for no cache listener
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener );
+ RegionAttributesFactory<TKey, TValue>^ SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener );
/// <summary>
/// Sets the PartitionResolver for the <c>RegionAttributes</c> being created.
@@ -211,7 +211,7 @@ namespace Apache
/// user-defined partition resolver, or null for no partition resolver
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver );
+ RegionAttributesFactory<TKey, TValue>^ SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver );
/// <summary>
/// Sets the library path for the library that will be invoked for the loader of the region.
@@ -226,7 +226,7 @@ namespace Apache
/// <c>ICacheLoader</c> for a managed library.
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetCacheLoader( String^ libPath, String^ factoryFunctionName );
+ RegionAttributesFactory<TKey, TValue>^ SetCacheLoader( String^ libPath, String^ factoryFunctionName );
/// <summary>
/// Sets the library path for the library that will be invoked for the writer of the region.
@@ -241,7 +241,7 @@ namespace Apache
/// <c>ICacheWriter</c> for a managed library.
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetCacheWriter( String^ libPath, String^ factoryFunctionName );
+ RegionAttributesFactory<TKey, TValue>^ SetCacheWriter( String^ libPath, String^ factoryFunctionName );
/// <summary>
/// Sets the library path for the library that will be invoked for the listener of the region.
@@ -256,7 +256,7 @@ namespace Apache
/// <c>ICacheListener</c> for a managed library.
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetCacheListener( String^ libPath, String^ factoryFunctionName );
+ RegionAttributesFactory<TKey, TValue>^ SetCacheListener( String^ libPath, String^ factoryFunctionName );
/// <summary>
@@ -272,7 +272,7 @@ namespace Apache
/// <c>IPartitionResolver</c> for a managed library.
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetPartitionResolver( String^ libPath, String^ factoryFunctionName );
+ RegionAttributesFactory<TKey, TValue>^ SetPartitionResolver( String^ libPath, String^ factoryFunctionName );
// EXPIRATION ATTRIBUTES
@@ -287,7 +287,7 @@ namespace Apache
/// <param name="idleTimeout">
/// the idleTimeout in seconds for entries in this region.
/// </param>
- AttributesFactory<TKey, TValue>^ SetEntryIdleTimeout( ExpirationAction action, TimeSpan idleTimeout );
+ RegionAttributesFactory<TKey, TValue>^ SetEntryIdleTimeout( ExpirationAction action, TimeSpan idleTimeout );
/// <summary>
/// Sets the timeToLive expiration attributes for region entries for the next
@@ -299,7 +299,7 @@ namespace Apache
/// <param name="timeToLive">
/// the timeToLive in seconds for entries in this region.
/// </param>
- AttributesFactory<TKey, TValue>^ SetEntryTimeToLive( ExpirationAction action, TimeSpan timeToLive );
+ RegionAttributesFactory<TKey, TValue>^ SetEntryTimeToLive( ExpirationAction action, TimeSpan timeToLive );
/// <summary>
/// Sets the idleTimeout expiration attributes for the region itself for the
@@ -311,7 +311,7 @@ namespace Apache
/// <param name="idleTimeout">
/// the idleTimeout in seconds for the region as a whole.
/// </param>
- AttributesFactory<TKey, TValue>^ SetRegionIdleTimeout( ExpirationAction action, TimeSpan idleTimeout );
+ RegionAttributesFactory<TKey, TValue>^ SetRegionIdleTimeout( ExpirationAction action, TimeSpan idleTimeout );
/// <summary>
/// Sets the timeToLive expiration attributes for the region itself for the
@@ -323,7 +323,7 @@ namespace Apache
/// <param name="timeToLive">
/// the timeToLive in seconds for the region as a whole.
/// </param>
- AttributesFactory<TKey, TValue>^ SetRegionTimeToLive( ExpirationAction action, TimeSpan timeToLive );
+ RegionAttributesFactory<TKey, TValue>^ SetRegionTimeToLive( ExpirationAction action, TimeSpan timeToLive );
// PERSISTENCE
@@ -335,7 +335,7 @@ namespace Apache
/// Persistence Manager object
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager);
+ RegionAttributesFactory<TKey, TValue>^ SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager);
/// <summary>
/// Sets the PersistenceManager object that will be invoked for the persistence of the region.
@@ -347,7 +347,7 @@ namespace Apache
/// The configuration properties to use for the PersistenceManager.
/// </param>
//generic<class TKey, class TValue>
- AttributesFactory<TKey, TValue>^ SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager, Properties<String^, String^>^ config);
+ RegionAttributesFactory<TKey, TValue>^ SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager, Properties<String^, String^>^ config);
/// <summary>
@@ -359,7 +359,7 @@ namespace Apache
/// <param name="factoryFunctionName">
/// The name of the factory function to create an instance of PersistenceManager object.
/// </param>
- AttributesFactory<TKey, TValue>^ SetPersistenceManager( String^ libPath, String^ factoryFunctionName );
+ RegionAttributesFactory<TKey, TValue>^ SetPersistenceManager( String^ libPath, String^ factoryFunctionName );
/// <summary>
/// Sets the library path for the library that will be invoked for the persistence of the region.
@@ -373,7 +373,7 @@ namespace Apache
/// <param name="config">
/// The configuration properties to use for the PersistenceManager.
/// </param>
- AttributesFactory<TKey, TValue>^ SetPersistenceManager( String^ libPath, String^ factoryFunctionName,
+ RegionAttributesFactory<TKey, TValue>^ SetPersistenceManager( String^ libPath, String^ factoryFunctionName,
/*Dictionary<Object^, Object^>*/Properties<String^, String^>^ config );
@@ -388,7 +388,7 @@ namespace Apache
/// <param name="poolName">
/// The name of the pool to attach to this region.
/// </param>
- AttributesFactory<TKey, TValue>^ SetPoolName( String^ poolName );
+ RegionAttributesFactory<TKey, TValue>^ SetPoolName( String^ poolName );
// MAP ATTRIBUTES
@@ -401,7 +401,7 @@ namespace Apache
/// <exception cref="IllegalArgumentException">
/// if initialCapacity is nonpositive
/// </exception>
- AttributesFactory<TKey, TValue>^ SetInitialCapacity( System::Int32 initialCapacity );
+ RegionAttributesFactory<TKey, TValue>^ SetInitialCapacity( System::Int32 initialCapacity );
/// <summary>
/// Sets the entry load factor for the next <c>RegionAttributes</c>
@@ -412,7 +412,7 @@ namespace Apache
/// <exception cref="IllegalArgumentException">
/// if loadFactor is nonpositive
/// </exception>
- AttributesFactory<TKey, TValue>^ SetLoadFactor( Single loadFactor );
+ RegionAttributesFactory<TKey, TValue>^ SetLoadFactor( Single loadFactor );
/// <summary>
/// Sets the concurrency level of the next <c>RegionAttributes</c>
@@ -424,7 +424,7 @@ namespace Apache
/// <exception cref="IllegalArgumentException">
/// if concurrencyLevel is nonpositive
/// </exception>
- AttributesFactory<TKey, TValue>^ SetConcurrencyLevel( System::Int32 concurrencyLevel );
+ RegionAttributesFactory<TKey, TValue>^ SetConcurrencyLevel( System::Int32 concurrencyLevel );
/// <summary>
/// Sets a limit on the number of entries that will be held in the cache.
@@ -435,7 +435,7 @@ namespace Apache
/// The limit of the number of entries before eviction starts.
/// Defaults to 0, meaning no LRU actions will used.
/// </param>
- AttributesFactory<TKey, TValue>^ SetLruEntriesLimit( System::UInt32 entriesLimit );
+ RegionAttributesFactory<TKey, TValue>^ SetLruEntriesLimit( System::UInt32 entriesLimit );
/// <summary>
/// Sets the disk policy type for the next <c>RegionAttributes</c> created.
@@ -443,7 +443,7 @@ namespace Apache
/// <param name="diskPolicy">
/// the disk policy to use for the region
/// </param>
- AttributesFactory<TKey, TValue>^ SetDiskPolicy( DiskPolicyType diskPolicy );
+ RegionAttributesFactory<TKey, TValue>^ SetDiskPolicy( DiskPolicyType diskPolicy );
/// <summary>
/// Set caching enabled flag for this region.
@@ -461,7 +461,7 @@ namespace Apache
/// <param name="cachingEnabled">
/// if true, cache data for this region in this process.
/// </param>
- AttributesFactory<TKey, TValue>^ SetCachingEnabled( bool cachingEnabled );
+ RegionAttributesFactory<TKey, TValue>^ SetCachingEnabled( bool cachingEnabled );
/// <summary>
/// Set cloning enabled flag for this region.
/// </summary>
@@ -477,7 +477,7 @@ namespace Apache
/// <param name="cloningEnabled">
/// if true, clone old value before applying delta so that in-place change would not occour..
/// </param>
- AttributesFactory<TKey, TValue>^ SetCloningEnabled( bool cloningEnabled );
+ RegionAttributesFactory<TKey, TValue>^ SetCloningEnabled( bool cloningEnabled );
/// <summary>
/// Sets concurrency checks enabled flag for this region.
@@ -492,7 +492,7 @@ namespace Apache
/// <param name="concurrencyChecksEnabled">
/// if true, version checks for region entries will occur.
/// </param>
- AttributesFactory<TKey, TValue>^ SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled );
+ RegionAttributesFactory<TKey, TValue>^ SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled );
// FACTORY METHOD
/// <summary>
@@ -503,10 +503,10 @@ namespace Apache
/// if the current settings violate the
/// compatibility rules.
/// </exception>
- RegionAttributes<TKey, TValue>^ CreateRegionAttributes( );
+ RegionAttributes<TKey, TValue>^ Create( );
private:
- native_unique_ptr<native::AttributesFactory>^ m_nativeptr;
+ native_unique_ptr<native::RegionAttributesFactory>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
diff --git a/clicache/src/RegionFactory.hpp b/clicache/src/RegionFactory.hpp
index 899f901..aa0e954 100644
--- a/clicache/src/RegionFactory.hpp
+++ b/clicache/src/RegionFactory.hpp
@@ -20,7 +20,7 @@
#include "geode_defs.hpp"
#include "begin_native.hpp"
-#include <geode/AttributesFactory.hpp>
+#include <geode/RegionAttributesFactory.hpp>
#include <geode/RegionFactory.hpp>
#include "end_native.hpp"
diff --git a/clicache/src/geode_defs.hpp b/clicache/src/geode_defs.hpp
index 6bab323..8235e58 100644
--- a/clicache/src/geode_defs.hpp
+++ b/clicache/src/geode_defs.hpp
@@ -55,8 +55,8 @@
/// @file geode_includes.hpp
/// Provides a commonly-used set of include directives.
-/// @file AttributesFactory.hpp
-/// Declares the AttributesFactory class.
+/// @file RegionAttributesFactory.hpp
+/// Declares the RegionAttributesFactory class.
/// @file AttributesMutator.hpp
/// Declares the AttributesMutator class.
@@ -72,7 +72,7 @@
/// template classes and their instantiations for CacheableBoolean,
/// CacheableByte, CacheableDouble, CacheableFloat, CacheableInt16,
/// CacheableInt32, CacheableInt64, CacheableBytes, CacheableDoubleArray,
-/// CacheableFloatArray, CacheableInt16Array, CacheableInt32Array,
+/// CacheableFloatArray, CacheableInt16Array, CacheableInt32Array,
/// CacheableInt64Array, BooleanArray and CharArray
/// @file CacheableBuiltins.hpp
diff --git a/clicache/src/geodeclicache.vcxproj.filters b/clicache/src/geodeclicache.vcxproj.filters
index 7ef06a8..68e4720 100755
--- a/clicache/src/geodeclicache.vcxproj.filters
+++ b/clicache/src/geodeclicache.vcxproj.filters
@@ -613,7 +613,7 @@ limitations under the License.
<ClInclude Include="com\vmware\CacheAttributesMN.hpp">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="com\vmware\AttributesFactoryMN.hpp">
+ <ClInclude Include="com\vmware\RegionAttributesFactoryMN.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="com\vmware\AttributesMutatorMN.hpp">
@@ -1062,7 +1062,7 @@ limitations under the License.
<ClCompile Include="com\vmware\CacheAttributesMN.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="com\vmware\AttributesFactoryMN.cpp">
+ <ClCompile Include="com\vmware\RegionAttributesFactoryMN.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="com\vmware\AttributesMutatorMN.cpp">
diff --git a/cppcache/include/geode/AttributesMutator.hpp b/cppcache/include/geode/AttributesMutator.hpp
index 8d1fad0..61d9994 100644
--- a/cppcache/include/geode/AttributesMutator.hpp
+++ b/cppcache/include/geode/AttributesMutator.hpp
@@ -46,7 +46,7 @@ class Region;
*
* Supports modification of certain region attributes after the region has been
* created. It is required that the attributes be completely initialized
- * using an {@link AttributesFactory} before creating the region.
+ * using an {@link RegionAttributesFactory} before creating the region.
*AttributesMutator
* can be applied to adjusting and tuning a subset of attributes that are
*modifiable
@@ -56,7 +56,7 @@ class Region;
*
* @see Region::getAttributesMutator
* @see RegionAttributes
- * @see AttributesFactory
+ * @see RegionAttributesFactory
*/
class _GEODE_EXPORT AttributesMutator {
private:
diff --git a/cppcache/include/geode/CacheListener.hpp b/cppcache/include/geode/CacheListener.hpp
index 795330d..244343b 100644
--- a/cppcache/include/geode/CacheListener.hpp
+++ b/cppcache/include/geode/CacheListener.hpp
@@ -72,7 +72,7 @@ class RegionEvent;
* first case where listeners are invoked only when the region update
* operation succeeds.
*
- * @see AttributesFactory::setCacheListener
+ * @see RegionAttributesFactory::setCacheListener
* @see RegionAttributes::getCacheListener
* @see CacheListenerException
*/
diff --git a/cppcache/include/geode/CacheLoader.hpp b/cppcache/include/geode/CacheLoader.hpp
index 3ea8e2d..df7b701 100644
--- a/cppcache/include/geode/CacheLoader.hpp
+++ b/cppcache/include/geode/CacheLoader.hpp
@@ -49,7 +49,7 @@ class Region;
* creates the value for the desired key by performing an operation such
* as a database query.
*
- * @see AttributesFactory::setCacheLoader
+ * @see RegionAttributesFactory::setCacheLoader
* @see RegionAttributes::getCacheLoader
*/
class _GEODE_EXPORT CacheLoader {
diff --git a/cppcache/include/geode/CacheWriter.hpp b/cppcache/include/geode/CacheWriter.hpp
index 53cb0f1..1d27fa5 100644
--- a/cppcache/include/geode/CacheWriter.hpp
+++ b/cppcache/include/geode/CacheWriter.hpp
@@ -80,7 +80,7 @@ class Region;
* of whether the initiator is in the same process as the
* <code>CacheWriter</code>.
*
- * @see AttributesFactory::setCacheWriter
+ * @see RegionAttributesFactory::setCacheWriter
* @see RegionAttributes::getCacheWriter
* @see AttributesMutator::setCacheWriter
*/
diff --git a/cppcache/include/geode/DiskPolicyType.hpp b/cppcache/include/geode/DiskPolicyType.hpp
index 09102c0..b4cd1ec 100644
--- a/cppcache/include/geode/DiskPolicyType.hpp
+++ b/cppcache/include/geode/DiskPolicyType.hpp
@@ -37,7 +37,7 @@ namespace client {
* @class DiskPolicyType DiskPolicyType.hpp
* Enumerated type for disk policy.
* @see RegionAttributes::getDiskPolicy
- * @see AttributesFactory::setDiskPolicy
+ * @see RegionAttributesFactory::setDiskPolicy
*/
enum class DiskPolicyType { NONE = 0, OVERFLOWS, PERSIST };
diff --git a/cppcache/include/geode/ExpirationAttributes.hpp b/cppcache/include/geode/ExpirationAttributes.hpp
index 39a72dd..5421267 100644
--- a/cppcache/include/geode/ExpirationAttributes.hpp
+++ b/cppcache/include/geode/ExpirationAttributes.hpp
@@ -43,7 +43,7 @@ namespace client {
* If the timeout is not specified, it defaults to zero (which means to never
* time out).
*
- * @see AttributesFactory
+ * @see RegionAttributesFactory
* @see RegionAttributes
* @see AttributesMutator
*/
diff --git a/cppcache/include/geode/Region.hpp b/cppcache/include/geode/Region.hpp
index 7c516c5..7aa0120 100644
--- a/cppcache/include/geode/Region.hpp
+++ b/cppcache/include/geode/Region.hpp
@@ -32,7 +32,7 @@
#include "CacheableString.hpp"
#include "ExceptionTypes.hpp"
#include "Serializable.hpp"
-#include "AttributesFactory.hpp"
+#include "RegionAttributesFactory.hpp"
#include "AttributesMutator.hpp"
#include "CacheListener.hpp"
#include "CacheLoader.hpp"
@@ -62,38 +62,38 @@ static constexpr std::chrono::milliseconds DEFAULT_RESPONSE_TIMEOUT =
std::chrono::seconds(15);
/**
-* @class Region Region.hpp
-*
-* This class manages subregions and cached data. Each region
-* can contain multiple subregions and entries for data.
-* Regions provide a hierachical name space
-* within the cache. Also, a region can be used to group cached
-* objects for management purposes.
-*
-* Entries managed by the region are key-value pairs. A set of region attributes
-* is associated with the region when it is created.
-*
-* The Region interface basically contains two set of APIs: Region management
-* APIs and (potentially) distributed operations on entries. Non-distributed
-* operations on entries are provided by <code>RegionEntry</code>.
-*
-* Each <code>Cache</code> defines regions called the root regions.
-* User applications can use the root regions to create subregions
-* for isolated name space and object grouping.
-*
-* A region's name can be any String, except that it should not contain
-* the region name separator, a forward slash (/).
-*
-* <code>Regions</code> can be referenced by a relative path name from any
-* region
-* higher in the hierarchy in {@link Region::getSubregion}. You can get the
-* relative
-* path from the root region with {@link Region::getFullPath}. The name separator
-* is used to concatenate all the region names together from the root, starting
-* with the root's subregions.
-*
-* @see RegionAttributes
-*/
+ * @class Region Region.hpp
+ *
+ * This class manages subregions and cached data. Each region
+ * can contain multiple subregions and entries for data.
+ * Regions provide a hierachical name space
+ * within the cache. Also, a region can be used to group cached
+ * objects for management purposes.
+ *
+ * Entries managed by the region are key-value pairs. A set of region attributes
+ * is associated with the region when it is created.
+ *
+ * The Region interface basically contains two set of APIs: Region management
+ * APIs and (potentially) distributed operations on entries. Non-distributed
+ * operations on entries are provided by <code>RegionEntry</code>.
+ *
+ * Each <code>Cache</code> defines regions called the root regions.
+ * User applications can use the root regions to create subregions
+ * for isolated name space and object grouping.
+ *
+ * A region's name can be any String, except that it should not contain
+ * the region name separator, a forward slash (/).
+ *
+ * <code>Regions</code> can be referenced by a relative path name from any
+ * region
+ * higher in the hierarchy in {@link Region::getSubregion}. You can get the
+ * relative
+ * path from the root region with {@link Region::getFullPath}. The name
+ * separator is used to concatenate all the region names together from the root,
+ * starting with the root's subregions.
+ *
+ * @see RegionAttributes
+ */
class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
/** @brief Public Methods
*/
@@ -114,7 +114,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
/** Return the RegionAttributes for this region.
*/
- virtual std::shared_ptr<RegionAttributes> getAttributes() const = 0;
+ virtual const RegionAttributes& getAttributes() const = 0;
/** Return the a mutator object for changing a subset of the region
* attributes.
@@ -143,7 +143,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* This operation is not distributed.
*/
virtual void invalidateRegion(
- const std::shared_ptr<Serializable>& aCallbackArgument = nullptr) = 0;
+ const std::shared_ptr<Serializable>& aCallbackArgument = nullptr) = 0;
/** Invalidates this region. The invalidation will cascade to
* all the subregions and cached entries. After
@@ -165,7 +165,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
*/
virtual void localInvalidateRegion(
- const std::shared_ptr<Serializable>& aCallbackArgument = nullptr) = 0;
+ const std::shared_ptr<Serializable>& aCallbackArgument = nullptr) = 0;
/** Destroys the whole region and provides a user-defined parameter
* object to any <code>CacheWriter</code> invoked in the process.
@@ -204,7 +204,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* @see invalidateRegion
*/
virtual void destroyRegion(
- const std::shared_ptr<Serializable>& aCallbackArgument = nullptr) = 0;
+ const std::shared_ptr<Serializable>& aCallbackArgument = nullptr) = 0;
/**
* Removes all entries from this region and provides a user-defined parameter
* object to any <code>CacheWriter</code> or <code>CacheListener</code>
@@ -242,7 +242,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* @see localInvalidateRegion
*/
virtual void localDestroyRegion(
- const std::shared_ptr<Serializable>& aCallbackArgument = nullptr) = 0;
+ const std::shared_ptr<Serializable>& aCallbackArgument = nullptr) = 0;
/** Returns the subregion identified by the path, nullptr if no such subregion
*/
@@ -250,8 +250,8 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
/** Creates a subregion with the specified attributes */
virtual std::shared_ptr<Region> createSubregion(
- const std::string& subregionName,
- const std::shared_ptr<RegionAttributes>& aRegionAttributes) = 0;
+ const std::string& subregionName,
+ RegionAttributes aRegionAttributes) = 0;
/** Populates the passed in std::vector<std::shared_ptr<Region>> with
* subregions of the current region
@@ -992,7 +992,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* Return all the keys in the local process for this region. This includes
* keys for which the entry is invalid.
*/
- virtual std::vector<std::shared_ptr<CacheableKey>> keys() = 0;
+ virtual std::vector<std::shared_ptr<CacheableKey>> keys() = 0;
/**
* Return the set of keys defined in the server process associated to this
@@ -1019,7 +1019,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* @throws UnsupportedOperationException if the member type is not CLIENT
* or region is not a native client one.
*/
- virtual std::vector<std::shared_ptr<CacheableKey>> serverKeys() = 0;
+ virtual std::vector<std::shared_ptr<CacheableKey>> serverKeys() = 0;
/**
* Return all values in the local process for this region. No value is
@@ -1074,7 +1074,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* @throws UnsupportedOperationException if the region's scope is
* ScopeType::LOCAL.
*/
- virtual std::vector<std::shared_ptr<CacheableKey>> getInterestList() const = 0;
+ virtual std::vector<std::shared_ptr<CacheableKey>> getInterestList() const = 0;
/**
* Returns the list of regular expresssions on which this client is
* interested and will be notified of changes.
@@ -1096,7 +1096,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
/**
* Registers an array of keys for getting updates from the server.
* Valid only for a Native Client region when client notification
- * ( {@link AttributesFactory::setClientNotification} ) is true.
+ * ( {@link RegionAttributesFactory::setClientNotification} ) is true.
*
* @param keys the array of keys
* @param isDurable flag to indicate whether this is a durable registration
@@ -1114,7 +1114,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* the exception that should be caught.
* @throws UnsupportedOperationException If the region is not a Native Client
* region or
- * {@link AttributesFactory::setClientNotification} is false.
+ * {@link RegionAttributesFactory::setClientNotification} is false.
* @throws CacheServerException If an exception is received from the Java
* cache server.
* @throws NotConnectedException if it is not connected to the cache because
@@ -1128,7 +1128,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* @throws UnknownException For other exceptions.
* @throws TimeoutException if operation timed out
*/
- virtual void registerKeys(const std::vector<std::shared_ptr<CacheableKey>> & keys,
+ virtual void registerKeys(const std::vector<std::shared_ptr<CacheableKey>>& keys,
bool isDurable = false,
bool getInitialValues = false,
bool receiveValues = true) = 0;
@@ -1136,7 +1136,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
/**
* Unregisters an array of keys to stop getting updates for them.
* Valid only for a Native Client region when client notification
- * ( {@link AttributesFactory::setClientNotification} ) is true.
+ * ( {@link RegionAttributesFactory::setClientNotification} ) is true.
*
* @param keys the array of keys
*
@@ -1144,7 +1144,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* @throws IllegalStateException If no keys were previously registered.
* @throws UnsupportedOperationException If the region is not a Native Client
* region or
- * {@link AttributesFactory::setClientNotification} is false.
+ * {@link RegionAttributesFactory::setClientNotification} is false.
* @throws CacheServerException If an exception is received from the Java
* cache server.
* @throws NotConnectedException if it is not connected to the cache because
@@ -1158,12 +1158,12 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* @throws UnknownException For other exceptions.
* @throws TimeoutException if operation timed out
*/
- virtual void unregisterKeys(const std::vector<std::shared_ptr<CacheableKey>> & keys) = 0;
+ virtual void unregisterKeys(const std::vector<std::shared_ptr<CacheableKey>>& keys) = 0;
/**
* Registers to get updates for all keys from the server.
* Valid only for a Native Client region when client notification
- * ( {@link AttributesFactory::setClientNotification} ) is true.
+ * ( {@link RegionAttributesFactory::setClientNotification} ) is true.
*
* @param isDurable flag to indicate whether this is a durable registration
* @param getInitialValues true to populate the cache with values of all keys
@@ -1178,7 +1178,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* the exception that should be caught.
* @throws UnsupportedOperationException If the region is not a Native Client
* region or
- * {@link AttributesFactory::setClientNotification} is false.
+ * {@link RegionAttributesFactory::setClientNotification} is false.
* @throws CacheServerException If an exception is received from the Java
* cache server.
* @throws NotConnectedException if it is not connected to the cache because
@@ -1199,12 +1199,12 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
/**
* Registers to get updates for all keys from the server.
* Valid only for a Native Client region when client notification
- * ( {@link AttributesFactory::setClientNotification} ) is true.
+ * ( {@link RegionAttributesFactory::setClientNotification} ) is true.
*
* @throws IllegalStateException If not previously registered all keys.
* @throws UnsupportedOperationException If the region is not a Native Client
* region or
- * {@link AttributesFactory::setClientNotification} is false.
+ * {@link RegionAttributesFactory::setClientNotification} is false.
* @throws CacheServerException If an exception is received from the Java
* cache server.
* @throws NotConnectedException if it is not connected to the cache because
@@ -1224,7 +1224,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* Registers a regular expression to match with keys to get updates from the
* server.
* Valid only for a Native Client region when client notification
- * ( {@link AttributesFactory::setClientNotification} ) is true.
+ * ( {@link RegionAttributesFactory::setClientNotification} ) is true.
*
* @param regex The regular expression string.
* @param isDurable flag to indicate whether this is a durable registration
@@ -1245,7 +1245,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* the exception that should be caught.
* @throws UnsupportedOperationException If the region is not a Native Client
* region or
- * {@link AttributesFactory::setClientNotification} is false.
+ * {@link RegionAttributesFactory::setClientNotification} is false.
* @throws CacheServerException If an exception is received from the Java
* cache server.
* @throws NotConnectedException if it is not connected to the cache because
@@ -1271,7 +1271,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* Unregisters a regular expression to stop getting updates for keys from the
* server.
* Valid only for a Native Client region when client notification
- * ( {@link AttributesFactory::setClientNotification} ) is true.
+ * ( {@link RegionAttributesFactory::setClientNotification} ) is true.
*
* @param regex The regular expression string.
*
@@ -1280,7 +1280,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region> {
* expression string.
* @throws UnsupportedOperationException If the region is not a Native Client
* region or
- * {@link AttributesFactory::setClientNotification} is false.
+ * {@link RegionAttributesFactory::setClientNotification} is false.
* @throws CacheServerException If an exception is received from the Java
* cache server.
* @throws NotConnectedException if it is not connected to the cache because
diff --git a/cppcache/include/geode/RegionAttributes.hpp b/cppcache/include/geode/RegionAttributes.hpp
index 9524494..b5158a7 100644
--- a/cppcache/include/geode/RegionAttributes.hpp
+++ b/cppcache/include/geode/RegionAttributes.hpp
@@ -56,18 +56,19 @@ class CacheImpl;
* and whether statistics are enabled for the region and its entries.
*
* To create an instance of this interface, use {@link
- * AttributesFactory::createRegionAttributes}.
+ * RegionAttributesFactory::create}.
*
- * For compatibility rules and default values, see {@link AttributesFactory}.
+ * For compatibility rules and default values, see {@link
+ * RegionAttributesFactory}.
*
* <p>Note that the <code>RegionAttributes</code> are not distributed with the
* region.
*
- * @see AttributesFactory
+ * @see RegionAttributesFactory
* @see AttributesMutator
* @see Region::getAttributes
*/
-class AttributesFactory;
+class RegionAttributesFactory;
class AttributesMutator;
class Cache;
class Region;
@@ -82,21 +83,21 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
* <code>CacheLoader</code> , nullptr if there is no CacheLoader for this
* region.
*/
- std::shared_ptr<CacheLoader> getCacheLoader();
+ std::shared_ptr<CacheLoader> getCacheLoader() const;
/** Gets the cache writer for the region.
* @return a pointer that points to the region's ,
* <code>CacheWriter</code> , nullptr if there is no CacheWriter for this
* region
*/
- std::shared_ptr<CacheWriter> getCacheWriter();
+ std::shared_ptr<CacheWriter> getCacheWriter() const;
/** Gets the cache listener for the region.
* @return a pointer that points to the region's ,
* <code>CacheListener</code> , nullptr if there is no CacheListener defined
* for this region.
*/
- std::shared_ptr<CacheListener> getCacheListener();
+ std::shared_ptr<CacheListener> getCacheListener() const;
/** Gets the partition resolver for the partition region.
* @return a pointer that points to the region's ,
@@ -104,7 +105,7 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
* defined
* for this region.
*/
- std::shared_ptr<PartitionResolver> getPartitionResolver();
+ std::shared_ptr<PartitionResolver> getPartitionResolver() const;
/** Gets the <code>timeToLive</code> expiration attributes for the region as a
* whole.
@@ -159,7 +160,7 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
/** Returns the concurrencyLevel of the entry's local cache.
* @return the concurrencyLevel
- * @see AttributesFactory
+ * @see RegionAttributesFactory
*/
uint8_t getConcurrencyLevel() const;
@@ -185,7 +186,11 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
/**
* Returns the name of the pool attached to the region.
*/
- const std::string& getPoolName() const;
+ const std::string& getPoolName() const { return m_poolName; }
+
+ // will be created by the factory
+ RegionAttributes();
+ RegionAttributes(const RegionAttributes& rhs) = default;
/*destructor
*
@@ -214,49 +219,49 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
* This method returns the path of the library from which
* the factory function will be invoked on a cache server.
*/
- const std::string& getCacheLoaderLibrary();
+ const std::string& getCacheLoaderLibrary() const;
/**
* This method returns the symbol name of the factory function from which
* the loader will be created on a cache server.
*/
- const std::string& getCacheLoaderFactory();
+ const std::string& getCacheLoaderFactory() const;
/**
* This method returns the path of the library from which
* the factory function will be invoked on a cache server.
*/
- const std::string& getCacheListenerLibrary();
+ const std::string& getCacheListenerLibrary() const;
/**
* This method returns the symbol name of the factory function from which
* the loader will be created on a cache server.
*/
- const std::string& getCacheListenerFactory();
+ const std::string& getCacheListenerFactory() const;
/**
* This method returns the path of the library from which
* the factory function will be invoked on a cache server.
*/
- const std::string& getCacheWriterLibrary();
+ const std::string& getCacheWriterLibrary() const;
/**
* This method returns the symbol name of the factory function from which
* the loader will be created on a cache server.
*/
- const std::string& getCacheWriterFactory();
+ const std::string& getCacheWriterFactory() const;
/**
* This method returns the path of the library from which
* the factory function will be invoked on a cache server.
*/
- const std::string& getPartitionResolverLibrary();
+ const std::string& getPartitionResolverLibrary() const;
/**
* This method returns the symbol name of the factory function from which
* the loader will be created on a cache server.
*/
- const std::string& getPartitionResolverFactory();
+ const std::string& getPartitionResolverFactory() const;
/** Return true if all the attributes are equal to those of other. */
bool operator==(const RegionAttributes& other) const;
@@ -274,7 +279,7 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
/**
* This method returns the list of servername:portno separated by comma
*/
- const std::string& getEndpoints();
+ const std::string& getEndpoints() const;
/**
* This method returns the setting of client notification
@@ -285,18 +290,18 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
* This method returns the path of the library from which
* the factory function will be invoked on a cache server.
*/
- const std::string& getPersistenceLibrary();
+ const std::string& getPersistenceLibrary() const;
/**
* This method returns the symbol name of the factory function from which
* the persistence will be created on a cache server.
*/
- const std::string& getPersistenceFactory();
+ const std::string& getPersistenceFactory() const;
/**
* This method returns the properties pointer which is set for persistence.
*/
- std::shared_ptr<Properties> getPersistenceProperties();
+ std::shared_ptr<Properties> getPersistenceProperties() const;
/** Gets the persistence for the region.
* @return a pointer that points to the region's ,
@@ -304,23 +309,19 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
* for this
* region.
*/
- std::shared_ptr<PersistenceManager> getPersistenceManager();
+ std::shared_ptr<PersistenceManager> getPersistenceManager() const;
- /** TODO
- * Returns the name of the {@link Pool} that this region
- * will use to communicate with servers, if any.
- * @return the name of the client-server {@link Pool}
- */
- const std::string& getPoolName() { return m_poolName; }
- bool getCloningEnabled() { return m_isClonable; }
+ bool getCloningEnabled() const { return m_isClonable; }
/**
* Returns true if concurrent update checks are turned on for this region.
* <p>
* @return true if concurrent update checks are turned on
*/
- bool getConcurrencyChecksEnabled() { return m_isConcurrencyChecksEnabled; }
- const RegionAttributes& operator=(const RegionAttributes&) = delete;
+ bool getConcurrencyChecksEnabled() const {
+ return m_isConcurrencyChecksEnabled;
+ }
+ RegionAttributes& operator=(const RegionAttributes&) = default;
private:
void setCacheListener(const std::string& libpath,
@@ -351,19 +352,15 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
m_regionIdleTimeout > std::chrono::seconds::zero());
}
- // will be created by the factory
- RegionAttributes(const RegionAttributes& rhs);
- RegionAttributes();
-
ExpirationAction m_regionTimeToLiveExpirationAction;
ExpirationAction m_regionIdleTimeoutExpirationAction;
ExpirationAction m_entryTimeToLiveExpirationAction;
ExpirationAction m_entryIdleTimeoutExpirationAction;
ExpirationAction m_lruEvictionAction;
- std::shared_ptr<CacheWriter> m_cacheWriter;
- std::shared_ptr<CacheLoader> m_cacheLoader;
- std::shared_ptr<CacheListener> m_cacheListener;
- std::shared_ptr<PartitionResolver> m_partitionResolver;
+ mutable std::shared_ptr<CacheWriter> m_cacheWriter;
+ mutable std::shared_ptr<CacheLoader> m_cacheLoader;
+ mutable std::shared_ptr<CacheListener> m_cacheListener;
+ mutable std::shared_ptr<PartitionResolver> m_partitionResolver;
uint32_t m_lruEntriesLimit;
bool m_caching;
uint32_t m_maxValueDistLimit;
@@ -388,11 +385,11 @@ class _GEODE_EXPORT RegionAttributes : public Serializable {
std::string m_persistenceLibrary;
std::string m_persistenceFactory;
std::shared_ptr<Properties> m_persistenceProperties;
- std::shared_ptr<PersistenceManager> m_persistenceManager;
+ mutable std::shared_ptr<PersistenceManager> m_persistenceManager;
std::string m_poolName;
bool m_isClonable;
bool m_isConcurrencyChecksEnabled;
- friend class AttributesFactory;
+ friend class RegionAttributesFactory;
friend class AttributesMutator;
friend class Cache;
friend class CacheImpl;
diff --git a/cppcache/include/geode/AttributesFactory.hpp b/cppcache/include/geode/RegionAttributesFactory.hpp
similarity index 88%
rename from cppcache/include/geode/AttributesFactory.hpp
rename to cppcache/include/geode/RegionAttributesFactory.hpp
index cad95fd..d067130 100644
--- a/cppcache/include/geode/AttributesFactory.hpp
+++ b/cppcache/include/geode/RegionAttributesFactory.hpp
@@ -45,12 +45,12 @@ namespace client {
/**
* Creates instances of {@link RegionAttributes}. An
- * <code>AttributesFactory</code>
+ * <code>RegionAttributesFactory</code>
* instance maintains state for creating <code>RegionAttributes</code>
* instances.
* The setter methods are used to change the settings that will be used for
* creating the next attributes instance with the {@link
- * #createRegionAttributes}
+ * #create}
* method. If you create a factory with the default constructor, then the
* factory is set up to create attributes with all default settings. You can
* also create a factory by providing a <code>RegionAttributes</code>, which
@@ -153,7 +153,7 @@ namespace client {
* @see Region#createSubregion(String, RegionAttributes)
*/
-class _GEODE_EXPORT AttributesFactory {
+class _GEODE_EXPORT RegionAttributesFactory {
/**
* @brief public methods
*/
@@ -163,24 +163,26 @@ class _GEODE_EXPORT AttributesFactory {
*/
/**
- * Creates a new instance of AttributesFactory ready to create a
+ * Creates a new instance of RegionAttributesFactory ready to create a
* <code>RegionAttributes</code> with default settings.
*/
- AttributesFactory();
+ RegionAttributesFactory();
/**
- * Creates a new instance of AttributesFactory ready to create a
+ * Creates a new instance of RegionAttributesFactory ready to create a
* <code>RegionAttributes</code> with the same settings as those in the
* specified <code>RegionAttributes</code>.
* @param regionAttributes the <code>RegionAttributes</code> used to
- * initialize this AttributesFactory
+ * initialize this RegionAttributesFactory
*/
- AttributesFactory(const std::shared_ptr<RegionAttributes>& regionAttributes);
+ RegionAttributesFactory(const RegionAttributes regionAttributes);
+
+ RegionAttributesFactory(const RegionAttributesFactory&) = default;
/**
*@brief destructor
*/
- virtual ~AttributesFactory();
+ virtual ~RegionAttributesFactory();
// CALLBACKS
@@ -189,7 +191,7 @@ class _GEODE_EXPORT AttributesFactory {
* @param cacheLoader the cache loader or nullptr if no loader
* @return a reference to <code>this</code>
*/
- AttributesFactory& setCacheLoader(
+ RegionAttributesFactory& setCacheLoader(
const std::shared_ptr<CacheLoader>& cacheLoader);
/**
@@ -197,7 +199,7 @@ class _GEODE_EXPORT AttributesFactory {
* @param cacheWriter the cache writer or nullptr if no cache writer
* @return a reference to <code>this</code>
*/
- AttributesFactory& setCacheWriter(
+ RegionAttributesFactory& setCacheWriter(
const std::shared_ptr<CacheWriter>& cacheWriter);
/**
@@ -205,7 +207,7 @@ class _GEODE_EXPORT AttributesFactory {
* @param aListener a user defined CacheListener, nullptr if no listener
* @return a reference to <code>this</code>
*/
- AttributesFactory& setCacheListener(
+ RegionAttributesFactory& setCacheListener(
const std::shared_ptr<CacheListener>& aListener);
/**
@@ -214,7 +216,7 @@ class _GEODE_EXPORT AttributesFactory {
* @param aResolver a user defined PartitionResolver, nullptr if no resolver
* @return a reference to <code>this</code>
*/
- AttributesFactory& setPartitionResolver(
+ RegionAttributesFactory& setPartitionResolver(
const std::shared_ptr<PartitionResolver>& aResolver);
/**
@@ -222,7 +224,7 @@ class _GEODE_EXPORT AttributesFactory {
* of the region.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setCacheLoader(const std::string& libpath,
+ RegionAttributesFactory& setCacheLoader(const std::string& libpath,
const std::string& factoryFuncName);
/**
@@ -231,7 +233,7 @@ class _GEODE_EXPORT AttributesFactory {
* @return a reference to <code>this</code>
*/
- AttributesFactory& setCacheWriter(const std::string& libpath,
+ RegionAttributesFactory& setCacheWriter(const std::string& libpath,
const std::string& factoryFuncName);
/**
@@ -239,7 +241,7 @@ class _GEODE_EXPORT AttributesFactory {
* of the region.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setCacheListener(const std::string& libpath,
+ RegionAttributesFactory& setCacheListener(const std::string& libpath,
const std::string& factoryFuncName);
/**
@@ -247,7 +249,7 @@ class _GEODE_EXPORT AttributesFactory {
* partition resolver of the region.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setPartitionResolver(const std::string& libpath,
+ RegionAttributesFactory& setPartitionResolver(const std::string& libpath,
const std::string& factoryFuncName);
// EXPIRATION ATTRIBUTES
@@ -262,7 +264,7 @@ class _GEODE_EXPORT AttributesFactory {
* @param idleTimeout the idleTimeout for entries in this region.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setEntryIdleTimeout(ExpirationAction action,
+ RegionAttributesFactory& setEntryIdleTimeout(ExpirationAction action,
std::chrono::seconds idleTimeout);
/**
@@ -275,7 +277,7 @@ class _GEODE_EXPORT AttributesFactory {
* @param timeToLive the timeToLive for entries in this region.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setEntryTimeToLive(ExpirationAction action,
+ RegionAttributesFactory& setEntryTimeToLive(ExpirationAction action,
std::chrono::seconds timeToLive);
/**
@@ -288,7 +290,7 @@ class _GEODE_EXPORT AttributesFactory {
* @param idleTimeout the idleTimeout for the region as a whole.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setRegionIdleTimeout(ExpirationAction action,
+ RegionAttributesFactory& setRegionIdleTimeout(ExpirationAction action,
std::chrono::seconds idleTimeout);
/**
@@ -301,7 +303,7 @@ class _GEODE_EXPORT AttributesFactory {
* @param timeToLive the timeToLive for the region as a whole.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setRegionTimeToLive(ExpirationAction action,
+ RegionAttributesFactory& setRegionTimeToLive(ExpirationAction action,
std::chrono::seconds timeToLive);
// PERSISTENCE
@@ -313,7 +315,7 @@ class _GEODE_EXPORT AttributesFactory {
* this must be used to set the PersistenceManager.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setPersistenceManager(
+ RegionAttributesFactory& setPersistenceManager(
const std::string& libpath, const std::string& factoryFuncName,
const std::shared_ptr<Properties>& config = nullptr);
@@ -323,7 +325,7 @@ class _GEODE_EXPORT AttributesFactory {
* resolver
* @return a reference to <code>this</code>
*/
- AttributesFactory& setPersistenceManager(
+ RegionAttributesFactory& setPersistenceManager(
const std::shared_ptr<PersistenceManager>& persistenceManager,
const std::shared_ptr<Properties>& config = nullptr);
@@ -336,7 +338,7 @@ class _GEODE_EXPORT AttributesFactory {
* @return a reference to <code>this</code>
* @throws IllegalArgumentException if initialCapacity is negative.
*/
- AttributesFactory& setInitialCapacity(int initialCapacity);
+ RegionAttributesFactory& setInitialCapacity(int initialCapacity);
/**
* Sets the entry load factor for the next <code>RegionAttributes</code>
@@ -346,7 +348,7 @@ class _GEODE_EXPORT AttributesFactory {
* @return a reference to <code>this</code>
* @throws IllegalArgumentException if loadFactor is nonpositive
*/
- AttributesFactory& setLoadFactor(float loadFactor);
+ RegionAttributesFactory& setLoadFactor(float loadFactor);
/**
* Sets the concurrency level tof the next <code>RegionAttributes</code>
@@ -355,7 +357,7 @@ class _GEODE_EXPORT AttributesFactory {
* @return a reference to <code>this</code>
* @throws IllegalArgumentException if concurrencyLevel is nonpositive
*/
- AttributesFactory& setConcurrencyLevel(uint8_t concurrencyLevel);
+ RegionAttributesFactory& setConcurrencyLevel(uint8_t concurrencyLevel);
/**
* Sets a limit on the number of entries that will be held in the cache.
@@ -364,7 +366,7 @@ class _GEODE_EXPORT AttributesFactory {
* used.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setLruEntriesLimit(const uint32_t entriesLimit);
+ RegionAttributesFactory& setLruEntriesLimit(const uint32_t entriesLimit);
/**
* Sets the Disk policy type for the next <code>RegionAttributes</code>
@@ -373,7 +375,7 @@ class _GEODE_EXPORT AttributesFactory {
* @return a reference to <code>this</code>
* @throws IllegalArgumentException if diskPolicyType is Invalid
*/
- AttributesFactory& setDiskPolicy(const DiskPolicyType diskPolicy);
+ RegionAttributesFactory& setDiskPolicy(const DiskPolicyType diskPolicy);
/**
* Set caching enabled flag for this region. If set to false, then no data is
@@ -385,7 +387,7 @@ class _GEODE_EXPORT AttributesFactory {
* @param cachingEnabled if true, cache data for this region in this process.
* @return a reference to <code>this</code>
*/
- AttributesFactory& setCachingEnabled(bool cachingEnabled);
+ RegionAttributesFactory& setCachingEnabled(bool cachingEnabled);
/**
* Sets the pool name attribute.
@@ -405,7 +407,7 @@ class _GEODE_EXPORT AttributesFactory {
* or <code>""</code> then the connection pool is disabled for regions
* using these attributes.
*/
- AttributesFactory& setPoolName(const std::string& name);
+ RegionAttributesFactory& setPoolName(const std::string& name);
/**
* Sets cloning on region
@@ -413,7 +415,7 @@ class _GEODE_EXPORT AttributesFactory {
* @return a reference to <code>this</code>
* @see RegionAttributes#getCloningEnabled()
*/
- AttributesFactory& setCloningEnabled(bool isClonable);
+ RegionAttributesFactory& setCloningEnabled(bool isClonable);
/**
* Enables or disables concurrent modification checks
@@ -422,7 +424,7 @@ class _GEODE_EXPORT AttributesFactory {
* operations
* @return a reference to <code>this</code>
*/
- AttributesFactory& setConcurrencyChecksEnabled(bool concurrencyChecksEnabled);
+ RegionAttributesFactory& setConcurrencyChecksEnabled(bool concurrencyChecksEnabled);
// FACTORY METHOD
@@ -433,7 +435,7 @@ class _GEODE_EXPORT AttributesFactory {
* compatibility rules
* @return a reference to <code>this</code>
*/
- std::unique_ptr<RegionAttributes> createRegionAttributes();
+ RegionAttributes create();
private:
RegionAttributes m_regionAttributes;
diff --git a/cppcache/include/geode/RegionFactory.hpp b/cppcache/include/geode/RegionFactory.hpp
index 56cf0c0..ab85c31 100644
--- a/cppcache/include/geode/RegionFactory.hpp
+++ b/cppcache/include/geode/RegionFactory.hpp
@@ -23,7 +23,7 @@
#include <chrono>
#include "internal/geode_globals.hpp"
-#include "AttributesFactory.hpp"
+#include "RegionAttributesFactory.hpp"
#include "internal/chrono/duration.hpp"
/**
@@ -264,7 +264,7 @@ class _GEODE_EXPORT RegionFactory {
RegionShortcut m_preDefinedRegion;
- std::shared_ptr<AttributesFactory> m_attributeFactory;
+ std::shared_ptr<RegionAttributesFactory> m_regionAttributesFactory;
CacheImpl* m_cacheImpl;
diff --git a/cppcache/integration-test/CMakeLists.txt b/cppcache/integration-test/CMakeLists.txt
index a3025f3..93b1613 100644
--- a/cppcache/integration-test/CMakeLists.txt
+++ b/cppcache/integration-test/CMakeLists.txt
@@ -131,7 +131,7 @@ set_property(TEST testLinkage PROPERTY LABELS STABLE QUICK)
set_property(TEST testRegionTemplateArgs PROPERTY LABELS STABLE QUICK)
set_property(TEST testRegionMap PROPERTY LABELS STABLE QUICK)
set_property(TEST testXmlCacheCreationWithRefid PROPERTY LABELS STABLE QUICK)
-set_property(TEST testAttributesFactory PROPERTY LABELS STABLE QUICK)
+set_property(TEST testRegionAttributesFactory PROPERTY LABELS STABLE QUICK)
set_property(TEST testXmlCacheCreationWithOverFlow PROPERTY LABELS STABLE QUICK)
set_property(TEST testConnect PROPERTY LABELS STABLE QUICK)
set_property(TEST testThinClientRemoveAllLocal PROPERTY LABELS STABLE QUICK)
diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp
index 496d50e..b6d4e76 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -102,7 +102,7 @@ CacheHelper::CacheHelper(const char* member_id,
rootRegionPtr = cachePtr->getRegion(ROOT_NAME);
}
- showRegionAttributes(*rootRegionPtr->getAttributes());
+ showRegionAttributes(rootRegionPtr->getAttributes());
}
/** rootRegionPtr will still be null... */
@@ -150,7 +150,7 @@ CacheHelper::CacheHelper(const std::shared_ptr<Properties>& configPtr,
rootRegionPtr = cachePtr->getRegion(ROOT_NAME);
}
- showRegionAttributes(*rootRegionPtr->getAttributes());
+ showRegionAttributes(rootRegionPtr->getAttributes());
}
CacheHelper::CacheHelper(const bool isThinclient,
@@ -340,16 +340,15 @@ void CacheHelper::createPlainRegion(const char* regionName,
void CacheHelper::createPlainRegion(const char* regionName,
std::shared_ptr<Region>& regionPtr,
uint32_t size) {
- std::shared_ptr<RegionAttributes> regAttrs;
- AttributesFactory attrFactory;
+ RegionAttributesFactory regionAttributesFactory;
// set lru attributes...
- attrFactory.setLruEntriesLimit(0); // no limit.
- attrFactory.setInitialCapacity(size); // no limit.
+ regionAttributesFactory.setLruEntriesLimit(0); // no limit.
+ regionAttributesFactory.setInitialCapacity(size); // no limit.
// then...
- regAttrs = attrFactory.createRegionAttributes();
- showRegionAttributes(*regAttrs);
+ auto regionAttributes = regionAttributesFactory.create();
+ showRegionAttributes(regionAttributes);
// This is using subregions (deprecated) so not placing the new cache API here
- regionPtr = rootRegionPtr->createSubregion(regionName, regAttrs);
+ regionPtr = rootRegionPtr->createSubregion(regionName, regionAttributes);
ASSERT(regionPtr != nullptr, "failed to create region.");
}
@@ -360,16 +359,15 @@ void CacheHelper::createLRURegion(const char* regionName,
void CacheHelper::createLRURegion(const char* regionName,
std::shared_ptr<Region>& regionPtr,
uint32_t size) {
- std::shared_ptr<RegionAttributes> regAttrs;
- AttributesFactory attrFactory;
+ RegionAttributesFactory regionAttributesFactory;
// set lru attributes...
- attrFactory.setLruEntriesLimit(size);
- attrFactory.setInitialCapacity(size);
+ regionAttributesFactory.setLruEntriesLimit(size);
+ regionAttributesFactory.setInitialCapacity(size);
// then...
- regAttrs = attrFactory.createRegionAttributes();
- showRegionAttributes(*regAttrs);
+ auto regionAttributes = regionAttributesFactory.create();
+ showRegionAttributes(regionAttributes);
// This is using subregions (deprecated) so not placing the new cache API here
- regionPtr = rootRegionPtr->createSubregion(regionName, regAttrs);
+ regionPtr = rootRegionPtr->createSubregion(regionName, regionAttributes);
ASSERT(regionPtr != nullptr, "failed to create region.");
}
@@ -381,16 +379,15 @@ void CacheHelper::createDistRegion(const char* regionName,
void CacheHelper::createDistRegion(const char* regionName,
std::shared_ptr<Region>& regionPtr,
uint32_t size) {
- std::shared_ptr<RegionAttributes> regAttrs;
- AttributesFactory attrFactory;
+ RegionAttributesFactory regionAttributesFactory;
// set lru attributes...
- attrFactory.setLruEntriesLimit(0); // no limit.
- attrFactory.setInitialCapacity(size); // no limit.
+ regionAttributesFactory.setLruEntriesLimit(0); // no limit.
+ regionAttributesFactory.setInitialCapacity(size); // no limit.
// then...
- regAttrs = attrFactory.createRegionAttributes();
- showRegionAttributes(*regAttrs);
+ auto regionAttributes = regionAttributesFactory.create();
+ showRegionAttributes(regionAttributes);
// This is using subregions (deprecated) so not placing the new cache API here
- regionPtr = rootRegionPtr->createSubregion(regionName, regAttrs);
+ regionPtr = rootRegionPtr->createSubregion(regionName, regionAttributes);
ASSERT(regionPtr != nullptr, "failed to create region.");
}
std::shared_ptr<Region> CacheHelper::getRegion(const char* name) {
@@ -401,20 +398,20 @@ std::shared_ptr<Region> CacheHelper::createRegion(
const std::shared_ptr<CacheListener>& listener,
bool clientNotificationEnabled, bool scopeLocal,
bool concurrencyCheckEnabled, int32_t tombstonetimeout) {
- AttributesFactory af;
- af.setCachingEnabled(caching);
+ RegionAttributesFactory regionAttributeFactory;
+ regionAttributeFactory.setCachingEnabled(caching);
if (listener != nullptr) {
- af.setCacheListener(listener);
+ regionAttributeFactory.setCacheListener(listener);
}
if (concurrencyCheckEnabled) {
- af.setConcurrencyChecksEnabled(concurrencyCheckEnabled);
+ regionAttributeFactory.setConcurrencyChecksEnabled(concurrencyCheckEnabled);
}
- std::shared_ptr<RegionAttributes> rattrsPtr = af.createRegionAttributes();
+ auto regionAttributes = regionAttributeFactory.create();
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
std::shared_ptr<Region> regionPtr;
- cacheImpl->createRegion(name, rattrsPtr, regionPtr);
+ cacheImpl->createRegion(name, regionAttributes, regionPtr);
return regionPtr;
}
std::shared_ptr<Region> CacheHelper::createRegion(
@@ -422,19 +419,19 @@ std::shared_ptr<Region> CacheHelper::createRegion(
const std::chrono::seconds& eit, const std::chrono::seconds& rttl,
const std::chrono::seconds& rit, int lel, ExpirationAction action,
const char* endpoints, bool clientNotificationEnabled) {
- AttributesFactory af;
- af.setCachingEnabled(caching);
- af.setLruEntriesLimit(lel);
- af.setEntryIdleTimeout(action, eit);
- af.setEntryTimeToLive(action, ettl);
- af.setRegionIdleTimeout(action, rit);
- af.setRegionTimeToLive(action, rttl);
+ RegionAttributesFactory regionAttributeFactory;
+ regionAttributeFactory.setCachingEnabled(caching);
+ regionAttributeFactory.setLruEntriesLimit(lel);
+ regionAttributeFactory.setEntryIdleTimeout(action, eit);
+ regionAttributeFactory.setEntryTimeToLive(action, ettl);
+ regionAttributeFactory.setRegionIdleTimeout(action, rit);
+ regionAttributeFactory.setRegionTimeToLive(action, rttl);
- std::shared_ptr<RegionAttributes> rattrsPtr = af.createRegionAttributes();
+ auto regionAttributes = regionAttributeFactory.create();
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
std::shared_ptr<Region> regionPtr;
- cacheImpl->createRegion(name, rattrsPtr, regionPtr);
+ cacheImpl->createRegion(name, regionAttributes, regionPtr);
return regionPtr;
}
std::shared_ptr<Pool> CacheHelper::createPool(
@@ -613,27 +610,6 @@ void CacheHelper::addServerLocatorEPs(const char* epList, PoolFactory& pf,
}
}
-// void CacheHelper::addServerLocatorEPs(const char* epList,
-// std::shared_ptr<CacheFactory> cacheFac,
-// bool poolLocators) {
-// std::unordered_set<std::string> endpointNames;
-// Utils::parseEndpointNamesString(epList, endpointNames);
-// for (std::unordered_set<std::string>::iterator iter = endpointNames.begin();
-// iter != endpointNames.end(); ++iter) {
-// size_t position = (*iter).find_first_of(":");
-// if (position != std::string::npos) {
-// std::string hostname = (*iter).substr(0, position);
-// int portnumber = atoi(((*iter).substr(position + 1)).c_str());
-// if (poolLocators) {
-// getCache()->getPoolFactory()->addLocator(hostname.c_str(),
-// portnumber);
-// } else {
-// printf("ankur Server: %d", portnumber);
-// getCache()->getPoolFactory()->addServer(hostname.c_str(), portnumber);
-// }
-// }
-// }
-//}
std::shared_ptr<Region> CacheHelper::createPooledRegion(
const char* name, bool ack, const char* locators, const char* poolName,
bool caching, bool clientNotificationEnabled,
@@ -716,16 +692,16 @@ std::shared_ptr<Region> CacheHelper::createRegionDiscOverFlow(
const std::chrono::seconds& ettl, const std::chrono::seconds& eit,
const std::chrono::seconds& rttl, const std::chrono::seconds& rit, int lel,
ExpirationAction action) {
- AttributesFactory af;
- af.setCachingEnabled(caching);
- af.setLruEntriesLimit(lel);
- af.setEntryIdleTimeout(action, eit);
- af.setEntryTimeToLive(action, ettl);
- af.setRegionIdleTimeout(action, rit);
- af.setRegionTimeToLive(action, rttl);
- af.setCloningEnabled(true);
+ RegionAttributesFactory regionAttributeFactory;
+ regionAttributeFactory.setCachingEnabled(caching);
+ regionAttributeFactory.setLruEntriesLimit(lel);
+ regionAttributeFactory.setEntryIdleTimeout(action, eit);
+ regionAttributeFactory.setEntryTimeToLive(action, ettl);
+ regionAttributeFactory.setRegionIdleTimeout(action, rit);
+ regionAttributeFactory.setRegionTimeToLive(action, rttl);
+ regionAttributeFactory.setCloningEnabled(true);
if (lel > 0) {
- af.setDiskPolicy(DiskPolicyType::OVERFLOWS);
+ regionAttributeFactory.setDiskPolicy(DiskPolicyType::OVERFLOWS);
auto sqLiteProps = Properties::create();
sqLiteProps->insert("PageSize", "65536");
sqLiteProps->insert("MaxPageCount", "1073741823");
@@ -733,13 +709,13 @@ std::shared_ptr<Region> CacheHelper::createRegionDiscOverFlow(
"SqLiteRegionData" +
std::to_string(static_cast<long long int>(ACE_OS::getpid()));
sqLiteProps->insert("PersistenceDirectory", sqlite_dir.c_str());
- af.setPersistenceManager("SqLiteImpl", "createSqLiteInstance", sqLiteProps);
+ regionAttributeFactory.setPersistenceManager("SqLiteImpl", "createSqLiteInstance", sqLiteProps);
}
- std::shared_ptr<RegionAttributes> rattrsPtr = af.createRegionAttributes();
+ auto regionAttributes = regionAttributeFactory.create();
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
std::shared_ptr<Region> regionPtr;
- cacheImpl->createRegion(name, rattrsPtr, regionPtr);
+ cacheImpl->createRegion(name, regionAttributes, regionPtr);
return regionPtr;
}
std::shared_ptr<Region> CacheHelper::createPooledRegionDiscOverFlow(
@@ -883,14 +859,14 @@ std::shared_ptr<Region> CacheHelper::createPooledRegionStickySingleHop(
std::shared_ptr<Region> CacheHelper::createSubregion(
std::shared_ptr<Region>& parent, const char* name, bool ack, bool caching,
const std::shared_ptr<CacheListener>& listener) {
- AttributesFactory af;
- af.setCachingEnabled(caching);
+ RegionAttributesFactory regionAttributeFactory;
+ regionAttributeFactory.setCachingEnabled(caching);
if (listener != nullptr) {
- af.setCacheListener(listener);
+ regionAttributeFactory.setCacheListener(listener);
}
- std::shared_ptr<RegionAttributes> rattrsPtr = af.createRegionAttributes();
+ auto regionAttributes = regionAttributeFactory.create();
- return parent->createSubregion(name, rattrsPtr);
+ return parent->createSubregion(name, regionAttributes);
}
std::shared_ptr<CacheableString> CacheHelper::createCacheable(
const char* value) {
@@ -906,7 +882,7 @@ void CacheHelper::showKeys(
fflush(stdout);
}
-void CacheHelper::showRegionAttributes(RegionAttributes& attributes) {
+void CacheHelper::showRegionAttributes(RegionAttributes attributes) {
printf("caching=%s\n", attributes.getCachingEnabled() ? "true" : "false");
printf("Entry Time To Live = %s\n",
to_string(attributes.getEntryTimeToLive()).c_str());
diff --git a/cppcache/integration-test/CacheHelper.hpp b/cppcache/integration-test/CacheHelper.hpp
index 8dcbb17..08234ab 100644
--- a/cppcache/integration-test/CacheHelper.hpp
+++ b/cppcache/integration-test/CacheHelper.hpp
@@ -264,7 +264,7 @@ class CacheHelper {
void showKeys(std::vector<std::shared_ptr<CacheableKey>>& vecKeys);
- void showRegionAttributes(RegionAttributes& attributes);
+ void showRegionAttributes(RegionAttributes attributes);
std::shared_ptr<QueryService> getQueryService();
diff --git a/cppcache/integration-test/CacheImplHelper.hpp b/cppcache/integration-test/CacheImplHelper.hpp
index 51e7a2d..8408e9e 100644
--- a/cppcache/integration-test/CacheImplHelper.hpp
+++ b/cppcache/integration-test/CacheImplHelper.hpp
@@ -49,18 +49,17 @@ class CacheImplHelper : public CacheHelper {
std::shared_ptr<Region>& regionPtr, uint32_t size,
bool ack = false, bool cacheServerClient = false,
bool cacheEnabled = true) {
- std::shared_ptr<RegionAttributes> regAttrs;
- AttributesFactory attrFactory;
+ RegionAttributesFactory regionAttributesFactory;
// set lru attributes...
- attrFactory.setLruEntriesLimit(0); // no limit.
- attrFactory.setInitialCapacity(size); // no limit.
+ regionAttributesFactory.setLruEntriesLimit(0); // no limit.
+ regionAttributesFactory.setInitialCapacity(size); // no limit.
// then...
- attrFactory.setCachingEnabled(cacheEnabled);
- regAttrs = attrFactory.createRegionAttributes();
- showRegionAttributes(*regAttrs);
+ regionAttributesFactory.setCachingEnabled(cacheEnabled);
+ auto regionAttributes = regionAttributesFactory.create();
+ showRegionAttributes(regionAttributes);
CacheImpl* cimpl = TestUtils::getCacheImpl(cachePtr);
ASSERT(cimpl != nullptr, "failed to get cacheImpl *.");
- cimpl->createRegion(regionName, regAttrs, regionPtr);
+ cimpl->createRegion(regionName, regionAttributes, regionPtr);
ASSERT(regionPtr != nullptr, "failed to create region.");
}
};
diff --git a/cppcache/integration-test/ThinClientHelper.hpp b/cppcache/integration-test/ThinClientHelper.hpp
index 7910b6b..6e518f9 100644
--- a/cppcache/integration-test/ThinClientHelper.hpp
+++ b/cppcache/integration-test/ThinClientHelper.hpp
@@ -384,10 +384,10 @@ std::shared_ptr<Region> createOverflowRegion(
bool clientNotificationEnabled = true, bool caching = true) {
std::string bdb_dir = "BDB";
std::string bdb_dirEnv = "BDBEnv";
- AttributesFactory af;
- af.setCachingEnabled(caching);
- af.setLruEntriesLimit(lel);
- af.setDiskPolicy(DiskPolicyType::OVERFLOWS);
+ RegionAttributesFactory regionAttributesFactory;
+ regionAttributesFactory.setCachingEnabled(caching);
+ regionAttributesFactory.setLruEntriesLimit(lel);
+ regionAttributesFactory.setDiskPolicy(DiskPolicyType::OVERFLOWS);
auto sqLiteProps = Properties::create();
sqLiteProps->insert("PageSize", "65536");
@@ -396,13 +396,13 @@ std::shared_ptr<Region> createOverflowRegion(
"SqLiteRegionData" +
std::to_string(static_cast<long long int>(ACE_OS::getpid()));
sqLiteProps->insert("PersistenceDirectory", sqlite_dir.c_str());
- af.setPersistenceManager("SqLiteImpl", "createSqLiteInstance", sqLiteProps);
+ regionAttributesFactory.setPersistenceManager("SqLiteImpl", "createSqLiteInstance", sqLiteProps);
- std::shared_ptr<RegionAttributes> rattrsPtr = af.createRegionAttributes();
+ auto regionAttributes = regionAttributesFactory.create();
auto cache = getHelper()->cachePtr;
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
std::shared_ptr<Region> regionPtr;
- cacheImpl->createRegion(name, rattrsPtr, regionPtr);
+ cacheImpl->createRegion(name, regionAttributes, regionPtr);
return regionPtr;
}
std::shared_ptr<Region> createPooledRegion(
diff --git a/cppcache/integration-test/ThinClientListenerInit.hpp b/cppcache/integration-test/ThinClientListenerInit.hpp
index 17da167..cafa20f 100644
--- a/cppcache/integration-test/ThinClientListenerInit.hpp
+++ b/cppcache/integration-test/ThinClientListenerInit.hpp
@@ -64,8 +64,8 @@ class ThinClientTallyLoader : public TallyLoader {
char lstrvalue[32];
sprintf(lstrvalue, "%i", loadValue);
auto lreturnValue = CacheableString::create(lstrvalue);
- if (key && (!rp.getAttributes()->getEndpoints().empty() ||
- !rp.getAttributes()->getPoolName().empty())) {
+ if (key && (!rp.getAttributes().getEndpoints().empty() ||
+ !rp.getAttributes().getPoolName().empty())) {
LOGDEBUG("Putting the value (%s) for local region clients only ",
lstrvalue);
rp.put(key, lreturnValue);
diff --git a/cppcache/integration-test/ThinClientLocalCacheLoader.hpp b/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
index 81ed1c8..a4a7b84 100644
--- a/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
+++ b/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
@@ -51,8 +51,8 @@ class ThinClientTallyLoader : public TallyLoader {
char lstrvalue[32];
sprintf(lstrvalue, "%i", loadValue);
auto lreturnValue = CacheableString::create(lstrvalue);
- if (key != nullptr && (!rp.getAttributes()->getEndpoints().empty() ||
- !rp.getAttributes()->getPoolName().empty())) {
+ if (key != nullptr && (!rp.getAttributes().getEndpoints().empty() ||
+ !rp.getAttributes().getPoolName().empty())) {
LOGDEBUG("Putting the value (%s) for local region clients only ",
lstrvalue);
rp.put(key, lreturnValue);
diff --git a/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp b/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
index 1419502..6979831 100644
--- a/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
+++ b/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
@@ -147,9 +147,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pool_Locator)
// create subregion
auto regptr = getHelper()->getRegion(regionNames[2]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr1 = regptr->createSubregion(regionNames[3], lattribPtr);
- auto subregPtr2 = regptr->createSubregion(regionNames[4], lattribPtr);
+ auto subregPtr1 = regptr->createSubregion(regionNames[3], regptr->getAttributes());
+ auto subregPtr2 = regptr->createSubregion(regionNames[4], regptr->getAttributes());
LOGINFO(
"NIL: CLIENT1 StepOne_Pool_Locator subregions created successfully");
@@ -178,9 +177,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo_Pool_Locator)
// create subregion
auto regptr = getHelper()->getRegion(regionNames[2]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr1 = regptr->createSubregion(regionNames[3], lattribPtr);
- auto subregPtr2 = regptr->createSubregion(regionNames[4], lattribPtr);
+ auto subregPtr1 = regptr->createSubregion(regionNames[3], regptr->getAttributes());
+ auto subregPtr2 = regptr->createSubregion(regionNames[4], regptr->getAttributes());
LOGINFO(
"NIL: CLIENT2 StepTwo_Pool_Locator:: subregions created successfully");
diff --git a/cppcache/integration-test/testAttributesMutator.cpp b/cppcache/integration-test/testAttributesMutator.cpp
index 5140885..0678ce6 100644
--- a/cppcache/integration-test/testAttributesMutator.cpp
+++ b/cppcache/integration-test/testAttributesMutator.cpp
@@ -40,13 +40,13 @@ DUNIT_TASK(A, Init)
auto cacheFactory = CacheFactory();
Test.m_cache = std::make_shared<Cache>(cacheFactory.create());
- AttributesFactory af;
- af.setEntryTimeToLive(ExpirationAction::LOCAL_INVALIDATE,
+ RegionAttributesFactory regionAttributesFactory;
+ regionAttributesFactory.setEntryTimeToLive(ExpirationAction::LOCAL_INVALIDATE,
std::chrono::seconds(5));
- std::shared_ptr<RegionAttributes> attrs = af.createRegionAttributes();
+ auto regionAttributes = regionAttributesFactory.create();
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(Test.m_cache.get());
- cacheImpl->createRegion("Local_ETTL_LI", attrs, Test.m_region);
+ cacheImpl->createRegion("Local_ETTL_LI", regionAttributes, Test.m_region);
}
ENDTASK
diff --git a/cppcache/integration-test/testCache.cpp b/cppcache/integration-test/testCache.cpp
index 5c18eec..4556e46 100644
--- a/cppcache/integration-test/testCache.cpp
+++ b/cppcache/integration-test/testCache.cpp
@@ -41,18 +41,11 @@ BEGIN_TEST(CacheFunction)
<< " and unitialized system" << std::endl;
auto cacheFactory = CacheFactory();
cptr = std::make_shared<Cache>(cacheFactory.create());
- AttributesFactory attrFac;
- std::shared_ptr<RegionAttributes> rAttr;
+ RegionAttributesFactory regionAttributesFactory;
+
std::cout << "create RegionAttributes" << std::endl;
- try {
- rAttr = attrFac.createRegionAttributes();
- } catch (Exception& ex) {
- std::cout << ex.what() << std::endl;
- ASSERT(false, "attribute create failed");
- }
- if (rAttr == nullptr) {
- std::cout << "Warnning! : AttributesFactory returned nullptr" << std::endl;
- }
+ auto regionAttributes = regionAttributesFactory.create();
+
std::shared_ptr<Region> rptr;
if (rptr != nullptr) {
std::cout << "rptr is not null" << std::endl;
@@ -60,7 +53,7 @@ BEGIN_TEST(CacheFunction)
std::cout << "create Region with name=" << regionName << std::endl;
try {
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cptr.get());
- cacheImpl->createRegion(regionName, rAttr, rptr);
+ cacheImpl->createRegion(regionName, regionAttributes, rptr);
} catch (Exception& ex) {
std::cout << ex.what() << std::endl;
ASSERT(false, (char*)"attribute create failed");
@@ -68,7 +61,7 @@ BEGIN_TEST(CacheFunction)
std::cout << "create Sub Region with name=" << subRegionName1 << std::endl;
std::shared_ptr<Region> subRptr1;
try {
- subRptr1 = rptr->createSubregion(subRegionName1, rAttr);
+ subRptr1 = rptr->createSubregion(subRegionName1, regionAttributes);
} catch (Exception& ex) {
std::cout << ex.what() << std::endl;
ASSERT(false, (char*)"subregion create failed");
@@ -76,7 +69,7 @@ BEGIN_TEST(CacheFunction)
std::cout << "create Sub Region with name=" << subRegionName2 << std::endl;
std::shared_ptr<Region> subRptr2;
try {
- subRptr2 = rptr->createSubregion(subRegionName2, rAttr);
+ subRptr2 = rptr->createSubregion(subRegionName2, regionAttributes);
} catch (Exception& ex) {
std::cout << ex.what() << std::endl;
ASSERT(false, (char*)"subregion create failed");
@@ -85,7 +78,7 @@ BEGIN_TEST(CacheFunction)
<< "inside region=" << subRegionName2 << std::endl;
std::shared_ptr<Region> subRptr21;
try {
- subRptr21 = subRptr2->createSubregion(subRegionName21, rAttr);
+ subRptr21 = subRptr2->createSubregion(subRegionName21, regionAttributes);
} catch (Exception& ex) {
std::cout << ex.what() << std::endl;
ASSERT(false, (char*)"subregion create failed");
diff --git a/cppcache/integration-test/testCacheless.cpp b/cppcache/integration-test/testCacheless.cpp
index 24900bd..da5eb11 100644
--- a/cppcache/integration-test/testCacheless.cpp
+++ b/cppcache/integration-test/testCacheless.cpp
@@ -29,8 +29,6 @@ class RegionWrapper {
public:
explicit RegionWrapper(const char* name)
: m_regionPtr(cacheHelper->getRegion(name)) {
- std::shared_ptr<RegionAttributes> attrs;
- attrs = m_regionPtr->getAttributes();
m_noack = true;
}
diff --git a/cppcache/integration-test/testExpiration.cpp b/cppcache/integration-test/testExpiration.cpp
index 73b9313..e546b67 100644
--- a/cppcache/integration-test/testExpiration.cpp
+++ b/cppcache/integration-test/testExpiration.cpp
@@ -75,20 +75,19 @@ std::shared_ptr<CacheableKey> do1Put(std::shared_ptr<Region>& rptr) {
return key;
}
-void setExpTimes(
- std::shared_ptr<RegionAttributes>& attrs,
- const std::chrono::seconds& ettl = std::chrono::seconds::zero(),
- const std::chrono::seconds& eit = std::chrono::seconds::zero(),
- const std::chrono::seconds& rttl = std::chrono::seconds::zero(),
- const std::chrono::seconds& rit = std::chrono::seconds::zero()) {
- AttributesFactory afact;
-
- afact.setEntryIdleTimeout(action, eit);
- afact.setEntryTimeToLive(action, ettl);
- afact.setRegionIdleTimeout(action, rit);
- afact.setRegionTimeToLive(action, rttl);
-
- attrs = afact.createRegionAttributes();
+RegionAttributes setRegionAttributesTimeouts(
+ const std::chrono::seconds &entryTimeToLive = std::chrono::seconds::zero(),
+ const std::chrono::seconds &entryIdleTimeout = std::chrono::seconds::zero(),
+ const std::chrono::seconds ®ionTimeToLive = std::chrono::seconds::zero(),
+ const std::chrono::seconds ®ionIdleTimeout = std::chrono::seconds::zero()) {
+ RegionAttributesFactory regionAttributesFactory;
+
+ regionAttributesFactory.setEntryTimeToLive(action, entryTimeToLive);
+ regionAttributesFactory.setEntryIdleTimeout(action, entryIdleTimeout);
+ regionAttributesFactory.setRegionTimeToLive(action, regionTimeToLive);
+ regionAttributesFactory.setRegionIdleTimeout(action, regionIdleTimeout);
+
+ return regionAttributesFactory.create();
}
BEGIN_TEST(TEST_EXPIRATION)
@@ -103,9 +102,9 @@ BEGIN_TEST(TEST_EXPIRATION)
size_t n;
- std::shared_ptr<RegionAttributes> attrs_1;
+ RegionAttributes attrs_1;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_1);
+ attrs_1 = setRegionAttributesTimeouts();
std::shared_ptr<Region> R1;
cacheImpl->createRegion("R1", attrs_1, R1);
ASSERT(R1 != nullptr, "Expected R1 to be NON-nullptr");
@@ -119,10 +118,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R1->isDestroyed() == false, "Expected R1 to be alive");
- std::shared_ptr<RegionAttributes> attrs_2;
+ RegionAttributes attrs_2;
- setExpTimes(attrs_2, std::chrono::seconds(20), std::chrono::seconds(2),
- std::chrono::seconds(0), std::chrono::seconds(0));
+ attrs_2 = setRegionAttributesTimeouts(std::chrono::seconds(20), std::chrono::seconds(2),
+ std::chrono::seconds(0), std::chrono::seconds(0));
std::shared_ptr<Region> R2;
cacheImpl->createRegion("R2", attrs_2, R2);
@@ -137,10 +136,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R2->isDestroyed() == false, "Expected R2 to be alive");
- std::shared_ptr<RegionAttributes> attrs_3;
+ RegionAttributes attrs_3;
// rttl = 20, reit = 2
- setExpTimes(attrs_3, std::chrono::seconds(0), std::chrono::seconds(0),
- std::chrono::seconds(20), std::chrono::seconds(2));
+ attrs_3 = setRegionAttributesTimeouts(std::chrono::seconds(0), std::chrono::seconds(0),
+ std::chrono::seconds(20), std::chrono::seconds(2));
std::shared_ptr<Region> R3;
cacheImpl->createRegion("R3", attrs_3, R3);
@@ -150,10 +149,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R3->isDestroyed() == false, "Expected R3 to be alive");
- std::shared_ptr<RegionAttributes> attrs_4;
+ RegionAttributes attrs_4;
- setExpTimes(attrs_4, std::chrono::seconds(5), std::chrono::seconds(0),
- std::chrono::seconds(0), std::chrono::seconds(0));
+ attrs_4 = setRegionAttributesTimeouts(std::chrono::seconds(5), std::chrono::seconds(0),
+ std::chrono::seconds(0), std::chrono::seconds(0));
std::shared_ptr<Region> R4;
cacheImpl->createRegion("R4", attrs_4, R4);
@@ -169,10 +168,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R4->isDestroyed() == false, "Expected R4 to be alive");
- std::shared_ptr<RegionAttributes> attrs_5;
+ RegionAttributes attrs_5;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_5, std::chrono::seconds(0), std::chrono::seconds(5),
- std::chrono::seconds(0), std::chrono::seconds(0));
+ attrs_5 = setRegionAttributesTimeouts(std::chrono::seconds(0), std::chrono::seconds(5),
+ std::chrono::seconds(0), std::chrono::seconds(0));
std::shared_ptr<Region> R5;
cacheImpl->createRegion("R5", attrs_5, R5);
@@ -197,10 +196,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(n == 0, "Expected 0 entry");
ASSERT(R5->isDestroyed() == false, "Expected R5 to be alive");
- std::shared_ptr<RegionAttributes> attrs_6;
+ RegionAttributes attrs_6;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_6, std::chrono::seconds(0), std::chrono::seconds(0),
- std::chrono::seconds(5), std::chrono::seconds(0));
+ attrs_6 = setRegionAttributesTimeouts(std::chrono::seconds(0), std::chrono::seconds(0),
+ std::chrono::seconds(5), std::chrono::seconds(0));
std::shared_ptr<Region> R6;
cacheImpl->createRegion("R6", attrs_6, R6);
@@ -216,10 +215,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R6->isDestroyed() == true, "Expected R6 to be dead");
- std::shared_ptr<RegionAttributes> attrs_7;
+ RegionAttributes attrs_7;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_7, std::chrono::seconds(0), std::chrono::seconds(0),
- std::chrono::seconds(0), std::chrono::seconds(5));
+ attrs_7 = setRegionAttributesTimeouts(std::chrono::seconds(0), std::chrono::seconds(0),
+ std::chrono::seconds(0), std::chrono::seconds(5));
std::shared_ptr<Region> R7;
cacheImpl->createRegion("R7", attrs_7, R7);
@@ -235,10 +234,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R7->isDestroyed() == true, "Expected R7 to be dead");
- std::shared_ptr<RegionAttributes> attrs_8;
+ RegionAttributes attrs_8;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_8, std::chrono::seconds(10), std::chrono::seconds(0),
- std::chrono::seconds(0), std::chrono::seconds(0));
+ attrs_8 = setRegionAttributesTimeouts(std::chrono::seconds(10), std::chrono::seconds(0),
+ std::chrono::seconds(0), std::chrono::seconds(0));
std::shared_ptr<Region> R8;
cacheImpl->createRegion("R8", attrs_8, R8);
@@ -255,10 +254,10 @@ BEGIN_TEST(TEST_EXPIRATION)
n = getNumOfEntries(R8);
ASSERT(n == 0, "Expected 1 entries");
- std::shared_ptr<RegionAttributes> attrs_9;
+ RegionAttributes attrs_9;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_9, std::chrono::seconds(0), std::chrono::seconds(0),
- std::chrono::seconds(0), std::chrono::seconds(8));
+ attrs_9 = setRegionAttributesTimeouts(std::chrono::seconds(0), std::chrono::seconds(0),
+ std::chrono::seconds(0), std::chrono::seconds(8));
std::shared_ptr<Region> R9;
cacheImpl->createRegion("R9", attrs_9, R9);
@@ -277,10 +276,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R9->isDestroyed() == false, "Expected R9 to be alive");
- std::shared_ptr<RegionAttributes> attrs_10;
+ RegionAttributes attrs_10;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_10, std::chrono::seconds(6), std::chrono::seconds(0),
- std::chrono::seconds(0), std::chrono::seconds(12));
+ attrs_10 = setRegionAttributesTimeouts(std::chrono::seconds(6), std::chrono::seconds(0),
+ std::chrono::seconds(0), std::chrono::seconds(12));
std::shared_ptr<Region> R10;
cacheImpl->createRegion("R10", attrs_10, R10);
@@ -297,11 +296,11 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R10->isDestroyed() == true, "Expected R10 to be dead");
- std::shared_ptr<RegionAttributes> attrs_11;
+ RegionAttributes attrs_11;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_11, std::chrono::seconds(0), std::chrono::seconds(4),
- std::chrono::seconds(0), std::chrono::seconds(7));
+ attrs_11 = setRegionAttributesTimeouts(std::chrono::seconds(0), std::chrono::seconds(4),
+ std::chrono::seconds(0), std::chrono::seconds(7));
std::shared_ptr<Region> R11;
cacheImpl->createRegion("R11", attrs_11, R11);
@@ -325,10 +324,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R11->isDestroyed() == true, "Expected R11 to be dead");
- std::shared_ptr<RegionAttributes> attrs_12;
+ RegionAttributes attrs_12;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_12, std::chrono::seconds(5), std::chrono::seconds(0),
- std::chrono::seconds(0), std::chrono::seconds(0));
+ attrs_12 = setRegionAttributesTimeouts(std::chrono::seconds(5), std::chrono::seconds(0),
+ std::chrono::seconds(0), std::chrono::seconds(0));
std::shared_ptr<Region> R12;
cacheImpl->createRegion("R12", attrs_12, R12);
@@ -344,10 +343,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R12->isDestroyed() == false, "Expected R12 to be alive");
/////////
- std::shared_ptr<RegionAttributes> attrs_14;
+ RegionAttributes attrs_14;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_14, std::chrono::seconds(0), std::chrono::seconds(0),
- std::chrono::seconds(10), std::chrono::seconds(0));
+ attrs_14 = setRegionAttributesTimeouts(std::chrono::seconds(0), std::chrono::seconds(0),
+ std::chrono::seconds(10), std::chrono::seconds(0));
std::shared_ptr<Region> R14;
cacheImpl->createRegion("R14", attrs_14, R14);
@@ -359,10 +358,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R14->isDestroyed() == true, "Expected R14 to be dead");
- std::shared_ptr<RegionAttributes> attrs_15;
+ RegionAttributes attrs_15;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_15, std::chrono::seconds(0), std::chrono::seconds(5),
- std::chrono::seconds(0), std::chrono::seconds(0));
+ attrs_15 = setRegionAttributesTimeouts(std::chrono::seconds(0), std::chrono::seconds(5),
+ std::chrono::seconds(0), std::chrono::seconds(0));
std::shared_ptr<Region> R15;
cacheImpl->createRegion("R15", attrs_15, R15);
@@ -379,10 +378,10 @@ BEGIN_TEST(TEST_EXPIRATION)
ASSERT(R15->isDestroyed() == false, "Expected R15 to be alive");
//////////////
- std::shared_ptr<RegionAttributes> attrs_18;
+ RegionAttributes attrs_18;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_18, std::chrono::seconds(6), std::chrono::seconds(3),
- std::chrono::seconds(0), std::chrono::seconds(0));
+ attrs_18 = setRegionAttributesTimeouts(std::chrono::seconds(6), std::chrono::seconds(3),
+ std::chrono::seconds(0), std::chrono::seconds(0));
std::shared_ptr<Region> R18;
cacheImpl->createRegion("R18", attrs_18, R18);
@@ -399,10 +398,10 @@ BEGIN_TEST(TEST_EXPIRATION)
n = getNumOfEntries(R18);
ASSERT(n == 0, "ttl is over so it should be 0");
- std::shared_ptr<RegionAttributes> attrs_19;
+ RegionAttributes attrs_19;
// ettl = 0, eit = 0, rttl = 0, reit = 0
- setExpTimes(attrs_19, std::chrono::seconds(0), std::chrono::seconds(0),
- std::chrono::seconds(6), std::chrono::seconds(3));
+ attrs_19 = setRegionAttributesTimeouts(std::chrono::seconds(0), std::chrono::seconds(0),
+ std::chrono::seconds(6), std::chrono::seconds(3));
std::shared_ptr<Region> R19;
cacheImpl->createRegion("R19x", attrs_19, R19);
diff --git a/cppcache/integration-test/testLinkage.cpp b/cppcache/integration-test/testLinkage.cpp
index ad5543a..cdbb02d 100644
--- a/cppcache/integration-test/testLinkage.cpp
+++ b/cppcache/integration-test/testLinkage.cpp
@@ -17,7 +17,7 @@
#define ROOT_NAME "testLinkage"
-#include <geode/AttributesFactory.hpp>
+#include <geode/RegionAttributesFactory.hpp>
#include "fw_helper.hpp"
using namespace apache::geode::client;
@@ -28,7 +28,7 @@ using namespace apache::geode::client;
BEGIN_TEST(LinkageTest)
// just create one for now...
- AttributesFactory af;
+ RegionAttributesFactory regionAttributesFactory;
{
std::shared_ptr<Cacheable> cacheablePtr;
diff --git a/cppcache/integration-test/testOverflowPutGetSqLite.cpp b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
index e1e13be..f371099 100644
--- a/cppcache/integration-test/testOverflowPutGetSqLite.cpp
+++ b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
@@ -41,43 +41,43 @@ void getNumOfEntries(std::shared_ptr<Region>& regionPtr, uint32_t num) {
ASSERT(vecValues.size() == num, (char*)"size of value vec and num not equal");
}
-void setAttributes(std::shared_ptr<RegionAttributes>& attrsPtr,
+void setAttributes(RegionAttributes regionAttributes,
std::string pDir = sqlite_dir) {
- AttributesFactory attrsFact;
- attrsFact.setCachingEnabled(true);
- attrsFact.setLruEntriesLimit(10);
- attrsFact.setInitialCapacity(1000);
- attrsFact.setDiskPolicy(DiskPolicyType::OVERFLOWS);
+ RegionAttributesFactory regionAttributesFactory;
+ regionAttributesFactory.setCachingEnabled(true);
+ regionAttributesFactory.setLruEntriesLimit(10);
+ regionAttributesFactory.setInitialCapacity(1000);
+ regionAttributesFactory.setDiskPolicy(DiskPolicyType::OVERFLOWS);
auto sqliteProperties = Properties::create();
sqliteProperties->insert("MaxPageCount", "1073741823");
sqliteProperties->insert("PageSize", "65536");
sqliteProperties->insert("PersistenceDirectory", pDir.c_str());
- attrsFact.setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
- sqliteProperties);
+ regionAttributesFactory.setPersistenceManager(
+ "SqLiteImpl", "createSqLiteInstance", sqliteProperties);
- attrsPtr = attrsFact.createRegionAttributes();
+ regionAttributes = regionAttributesFactory.create();
}
-void setAttributesWithMirror(std::shared_ptr<RegionAttributes>& attrsPtr) {
- AttributesFactory attrsFact;
- attrsFact.setCachingEnabled(true);
- attrsFact.setLruEntriesLimit(20);
- attrsFact.setInitialCapacity(1000);
- attrsFact.setDiskPolicy(DiskPolicyType::OVERFLOWS);
+void setAttributesWithMirror(RegionAttributes regionAttributes) {
+ RegionAttributesFactory regionAttributesFactory;
+ regionAttributesFactory.setCachingEnabled(true);
+ regionAttributesFactory.setLruEntriesLimit(20);
+ regionAttributesFactory.setInitialCapacity(1000);
+ regionAttributesFactory.setDiskPolicy(DiskPolicyType::OVERFLOWS);
auto sqliteProperties = Properties::create();
sqliteProperties->insert("MaxPageCount", "1073741823");
sqliteProperties->insert("PageSize", "65536");
sqliteProperties->insert("PersistenceDirectory", sqlite_dir.c_str());
- attrsFact.setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
- sqliteProperties);
- attrsPtr = attrsFact.createRegionAttributes();
+ regionAttributesFactory.setPersistenceManager(
+ "SqLiteImpl", "createSqLiteInstance", sqliteProperties);
+ regionAttributes = regionAttributesFactory.create();
}
// Testing for attibute validation.
void validateAttribute(std::shared_ptr<Region>& regionPtr) {
- std::shared_ptr<RegionAttributes> regAttr = regionPtr->getAttributes();
- int initialCapacity = regAttr->getInitialCapacity();
+ RegionAttributes regAttr = regionPtr->getAttributes();
+ int initialCapacity = regAttr.getInitialCapacity();
ASSERT(initialCapacity == 1000, "Expected initial capacity to be 1000");
- const DiskPolicyType type = regAttr->getDiskPolicy();
+ const DiskPolicyType type = regAttr.getDiskPolicy();
ASSERT(type == DiskPolicyType::OVERFLOWS,
"Expected Action should overflow to disk");
}
@@ -331,7 +331,7 @@ void setSqLiteProperties(std::shared_ptr<Properties>& sqliteProperties,
void createSubRegion(std::shared_ptr<Region>& regionPtr,
std::shared_ptr<Region>& subRegion, const char* regionName,
std::string pDir = sqlite_dir) {
- std::shared_ptr<RegionAttributes> regionAttributesPtr;
+ RegionAttributes regionAttributesPtr;
setAttributes(regionAttributesPtr, pDir);
subRegion = regionPtr->createSubregion(regionName, regionAttributesPtr);
ASSERT(subRegion != nullptr, "Expected region to be NON-nullptr");
@@ -501,7 +501,6 @@ BEGIN_TEST(OverFlowTest_SqLiteFull)
}
END_TEST(OverFlowTest_SqLiteFull)
-
BEGIN_TEST(OverFlowTest_HeapLRU)
{
/** Creating a cache to manage regions. */
@@ -544,9 +543,9 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
std::shared_ptr<Region> subRegion;
for (int i = 0; i < 10; i++) {
- std::shared_ptr<RegionAttributes> regionAttributesPtr;
- setAttributes(regionAttributesPtr);
- subRegion = regionPtr->createSubregion("SubRegion", regionAttributesPtr);
+ RegionAttributes regionAttributes;
+ setAttributes(regionAttributes);
+ subRegion = regionPtr->createSubregion("SubRegion", regionAttributes);
ASSERT(subRegion != nullptr, "Expected region to be NON-nullptr");
char fileName[512];
sprintf(fileName, "%s/%s/%s.db", sqlite_dir.c_str(), "SubRegion",
@@ -573,14 +572,13 @@ BEGIN_TEST(OverFlowTest_MultiThreaded)
auto cachePtr = std::make_shared<Cache>(CacheFactory().create());
ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
- std::shared_ptr<RegionAttributes> attrsPtr;
- setAttributes(attrsPtr);
- ASSERT(attrsPtr != nullptr, "Expected region attributes to be NON-nullptr");
- /** Create a region with caching and LRU. */
+ RegionAttributes regionAttributes;
+ setAttributes(regionAttributes);
+ /** Create a region with caching and LRU. */
std::shared_ptr<Region> regionPtr;
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
- cacheImpl->createRegion("OverFlowRegion", attrsPtr, regionPtr);
+ cacheImpl->createRegion("OverFlowRegion", regionAttributes, regionPtr);
ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-nullptr");
validateAttribute(regionPtr);
@@ -614,14 +612,13 @@ BEGIN_TEST(OverFlowTest_PutGetAll)
auto cachePtr = std::make_shared<Cache>(CacheFactory().create());
ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
- std::shared_ptr<RegionAttributes> attrsPtr;
- setAttributes(attrsPtr);
- ASSERT(attrsPtr != nullptr, "Expected region attributes to be NON-nullptr");
- /** Create a region with caching and LRU. */
+ RegionAttributes regionAttributes;
+ setAttributes(regionAttributes);
+ /** Create a region with caching and LRU. */
std::shared_ptr<Region> regionPtr;
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
- cacheImpl->createRegion("OverFlowRegion", attrsPtr, regionPtr);
+ cacheImpl->createRegion("OverFlowRegion", regionAttributes, regionPtr);
ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-nullptr");
validateAttribute(regionPtr);
diff --git a/cppcache/integration-test/testRegionAccessThreadSafe.cpp b/cppcache/integration-test/testRegionAccessThreadSafe.cpp
index 6954e2f..c89a921 100644
--- a/cppcache/integration-test/testRegionAccessThreadSafe.cpp
+++ b/cppcache/integration-test/testRegionAccessThreadSafe.cpp
@@ -118,9 +118,9 @@ DUNIT_TASK(s2p2, CreateNormalRegion)
regionPtr = getHelper()->createPooledRegion(
"DistRegionAck", USE_ACK, locHostPort, "__TEST_POOL1__", true, true);
getThread->setRegionFlag();
- AttributesFactory af;
- std::shared_ptr<RegionAttributes> rattrsPtr = af.createRegionAttributes();
- getThread->setSubRegionFlag();
+ RegionAttributesFactory regionAttributesFactory;
+ auto regionAttributes = regionAttributesFactory.create();
+ getThread->setSubRegionFlag();
LOG("create normal region successful");
}
END_TASK(CreateNormalRegion)
diff --git a/cppcache/integration-test/testAttributesFactory.cpp b/cppcache/integration-test/testRegionAttributesFactory.cpp
similarity index 85%
rename from cppcache/integration-test/testAttributesFactory.cpp
rename to cppcache/integration-test/testRegionAttributesFactory.cpp
index 770e918..2d2ee85 100644
--- a/cppcache/integration-test/testAttributesFactory.cpp
+++ b/cppcache/integration-test/testRegionAttributesFactory.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-#define ROOT_NAME "testAttributesFactory"
+#define ROOT_NAME "testRegionAttributesFactory"
#include "fw_helper.hpp"
#include <CacheRegionHelper.hpp>
@@ -40,9 +40,9 @@ BEGIN_TEST(REGION_FACTORY)
}
auto region = rf.create("Local_ETTL_LI");
- LOGINFO("region->getAttributes()->getInitialCapacity() = %d ",
- region->getAttributes()->getInitialCapacity());
- ASSERT(region->getAttributes()->getInitialCapacity() == 10000,
+ LOGINFO("region->getAttributes().getInitialCapacity() = %d ",
+ region->getAttributes().getInitialCapacity());
+ ASSERT(region->getAttributes().getInitialCapacity() == 10000,
"Incorrect InitialCapacity");
region->put(1, 1);
@@ -66,9 +66,9 @@ BEGIN_TEST(REGION_FACTORY)
LOG("Got expected IllegalArgumentException");
}
auto region1 = rf1.create("Local_ETTL_LI");
- LOGINFO("region1->getAttributes()->getInitialCapacity() = %d ",
- region1->getAttributes()->getInitialCapacity());
- ASSERT(region1->getAttributes()->getInitialCapacity() == 10000,
+ LOGINFO("region1->getAttributes().getInitialCapacity() = %d ",
+ region1->getAttributes().getInitialCapacity());
+ ASSERT(region1->getAttributes().getInitialCapacity() == 10000,
"Incorrect InitialCapacity");
region1->put(1, 1);
diff --git a/cppcache/integration-test/testRegionTemplateArgs.cpp b/cppcache/integration-test/testRegionTemplateArgs.cpp
index c7661f4..1d2c514 100644
--- a/cppcache/integration-test/testRegionTemplateArgs.cpp
+++ b/cppcache/integration-test/testRegionTemplateArgs.cpp
@@ -37,11 +37,11 @@ BEGIN_TEST(CheckTemplates)
{
auto cacheFactory = CacheFactory();
auto cache = std::make_shared<Cache>(cacheFactory.create());
- AttributesFactory afact;
- std::shared_ptr<RegionAttributes> attrs = afact.createRegionAttributes();
+ RegionAttributesFactory regionAttributesFactory;
+ auto regionAttributes = regionAttributesFactory.create();
std::shared_ptr<Region> regPtr;
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
- cacheImpl->createRegion("TestRegion", attrs, regPtr);
+ cacheImpl->createRegion("TestRegion", regionAttributes, regPtr);
const char charKey[] = "test key";
const char charVal[] = "test value";
diff --git a/cppcache/integration-test/testThinClientAfterRegionLive.cpp b/cppcache/integration-test/testThinClientAfterRegionLive.cpp
index 4fdf936..148c9a8 100644
--- a/cppcache/integration-test/testThinClientAfterRegionLive.cpp
+++ b/cppcache/integration-test/testThinClientAfterRegionLive.cpp
@@ -67,32 +67,32 @@ void createPooledRegionMine(bool callReadyForEventsAPI = false) {
auto pptr = poolFac.create("__TEST_POOL1__");
}
SLEEP(10000);
- AttributesFactory af;
- af.setCachingEnabled(true);
- af.setLruEntriesLimit(0);
- af.setEntryIdleTimeout(ExpirationAction::DESTROY, std::chrono::seconds(0));
- af.setEntryTimeToLive(ExpirationAction::DESTROY, std::chrono::seconds(0));
- af.setRegionIdleTimeout(ExpirationAction::DESTROY, std::chrono::seconds(0));
- af.setRegionTimeToLive(ExpirationAction::DESTROY, std::chrono::seconds(0));
- af.setPoolName("__TEST_POOL1__");
+ RegionAttributesFactory regionAttributesFactory;
+ regionAttributesFactory.setCachingEnabled(true);
+ regionAttributesFactory.setLruEntriesLimit(0);
+ regionAttributesFactory.setEntryIdleTimeout(ExpirationAction::DESTROY, std::chrono::seconds(0));
+ regionAttributesFactory.setEntryTimeToLive(ExpirationAction::DESTROY, std::chrono::seconds(0));
+ regionAttributesFactory.setRegionIdleTimeout(ExpirationAction::DESTROY, std::chrono::seconds(0));
+ regionAttributesFactory.setRegionTimeToLive(ExpirationAction::DESTROY, std::chrono::seconds(0));
+ regionAttributesFactory.setPoolName("__TEST_POOL1__");
LOG("poolName = ");
LOG("__TEST_POOL1__");
- af.setCacheListener(cptr1);
- std::shared_ptr<RegionAttributes> rattrsPtr1 = af.createRegionAttributes();
- af.setCacheListener(cptr2);
- std::shared_ptr<RegionAttributes> rattrsPtr2 = af.createRegionAttributes();
- af.setCacheListener(cptr3);
- std::shared_ptr<RegionAttributes> rattrsPtr3 = af.createRegionAttributes();
- af.setCacheListener(cptr4);
- std::shared_ptr<RegionAttributes> rattrsPtr4 = af.createRegionAttributes();
+ regionAttributesFactory.setCacheListener(cptr1);
+ auto regionAttributes1 = regionAttributesFactory.create();
+ regionAttributesFactory.setCacheListener(cptr2);
+ auto regionAttributes2 = regionAttributesFactory.create();
+ regionAttributesFactory.setCacheListener(cptr3);
+ auto regionAttributes3 = regionAttributesFactory.create();
+ regionAttributesFactory.setCacheListener(cptr4);
+ auto regionAttributes4 = regionAttributesFactory.create();
CacheImpl* cacheImpl =
CacheRegionHelper::getCacheImpl(getHelper()->cachePtr.get());
std::shared_ptr<Region> region1;
- cacheImpl->createRegion(regionNames[0], rattrsPtr1, region1);
+ cacheImpl->createRegion(regionNames[0], regionAttributes1, region1);
std::shared_ptr<Region> region2;
- cacheImpl->createRegion(regionNames[1], rattrsPtr2, region2);
- auto subregion1 = region1->createSubregion(regionNames[0], rattrsPtr3);
- auto subregion2 = region2->createSubregion(regionNames[1], rattrsPtr4);
+ cacheImpl->createRegion(regionNames[1], regionAttributes2, region2);
+ auto subregion1 = region1->createSubregion(regionNames[0], regionAttributes3);
+ auto subregion2 = region2->createSubregion(regionNames[1], regionAttributes4);
if (callReadyForEventsAPI) {
getHelper()->cachePtr->readyForEvents();
}
diff --git a/cppcache/integration-test/testThinClientCacheableStringArray.cpp b/cppcache/integration-test/testThinClientCacheableStringArray.cpp
index 3fad7ea..62eaed2 100644
--- a/cppcache/integration-test/testThinClientCacheableStringArray.cpp
+++ b/cppcache/integration-test/testThinClientCacheableStringArray.cpp
@@ -77,8 +77,7 @@ DUNIT_TASK(CLIENT1, StepOne)
auto regptr = getHelper()->createPooledRegion(
_regionNames[0], USE_ACK, locHostPort, "__TEST_POOL1__", true, true);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(_regionNames[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(_regionNames[1], regptr->getAttributes());
auto&& qh = &QueryHelper::getHelper();
std::vector<std::shared_ptr<CacheableString>> cstr{
diff --git a/cppcache/integration-test/testThinClientClearRegion.cpp b/cppcache/integration-test/testThinClientClearRegion.cpp
index bb32a88..d417271 100644
--- a/cppcache/integration-test/testThinClientClearRegion.cpp
+++ b/cppcache/integration-test/testThinClientClearRegion.cpp
@@ -110,7 +110,7 @@ DUNIT_TASK(CLIENT2, VerifyClear)
{
auto regPtr = getHelper()->getRegion(regionNames[0]);
ASSERT(regPtr->size() == 0, "size incorrect");
- auto keyPtr = CacheableKey::create((const char*)"key02");
+ auto keyPtr = CacheableKey::create("key02");
auto valPtr =
CacheableBytes::create(std::vector<int8_t>{'v','a','l','u','e','0','2'});
regPtr->put(keyPtr, valPtr);
@@ -123,24 +123,26 @@ END_TASK(VerifyClear)
DUNIT_TASK(CLIENT1, VerifyClear1)
{
- auto regPtr = getHelper()->getRegion(regionNames[0]);
- ASSERT(regPtr->size() == 1, "size incorrect");
- regPtr->localClear();
- ASSERT(regPtr->size() == 0, "size incorrect");
- auto keyPtr = CacheableKey::create((const char*)"key02");
- ASSERT(regPtr->containsKeyOnServer(keyPtr), "key should be there");
- std::shared_ptr<RegionAttributes> attr = regPtr->getAttributes();
- auto clp = attr->getCacheListener();
- MyCacheListener* mcl = dynamic_cast<MyCacheListener*>(clp.get());
- char buf[1024];
- sprintf(buf, "listener clear count=%d", mcl->getClearCnt());
- LOG(buf);
- ASSERT(mcl->getClearCnt() == 2, buf);
- auto cwp = attr->getCacheWriter();
- MyCacheWriter* mcw = dynamic_cast<MyCacheWriter*>(cwp.get());
- sprintf(buf, "writer clear count=%d", mcw->getClearCnt());
- LOG(buf);
- ASSERT(mcw->getClearCnt() == 2, buf);
+ auto region = getHelper()->getRegion(regionNames[0]);
+ ASSERT(region->size() == 1, "size incorrect");
+
+ region->localClear();
+ ASSERT(region->size() == 0, "size incorrect");
+
+ auto key = CacheableKey::create("key02");
+ ASSERT(region->containsKeyOnServer(key), "key should be there");
+
+ auto cacheListener = region->getAttributes().getCacheListener();
+ auto myCacheListener = std::dynamic_pointer_cast<MyCacheListener>(cacheListener);
+ auto listenerClearCount = "listener clear count" + std::to_string(myCacheListener->getClearCnt());
+ LOG(listenerClearCount);
+ ASSERT(myCacheListener->getClearCnt() == 2, listenerClearCount.c_str());
+
+ auto cacheWriter = region->getAttributes().getCacheWriter();
+ auto myCacheWriter = std::dynamic_pointer_cast<MyCacheWriter>(cacheWriter);
+ auto writerClearCount = "writer clear count" + std::to_string(myCacheWriter->getClearCnt());
+ LOG(writerClearCount);
+ ASSERT(myCacheWriter->getClearCnt() == 2, writerClearCount.c_str());
}
END_TASK(VerifyClear1)
diff --git a/cppcache/integration-test/testThinClientCq.cpp b/cppcache/integration-test/testThinClientCq.cpp
index f6ed816..2af1ad1 100644
--- a/cppcache/integration-test/testThinClientCq.cpp
+++ b/cppcache/integration-test/testThinClientCq.cpp
@@ -300,8 +300,7 @@ void stepOne() {
initClientCq(true);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne complete.");
}
@@ -349,8 +348,7 @@ void stepOne2() {
initClientCq(true);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne2 complete.");
}
diff --git a/cppcache/integration-test/testThinClientCqDurable.cpp b/cppcache/integration-test/testThinClientCqDurable.cpp
index c1a1828..c4528ba 100644
--- a/cppcache/integration-test/testThinClientCqDurable.cpp
+++ b/cppcache/integration-test/testThinClientCqDurable.cpp
@@ -177,8 +177,7 @@ void stepOne() {
initClientWithId(0);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne complete.");
}
@@ -340,8 +339,7 @@ void stepOne2() {
initClientWithId(1);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne2 complete.");
}
diff --git a/cppcache/integration-test/testThinClientCqFailover.cpp b/cppcache/integration-test/testThinClientCqFailover.cpp
index 5324f1f..9da8dfc 100644
--- a/cppcache/integration-test/testThinClientCqFailover.cpp
+++ b/cppcache/integration-test/testThinClientCqFailover.cpp
@@ -156,8 +156,7 @@ void stepOne() {
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
QueryHelper* qh = &QueryHelper::getHelper();
@@ -175,8 +174,7 @@ void stepOne2() {
initClientCq(true);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne2 complete.");
}
diff --git a/cppcache/integration-test/testThinClientCqHAFailover.cpp b/cppcache/integration-test/testThinClientCqHAFailover.cpp
index a5910ce..f3addff 100644
--- a/cppcache/integration-test/testThinClientCqHAFailover.cpp
+++ b/cppcache/integration-test/testThinClientCqHAFailover.cpp
@@ -168,8 +168,7 @@ void stepOne() {
createRegionForCQ(regionNamesCq[0], USE_ACK, true, 1);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
QueryHelper* qh = &QueryHelper::getHelper();
@@ -187,8 +186,7 @@ void stepOne2() {
initClientCq(1);
createRegionForCQ(regionNamesCq[0], USE_ACK, true, 1);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne2 complete.");
}
diff --git a/cppcache/integration-test/testThinClientCqIR.cpp b/cppcache/integration-test/testThinClientCqIR.cpp
index da090e9..25fdd60 100644
--- a/cppcache/integration-test/testThinClientCqIR.cpp
+++ b/cppcache/integration-test/testThinClientCqIR.cpp
@@ -97,8 +97,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1Regions)
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
createRegionForCQ(regionNamesCq[2], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("CreateClient1Regions complete.");
}
@@ -109,8 +108,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2Regions)
initClientCq(true);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("CreateClient2Regions complete.");
}
diff --git a/cppcache/integration-test/testThinClientLRUExpiration.cpp b/cppcache/integration-test/testThinClientLRUExpiration.cpp
index 6b56111..096f01d 100644
--- a/cppcache/integration-test/testThinClientLRUExpiration.cpp
+++ b/cppcache/integration-test/testThinClientLRUExpiration.cpp
@@ -71,29 +71,29 @@ CacheHelper* getHelper() {
ASSERT(cacheHelper != nullptr, "No cacheHelper initialized.");
return cacheHelper;
}
-void printAttribute(std::shared_ptr<RegionAttributes>& attr) {
+void printAttribute(RegionAttributes attr) {
printf("CachingEnable: %s\n",
- attr->getCachingEnabled() ? "enabled" : "disabled");
- printf("InitialCapacity: %d\n", attr->getInitialCapacity());
- printf("LoadFactor: %f\n", attr->getLoadFactor());
- printf("ConcurencyLevel: %d\n", attr->getConcurrencyLevel());
+ attr.getCachingEnabled() ? "enabled" : "disabled");
+ printf("InitialCapacity: %d\n", attr.getInitialCapacity());
+ printf("LoadFactor: %f\n", attr.getLoadFactor());
+ printf("ConcurencyLevel: %d\n", attr.getConcurrencyLevel());
printf("RegionTimeToLive: %s\n",
- to_string(attr->getRegionTimeToLive()).c_str());
+ to_string(attr.getRegionTimeToLive()).c_str());
printf("RegionIdleTimeout: %s\n",
- to_string(attr->getRegionIdleTimeout()).c_str());
+ to_string(attr.getRegionIdleTimeout()).c_str());
printf("EntryTimeToLive: %s\n",
- to_string(attr->getEntryTimeToLive()).c_str());
+ to_string(attr.getEntryTimeToLive()).c_str());
printf("EntryIdleTimeout: %s\n",
- to_string(attr->getEntryIdleTimeout()).c_str());
- printf("getLruEntriesLimit: %d\n", attr->getLruEntriesLimit());
- printf("RegionTimeToLiveAction: %d\n", attr->getRegionTimeToLiveAction());
- printf("RegionIdleTimeoutAction: %d\n", attr->getRegionIdleTimeoutAction());
- printf("EntryTimeToLiveAction: %d\n", attr->getEntryTimeToLiveAction());
- printf("EntryIdleTimeoutAction: %d\n", attr->getEntryIdleTimeoutAction());
- printf("LruEvictionAction: %d\n", attr->getLruEvictionAction());
+ to_string(attr.getEntryIdleTimeout()).c_str());
+ printf("getLruEntriesLimit: %d\n", attr.getLruEntriesLimit());
+ printf("RegionTimeToLiveAction: %d\n", attr.getRegionTimeToLiveAction());
+ printf("RegionIdleTimeoutAction: %d\n", attr.getRegionIdleTimeoutAction());
+ printf("EntryTimeToLiveAction: %d\n", attr.getEntryTimeToLiveAction());
+ printf("EntryIdleTimeoutAction: %d\n", attr.getEntryIdleTimeoutAction());
+ printf("LruEvictionAction: %d\n", attr.getLruEvictionAction());
printf("ClientNotification: %s\n",
- attr->getClientNotificationEnabled() ? "true" : "false");
- // printf("getEndPoint: %s\n",attr->getEndpoints());
+ attr.getClientNotificationEnabled() ? "true" : "false");
+ // printf("getEndPoint: %s\n",attr.getEndpoints());
}
void setCacheListener(const char* regName, std::shared_ptr<TallyListener> regListener) {
diff --git a/cppcache/integration-test/testThinClientPoolAttrTest.cpp b/cppcache/integration-test/testThinClientPoolAttrTest.cpp
index cd72576..455f9d6 100644
--- a/cppcache/integration-test/testThinClientPoolAttrTest.cpp
+++ b/cppcache/integration-test/testThinClientPoolAttrTest.cpp
@@ -254,7 +254,7 @@ DUNIT_TASK(CLIENT1, ClientOp)
SLEEP(5000);
// Check current # connections they should be == min
std::string poolName =
- getHelper()->getRegion(poolRegNames[0])->getAttributes()->getPoolName();
+ getHelper()->getRegion(poolRegNames[0])->getAttributes().getPoolName();
int level = TestUtils::getCacheImpl(getHelper()->cachePtr)
->getPoolSize(poolName.c_str());
int min = getHelper()
diff --git a/cppcache/integration-test/testThinClientRemoteQueryRS.cpp b/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
index 78dc60b..6dcef9c 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
@@ -74,8 +74,7 @@ void stepOne() {
createRegionAndAttachPool(qRegionNames[3], USE_ACK, poolNames[0]);
auto regptr = getHelper()->getRegion(qRegionNames[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(qRegionNames[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(qRegionNames[1], regptr->getAttributes());
LOG("StepOne complete.");
}
diff --git a/cppcache/integration-test/testThinClientRemoteQuerySS.cpp b/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
index 0a9dbfb..19d7a47 100644
--- a/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
@@ -234,8 +234,7 @@ void stepOne() {
createRegionAndAttachPool(qRegionNames[3], USE_ACK, poolNames[0]);
auto regptr = getHelper()->getRegion(qRegionNames[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(qRegionNames[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(qRegionNames[1], regptr->getAttributes());
LOG("StepOne complete.");
}
diff --git a/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp b/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
index a9e6a55..7480e6d 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
@@ -73,8 +73,7 @@ void stepOne() {
createRegionAndAttachPool(qRegionNames[0], USE_ACK, poolNames[0]);
auto regptr = getHelper()->getRegion(qRegionNames[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(qRegionNames[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(qRegionNames[1], regptr->getAttributes());
LOG("StepOne complete.");
}
diff --git a/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp b/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
index 2d25c18..bc1f9fc 100644
--- a/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
+++ b/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
@@ -107,8 +107,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOnePoolLocator)
createRegionAndAttachPool(qRegionNames[3], USE_ACK, poolNames[1]);
auto regptr = getHelper()->getRegion(qRegionNames[0]);
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- auto subregPtr = regptr->createSubregion(qRegionNames[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(qRegionNames[1], regptr->getAttributes());
LOG("StepOne complete.");
}
diff --git a/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp b/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
index 7205f41..6cde314 100644
--- a/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
+++ b/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
@@ -18,7 +18,7 @@
#include <geode/FunctionService.hpp>
#include <geode/Execution.hpp>
#include <geode/UserFunctionExecutionException.hpp>
-#include <geode/AttributesFactory.hpp>
+#include <geode/RegionAttributesFactory.hpp>
#include <geode/CqAttributesFactory.hpp>
#define ROOT_NAME "testThinClientSecurityAuthenticationMU"
diff --git a/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp b/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
index 91ff752..357e27b 100644
--- a/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
+++ b/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
@@ -214,9 +214,8 @@ void initCredentialGenerator() {
LOG("StepOne1 complete. 3");
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
LOG("StepOne1 complete. 4");
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
LOG("StepOne1 complete. 5");
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne complete.");
}
@@ -229,9 +228,8 @@ void stepOne2(bool pool = false, bool locator = false) {
LOG("StepOne2 complete. 3");
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
LOG("StepOne2 complete. 4");
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
LOG("StepOne2 complete. 5");
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne2 complete.");
}
diff --git a/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp b/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
index aa69dae..4689a90 100644
--- a/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
+++ b/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
@@ -224,9 +224,7 @@ void initCredentialGenerator() {
LOG("StepOne1 complete. 3");
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
LOG("StepOne1 complete. 4");
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- LOG("StepOne1 complete. 5");
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne complete.");
}
@@ -248,9 +246,7 @@ void stepOne2(bool pool = false, bool locator = false) {
LOG("StepOne2 complete. 3");
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
LOG("StepOne2 complete. 4");
- std::shared_ptr<RegionAttributes> lattribPtr = regptr->getAttributes();
- LOG("StepOne2 complete. 5");
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], lattribPtr);
+ auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne2 complete.");
}
diff --git a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
index 8681651..b436a2b 100644
--- a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
+++ b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
@@ -131,51 +131,50 @@ int testXmlCacheCreationWithOverflow() {
std::cout << "Test the attributes of region" << std::endl;
- std::shared_ptr<RegionAttributes> raPtr = regPtr1->getAttributes();
- RegionAttributes* regAttr = raPtr.get();
+ auto regionAttributes = regPtr1->getAttributes();
std::cout << "Attributes of root region Root1 are : " << std::endl;
- bool cachingEnabled = regAttr->getCachingEnabled();
+ bool cachingEnabled = regionAttributes.getCachingEnabled();
std::cout << "Caching-enabled :true" << std::endl;
if (!cachingEnabled) {
return -1;
}
- int lruEL = regAttr->getLruEntriesLimit();
+ int lruEL = regionAttributes.getLruEntriesLimit();
std::cout << "lru-entries-limit : 35" << std::endl;
if (lruEL != 35) {
return -1;
}
- int concurrency = regAttr->getConcurrencyLevel();
+ int concurrency = regionAttributes.getConcurrencyLevel();
std::cout << "concurrency-level : 10" << std::endl;
if (concurrency != 10) {
return -1;
}
- int initialCapacity = regAttr->getInitialCapacity();
+ int initialCapacity = regionAttributes.getInitialCapacity();
std::cout << "initial-capacity : 25" << std::endl;
if (initialCapacity != 25) {
return -1;
}
- int regionIdleTO = regAttr->getRegionIdleTimeout().count();
+ int regionIdleTO = regionAttributes.getRegionIdleTimeout().count();
std::cout << "RegionIdleTimeout:20 " << std::endl;
if (regionIdleTO != 20) {
return -1;
}
- ExpirationAction action1 = regAttr->getRegionIdleTimeoutAction();
+ ExpirationAction action1 = regionAttributes.getRegionIdleTimeoutAction();
std::cout << "RegionIdleTimeoutAction : Destroy" << std::endl;
if (action1 != ExpirationAction::DESTROY) {
return -1;
}
- const DiskPolicyType type = regAttr->getDiskPolicy();
+ const DiskPolicyType type = regionAttributes.getDiskPolicy();
std::cout << "DiskPolicy : overflows" << std::endl;
if (type != DiskPolicyType::OVERFLOWS) {
std::cout << " diskpolicy is not overflows " << std::endl;
return -1;
}
- std::cout << "persistence library = " << regAttr->getPersistenceLibrary() << std::endl;
- std::cout << "persistence function = " << regAttr->getPersistenceFactory() << std::endl;
- auto pconfig = regAttr->getPersistenceProperties();
+ std::cout << "persistence library = " << regionAttributes.getPersistenceLibrary() << std::endl;
+ std::cout << "persistence function = " << regionAttributes.getPersistenceFactory() << std::endl;
+ auto pconfig = regionAttributes.getPersistenceProperties();
if (pconfig != nullptr) {
std::cout << " persistence property is not null" << std::endl;
std::cout << " persistencedir = "
@@ -188,10 +187,10 @@ int testXmlCacheCreationWithOverflow() {
}
std::cout << "****Attributes of Root1 are correctly set****" << std::endl;
- std::shared_ptr<RegionAttributes> raPtr2 = regPtr2->getAttributes();
- std::cout << "persistence library = " << raPtr2->getPersistenceLibrary() << std::endl;
- std::cout << "persistence function = " << raPtr2->getPersistenceFactory() << std::endl;
- auto pconfig2 = raPtr2->getPersistenceProperties();
+ auto regionAttributes2 = regPtr2->getAttributes();
+ std::cout << "persistence library = " << regionAttributes2.getPersistenceLibrary() << std::endl;
+ std::cout << "persistence function = " << regionAttributes2.getPersistenceFactory() << std::endl;
+ auto pconfig2 = regionAttributes2.getPersistenceProperties();
if (pconfig2 != nullptr) {
std::cout << " persistence property is not null for Root2" << std::endl;
std::cout << " persistencedir2 = "
diff --git a/cppcache/integration-test/testXmlCacheCreationWithPools.cpp b/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
index 967a29c..af8ce4d 100644
--- a/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
+++ b/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
@@ -339,9 +339,9 @@ int testXmlCacheCreationWithPools() {
std::cout << "Test the attributes of region" << std::endl;
- const auto& poolNameReg1 = regPtr1->getAttributes()->getPoolName();
- const auto& poolNameSubReg = subRegPtr->getAttributes()->getPoolName();
- const auto& poolNameReg2 = regPtr2->getAttributes()->getPoolName();
+ const auto& poolNameReg1 = regPtr1->getAttributes().getPoolName();
+ const auto& poolNameSubReg = subRegPtr->getAttributes().getPoolName();
+ const auto& poolNameReg2 = regPtr2->getAttributes().getPoolName();
if (poolNameReg1 != "test_pool_1") {
std::cout << "Wrong pool name for region 1" << std::endl;
@@ -512,22 +512,21 @@ int testXmlDeclarativeCacheCreation() {
}
auto regPtr1 = vrp.at(0);
- std::shared_ptr<RegionAttributes> raPtr = regPtr1->getAttributes();
- RegionAttributes* regAttr = raPtr.get();
+ auto regionAttributes = regPtr1->getAttributes();
std::cout << "Test Attributes of root region Root1 " << std::endl;
std::cout << "Region name " << regPtr1->getName() << std::endl;
- if (regAttr->getCacheLoader() == nullptr) {
+ if (regionAttributes.getCacheLoader() == nullptr) {
std::cout << "Cache Loader not initialized." << std::endl;
return -1;
}
- if (regAttr->getCacheListener() == nullptr) {
+ if (regionAttributes.getCacheListener() == nullptr) {
std::cout << "Cache Listener not initialized." << std::endl;
return -1;
}
- if (regAttr->getCacheWriter() == nullptr) {
+ if (regionAttributes.getCacheWriter() == nullptr) {
std::cout << "Cache Writer not initialized." << std::endl;
return -1;
}
diff --git a/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp b/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp
index 79e54dd..f99f067 100644
--- a/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp
+++ b/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp
@@ -83,22 +83,22 @@ int testXmlCacheCreationWithRefid(const char* fileName) {
auto atts = SubRegion11->getAttributes();
- if (atts->getCachingEnabled() != true) {
+ if (atts.getCachingEnabled() != true) {
LOGINFO("Caching is not enabled in SubRegion11");
return -1;
}
- if (atts->getInitialCapacity() != 10) {
+ if (atts.getInitialCapacity() != 10) {
LOGINFO("Initial capacity of SubRegion11 is not 10");
return -1;
}
- if (atts->getConcurrencyLevel() != 52) {
+ if (atts.getConcurrencyLevel() != 52) {
LOGINFO("Concurrency level of SubRegion11 is not 52");
return -1;
}
- if (fabs(atts->getLoadFactor() - 0.89) > 0.001) {
+ if (fabs(atts.getLoadFactor() - 0.89) > 0.001) {
LOGINFO("Load factor of SubRegion11 is not 0.89");
return -1;
}
@@ -107,22 +107,22 @@ int testXmlCacheCreationWithRefid(const char* fileName) {
atts = SubRegion2->getAttributes();
- if (atts->getCachingEnabled() != true) {
+ if (atts.getCachingEnabled() != true) {
LOGINFO("Caching is not enabled in SubRegion2");
return -1;
}
- if (atts->getInitialCapacity() != 10) {
+ if (atts.getInitialCapacity() != 10) {
LOGINFO("Initial capacity of SubRegion2 is not 10");
return -1;
}
- if (fabs(atts->getLoadFactor() - 0.89) > 0.001) {
+ if (fabs(atts.getLoadFactor() - 0.89) > 0.001) {
LOGINFO("Load factor of SubRegion2 is not 0.89");
return -1;
}
- if (atts->getConcurrencyLevel() != 52) {
+ if (atts.getConcurrencyLevel() != 52) {
LOGINFO("Concurrency level of SubRegion2 is not 52");
return -1;
}
@@ -131,42 +131,42 @@ int testXmlCacheCreationWithRefid(const char* fileName) {
atts = SubRegion21->getAttributes();
- if (atts->getCachingEnabled() != true) {
+ if (atts.getCachingEnabled() != true) {
LOGINFO("Caching is not enabled in SubRegion21");
return -1;
}
- if (atts->getInitialCapacity() != 10) {
+ if (atts.getInitialCapacity() != 10) {
LOGINFO("Initial capacity of SubRegion21 is not 10");
return -1;
}
- if (fabs(atts->getLoadFactor() - 0.89) > 0.001) {
+ if (fabs(atts.getLoadFactor() - 0.89) > 0.001) {
LOGINFO("Load factor of SubRegion21 is not 0.89");
return -1;
}
- if (atts->getConcurrencyLevel() != 52) {
+ if (atts.getConcurrencyLevel() != 52) {
LOGINFO("Concurrency level of SubRegion21 is not 52");
return -1;
}
- if (atts->getEntryIdleTimeout().count() != 10) {
+ if (atts.getEntryIdleTimeout().count() != 10) {
LOGINFO("Entryidletimeout of SubRegion21 is not 10");
return -1;
}
- if (atts->getEntryIdleTimeoutAction() != ExpirationAction::INVALIDATE) {
+ if (atts.getEntryIdleTimeoutAction() != ExpirationAction::INVALIDATE) {
LOGINFO("Entryidletimeoutaction of SubRegion21 is not invalidate");
return -1;
}
- if (atts->getRegionIdleTimeout().count() != 20) {
+ if (atts.getRegionIdleTimeout().count() != 20) {
LOGINFO("Regionidletimeout of SubRegion21 is not 20");
return -1;
}
- if (atts->getRegionIdleTimeoutAction() != ExpirationAction::DESTROY) {
+ if (atts.getRegionIdleTimeoutAction() != ExpirationAction::DESTROY) {
LOGINFO("Regionidletimeoutaction of SubRegion21 is not destroy");
return -1;
}
@@ -175,62 +175,62 @@ int testXmlCacheCreationWithRefid(const char* fileName) {
atts = Root2->getAttributes();
- if (atts->getCachingEnabled() != true) {
+ if (atts.getCachingEnabled() != true) {
LOGINFO("Caching is not enabled in Root2");
return -1;
}
- if (atts->getInitialCapacity() != 25) {
+ if (atts.getInitialCapacity() != 25) {
LOGINFO("Initial capacity of Root2 is not 10");
return -1;
}
- if (fabs(atts->getLoadFactor() - 0.32) > 0.001) {
+ if (fabs(atts.getLoadFactor() - 0.32) > 0.001) {
LOGINFO("Load factor of Root2 is not 0.0.32");
return -1;
}
- if (atts->getConcurrencyLevel() != 16) {
+ if (atts.getConcurrencyLevel() != 16) {
LOGINFO("Concurrency level of Root2 is not 16");
return -1;
}
- if (atts->getEntryIdleTimeout().count() != 10) {
+ if (atts.getEntryIdleTimeout().count() != 10) {
LOGINFO("Entryidletimeout of Root2 is not 10");
return -1;
}
- if (atts->getEntryIdleTimeoutAction() != ExpirationAction::INVALIDATE) {
+ if (atts.getEntryIdleTimeoutAction() != ExpirationAction::INVALIDATE) {
LOGINFO("Entryidletimeoutaction of Root2 is not invalidate");
return -1;
}
- if (atts->getEntryTimeToLive().count() != 0) {
+ if (atts.getEntryTimeToLive().count() != 0) {
LOGINFO("Entrytimetolive of Root2 is not 0");
return -1;
}
- if (atts->getEntryTimeToLiveAction() != ExpirationAction::LOCAL_INVALIDATE) {
+ if (atts.getEntryTimeToLiveAction() != ExpirationAction::LOCAL_INVALIDATE) {
LOGINFO("Entrytimetoliveaction of Root2 is not local_invalidate");
return -1;
}
- if (atts->getRegionIdleTimeout().count() != 0) {
+ if (atts.getRegionIdleTimeout().count() != 0) {
LOGINFO("Regionidletimeout of Root2 is not 0");
return -1;
}
- if (atts->getRegionIdleTimeoutAction() != ExpirationAction::INVALIDATE) {
+ if (atts.getRegionIdleTimeoutAction() != ExpirationAction::INVALIDATE) {
LOGINFO("Regionidletimeoutaction of Root2 is not invalidate");
return -1;
}
- if (atts->getRegionTimeToLive().count() != 0) {
+ if (atts.getRegionTimeToLive().count() != 0) {
LOGINFO("Regiontimetolive of Root2 is not 0");
return -1;
}
- if (atts->getRegionTimeToLiveAction() != ExpirationAction::DESTROY) {
+ if (atts.getRegionTimeToLiveAction() != ExpirationAction::DESTROY) {
LOGINFO("Regiontimetoliveaction of Root2 is not destroy");
return -1;
}
diff --git a/cppcache/src/Cache.cpp b/cppcache/src/Cache.cpp
index d95d6b6..3f2ee57 100644
--- a/cppcache/src/Cache.cpp
+++ b/cppcache/src/Cache.cpp
@@ -91,7 +91,7 @@ std::shared_ptr<Region> Cache::getRegion(const std::string& path) const {
if (result != nullptr) {
if (isPoolInMultiuserMode(result)) {
- LOGWARN("Pool " + result->getAttributes()->getPoolName() +
+ LOGWARN("Pool " + result->getAttributes().getPoolName() +
" attached with region " + result->getFullPath() +
" is in multiuser authentication mode. Operations may fail as "
"this instance does not have any credentials.");
@@ -165,7 +165,7 @@ void Cache::initializeDeclarativeCache(const std::string& cacheXml) {
void Cache::readyForEvents() { m_cacheImpl->readyForEvents(); }
bool Cache::isPoolInMultiuserMode(std::shared_ptr<Region> regionPtr) {
- const auto& poolName = regionPtr->getAttributes()->getPoolName();
+ const auto& poolName = regionPtr->getAttributes().getPoolName();
if (!poolName.empty()) {
auto poolPtr = regionPtr->getCache().getPoolManager().find(poolName);
diff --git a/cppcache/src/CacheImpl.cpp b/cppcache/src/CacheImpl.cpp
index 56b1f76..38e4718 100644
--- a/cppcache/src/CacheImpl.cpp
+++ b/cppcache/src/CacheImpl.cpp
@@ -128,7 +128,7 @@ void CacheImpl::netDown() {
void CacheImpl::revive() { m_tcrConnectionManager->revive(); }
CacheImpl::RegionKind CacheImpl::getRegionKind(
- const std::shared_ptr<RegionAttributes>& rattrs) const {
+ RegionAttributes regionAttributes) const {
RegionKind regionKind = CPP_REGION;
std::string endpoints;
@@ -137,18 +137,18 @@ CacheImpl::RegionKind CacheImpl::getRegionKind(
(m_attributes->getRedundancyLevel() > 0 ||
m_tcrConnectionManager->isDurable())) {
regionKind = THINCLIENT_HA_REGION;
- } else if (!endpoints.empty() && rattrs->getEndpoints().empty()) {
- rattrs->setEndpoints(endpoints);
+ } else if (!endpoints.empty() && regionAttributes.getEndpoints().empty()) {
+ regionAttributes.setEndpoints(endpoints);
}
- if (!(endpoints = rattrs->getEndpoints()).empty()) {
+ if (!(endpoints = regionAttributes.getEndpoints()).empty()) {
if ("none" == endpoints) {
regionKind = CPP_REGION;
} else if (regionKind != THINCLIENT_HA_REGION) {
regionKind = THINCLIENT_REGION;
}
- } else if (!rattrs->getPoolName().empty()) {
- auto pPtr = getCache()->getPoolManager().find(rattrs->getPoolName());
+ } else if (!regionAttributes.getPoolName().empty()) {
+ auto pPtr = getCache()->getPoolManager().find(regionAttributes.getPoolName());
if ((pPtr != nullptr && (pPtr->getSubscriptionRedundancy() > 0 ||
pPtr->getSubscriptionEnabled())) ||
m_tcrConnectionManager->isDurable()) {
@@ -326,9 +326,9 @@ bool CacheImpl::isCacheDestroyPending() const { return m_destroyPending; }
void CacheImpl::validateRegionAttributes(
const std::string& name,
- const std::shared_ptr<RegionAttributes>& attrs) const {
- auto&& kind = getRegionKind(attrs);
- if (attrs->m_clientNotificationEnabled && kind == CPP_REGION) {
+ const RegionAttributes regionAttributes) const {
+ auto&& kind = getRegionKind(regionAttributes);
+ if (regionAttributes.m_clientNotificationEnabled && kind == CPP_REGION) {
throw UnsupportedOperationException(
"Cache::createRegion: \"" + name +
"\" Client notification can be enabled only for native client region");
@@ -340,12 +340,12 @@ void CacheImpl::validateRegionAttributes(
// pointer here
void CacheImpl::createRegion(
std::string name,
- const std::shared_ptr<RegionAttributes>& aRegionAttributes,
+ RegionAttributes regionAttributes,
std::shared_ptr<Region>& regionPtr) {
{
ACE_Guard<ACE_Thread_Mutex> _guard(m_initDoneLock);
if (!m_initDone) {
- if (aRegionAttributes->getPoolName().empty()) {
+ if (regionAttributes.getPoolName().empty()) {
m_tcrConnectionManager->init();
m_remoteQueryServicePtr = std::make_shared<RemoteQueryService>(this);
auto& prop = m_distributedSystem->getSystemProperties();
@@ -360,17 +360,13 @@ void CacheImpl::createRegion(
if (m_closed || m_destroyPending) {
throw CacheClosedException("Cache::createRegion: cache closed");
}
- if (aRegionAttributes == nullptr) {
- throw IllegalArgumentException(
- "Cache::createRegion: RegionAttributes is null");
- }
if (name.find('/') != std::string::npos) {
throw IllegalArgumentException(
"Malformed name string, contains region path seperator '/'");
}
- validateRegionAttributes(name, aRegionAttributes);
+ validateRegionAttributes(name, regionAttributes);
std::shared_ptr<RegionInternal> rpImpl = nullptr;
{
// For multi threading and the operations between bind and find seems to be
@@ -385,7 +381,7 @@ void CacheImpl::createRegion(
auto csptr = std::make_shared<CacheStatistics>();
try {
- rpImpl = createRegion_internal(name.c_str(), nullptr, aRegionAttributes,
+ rpImpl = createRegion_internal(name.c_str(), nullptr, regionAttributes,
csptr, false);
} catch (const AuthenticationFailedException&) {
throw;
@@ -408,13 +404,13 @@ void CacheImpl::createRegion(
regionPtr = rpImpl;
rpImpl->addDisMessToQueue();
// Instantiate a PersistenceManager object if DiskPolicy is overflow
- if (aRegionAttributes->getDiskPolicy() == DiskPolicyType::OVERFLOWS) {
- auto pmPtr = aRegionAttributes->getPersistenceManager();
+ if (regionAttributes.getDiskPolicy() == DiskPolicyType::OVERFLOWS) {
+ auto pmPtr = regionAttributes.getPersistenceManager();
if (pmPtr == nullptr) {
throw NullPointerException(
"PersistenceManager could not be instantiated");
}
- auto props = aRegionAttributes->getPersistenceProperties();
+ auto props = regionAttributes.getPersistenceProperties();
pmPtr->init(regionPtr, props);
rpImpl->setPersistenceManager(pmPtr);
}
@@ -427,7 +423,7 @@ void CacheImpl::createRegion(
// metadata for single hop.
auto& props = m_distributedSystem->getSystemProperties();
if (!props.isGridClient()) {
- const auto& poolName = aRegionAttributes->getPoolName();
+ const auto& poolName = regionAttributes.getPoolName();
if (!poolName.empty()) {
auto pool = getCache()->getPoolManager().find(poolName);
if (pool != nullptr && !pool->isDestroyed() &&
@@ -506,18 +502,13 @@ void CacheImpl::getRegion(const std::string& path,
std::shared_ptr<RegionInternal> CacheImpl::createRegion_internal(
const std::string& name, const std::shared_ptr<RegionInternal>& rootRegion,
- const std::shared_ptr<RegionAttributes>& attrs, const std::shared_ptr<CacheStatistics>& csptr,
+ const RegionAttributes& attrs, const std::shared_ptr<CacheStatistics>& csptr,
bool shared) {
- if (attrs == nullptr) {
- throw IllegalArgumentException(
- "createRegion: "
- "RegionAttributes is null");
- }
std::shared_ptr<RegionInternal> rptr = nullptr;
RegionKind regionKind = getRegionKind(attrs);
- const auto& poolName = attrs->getPoolName();
- const auto& regionEndpoints = attrs->getEndpoints();
+ const auto& poolName = attrs.getPoolName();
+ const auto& regionEndpoints = attrs.getEndpoints();
const std::string cacheEndpoints =
m_attributes ? m_attributes->getEndpoints() : "";
@@ -531,7 +522,7 @@ std::shared_ptr<RegionInternal> CacheImpl::createRegion_internal(
auto pool = getCache()->getPoolManager().find(poolName);
if (pool != nullptr && !pool->isDestroyed()) {
bool isMultiUserSecureMode = pool->getMultiuserAuthentication();
- if (isMultiUserSecureMode && (attrs->getCachingEnabled())) {
+ if (isMultiUserSecureMode && (attrs.getCachingEnabled())) {
LOGERROR(
"Pool [%s] is in multiuser authentication mode so region local "
"caching is not supported.",
@@ -556,7 +547,7 @@ std::shared_ptr<RegionInternal> CacheImpl::createRegion_internal(
if (regionKind == THINCLIENT_REGION) {
LOGINFO("Creating region " + name + " with region endpoints " +
- attrs->getEndpoints().c_str());
+ attrs.getEndpoints().c_str());
auto tmp = std::make_shared<ThinClientRegion>(name, this, rootRegion, attrs,
csptr, shared);
tmp->initTCR();
@@ -569,7 +560,7 @@ std::shared_ptr<RegionInternal> CacheImpl::createRegion_internal(
rptr = tmp;
} else if (regionKind == THINCLIENT_POOL_REGION) {
LOGINFO("Creating region " + name + " attached to pool " +
- attrs->getPoolName());
+ attrs.getPoolName());
auto tmp = std::make_shared<ThinClientPoolRegion>(name, this, rootRegion,
attrs, csptr, shared);
tmp->initTCR();
@@ -706,50 +697,52 @@ RegionFactory CacheImpl::createRegionFactory(RegionShortcut preDefinedRegion) {
return RegionFactory(preDefinedRegion, this);
}
-std::map<std::string, std::shared_ptr<RegionAttributes>> CacheImpl::getRegionShortcut() {
- std::map<std::string, std::shared_ptr<RegionAttributes>> preDefined;
+std::map<std::string, RegionAttributes> CacheImpl::getRegionShortcut() {
+ std::map<std::string, RegionAttributes> preDefined;
{
// PROXY
- auto regAttr_PROXY = std::make_shared<RegionAttributes>();
- regAttr_PROXY->setCachingEnabled(false);
+ auto regAttr_PROXY = RegionAttributes();
+ regAttr_PROXY.setCachingEnabled(false);
preDefined["PROXY"] = regAttr_PROXY;
}
{
// CACHING_PROXY
- auto regAttr_CACHING_PROXY = std::make_shared<RegionAttributes>();
- regAttr_CACHING_PROXY->setCachingEnabled(true);
+ auto regAttr_CACHING_PROXY = RegionAttributes();
+ regAttr_CACHING_PROXY.setCachingEnabled(true);
preDefined["CACHING_PROXY"] = regAttr_CACHING_PROXY;
}
{
// CACHING_PROXY_ENTRY_LRU
- auto regAttr_CACHING_PROXY_LRU = std::make_shared<RegionAttributes>();
- regAttr_CACHING_PROXY_LRU->setCachingEnabled(true);
- regAttr_CACHING_PROXY_LRU->setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
+ auto regAttr_CACHING_PROXY_LRU = RegionAttributes();
+ regAttr_CACHING_PROXY_LRU.setCachingEnabled(true);
+ regAttr_CACHING_PROXY_LRU.setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
preDefined["CACHING_PROXY_ENTRY_LRU"] = regAttr_CACHING_PROXY_LRU;
}
{
// LOCAL
- auto regAttr_LOCAL = std::make_shared<RegionAttributes>();
+ auto regAttr_LOCAL = RegionAttributes();
preDefined["LOCAL"] = regAttr_LOCAL;
}
{
// LOCAL_ENTRY_LRU
- auto regAttr_LOCAL_LRU = std::make_shared<RegionAttributes>();
- regAttr_LOCAL_LRU->setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
+ auto regAttr_LOCAL_LRU = RegionAttributes();
+ regAttr_LOCAL_LRU.setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
preDefined["LOCAL_ENTRY_LRU"] = regAttr_LOCAL_LRU;
}
return preDefined;
}
- std::shared_ptr<PdxTypeRegistry> CacheImpl::getPdxTypeRegistry() const {
+
+std::shared_ptr<PdxTypeRegistry> CacheImpl::getPdxTypeRegistry() const {
return m_pdxTypeRegistry;
}
- std::shared_ptr<SerializationRegistry> CacheImpl::getSerializationRegistry()
+
+std::shared_ptr<SerializationRegistry> CacheImpl::getSerializationRegistry()
const {
return m_serializationRegistry;
}
diff --git a/cppcache/src/CacheImpl.hpp b/cppcache/src/CacheImpl.hpp
index c720c00..3ed5834 100644
--- a/cppcache/src/CacheImpl.hpp
+++ b/cppcache/src/CacheImpl.hpp
@@ -170,7 +170,7 @@ class _GEODE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
* @throws UnknownException otherwise
*/
void createRegion(std::string name,
- const std::shared_ptr<RegionAttributes>& aRegionAttributes,
+ RegionAttributes aRegionAttributes,
std::shared_ptr<Region>& regionPtr);
void getRegion(const std::string& path, std::shared_ptr<Region>& rptr);
@@ -240,7 +240,7 @@ class _GEODE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
std::shared_ptr<RegionInternal> createRegion_internal(
const std::string& name,
const std::shared_ptr<RegionInternal>& rootRegion,
- const std::shared_ptr<RegionAttributes>& attrs,
+ const RegionAttributes& attrs,
const std::shared_ptr<CacheStatistics>& csptr, bool shared);
/**
@@ -270,7 +270,7 @@ class _GEODE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
bool getPdxReadSerialized() { return m_readPdxSerialized; }
bool isCacheDestroyPending() const;
- static std::map<std::string, std::shared_ptr<RegionAttributes>> getRegionShortcut();
+ static std::map<std::string, RegionAttributes> getRegionShortcut();
std::shared_ptr<PdxTypeRegistry> getPdxTypeRegistry() const;
@@ -315,13 +315,13 @@ class _GEODE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
THINCLIENT_POOL_REGION
};
- RegionKind getRegionKind(const std::shared_ptr<RegionAttributes>& rattrs) const;
+ RegionKind getRegionKind(RegionAttributes rattrs) const;
void sendNotificationCloseMsgs();
void validateRegionAttributes(
const std::string& name,
- const std::shared_ptr<RegionAttributes>& attrs) const;
+ const RegionAttributes attrs) const;
inline void getSubRegions(MapOfRegionWithLock& srm) {
MapOfRegionGuard guard(m_regions->mutex());
diff --git a/cppcache/src/CacheXmlParser.cpp b/cppcache/src/CacheXmlParser.cpp
index aa7f7cc..928e448 100644
--- a/cppcache/src/CacheXmlParser.cpp
+++ b/cppcache/src/CacheXmlParser.cpp
@@ -597,7 +597,8 @@ void CacheXmlParser::startPool(const xmlChar** atts) {
"A pool cannot be created without a name";
throw CacheXmlException(s.c_str());
}
- auto factory = std::make_shared<PoolFactory>(m_cache->getPoolManager().createFactory());
+ auto factory =
+ std::make_shared<PoolFactory>(m_cache->getPoolManager().createFactory());
const char* poolName = nullptr;
@@ -710,7 +711,7 @@ void CacheXmlParser::setPoolInfo(PoolFactory* factory, const char* name,
/**
* When a <code>region</code> element is first encountered, we
* create a {@link RegionCreation} and push it on the _stack.
- * An {@link AttributesFactory }is also created and puhed on _stack.
+ * An {@link RegionAttributesFactory }is also created and puhed on _stack.
*/
void CacheXmlParser::startRegion(const xmlChar** atts, bool isRoot) {
int attrsCount = 0;
@@ -766,14 +767,15 @@ void CacheXmlParser::startRegion(const xmlChar** atts, bool isRoot) {
_stack.push(region);
- AttributesFactory* attrsFactory = nullptr;
+ RegionAttributesFactory* regionAttributesFactory = nullptr;
if (refid == nullptr) {
- attrsFactory = new AttributesFactory();
+ regionAttributesFactory = new RegionAttributesFactory();
} else {
std::string refidStr(refid);
if (namedRegions.find(refidStr) != namedRegions.end()) {
- attrsFactory = new AttributesFactory(namedRegions[refidStr]);
+ regionAttributesFactory =
+ new RegionAttributesFactory(namedRegions[refidStr]);
} else {
std::string s =
"XML:referenced named attribute '" + refidStr + "' does not exist.";
@@ -781,8 +783,9 @@ void CacheXmlParser::startRegion(const xmlChar** atts, bool isRoot) {
}
}
- region->setAttributes(attrsFactory->createRegionAttributes());
- delete attrsFactory;
+ region->setAttributes(
+ regionAttributesFactory->create());
+ delete regionAttributesFactory;
}
void CacheXmlParser::startSubregion(const xmlChar** atts) {
@@ -796,7 +799,7 @@ void CacheXmlParser::startRootRegion(const xmlChar** atts) {
void CacheXmlParser::startRegionAttributes(const xmlChar** atts) {
bool isDistributed = false;
bool isTCR = false;
- std::shared_ptr<AttributesFactory> attrsFactory = nullptr;
+ std::shared_ptr<RegionAttributesFactory> regionAttributesFactory = nullptr;
if (atts) {
int attrsCount = 0;
while (atts[attrsCount] != nullptr) ++attrsCount;
@@ -836,14 +839,14 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) {
if (refid == nullptr) {
auto region = std::static_pointer_cast<RegionXmlCreation>(_stack.top());
- attrsFactory =
- std::make_shared<AttributesFactory>(region->getAttributes());
+ regionAttributesFactory =
+ std::make_shared<RegionAttributesFactory>(region->getAttributes());
} else {
std::string refidStr(refid);
if (namedRegions.find(refidStr) != namedRegions.end()) {
- attrsFactory =
- std::make_shared<AttributesFactory>(namedRegions[refidStr]);
+ regionAttributesFactory =
+ std::make_shared<RegionAttributesFactory>(namedRegions[refidStr]);
} else {
std::string s =
"XML:referenced named attribute '" + refidStr + "' does not exist.";
@@ -851,12 +854,12 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) {
}
}
- if (!attrsFactory) {
+ if (!regionAttributesFactory) {
throw UnknownException(
"CacheXmlParser::startRegionAttributes:Out of memeory");
}
- _stack.push(attrsFactory);
+ _stack.push(regionAttributesFactory);
for (int i = 0; (atts[i] != nullptr); i++) {
if (strcmp(ID, (char*)atts[i]) == 0 ||
@@ -887,15 +890,15 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) {
} else if (strcmp(INITIAL_CAPACITY, (char*)atts[i]) == 0) {
i++;
char* initialCapacity = (char*)atts[i];
- attrsFactory->setInitialCapacity(atoi(initialCapacity));
+ regionAttributesFactory->setInitialCapacity(atoi(initialCapacity));
} else if (strcmp(CONCURRENCY_LEVEL, (char*)atts[i]) == 0) {
i++;
char* concurrencyLevel = (char*)atts[i];
- attrsFactory->setConcurrencyLevel(atoi(concurrencyLevel));
+ regionAttributesFactory->setConcurrencyLevel(atoi(concurrencyLevel));
} else if (strcmp(LOAD_FACTOR, (char*)atts[i]) == 0) {
i++;
char* loadFactor = (char*)atts[i];
- attrsFactory->setLoadFactor(
+ regionAttributesFactory->setLoadFactor(
static_cast<float>(atof(loadFactor))); // check whether this works
} else if (strcmp(CACHING_ENABLED, (char*)atts[i]) == 0) {
bool flag = false;
@@ -915,23 +918,24 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) {
" is not a valid value for the attribute <caching-enabled>";
throw CacheXmlException(s.c_str());
}
- attrsFactory->setCachingEnabled(flag); // check whether this works
+ regionAttributesFactory->setCachingEnabled(
+ flag); // check whether this works
} else if (strcmp(LRU_ENTRIES_LIMIT, (char*)atts[i]) == 0) {
i++;
char* lruentriesLimit = (char*)atts[i];
int lruentriesLimitInt = atoi(lruentriesLimit);
uint32_t temp = static_cast<uint32_t>(lruentriesLimitInt);
- attrsFactory->setLruEntriesLimit(temp);
+ regionAttributesFactory->setLruEntriesLimit(temp);
} else if (strcmp(DISK_POLICY, (char*)atts[i]) == 0) {
i++;
char* diskPolicy = (char*)atts[i];
if (strcmp(OVERFLOWS, diskPolicy) == 0) {
- attrsFactory->setDiskPolicy(
+ regionAttributesFactory->setDiskPolicy(
apache::geode::client::DiskPolicyType::OVERFLOWS);
} else if (strcmp(PERSIST, diskPolicy) == 0) {
throw IllegalStateException(" persistence feature is not supported");
} else if (strcmp(NONE, diskPolicy) == 0) {
- attrsFactory->setDiskPolicy(
+ regionAttributesFactory->setDiskPolicy(
apache::geode::client::DiskPolicyType::NONE);
} else {
char* name = (char*)atts[i];
@@ -956,7 +960,7 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) {
} else if (strcmp(POOL_NAME, (char*)atts[i]) == 0) {
i++;
char* poolName = (char*)atts[i];
- attrsFactory->setPoolName(poolName);
+ regionAttributesFactory->setPoolName(poolName);
isTCR = true;
} else if (strcmp(CLONING_ENABLED, (char*)atts[i]) == 0) {
i++;
@@ -978,7 +982,7 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) {
throw CacheXmlException(s.c_str());
}
- attrsFactory->setCloningEnabled(flag);
+ regionAttributesFactory->setCloningEnabled(flag);
isTCR = true;
} else if (strcmp(CONCURRENCY_CHECKS_ENABLED, (char*)atts[i]) == 0) {
bool flag = false;
@@ -998,14 +1002,15 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) {
"<concurrency-checks-enabled>";
throw CacheXmlException(s.c_str());
}
- attrsFactory->setConcurrencyChecksEnabled(flag);
+ regionAttributesFactory->setConcurrencyChecksEnabled(flag);
}
} // for loop
} // atts is nullptr
else {
auto region = std::static_pointer_cast<RegionXmlCreation>(_stack.top());
- attrsFactory = std::make_shared<AttributesFactory>(region->getAttributes());
- _stack.push(attrsFactory);
+ regionAttributesFactory =
+ std::make_shared<RegionAttributesFactory>(region->getAttributes());
+ _stack.push(regionAttributesFactory);
}
if (isDistributed && isTCR) {
@@ -1016,15 +1021,15 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) {
}
void CacheXmlParser::endRegionAttributes() {
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
_stack.pop();
- if (!attrsFactory) {
+ if (!regionAttributesFactory) {
throw UnknownException(
- "CacheXmlParser::endRegion:AttributesFactory is null");
+ "CacheXmlParser::endRegion:RegionAttributesFactory is null");
}
- std::shared_ptr<RegionAttributes> regionAttributesPtr =
- attrsFactory->createRegionAttributes();
+ auto regionAttributes = regionAttributesFactory->create();
auto regionPtr = std::static_pointer_cast<RegionXmlCreation>(_stack.top());
if (!regionPtr) {
@@ -1033,10 +1038,10 @@ void CacheXmlParser::endRegionAttributes() {
std::string id = regionPtr->getAttrId();
if (id != "") {
- namedRegions[id] = regionAttributesPtr;
+ namedRegions[id] = regionAttributes;
}
- regionPtr->setAttributes(regionAttributesPtr);
+ regionPtr->setAttributes(regionAttributes);
}
/**
@@ -1335,8 +1340,9 @@ void CacheXmlParser::startCacheLoader(const xmlChar** atts) {
throw CacheXmlException(ex.what());
}
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
- attrsFactory->setCacheLoader(libraryName, libraryFunctionName);
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
+ regionAttributesFactory->setCacheLoader(libraryName, libraryFunctionName);
}
void CacheXmlParser::startCacheListener(const xmlChar** atts) {
@@ -1402,8 +1408,9 @@ void CacheXmlParser::startCacheListener(const xmlChar** atts) {
throw CacheXmlException(ex.what());
}
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
- attrsFactory->setCacheListener(libraryName, libraryFunctionName);
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
+ regionAttributesFactory->setCacheListener(libraryName, libraryFunctionName);
}
void CacheXmlParser::startPartitionResolver(const xmlChar** atts) {
@@ -1472,8 +1479,10 @@ void CacheXmlParser::startPartitionResolver(const xmlChar** atts) {
throw CacheXmlException(ex.what());
}
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
- attrsFactory->setPartitionResolver(libraryName, libraryFunctionName);
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
+ regionAttributesFactory->setPartitionResolver(libraryName,
+ libraryFunctionName);
}
void CacheXmlParser::startCacheWriter(const xmlChar** atts) {
@@ -1540,8 +1549,9 @@ void CacheXmlParser::startCacheWriter(const xmlChar** atts) {
throw CacheXmlException(ex.what());
}
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
- attrsFactory->setCacheWriter(libraryName, libraryFunctionName);
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
+ regionAttributesFactory->setCacheWriter(libraryName, libraryFunctionName);
}
/**
@@ -1585,7 +1595,7 @@ void CacheXmlParser::endCache() {}
/**
* When a <code>region-time-to-live</code> element is finished, the
* {@link ExpirationAttributes} are on top of the _stack followed by
- * the {@link AttributesFactory} to which the expiration
+ * the {@link RegionAttributesFactory} to which the expiration
* attributes are assigned.
*/
void CacheXmlParser::endRegionTimeToLive() {
@@ -1600,16 +1610,17 @@ void CacheXmlParser::endRegionTimeToLive() {
std::static_pointer_cast<ExpirationAttributes>(_stack.top());
_stack.pop();
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
- attrsFactory->setRegionTimeToLive(expireAttr->getAction(),
- expireAttr->getTimeout());
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
+ regionAttributesFactory->setRegionTimeToLive(expireAttr->getAction(),
+ expireAttr->getTimeout());
m_flagExpirationAttribute = false;
}
/**
* When a <code>region-idle-time</code> element is finished, the
* {@link ExpirationAttributes} are on top of the _stack followed by
- * the {@link AttributesFactory} to which the expiration
+ * the {@link RegionAttributesFactory} to which the expiration
* attributes are assigned.
*/
void CacheXmlParser::endRegionIdleTime() {
@@ -1621,17 +1632,18 @@ void CacheXmlParser::endRegionIdleTime() {
auto expireAttr =
std::static_pointer_cast<ExpirationAttributes>(_stack.top());
_stack.pop();
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
- attrsFactory->setRegionIdleTimeout(expireAttr->getAction(),
- expireAttr->getTimeout());
+ regionAttributesFactory->setRegionIdleTimeout(expireAttr->getAction(),
+ expireAttr->getTimeout());
m_flagExpirationAttribute = false;
}
/**
* When a <code>entry-time-to-live</code> element is finished, the
* {@link ExpirationAttributes} are on top of the _stack followed by
- * the {@link AttributesFactory} to which the expiration
+ * the {@link RegionAttributesFactory} to which the expiration
* attributes are assigned.
*/
void CacheXmlParser::endEntryTimeToLive() {
@@ -1644,17 +1656,18 @@ void CacheXmlParser::endEntryTimeToLive() {
auto expireAttr =
std::static_pointer_cast<ExpirationAttributes>(_stack.top());
_stack.pop();
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
- attrsFactory->setEntryTimeToLive(expireAttr->getAction(),
- expireAttr->getTimeout());
+ regionAttributesFactory->setEntryTimeToLive(expireAttr->getAction(),
+ expireAttr->getTimeout());
m_flagExpirationAttribute = false;
}
/**
* When a <code>entry-idle-time</code> element is finished, the
* {@link ExpirationAttributes} are on top of the _stack followed by
- * the {@link AttributesFactory} to which the expiration
+ * the {@link RegionAttributesFactory} to which the expiration
* attributes are assigned.
*/
void CacheXmlParser::endEntryIdleTime() {
@@ -1666,10 +1679,11 @@ void CacheXmlParser::endEntryIdleTime() {
auto expireAttr =
std::static_pointer_cast<ExpirationAttributes>(_stack.top());
_stack.pop();
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
// TODO GEODE-3136: consider string parser here.
- attrsFactory->setEntryIdleTimeout(expireAttr->getAction(),
- expireAttr->getTimeout());
+ regionAttributesFactory->setEntryIdleTimeout(expireAttr->getAction(),
+ expireAttr->getTimeout());
m_flagExpirationAttribute = false;
}
@@ -1684,14 +1698,15 @@ void CacheXmlParser::endPersistenceManager() {
std::shared_ptr<std::string> libraryName =
std::static_pointer_cast<std::string>(_stack.top());
_stack.pop();
- auto attrsFactory = std::static_pointer_cast<AttributesFactory>(_stack.top());
+ auto regionAttributesFactory =
+ std::static_pointer_cast<RegionAttributesFactory>(_stack.top());
if (m_config != nullptr) {
- attrsFactory->setPersistenceManager(libraryName->c_str(),
- libraryFunctionName->c_str(), m_config);
+ regionAttributesFactory->setPersistenceManager(
+ libraryName->c_str(), libraryFunctionName->c_str(), m_config);
m_config = nullptr;
} else {
- attrsFactory->setPersistenceManager(libraryName->c_str(),
- libraryFunctionName->c_str());
+ regionAttributesFactory->setPersistenceManager(
+ libraryName->c_str(), libraryFunctionName->c_str());
}
}
diff --git a/cppcache/src/CacheXmlParser.hpp b/cppcache/src/CacheXmlParser.hpp
index ff251df..fc0d2ea 100644
--- a/cppcache/src/CacheXmlParser.hpp
+++ b/cppcache/src/CacheXmlParser.hpp
@@ -66,7 +66,7 @@ class _GEODE_EXPORT CacheXmlParser : public CacheXml {
bool m_flagIllegalStateException;
bool m_flagAnyOtherException;
bool m_flagExpirationAttribute;
- std::map<std::string, std::shared_ptr<RegionAttributes>> namedRegions;
+ std::map<std::string, RegionAttributes> namedRegions;
std::shared_ptr<PoolFactory> m_poolFactory;
Cache* m_cache;
diff --git a/cppcache/src/ClientMetadataService.cpp b/cppcache/src/ClientMetadataService.cpp
index 4a34204..ce4d35d 100644
--- a/cppcache/src/ClientMetadataService.cpp
+++ b/cppcache/src/ClientMetadataService.cpp
@@ -248,7 +248,7 @@ void ClientMetadataService::getBucketServerLocation(
return;
}
std::shared_ptr<CacheableKey> resolvekey;
- const auto& resolver = region->getAttributes()->getPartitionResolver();
+ const auto& resolver = region->getAttributes().getPartitionResolver();
EntryEvent event(region, key, value, nullptr, aCallbackArgument, false);
int bucketId = 0;
@@ -377,7 +377,7 @@ ClientMetadataService::getServerToFilterMap(
for (const auto& key : keys) {
LOGDEBUG("cmds = %s", key->toString().c_str());
- const auto resolver = region->getAttributes()->getPartitionResolver();
+ const auto resolver = region->getAttributes().getPartitionResolver();
std::shared_ptr<CacheableKey> resolveKey;
if (resolver == nullptr) {
@@ -490,7 +490,7 @@ ClientMetadataService::groupByBucketOnClientSide(
auto bucketToKeysMap = std::make_shared<BucketToKeysMap>();
for (const auto& k : *keySet) {
const auto key = std::static_pointer_cast<CacheableKey>(k);
- const auto resolver = region->getAttributes()->getPartitionResolver();
+ const auto resolver = region->getAttributes().getPartitionResolver();
std::shared_ptr<CacheableKey> resolvekey;
EntryEvent event(region, key, nullptr, nullptr, nullptr, false);
int bucketId = -1;
diff --git a/cppcache/src/EntriesMapFactory.cpp b/cppcache/src/EntriesMapFactory.cpp
index e355eef..4c22c0a 100644
--- a/cppcache/src/EntriesMapFactory.cpp
+++ b/cppcache/src/EntriesMapFactory.cpp
@@ -33,15 +33,15 @@ using namespace apache::geode::client;
* support shared regions directly.
*/
EntriesMap* EntriesMapFactory::createMap(
- RegionInternal* region, const std::shared_ptr<RegionAttributes>& attrs) {
+ RegionInternal* region, RegionAttributes attrs) {
EntriesMap* result = nullptr;
- uint32_t initialCapacity = attrs->getInitialCapacity();
- uint8_t concurrency = attrs->getConcurrencyLevel();
+ uint32_t initialCapacity = attrs.getInitialCapacity();
+ uint8_t concurrency = attrs.getConcurrencyLevel();
/** @TODO will need a statistics entry factory... */
- uint32_t lruLimit = attrs->getLruEntriesLimit();
- const auto& ttl = attrs->getEntryTimeToLive();
- const auto& idle = attrs->getEntryIdleTimeout();
- bool concurrencyChecksEnabled = attrs->getConcurrencyChecksEnabled();
+ uint32_t lruLimit = attrs.getLruEntriesLimit();
+ const auto& ttl = attrs.getEntryTimeToLive();
+ const auto& idle = attrs.getEntryIdleTimeout();
+ bool concurrencyChecksEnabled = attrs.getConcurrencyChecksEnabled();
bool heapLRUEnabled = false;
auto cache = region->getCacheImpl();
@@ -50,7 +50,7 @@ EntriesMap* EntriesMapFactory::createMap(
if ((lruLimit != 0) || (prop.heapLRULimitEnabled())) { // create LRU map...
LRUAction::Action lruEvictionAction;
- DiskPolicyType dpType = attrs->getDiskPolicy();
+ DiskPolicyType dpType = attrs.getDiskPolicy();
if (dpType == DiskPolicyType::OVERFLOWS) {
lruEvictionAction = LRUAction::OVERFLOW_TO_DISK;
} else if ((dpType == DiskPolicyType::NONE) ||
diff --git a/cppcache/src/EntriesMapFactory.hpp b/cppcache/src/EntriesMapFactory.hpp
index 56bca31..cea39ca 100644
--- a/cppcache/src/EntriesMapFactory.hpp
+++ b/cppcache/src/EntriesMapFactory.hpp
@@ -34,7 +34,7 @@ class _GEODE_EXPORT EntriesMapFactory {
* type of entries map.
*/
static EntriesMap* createMap(RegionInternal* region,
- const std::shared_ptr<RegionAttributes>& attrs);
+ RegionAttributes attrs);
private:
/** @brief not to be instantiated. */
diff --git a/cppcache/src/EntryExpiryHandler.cpp b/cppcache/src/EntryExpiryHandler.cpp
index 54f270e..74c0626 100644
--- a/cppcache/src/EntryExpiryHandler.cpp
+++ b/cppcache/src/EntryExpiryHandler.cpp
@@ -48,7 +48,7 @@ int EntryExpiryHandler::handle_timeout(const ACE_Time_Value& current_time,
auto curr_time = std::chrono::system_clock::from_time_t(current_time.sec());
auto lastTimeForExp = expProps.getLastAccessTime();
- if (m_regionPtr->getAttributes()->getEntryTimeToLive() >
+ if (m_regionPtr->getAttributes().getEntryTimeToLive() >
std::chrono::seconds::zero()) {
lastTimeForExp = expProps.getLastModifiedTime();
}
diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp
index c8f7572..beebd22 100644
--- a/cppcache/src/LocalRegion.cpp
+++ b/cppcache/src/LocalRegion.cpp
@@ -43,7 +43,7 @@ namespace client {
LocalRegion::LocalRegion(const std::string& name, CacheImpl* cache,
const std::shared_ptr<RegionInternal>& rPtr,
- const std::shared_ptr<RegionAttributes>& attributes,
+ RegionAttributes attributes,
const std::shared_ptr<CacheStatistics>& stats,
bool shared, bool enableTimeStatistics)
: RegionInternal(cache->getCache(), attributes),
@@ -68,19 +68,19 @@ LocalRegion::LocalRegion(const std::string& name, CacheImpl* cache,
(m_fullPath = "/") += m_name;
}
// create entries map based on RegionAttributes...
- if (attributes->getCachingEnabled()) {
+ if (attributes.getCachingEnabled()) {
m_entries = EntriesMapFactory::createMap(this, m_regionAttributes);
}
// Initialize callbacks
std::shared_ptr<CacheListener> clptr;
std::shared_ptr<CacheWriter> cwptr;
- clptr = m_regionAttributes->getCacheListener();
+ clptr = m_regionAttributes.getCacheListener();
m_listener = clptr;
- cwptr = m_regionAttributes->getCacheWriter();
+ cwptr = m_regionAttributes.getCacheWriter();
m_writer = cwptr;
std::shared_ptr<CacheLoader> cldptr;
- cldptr = m_regionAttributes->getCacheLoader();
+ cldptr = m_regionAttributes.getCacheLoader();
m_loader = cldptr;
if (m_parentRegion != nullptr) {
@@ -94,7 +94,7 @@ LocalRegion::LocalRegion(const std::string& name, CacheImpl* cache,
->getStatisticsFactory(),
m_fullPath);
auto p =
- cache->getCache()->getPoolManager().find(getAttributes()->getPoolName());
+ cache->getCache()->getPoolManager().find(getAttributes().getPoolName());
// m_attachedPool = p;
setPool(p);
}
@@ -168,7 +168,7 @@ void LocalRegion::localDestroyRegion(const std::shared_ptr<Serializable>& aCallb
void LocalRegion::tombstoneOperationNoThrow(
const std::shared_ptr<CacheableHashMap>& tombstoneVersions,
const std::shared_ptr<CacheableHashSet>& tombstoneKeys) {
- bool cachingEnabled = m_regionAttributes->getCachingEnabled();
+ bool cachingEnabled = m_regionAttributes.getCachingEnabled();
if (!cachingEnabled) return;
@@ -223,9 +223,10 @@ std::shared_ptr<Region> LocalRegion::getSubregion(const std::string& path) {
}
return rptr;
}
+
std::shared_ptr<Region> LocalRegion::createSubregion(
const std::string& subregionName,
- const std::shared_ptr<RegionAttributes>& aRegionAttributes) {
+ RegionAttributes regionAttributes) {
CHECK_DESTROY_PENDING(TryWriteGuard, LocalRegion::createSubregion);
{
std::string namestr = subregionName;
@@ -246,20 +247,20 @@ std::shared_ptr<Region> LocalRegion::createSubregion(
auto rPtr = m_cacheImpl->createRegion_internal(
subregionName,
std::static_pointer_cast<RegionInternal>(shared_from_this()),
- aRegionAttributes, csptr, false);
+ regionAttributes, csptr, false);
region_ptr = rPtr;
if (!rPtr) {
throw OutOfMemoryException("createSubregion: failed to create region");
}
// Instantiate a PersistenceManager object if DiskPolicy is overflow
- if (aRegionAttributes->getDiskPolicy() == DiskPolicyType::OVERFLOWS) {
- auto pmPtr = aRegionAttributes->getPersistenceManager();
+ if (regionAttributes.getDiskPolicy() == DiskPolicyType::OVERFLOWS) {
+ auto pmPtr = regionAttributes.getPersistenceManager();
if (pmPtr == nullptr) {
throw NullPointerException(
"PersistenceManager could not be instantiated");
}
- auto props = aRegionAttributes->getPersistenceProperties();
+ auto props = regionAttributes.getPersistenceProperties();
pmPtr->init(std::shared_ptr<Region>(rPtr), props);
rPtr->setPersistenceManager(pmPtr);
}
@@ -301,7 +302,7 @@ void LocalRegion::getEntry(const std::shared_ptr<CacheableKey>& key, std::shared
std::shared_ptr<MapEntryImpl> mePtr;
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getEntry);
- if (m_regionAttributes->getCachingEnabled()) {
+ if (m_regionAttributes.getCachingEnabled()) {
m_entries->getEntry(key, mePtr, valuePtr);
}
}
@@ -512,7 +513,7 @@ std::vector<std::shared_ptr<Cacheable>> LocalRegion::values() {
std::vector<std::shared_ptr<Cacheable>> values;
- if (m_regionAttributes->getCachingEnabled()) {
+ if (m_regionAttributes.getCachingEnabled()) {
// invalidToken should not be added by the MapSegments.
m_entries->getValues(values);
}
@@ -525,7 +526,7 @@ std::vector<std::shared_ptr<RegionEntry>> LocalRegion::entries(bool recursive) {
std::vector<std::shared_ptr<RegionEntry>> entries;
- if (m_regionAttributes->getCachingEnabled()) {
+ if (m_regionAttributes.getCachingEnabled()) {
entries_internal(entries, recursive);
}
@@ -563,7 +564,7 @@ HashMapOfCacheable LocalRegion::getAll_internal(
uint32_t LocalRegion::size_remote() {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::size);
- if (m_regionAttributes->getCachingEnabled()) {
+ if (m_regionAttributes.getCachingEnabled()) {
return m_entries->size();
}
return 0;
@@ -593,7 +594,7 @@ CacheImpl* LocalRegion::getCacheImpl() const {
bool LocalRegion::containsValueForKey_remote(
const std::shared_ptr<CacheableKey>& keyPtr) const {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::containsValueForKey);
- if (!m_regionAttributes->getCachingEnabled()) {
+ if (!m_regionAttributes.getCachingEnabled()) {
return false;
}
std::shared_ptr<Cacheable> valuePtr;
@@ -747,7 +748,7 @@ void LocalRegion::release(bool invokeCallbacks) {
m_persistenceManager->close();
m_persistenceManager = nullptr;
}
- if (m_entries != nullptr && m_regionAttributes->getCachingEnabled()) {
+ if (m_entries != nullptr && m_regionAttributes.getCachingEnabled()) {
m_entries->close();
}
LOGFINE("LocalRegion::release done for region %s", m_fullPath.c_str());
@@ -769,7 +770,7 @@ bool LocalRegion::containsKey_internal(
if (keyPtr == nullptr) {
throw IllegalArgumentException("Region::containsKey: key is null");
}
- if (!m_regionAttributes->getCachingEnabled()) {
+ if (!m_regionAttributes.getCachingEnabled()) {
return false;
}
return m_entries->containsKey(keyPtr);
@@ -843,7 +844,7 @@ GfErrType LocalRegion::getNoThrow(
int updateCount = -1;
bool isLoaderInvoked = false;
bool isLocal = false;
- bool cachingEnabled = m_regionAttributes->getCachingEnabled();
+ bool cachingEnabled = m_regionAttributes.getCachingEnabled();
std::shared_ptr<Cacheable> localValue = nullptr;
if (cachingEnabled) {
isLocal = m_entries->get(keyPtr, value, me);
@@ -857,7 +858,7 @@ GfErrType LocalRegion::getNoThrow(
localValue = value;
value = nullptr;
// start tracking the entry
- if (!m_regionAttributes->getConcurrencyChecksEnabled()) {
+ if (!m_regionAttributes.getConcurrencyChecksEnabled()) {
updateCount =
m_entries->addTrackerForEntry(keyPtr, value, true, false, false);
LOGDEBUG(
@@ -881,7 +882,7 @@ GfErrType LocalRegion::getNoThrow(
: m_key(key), m_updateCount(updateCount), m_region(region) {}
~RemoveTracking() {
if (m_updateCount >= 0 &&
- !m_region.getAttributes()->getConcurrencyChecksEnabled()) {
+ !m_region.getAttributes().getConcurrencyChecksEnabled()) {
m_region.m_entries->removeTrackerForEntry(m_key);
}
}
@@ -1010,7 +1011,7 @@ GfErrType LocalRegion::getAllNoThrow(
// keys not in cache with their tracking numbers to be gotten using
// a remote call
std::vector<std::shared_ptr<CacheableKey>> serverKeys;
- bool cachingEnabled = m_regionAttributes->getCachingEnabled();
+ bool cachingEnabled = m_regionAttributes.getCachingEnabled();
bool regionAccessed = false;
auto& cachePerfStats = m_cacheImpl->getCachePerfStats();
@@ -1357,7 +1358,7 @@ class RemoveActions {
// propagate the remove to remote server, if any
std::shared_ptr<Cacheable> valuePtr;
GfErrType err = GF_NOERR;
- if (!allowNULLValue && m_region.getAttributes()->getCachingEnabled()) {
+ if (!allowNULLValue && m_region.getAttributes().getCachingEnabled()) {
m_region.getEntry(key, valuePtr);
std::unique_ptr<DataOutput> out1 =
m_region.getCacheImpl()->getCache()->createDataOutput();
@@ -1440,7 +1441,7 @@ class RemoveActions {
: GF_ENOENT;
if (updateCount >= 0 &&
!m_region.getAttributes()
- ->getConcurrencyChecksEnabled()) { // This means server has
+ .getConcurrencyChecksEnabled()) { // This means server has
// deleted an entry &
// same entry has been
// destroyed locally
@@ -1616,7 +1617,7 @@ GfErrType LocalRegion::updateNoThrow(
return err;
}
- bool cachingEnabled = m_regionAttributes->getCachingEnabled();
+ bool cachingEnabled = m_regionAttributes.getCachingEnabled();
std::shared_ptr<MapEntryImpl> entry;
// do not invoke the writer in case of notification/eviction
@@ -1642,7 +1643,7 @@ GfErrType LocalRegion::updateNoThrow(
// by a notification or another thread, so we do not do the local update
if (!eventFlags.isLocal() && !eventFlags.isNotification()) {
if (cachingEnabled && updateCount < 0 &&
- !m_regionAttributes->getConcurrencyChecksEnabled()) {
+ !m_regionAttributes.getConcurrencyChecksEnabled()) {
// add a tracking for the entry
if ((updateCount = m_entries->addTrackerForEntry(
key, oldValue, TAction::s_addIfAbsent, TAction::s_failIfPresent,
@@ -1657,7 +1658,7 @@ GfErrType LocalRegion::updateNoThrow(
err = action.remoteUpdate(key, value, aCallbackArgument, versionTag);
if (err != GF_NOERR) {
if (updateCount >= 0 &&
- !m_regionAttributes->getConcurrencyChecksEnabled()) {
+ !m_regionAttributes.getConcurrencyChecksEnabled()) {
m_entries->removeTrackerForEntry(key);
}
return err;
@@ -1712,7 +1713,7 @@ GfErrType LocalRegion::updateNoThrow(
} else { // if (getProcessedMarker())
action.getCallbackOldValue(cachingEnabled, key, entry, oldValue);
if (updateCount >= 0 &&
- !m_regionAttributes->getConcurrencyChecksEnabled()) {
+ !m_regionAttributes.getConcurrencyChecksEnabled()) {
m_entries->removeTrackerForEntry(key);
}
}
@@ -1741,7 +1742,7 @@ GfErrType LocalRegion::updateNoThrowTX(
CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
TAction action(*this);
- bool cachingEnabled = m_regionAttributes->getCachingEnabled();
+ bool cachingEnabled = m_regionAttributes.getCachingEnabled();
std::shared_ptr<MapEntryImpl> entry;
if (!eventFlags.isNotification() || getProcessedMarker()) {
@@ -1769,7 +1770,7 @@ GfErrType LocalRegion::updateNoThrowTX(
} else { // if (getProcessedMarker())
action.getCallbackOldValue(cachingEnabled, key, entry, oldValue);
if (updateCount >= 0 &&
- !m_regionAttributes->getConcurrencyChecksEnabled()) {
+ !m_regionAttributes.getConcurrencyChecksEnabled()) {
m_entries->removeTrackerForEntry(key);
}
}
@@ -1899,7 +1900,7 @@ GfErrType LocalRegion::putAllNoThrow(
return err;
}
- bool cachingEnabled = m_regionAttributes->getCachingEnabled();
+ bool cachingEnabled = m_regionAttributes.getCachingEnabled();
MapOfOldValue oldValueMap;
// remove tracking for the entries befor exiting the function
@@ -1912,7 +1913,7 @@ GfErrType LocalRegion::putAllNoThrow(
RemoveTracking(const MapOfOldValue& oldValueMap, LocalRegion& region)
: m_oldValueMap(oldValueMap), m_region(region) {}
~RemoveTracking() {
- if (!m_region.getAttributes()->getConcurrencyChecksEnabled()) {
+ if (!m_region.getAttributes().getConcurrencyChecksEnabled()) {
// need to remove the tracking added to the entries at the end
for (MapOfOldValue::const_iterator iter = m_oldValueMap.begin();
iter != m_oldValueMap.end(); ++iter) {
@@ -1929,7 +1930,7 @@ GfErrType LocalRegion::putAllNoThrow(
for (const auto& iter : map) {
const auto& key = iter.first;
if (cachingEnabled &&
- !m_regionAttributes->getConcurrencyChecksEnabled()) {
+ !m_regionAttributes.getConcurrencyChecksEnabled()) {
int updateCount =
m_entries->addTrackerForEntry(key, oldValue, true, false, true);
oldValueMap.insert(
@@ -2072,7 +2073,7 @@ GfErrType LocalRegion::removeAllNoThrow(
}
// 3.add tracking
- bool cachingEnabled = m_regionAttributes->getCachingEnabled();
+ bool cachingEnabled = m_regionAttributes.getCachingEnabled();
// 4. do remote removeAll
err =
@@ -2153,7 +2154,7 @@ void LocalRegion::localClear(
GfErrType LocalRegion::localClearNoThrow(
const std::shared_ptr<Serializable>& aCallbackArgument,
const CacheEventFlags eventFlags) {
- bool cachingEnabled = m_regionAttributes->getCachingEnabled();
+ bool cachingEnabled = m_regionAttributes.getCachingEnabled();
/*Update the stats for clear*/
m_regionStats->incClears();
GfErrType err = GF_NOERR;
@@ -2183,7 +2184,7 @@ GfErrType LocalRegion::invalidateLocal(
GfErrType err = GF_NOERR;
- bool cachingEnabled = m_regionAttributes->getCachingEnabled();
+ bool cachingEnabled = m_regionAttributes.getCachingEnabled();
std::shared_ptr<Cacheable> oldValue;
std::shared_ptr<MapEntryImpl> me;
@@ -2245,7 +2246,7 @@ GfErrType LocalRegion::invalidateRegionNoThrow(
CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
GfErrType err = GF_NOERR;
- if (m_regionAttributes->getCachingEnabled()) {
+ if (m_regionAttributes.getCachingEnabled()) {
std::vector<std::shared_ptr<CacheableKey>> v = keys_internal();
const auto size = v.size();
std::shared_ptr<MapEntryImpl> me;
@@ -2388,7 +2389,7 @@ GfErrType LocalRegion::destroyRegionNoThrow(
AFTER_REGION_DESTROY);
release(true);
- if (m_regionAttributes->getCachingEnabled()) {
+ if (m_regionAttributes.getCachingEnabled()) {
_GEODE_SAFE_DELETE(m_entries);
}
GF_D_ASSERT(m_destroyPending);
@@ -2486,7 +2487,7 @@ GfErrType LocalRegion::putLocal(const std::string& name, bool isCreate,
std::vector<std::shared_ptr<CacheableKey>> LocalRegion::keys_internal() {
std::vector<std::shared_ptr<CacheableKey>> keys;
- if (m_regionAttributes->getCachingEnabled()) {
+ if (m_regionAttributes.getCachingEnabled()) {
m_entries->getKeys(keys);
}
@@ -2788,14 +2789,14 @@ uint32_t LocalRegion::adjustLruEntriesLimit(uint32_t limit) {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::adjustLruEntriesLimit);
auto attrs = m_regionAttributes;
- if (!attrs->getCachingEnabled()) return 0;
- bool hadlru = (attrs->getLruEntriesLimit() != 0);
+ if (!attrs.getCachingEnabled()) return 0;
+ bool hadlru = (attrs.getLruEntriesLimit() != 0);
bool needslru = (limit != 0);
if (hadlru != needslru) {
throw IllegalStateException(
"Cannot disable or enable LRU, can only adjust limit.");
}
- uint32_t oldValue = attrs->getLruEntriesLimit();
+ uint32_t oldValue = attrs.getLruEntriesLimit();
setLruEntriesLimit(limit);
if (needslru) {
// checked in AttributesMutator already to assert that LRU was enabled..
@@ -2894,7 +2895,7 @@ bool LocalRegion::isStatisticsEnabled() {
}
bool LocalRegion::useModifiedTimeForRegionExpiry() {
- const auto& region_ttl = m_regionAttributes->getRegionTimeToLive();
+ const auto& region_ttl = m_regionAttributes.getRegionTimeToLive();
if (region_ttl > std::chrono::seconds::zero()) {
return true;
} else {
@@ -2903,7 +2904,7 @@ bool LocalRegion::useModifiedTimeForRegionExpiry() {
}
bool LocalRegion::useModifiedTimeForEntryExpiry() {
- if (m_regionAttributes->getEntryTimeToLive() > std::chrono::seconds::zero()) {
+ if (m_regionAttributes.getEntryTimeToLive() > std::chrono::seconds::zero()) {
return true;
} else {
return false;
@@ -2911,8 +2912,8 @@ bool LocalRegion::useModifiedTimeForEntryExpiry() {
}
bool LocalRegion::isEntryIdletimeEnabled() {
- if (m_regionAttributes->getCachingEnabled() &&
- m_regionAttributes->getEntryIdleTimeout() >
+ if (m_regionAttributes.getCachingEnabled() &&
+ m_regionAttributes.getEntryIdleTimeout() >
std::chrono::seconds::zero()) {
return true;
} else {
@@ -2921,25 +2922,25 @@ bool LocalRegion::isEntryIdletimeEnabled() {
}
ExpirationAction LocalRegion::getEntryExpirationAction() const {
- if (m_regionAttributes->getEntryTimeToLive() > std::chrono::seconds::zero()) {
- return m_regionAttributes->getEntryTimeToLiveAction();
+ if (m_regionAttributes.getEntryTimeToLive() > std::chrono::seconds::zero()) {
+ return m_regionAttributes.getEntryTimeToLiveAction();
} else {
- return m_regionAttributes->getEntryIdleTimeoutAction();
+ return m_regionAttributes.getEntryIdleTimeoutAction();
}
}
ExpirationAction LocalRegion::getRegionExpiryAction() const {
- const auto& region_ttl = m_regionAttributes->getRegionTimeToLive();
+ const auto& region_ttl = m_regionAttributes.getRegionTimeToLive();
if (region_ttl > std::chrono::seconds::zero()) {
- return m_regionAttributes->getRegionTimeToLiveAction();
+ return m_regionAttributes.getRegionTimeToLiveAction();
} else {
- return m_regionAttributes->getRegionIdleTimeoutAction();
+ return m_regionAttributes.getRegionIdleTimeoutAction();
}
}
std::chrono::seconds LocalRegion::getRegionExpiryDuration() const {
- const auto& region_ttl = m_regionAttributes->getRegionTimeToLive();
- const auto& region_idle = m_regionAttributes->getRegionIdleTimeout();
+ const auto& region_ttl = m_regionAttributes.getRegionTimeToLive();
+ const auto& region_idle = m_regionAttributes.getRegionIdleTimeout();
if (region_ttl > std::chrono::seconds::zero()) {
return region_ttl;
} else {
@@ -2948,8 +2949,8 @@ std::chrono::seconds LocalRegion::getRegionExpiryDuration() const {
}
std::chrono::seconds LocalRegion::getEntryExpiryDuration() const {
- const auto& entry_ttl = m_regionAttributes->getEntryTimeToLive();
- const auto& entry_idle = m_regionAttributes->getEntryIdleTimeout();
+ const auto& entry_ttl = m_regionAttributes.getEntryTimeToLive();
+ const auto& entry_idle = m_regionAttributes.getEntryIdleTimeout();
if (entry_ttl > std::chrono::seconds::zero()) {
return entry_ttl;
@@ -3061,7 +3062,7 @@ void LocalRegion::adjustCacheListener(const std::string& lib,
const std::string& func) {
WriteGuard guard(m_rwLock);
setCacheListener(lib, func);
- m_listener = m_regionAttributes->getCacheListener();
+ m_listener = m_regionAttributes.getCacheListener();
}
void LocalRegion::adjustCacheLoader(
@@ -3075,7 +3076,7 @@ void LocalRegion::adjustCacheLoader(const std::string& lib,
const std::string& func) {
WriteGuard guard(m_rwLock);
setCacheLoader(lib, func);
- m_loader = m_regionAttributes->getCacheLoader();
+ m_loader = m_regionAttributes.getCacheLoader();
}
void LocalRegion::adjustCacheWriter(const std::shared_ptr<CacheWriter>& aWriter) {
@@ -3088,7 +3089,7 @@ void LocalRegion::adjustCacheWriter(const std::string& lib,
const std::string& func) {
WriteGuard guard(m_rwLock);
setCacheWriter(lib, func);
- m_writer = m_regionAttributes->getCacheWriter();
+ m_writer = m_regionAttributes.getCacheWriter();
}
void LocalRegion::evict(int32_t percentage) {
diff --git a/cppcache/src/LocalRegion.hpp b/cppcache/src/LocalRegion.hpp
index a9995b2..e9b96c0 100644
--- a/cppcache/src/LocalRegion.hpp
+++ b/cppcache/src/LocalRegion.hpp
@@ -39,7 +39,7 @@
#include <geode/CacheWriter.hpp>
#include <geode/CacheLoader.hpp>
#include <geode/AttributesMutator.hpp>
-#include <geode/AttributesFactory.hpp>
+#include <geode/RegionAttributesFactory.hpp>
#include "RegionInternal.hpp"
#include "RegionStats.hpp"
@@ -130,7 +130,7 @@ class _GEODE_EXPORT LocalRegion : public RegionInternal {
*/
LocalRegion(const std::string& name, CacheImpl* cache,
const std::shared_ptr<RegionInternal>& rPtr,
- const std::shared_ptr<RegionAttributes>& attributes,
+ RegionAttributes attributes,
const std::shared_ptr<CacheStatistics>& stats,
bool shared = false, bool enableTimeStatistics = true);
virtual ~LocalRegion();
@@ -138,7 +138,7 @@ class _GEODE_EXPORT LocalRegion : public RegionInternal {
const std::string& getName() const override;
const std::string& getFullPath() const override;
std::shared_ptr<Region> getParentRegion() const override;
- std::shared_ptr<RegionAttributes> getAttributes() const override {
+ const RegionAttributes& getAttributes() const override {
return m_regionAttributes;
}
std::shared_ptr<AttributesMutator> getAttributesMutator() const override {
@@ -166,7 +166,7 @@ class _GEODE_EXPORT LocalRegion : public RegionInternal {
std::shared_ptr<Region> getSubregion(const std::string& path) override;
std::shared_ptr<Region> createSubregion(
const std::string& subregionName,
- const std::shared_ptr<RegionAttributes>& aRegionAttributes) override;
+ RegionAttributes regionAttributes) override;
std::vector<std::shared_ptr<Region>> subregions(
const bool recursive) override;
std::shared_ptr<RegionEntry> getEntry(
@@ -374,10 +374,10 @@ class _GEODE_EXPORT LocalRegion : public RegionInternal {
// other public methods
RegionStats* getRegionStats() override { return m_regionStats; }
inline bool cacheEnabled() override {
- return m_regionAttributes->getCachingEnabled();
+ return m_regionAttributes.getCachingEnabled();
}
inline bool cachelessWithListener() {
- return !m_regionAttributes->getCachingEnabled() && (m_listener != nullptr);
+ return !m_regionAttributes.getCachingEnabled() && (m_listener != nullptr);
}
virtual bool isDestroyed() const override { return m_destroyPending; }
/* above public methods are inherited from RegionInternal */
diff --git a/cppcache/src/MapSegment.cpp b/cppcache/src/MapSegment.cpp
index b4ecb73..d3b03e7 100644
--- a/cppcache/src/MapSegment.cpp
+++ b/cppcache/src/MapSegment.cpp
@@ -674,7 +674,7 @@ GfErrType MapSegment::putForTrackedEntry(
auto valueWithDelta = std::dynamic_pointer_cast<Delta>(oldValue);
std::shared_ptr<Cacheable>& newValue1 = const_cast<std::shared_ptr<Cacheable>&>(newValue);
try {
- if (m_region->getAttributes()->getCloningEnabled()) {
+ if (m_region->getAttributes().getCloningEnabled()) {
auto tempVal = valueWithDelta->clone();
ACE_Time_Value currTimeBefore = ACE_OS::gettimeofday();
tempVal->fromDelta(*delta);
diff --git a/cppcache/src/PoolManagerImpl.cpp b/cppcache/src/PoolManagerImpl.cpp
index 5741142..6d4a6fe 100644
--- a/cppcache/src/PoolManagerImpl.cpp
+++ b/cppcache/src/PoolManagerImpl.cpp
@@ -69,7 +69,7 @@ std::shared_ptr<Pool> PoolManagerImpl::find(const std::string& name) const {
std::shared_ptr<Pool> PoolManagerImpl::find(
std::shared_ptr<Region> region) const {
- return find(region->getAttributes()->getPoolName().c_str());
+ return find(region->getAttributes().getPoolName().c_str());
}
const HashMapOfPools& PoolManagerImpl::getAll() const {
diff --git a/cppcache/src/PoolXmlCreation.hpp b/cppcache/src/PoolXmlCreation.hpp
index df33f3a..cae970f 100644
--- a/cppcache/src/PoolXmlCreation.hpp
+++ b/cppcache/src/PoolXmlCreation.hpp
@@ -40,7 +40,7 @@ class Cache;
*/
class _GEODE_EXPORT PoolXmlCreation {
private:
- /** An <code>AttributesFactory</code> for creating default
+ /** An <code>RegionAttributesFactory</code> for creating default
* <code>PoolAttribute</code>s */
std::shared_ptr<PoolFactory> poolFactory;
diff --git a/cppcache/src/ProxyCache.cpp b/cppcache/src/ProxyCache.cpp
index 5ea7413..dd6d72a 100644
--- a/cppcache/src/ProxyCache.cpp
+++ b/cppcache/src/ProxyCache.cpp
@@ -93,7 +93,7 @@ std::shared_ptr<Region> ProxyCache::getRegion(const std::string& path) const {
if (result != nullptr) {
auto userAttachedPool = m_userAttributes->getPool();
auto pool = m_cacheImpl->getCache()->getPoolManager().find(
- result->getAttributes()->getPoolName());
+ result->getAttributes().getPoolName());
if (pool != nullptr && pool.get() == userAttachedPool.get() &&
!pool->isDestroyed()) {
return std::make_shared<ProxyRegion>(
@@ -144,7 +144,7 @@ std::vector<std::shared_ptr<Region>> ProxyCache::rootRegions() const {
for (const auto& reg : tmp) {
if (m_userAttributes->getPool()->getName() ==
- reg->getAttributes()->getPoolName()) {
+ reg->getAttributes().getPoolName()) {
auto pRegion = std::make_shared<ProxyRegion>(
std::const_pointer_cast<ProxyCache>(shared_from_this()),
std::static_pointer_cast<RegionInternal>(reg));
diff --git a/cppcache/src/ProxyRegion.hpp b/cppcache/src/ProxyRegion.hpp
index 0b67345..9cfc53b 100644
--- a/cppcache/src/ProxyRegion.hpp
+++ b/cppcache/src/ProxyRegion.hpp
@@ -35,7 +35,7 @@
#include <geode/CacheLoader.hpp>
#include <geode/RegionAttributes.hpp>
#include <geode/AttributesMutator.hpp>
-#include <geode/AttributesFactory.hpp>
+#include <geode/RegionAttributesFactory.hpp>
#include <geode/CacheableKey.hpp>
#include <geode/Query.hpp>
@@ -66,7 +66,7 @@ class _GEODE_EXPORT ProxyRegion : public Region {
return m_realRegion->getParentRegion();
}
- virtual std::shared_ptr<RegionAttributes> getAttributes() const override {
+ virtual const RegionAttributes& getAttributes() const override {
return m_realRegion->getAttributes();
}
@@ -124,7 +124,7 @@ class _GEODE_EXPORT ProxyRegion : public Region {
virtual std::shared_ptr<Region> createSubregion(
const std::string& subregionName,
- const std::shared_ptr<RegionAttributes>& aRegionAttributes) override {
+ RegionAttributes aRegionAttributes) override {
throw UnsupportedOperationException("createSubregion()");
return nullptr;
}
diff --git a/cppcache/src/RegionAttributes.cpp b/cppcache/src/RegionAttributes.cpp
index 3ef7795..1d6439e 100644
--- a/cppcache/src/RegionAttributes.cpp
+++ b/cppcache/src/RegionAttributes.cpp
@@ -58,8 +58,6 @@ RegionAttributes::RegionAttributes()
m_isClonable(false),
m_isConcurrencyChecksEnabled(true) {}
-RegionAttributes::RegionAttributes(const RegionAttributes& rhs) = default;
-
RegionAttributes::~RegionAttributes() noexcept = default;
namespace impl {
@@ -85,7 +83,7 @@ void* getFactoryFunc(const std::string& lib, const std::string& funcName) {
} // namespace impl
-std::shared_ptr<CacheLoader> RegionAttributes::getCacheLoader() {
+std::shared_ptr<CacheLoader> RegionAttributes::getCacheLoader() const {
if (!m_cacheLoader && !m_cacheLoaderLibrary.empty()) {
if (CacheXmlParser::managedCacheLoaderFn &&
m_cacheLoaderFactory.find('.') != std::string::npos) {
@@ -102,7 +100,8 @@ std::shared_ptr<CacheLoader> RegionAttributes::getCacheLoader() {
}
return m_cacheLoader;
}
-std::shared_ptr<CacheWriter> RegionAttributes::getCacheWriter() {
+
+std::shared_ptr<CacheWriter> RegionAttributes::getCacheWriter() const {
if (!m_cacheWriter && !m_cacheWriterLibrary.empty()) {
if (CacheXmlParser::managedCacheWriterFn &&
m_cacheWriterFactory.find('.') != std::string::npos) {
@@ -119,7 +118,8 @@ std::shared_ptr<CacheWriter> RegionAttributes::getCacheWriter() {
}
return m_cacheWriter;
}
-std::shared_ptr<CacheListener> RegionAttributes::getCacheListener() {
+
+std::shared_ptr<CacheListener> RegionAttributes::getCacheListener() const {
if (!m_cacheListener && !m_cacheListenerLibrary.empty()) {
if (CacheXmlParser::managedCacheListenerFn &&
m_cacheListenerFactory.find('.') != std::string::npos) {
@@ -136,7 +136,8 @@ std::shared_ptr<CacheListener> RegionAttributes::getCacheListener() {
}
return m_cacheListener;
}
-std::shared_ptr<PartitionResolver> RegionAttributes::getPartitionResolver() {
+
+std::shared_ptr<PartitionResolver> RegionAttributes::getPartitionResolver() const {
if (!m_partitionResolver && !m_partitionResolverLibrary.empty()) {
if (CacheXmlParser::managedPartitionResolverFn &&
m_partitionResolverFactory.find('.') != std::string::npos) {
@@ -154,7 +155,8 @@ std::shared_ptr<PartitionResolver> RegionAttributes::getPartitionResolver() {
}
return m_partitionResolver;
}
-std::shared_ptr<PersistenceManager> RegionAttributes::getPersistenceManager() {
+
+std::shared_ptr<PersistenceManager> RegionAttributes::getPersistenceManager() const {
if (!m_persistenceManager && !m_persistenceLibrary.empty()) {
if (CacheXmlParser::managedPartitionResolverFn &&
m_persistenceFactory.find('.') != std::string::npos) {
@@ -171,49 +173,55 @@ std::shared_ptr<PersistenceManager> RegionAttributes::getPersistenceManager() {
}
return m_persistenceManager;
}
-const std::string& RegionAttributes::getCacheLoaderFactory() {
+
+const std::string& RegionAttributes::getCacheLoaderFactory() const {
return m_cacheLoaderFactory;
}
-const std::string& RegionAttributes::getCacheWriterFactory() {
+const std::string& RegionAttributes::getCacheWriterFactory() const {
return m_cacheWriterFactory;
}
-const std::string& RegionAttributes::getCacheListenerFactory() {
+const std::string& RegionAttributes::getCacheListenerFactory() const {
return m_cacheListenerFactory;
}
-const std::string& RegionAttributes::getPartitionResolverFactory() {
+const std::string& RegionAttributes::getPartitionResolverFactory() const {
return m_partitionResolverFactory;
}
-const std::string& RegionAttributes::getPersistenceFactory() {
+const std::string& RegionAttributes::getPersistenceFactory() const {
return m_persistenceFactory;
}
-const std::string& RegionAttributes::getCacheLoaderLibrary() {
+const std::string& RegionAttributes::getCacheLoaderLibrary() const {
return m_cacheLoaderLibrary;
}
-const std::string& RegionAttributes::getCacheWriterLibrary() {
+const std::string& RegionAttributes::getCacheWriterLibrary() const {
return m_cacheWriterLibrary;
}
-const std::string& RegionAttributes::getCacheListenerLibrary() {
+const std::string& RegionAttributes::getCacheListenerLibrary() const {
return m_cacheListenerLibrary;
}
-const std::string& RegionAttributes::getPartitionResolverLibrary() {
+const std::string& RegionAttributes::getPartitionResolverLibrary() const {
return m_partitionResolverLibrary;
}
-const std::string& RegionAttributes::getEndpoints() { return m_endpoints; }
+const std::string& RegionAttributes::getEndpoints() const {
+ return m_endpoints;
+}
+
bool RegionAttributes::getClientNotificationEnabled() const {
return m_clientNotificationEnabled;
}
-const std::string& RegionAttributes::getPersistenceLibrary() {
+
+const std::string& RegionAttributes::getPersistenceLibrary() const {
return m_persistenceLibrary;
}
-std::shared_ptr<Properties> RegionAttributes::getPersistenceProperties() {
+
+std::shared_ptr<Properties> RegionAttributes::getPersistenceProperties() const {
return m_persistenceProperties;
}
@@ -268,7 +276,7 @@ uint32_t RegionAttributes::getLruEntriesLimit() const {
DiskPolicyType RegionAttributes::getDiskPolicy() const {
return m_diskPolicy;
}
-const std::string& RegionAttributes::getPoolName() const { return m_poolName; }
+
std::shared_ptr<Serializable> RegionAttributes::createDeserializable() {
return std::make_shared<RegionAttributes>();
}
diff --git a/cppcache/src/AttributesFactory.cpp b/cppcache/src/RegionAttributesFactory.cpp
similarity index 70%
rename from cppcache/src/AttributesFactory.cpp
rename to cppcache/src/RegionAttributesFactory.cpp
index a9473d6..0cc5436 100644
--- a/cppcache/src/AttributesFactory.cpp
+++ b/cppcache/src/RegionAttributesFactory.cpp
@@ -32,112 +32,113 @@ namespace client {
class Region;
-AttributesFactory::AttributesFactory() : m_regionAttributes() {}
+RegionAttributesFactory::RegionAttributesFactory() : m_regionAttributes() {}
-AttributesFactory::AttributesFactory(
- const std::shared_ptr<RegionAttributes>& regionAttributes)
- : m_regionAttributes(*regionAttributes) {}
+RegionAttributesFactory::RegionAttributesFactory(
+ const RegionAttributes regionAttributes)
+ : m_regionAttributes(regionAttributes) {}
-AttributesFactory::~AttributesFactory() {}
+RegionAttributesFactory::~RegionAttributesFactory() {}
-AttributesFactory& AttributesFactory::setCacheLoader(
+RegionAttributesFactory& RegionAttributesFactory::setCacheLoader(
const std::shared_ptr<CacheLoader>& cacheLoader) {
m_regionAttributes.m_cacheLoader = cacheLoader;
return *this;
}
-AttributesFactory& AttributesFactory::setCacheWriter(
+RegionAttributesFactory& RegionAttributesFactory::setCacheWriter(
const std::shared_ptr<CacheWriter>& cacheWriter) {
m_regionAttributes.m_cacheWriter = cacheWriter;
return *this;
}
-AttributesFactory& AttributesFactory::setCacheListener(
+RegionAttributesFactory& RegionAttributesFactory::setCacheListener(
const std::shared_ptr<CacheListener>& aListener) {
m_regionAttributes.m_cacheListener = aListener;
return *this;
}
-AttributesFactory& AttributesFactory::setPartitionResolver(
+RegionAttributesFactory& RegionAttributesFactory::setPartitionResolver(
const std::shared_ptr<PartitionResolver>& aResolver) {
m_regionAttributes.m_partitionResolver = aResolver;
return *this;
}
-AttributesFactory& AttributesFactory::setCacheLoader(const std::string& lib,
- const std::string& func) {
+RegionAttributesFactory& RegionAttributesFactory::setCacheLoader(
+ const std::string& lib, const std::string& func) {
m_regionAttributes.setCacheLoader(lib, func);
return *this;
}
-AttributesFactory& AttributesFactory::setCacheWriter(const std::string& lib,
- const std::string& func) {
+RegionAttributesFactory& RegionAttributesFactory::setCacheWriter(
+ const std::string& lib, const std::string& func) {
m_regionAttributes.setCacheWriter(lib, func);
return *this;
}
-AttributesFactory& AttributesFactory::setCacheListener(
+RegionAttributesFactory& RegionAttributesFactory::setCacheListener(
const std::string& lib, const std::string& func) {
m_regionAttributes.setCacheListener(lib, func);
return *this;
}
-AttributesFactory& AttributesFactory::setPartitionResolver(
+RegionAttributesFactory& RegionAttributesFactory::setPartitionResolver(
const std::string& lib, const std::string& func) {
m_regionAttributes.setPartitionResolver(lib, func);
return *this;
}
-AttributesFactory& AttributesFactory::setEntryIdleTimeout(
+RegionAttributesFactory& RegionAttributesFactory::setEntryIdleTimeout(
ExpirationAction action, std::chrono::seconds idleTimeout) {
m_regionAttributes.m_entryIdleTimeout = idleTimeout;
m_regionAttributes.m_entryIdleTimeoutExpirationAction = action;
return *this;
}
-AttributesFactory& AttributesFactory::setEntryTimeToLive(
+RegionAttributesFactory& RegionAttributesFactory::setEntryTimeToLive(
ExpirationAction action, std::chrono::seconds timeToLive) {
m_regionAttributes.m_entryTimeToLive = timeToLive;
m_regionAttributes.m_entryTimeToLiveExpirationAction = action;
return *this;
}
-AttributesFactory& AttributesFactory::setRegionIdleTimeout(
+RegionAttributesFactory& RegionAttributesFactory::setRegionIdleTimeout(
ExpirationAction action, std::chrono::seconds idleTimeout) {
m_regionAttributes.m_regionIdleTimeout = idleTimeout;
m_regionAttributes.m_regionIdleTimeoutExpirationAction = action;
return *this;
}
-AttributesFactory& AttributesFactory::setRegionTimeToLive(
+RegionAttributesFactory& RegionAttributesFactory::setRegionTimeToLive(
ExpirationAction action, std::chrono::seconds timeToLive) {
m_regionAttributes.m_regionTimeToLive = timeToLive;
m_regionAttributes.m_regionTimeToLiveExpirationAction = action;
return *this;
}
-AttributesFactory& AttributesFactory::setInitialCapacity(int initialCapacity) {
+RegionAttributesFactory& RegionAttributesFactory::setInitialCapacity(
+ int initialCapacity) {
m_regionAttributes.m_initialCapacity = initialCapacity;
return *this;
}
-AttributesFactory& AttributesFactory::setLoadFactor(float loadFactor) {
+RegionAttributesFactory& RegionAttributesFactory::setLoadFactor(
+ float loadFactor) {
m_regionAttributes.m_loadFactor = loadFactor;
return *this;
}
-AttributesFactory& AttributesFactory::setConcurrencyLevel(
+RegionAttributesFactory& RegionAttributesFactory::setConcurrencyLevel(
uint8_t concurrencyLevel) {
m_regionAttributes.m_concurrencyLevel = concurrencyLevel;
return *this;
}
-std::unique_ptr<RegionAttributes> AttributesFactory::createRegionAttributes() {
- std::shared_ptr<RegionAttributes> res;
+RegionAttributes RegionAttributesFactory::create() {
validateAttributes(m_regionAttributes);
- return std::unique_ptr<RegionAttributes>(
- new RegionAttributes(m_regionAttributes));
+ RegionAttributes regionAttributes(m_regionAttributes);
+ return regionAttributes; // RegionAttributes(m_regionAttributes);
}
-void AttributesFactory::validateAttributes(RegionAttributes& attrs) {
+void RegionAttributesFactory::validateAttributes(RegionAttributes& attrs) {
if (!attrs.m_caching) {
if (attrs.m_entryTimeToLive != std::chrono::seconds::zero()) {
throw IllegalStateException(
@@ -178,13 +179,13 @@ void AttributesFactory::validateAttributes(RegionAttributes& attrs) {
}
}
-AttributesFactory& AttributesFactory::setLruEntriesLimit(
+RegionAttributesFactory& RegionAttributesFactory::setLruEntriesLimit(
const uint32_t entriesLimit) {
m_regionAttributes.m_lruEntriesLimit = entriesLimit;
return *this;
}
-AttributesFactory& AttributesFactory::setDiskPolicy(
+RegionAttributesFactory& RegionAttributesFactory::setDiskPolicy(
const DiskPolicyType diskPolicy) {
if (diskPolicy == DiskPolicyType::PERSIST) {
throw IllegalStateException("Persistence feature is not supported");
@@ -193,12 +194,13 @@ AttributesFactory& AttributesFactory::setDiskPolicy(
return *this;
}
-AttributesFactory& AttributesFactory::setCachingEnabled(bool cachingEnabled) {
+RegionAttributesFactory& RegionAttributesFactory::setCachingEnabled(
+ bool cachingEnabled) {
m_regionAttributes.m_caching = cachingEnabled;
return *this;
}
-AttributesFactory& AttributesFactory::setPersistenceManager(
+RegionAttributesFactory& RegionAttributesFactory::setPersistenceManager(
const std::shared_ptr<PersistenceManager>& persistenceManager,
const std::shared_ptr<Properties>& props) {
m_regionAttributes.m_persistenceManager = persistenceManager;
@@ -206,23 +208,26 @@ AttributesFactory& AttributesFactory::setPersistenceManager(
return *this;
}
-AttributesFactory& AttributesFactory::setPersistenceManager(
+RegionAttributesFactory& RegionAttributesFactory::setPersistenceManager(
const std::string& lib, const std::string& func,
const std::shared_ptr<Properties>& config) {
m_regionAttributes.setPersistenceManager(lib, func, config);
return *this;
}
-AttributesFactory& AttributesFactory::setPoolName(const std::string& name) {
+RegionAttributesFactory& RegionAttributesFactory::setPoolName(
+ const std::string& name) {
m_regionAttributes.setPoolName(name);
return *this;
}
-AttributesFactory& AttributesFactory::setCloningEnabled(bool isClonable) {
+RegionAttributesFactory& RegionAttributesFactory::setCloningEnabled(
+ bool isClonable) {
m_regionAttributes.setCloningEnabled(isClonable);
return *this;
}
-AttributesFactory& AttributesFactory::setConcurrencyChecksEnabled(bool enable) {
+RegionAttributesFactory& RegionAttributesFactory::setConcurrencyChecksEnabled(
+ bool enable) {
m_regionAttributes.setConcurrencyChecksEnabled(enable);
return *this;
}
diff --git a/cppcache/src/RegionExpiryHandler.cpp b/cppcache/src/RegionExpiryHandler.cpp
index 1ebd5e7..0b9c2ac 100644
--- a/cppcache/src/RegionExpiryHandler.cpp
+++ b/cppcache/src/RegionExpiryHandler.cpp
@@ -47,7 +47,7 @@ int RegionExpiryHandler::handle_timeout(const ACE_Time_Value& current_time,
try {
auto statistics = m_regionPtr->getStatistics();
auto lastTimeForExp = statistics->getLastAccessedTime();
- if (m_regionPtr->getAttributes()->getRegionTimeToLive() >
+ if (m_regionPtr->getAttributes().getRegionTimeToLive() >
std::chrono::seconds::zero()) {
lastTimeForExp = statistics->getLastModifiedTime();
}
diff --git a/cppcache/src/RegionFactory.cpp b/cppcache/src/RegionFactory.cpp
index 8bc3157..c367d3f 100644
--- a/cppcache/src/RegionFactory.cpp
+++ b/cppcache/src/RegionFactory.cpp
@@ -39,24 +39,23 @@ namespace client {
RegionFactory::RegionFactory(RegionShortcut preDefinedRegion,
CacheImpl* cacheImpl)
: m_preDefinedRegion(preDefinedRegion),
- m_attributeFactory(std::make_shared<AttributesFactory>()),
+ m_regionAttributesFactory(std::make_shared<RegionAttributesFactory>()),
m_cacheImpl(cacheImpl) {
setRegionShortcut();
}
std::shared_ptr<Region> RegionFactory::create(std::string name) {
std::shared_ptr<Region> retRegionPtr = nullptr;
- std::shared_ptr<RegionAttributes> regAttr =
- m_attributeFactory->createRegionAttributes();
+ auto regionAttributes = m_regionAttributesFactory->create();
if (m_preDefinedRegion != RegionShortcut::LOCAL &&
- regAttr->getPoolName().empty()) {
+ regionAttributes.getPoolName().empty()) {
auto pool = m_cacheImpl->getPoolManager().getDefaultPool();
if (!pool) {
throw IllegalStateException("No pool for non-local region.");
}
- m_attributeFactory->setPoolName(pool->getName());
- regAttr = m_attributeFactory->createRegionAttributes();
+ m_regionAttributesFactory->setPoolName(pool->getName());
+ regionAttributes = m_regionAttributesFactory->create();
}
- m_cacheImpl->createRegion(name, regAttr, retRegionPtr);
+ m_cacheImpl->createRegion(name, regionAttributes, retRegionPtr);
return retRegionPtr;
}
@@ -64,90 +63,90 @@ std::shared_ptr<Region> RegionFactory::create(std::string name) {
void RegionFactory::setRegionShortcut() {
switch (m_preDefinedRegion) {
case RegionShortcut::PROXY: {
- m_attributeFactory->setCachingEnabled(false);
+ m_regionAttributesFactory->setCachingEnabled(false);
} break;
case RegionShortcut::CACHING_PROXY: {
- m_attributeFactory->setCachingEnabled(true);
+ m_regionAttributesFactory->setCachingEnabled(true);
} break;
case RegionShortcut::CACHING_PROXY_ENTRY_LRU: {
- m_attributeFactory->setCachingEnabled(true);
- m_attributeFactory->setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
+ m_regionAttributesFactory->setCachingEnabled(true);
+ m_regionAttributesFactory->setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
} break;
case RegionShortcut::LOCAL: {
} break;
case RegionShortcut::LOCAL_ENTRY_LRU: {
- m_attributeFactory->setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
+ m_regionAttributesFactory->setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
} break;
}
}
RegionFactory& RegionFactory::setCacheLoader(
const std::shared_ptr<CacheLoader>& cacheLoader) {
- m_attributeFactory->setCacheLoader(cacheLoader);
+ m_regionAttributesFactory->setCacheLoader(cacheLoader);
return *this;
}
RegionFactory& RegionFactory::setCacheWriter(
const std::shared_ptr<CacheWriter>& cacheWriter) {
- m_attributeFactory->setCacheWriter(cacheWriter);
+ m_regionAttributesFactory->setCacheWriter(cacheWriter);
return *this;
}
RegionFactory& RegionFactory::setCacheListener(
const std::shared_ptr<CacheListener>& aListener) {
- m_attributeFactory->setCacheListener(aListener);
+ m_regionAttributesFactory->setCacheListener(aListener);
return *this;
}
RegionFactory& RegionFactory::setPartitionResolver(
const std::shared_ptr<PartitionResolver>& aResolver) {
- m_attributeFactory->setPartitionResolver(aResolver);
+ m_regionAttributesFactory->setPartitionResolver(aResolver);
return *this;
}
RegionFactory& RegionFactory::setCacheLoader(const std::string& lib,
const std::string& func) {
- m_attributeFactory->setCacheLoader(lib, func);
+ m_regionAttributesFactory->setCacheLoader(lib, func);
return *this;
}
RegionFactory& RegionFactory::setCacheWriter(const std::string& lib,
const std::string& func) {
- m_attributeFactory->setCacheWriter(lib, func);
+ m_regionAttributesFactory->setCacheWriter(lib, func);
return *this;
}
RegionFactory& RegionFactory::setCacheListener(const std::string& lib,
const std::string& func) {
- m_attributeFactory->setCacheListener(lib, func);
+ m_regionAttributesFactory->setCacheListener(lib, func);
return *this;
}
RegionFactory& RegionFactory::setPartitionResolver(const std::string& lib,
const std::string& func) {
- m_attributeFactory->setPartitionResolver(lib, func);
+ m_regionAttributesFactory->setPartitionResolver(lib, func);
return *this;
}
RegionFactory& RegionFactory::setEntryIdleTimeout(
ExpirationAction action, std::chrono::seconds idleTimeout) {
- m_attributeFactory->setEntryIdleTimeout(action, idleTimeout);
+ m_regionAttributesFactory->setEntryIdleTimeout(action, idleTimeout);
return *this;
}
RegionFactory& RegionFactory::setEntryTimeToLive(
ExpirationAction action, std::chrono::seconds timeToLive) {
- m_attributeFactory->setEntryTimeToLive(action, timeToLive);
+ m_regionAttributesFactory->setEntryTimeToLive(action, timeToLive);
return *this;
}
RegionFactory& RegionFactory::setRegionIdleTimeout(
ExpirationAction action, std::chrono::seconds idleTimeout) {
- m_attributeFactory->setRegionIdleTimeout(action, idleTimeout);
+ m_regionAttributesFactory->setRegionIdleTimeout(action, idleTimeout);
return *this;
}
RegionFactory& RegionFactory::setRegionTimeToLive(
ExpirationAction action, std::chrono::seconds timeToLive) {
- m_attributeFactory->setRegionTimeToLive(action, timeToLive);
+ m_regionAttributesFactory->setRegionTimeToLive(action, timeToLive);
return *this;
}
@@ -157,60 +156,60 @@ RegionFactory& RegionFactory::setInitialCapacity(int initialCapacity) {
ACE_OS::snprintf(excpStr, 256, "initialCapacity must be >= 0 ");
throw IllegalArgumentException(excpStr);
}
- m_attributeFactory->setInitialCapacity(initialCapacity);
+ m_regionAttributesFactory->setInitialCapacity(initialCapacity);
return *this;
}
RegionFactory& RegionFactory::setLoadFactor(float loadFactor) {
- m_attributeFactory->setLoadFactor(loadFactor);
+ m_regionAttributesFactory->setLoadFactor(loadFactor);
return *this;
}
RegionFactory& RegionFactory::setConcurrencyLevel(uint8_t concurrencyLevel) {
- m_attributeFactory->setConcurrencyLevel(concurrencyLevel);
+ m_regionAttributesFactory->setConcurrencyLevel(concurrencyLevel);
return *this;
}
RegionFactory& RegionFactory::setConcurrencyChecksEnabled(bool enable) {
- m_attributeFactory->setConcurrencyChecksEnabled(enable);
+ m_regionAttributesFactory->setConcurrencyChecksEnabled(enable);
return *this;
}
RegionFactory& RegionFactory::setLruEntriesLimit(const uint32_t entriesLimit) {
- m_attributeFactory->setLruEntriesLimit(entriesLimit);
+ m_regionAttributesFactory->setLruEntriesLimit(entriesLimit);
return *this;
}
RegionFactory& RegionFactory::setDiskPolicy(
const DiskPolicyType diskPolicy) {
- m_attributeFactory->setDiskPolicy(diskPolicy);
+ m_regionAttributesFactory->setDiskPolicy(diskPolicy);
return *this;
}
RegionFactory& RegionFactory::setCachingEnabled(bool cachingEnabled) {
- m_attributeFactory->setCachingEnabled(cachingEnabled);
+ m_regionAttributesFactory->setCachingEnabled(cachingEnabled);
return *this;
}
RegionFactory& RegionFactory::setPersistenceManager(
const std::shared_ptr<PersistenceManager>& persistenceManager,
const std::shared_ptr<Properties>& config) {
- m_attributeFactory->setPersistenceManager(persistenceManager, config);
+ m_regionAttributesFactory->setPersistenceManager(persistenceManager, config);
return *this;
}
RegionFactory& RegionFactory::setPersistenceManager(
const std::string& lib, const std::string& func,
const std::shared_ptr<Properties>& config) {
- m_attributeFactory->setPersistenceManager(lib, func, config);
+ m_regionAttributesFactory->setPersistenceManager(lib, func, config);
return *this;
}
RegionFactory& RegionFactory::setPoolName(const std::string& name) {
- m_attributeFactory->setPoolName(name);
+ m_regionAttributesFactory->setPoolName(name);
return *this;
}
RegionFactory& RegionFactory::setCloningEnabled(bool isClonable) {
- m_attributeFactory->setCloningEnabled(isClonable);
+ m_regionAttributesFactory->setCloningEnabled(isClonable);
return *this;
}
} // namespace client
diff --git a/cppcache/src/RegionInternal.cpp b/cppcache/src/RegionInternal.cpp
index aa854ee..b8a9262 100644
--- a/cppcache/src/RegionInternal.cpp
+++ b/cppcache/src/RegionInternal.cpp
@@ -40,7 +40,7 @@ const CacheEventFlags CacheEventFlags::NOCACHEWRITER(
RegionInternal::RegionInternal(
Cache* cache,
- const std::shared_ptr<RegionAttributes>& attributes)
+ RegionAttributes attributes)
: Region(cache), m_regionAttributes(attributes) {}
RegionInternal::~RegionInternal() {}
@@ -109,128 +109,90 @@ std::shared_ptr<RegionEntry> RegionInternal::createRegionEntry(
}
void RegionInternal::setLruEntriesLimit(uint32_t limit) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_lruEntriesLimit = limit;
- }
+ m_regionAttributes.m_lruEntriesLimit = limit;
}
void RegionInternal::setRegionTimeToLiveExpirationAction(
ExpirationAction action) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_regionTimeToLiveExpirationAction = action;
- }
+ m_regionAttributes.m_regionTimeToLiveExpirationAction = action;
}
void RegionInternal::setRegionIdleTimeoutExpirationAction(
ExpirationAction action) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_regionIdleTimeoutExpirationAction = action;
- }
+ m_regionAttributes.m_regionIdleTimeoutExpirationAction = action;
}
void RegionInternal::setEntryTimeToLiveExpirationAction(
ExpirationAction action) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_entryTimeToLiveExpirationAction = action;
- }
+ m_regionAttributes.m_entryTimeToLiveExpirationAction = action;
}
void RegionInternal::setEntryIdleTimeoutExpirationAction(
ExpirationAction action) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_entryIdleTimeoutExpirationAction = action;
- }
+ m_regionAttributes.m_entryIdleTimeoutExpirationAction = action;
}
void RegionInternal::setRegionTimeToLive(const std::chrono::seconds& duration) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_regionTimeToLive = duration;
- }
+ m_regionAttributes.m_regionTimeToLive = duration;
}
void RegionInternal::setRegionIdleTimeout(
const std::chrono::seconds& duration) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_regionIdleTimeout = duration;
- }
+ m_regionAttributes.m_regionIdleTimeout = duration;
}
void RegionInternal::setEntryTimeToLive(const std::chrono::seconds& duration) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_entryTimeToLive = duration;
- }
+ m_regionAttributes.m_entryTimeToLive = duration;
}
void RegionInternal::setEntryIdleTimeout(const std::chrono::seconds& duration) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_entryIdleTimeout = duration;
- }
+ m_regionAttributes.m_entryIdleTimeout = duration;
}
void RegionInternal::setCacheListener(const std::shared_ptr<CacheListener>& aListener) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_cacheListener = aListener;
- }
+ m_regionAttributes.m_cacheListener = aListener;
}
void RegionInternal::setCacheListener(const std::string& libpath,
const std::string& factoryFuncName) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->setCacheListener(libpath, factoryFuncName);
- }
+ m_regionAttributes.setCacheListener(libpath, factoryFuncName);
}
void RegionInternal::setPartitionResolver(
const std::shared_ptr<PartitionResolver>& aResolver) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_partitionResolver = aResolver;
- }
+ m_regionAttributes.m_partitionResolver = aResolver;
}
void RegionInternal::setPartitionResolver(const std::string& libpath,
const std::string& factoryFuncName) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->setPartitionResolver(libpath, factoryFuncName);
- }
+ m_regionAttributes.setPartitionResolver(libpath, factoryFuncName);
}
void RegionInternal::setCacheLoader(const std::shared_ptr<CacheLoader>& aLoader) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_cacheLoader = aLoader;
- }
+ m_regionAttributes.m_cacheLoader = aLoader;
}
void RegionInternal::setCacheLoader(const std::string& libpath,
const std::string& factoryFuncName) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->setCacheLoader(libpath, factoryFuncName);
- }
+ m_regionAttributes.setCacheLoader(libpath, factoryFuncName);
}
void RegionInternal::setCacheWriter(const std::shared_ptr<CacheWriter>& aWriter) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_cacheWriter = aWriter;
- }
+ m_regionAttributes.m_cacheWriter = aWriter;
}
void RegionInternal::setCacheWriter(const std::string& libpath,
const std::string& factoryFuncName) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->setCacheWriter(libpath, factoryFuncName);
- }
+ m_regionAttributes.setCacheWriter(libpath, factoryFuncName);
}
void RegionInternal::setEndpoints(const std::string& endpoints) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->setEndpoints(endpoints);
- }
+ m_regionAttributes.setEndpoints(endpoints);
}
void RegionInternal::setClientNotificationEnabled(
bool clientNotificationEnabled) {
- if (m_regionAttributes != nullptr) {
- m_regionAttributes->m_clientNotificationEnabled = clientNotificationEnabled;
- }
+ m_regionAttributes.m_clientNotificationEnabled = clientNotificationEnabled;
}
void RegionInternal::txDestroy(const std::shared_ptr<CacheableKey>& key,
diff --git a/cppcache/src/RegionInternal.hpp b/cppcache/src/RegionInternal.hpp
index 94a0ce3..1e4b283 100644
--- a/cppcache/src/RegionInternal.hpp
+++ b/cppcache/src/RegionInternal.hpp
@@ -284,7 +284,7 @@ class RegionInternal : public Region {
const std::shared_ptr<Serializable>& callBack,
std::shared_ptr<VersionTag> versionTag);
inline bool isConcurrencyCheckEnabled() const {
- return m_regionAttributes->getConcurrencyChecksEnabled();
+ return m_regionAttributes.getConcurrencyChecksEnabled();
}
virtual const std::shared_ptr<Pool>& getPool() const override = 0;
@@ -292,7 +292,7 @@ class RegionInternal : public Region {
/**
* @brief constructor
*/
- RegionInternal(Cache* cache, const std::shared_ptr<RegionAttributes>& attributes);
+ RegionInternal(Cache* cache, RegionAttributes attributes);
void setLruEntriesLimit(uint32_t limit);
void setRegionTimeToLiveExpirationAction(ExpirationAction action);
@@ -319,14 +319,14 @@ class RegionInternal : public Region {
void setEndpoints(const std::string& endpoints);
void setClientNotificationEnabled(bool clientNotificationEnabled);
- std::shared_ptr<RegionAttributes> m_regionAttributes;
+ RegionAttributes m_regionAttributes;
inline bool entryExpiryEnabled() const {
- return m_regionAttributes->getEntryExpiryEnabled();
+ return m_regionAttributes.getEntryExpiryEnabled();
}
inline bool regionExpiryEnabled() const {
- return m_regionAttributes->getRegionExpiryEnabled();
+ return m_regionAttributes.getRegionExpiryEnabled();
}
RegionInternal(const RegionInternal&) = delete;
diff --git a/cppcache/src/RegionXmlCreation.cpp b/cppcache/src/RegionXmlCreation.cpp
index a673029..8ad53a1 100644
--- a/cppcache/src/RegionXmlCreation.cpp
+++ b/cppcache/src/RegionXmlCreation.cpp
@@ -31,11 +31,12 @@ void RegionXmlCreation::addSubregion(
}
void RegionXmlCreation::setAttributes(
- std::shared_ptr<RegionAttributes> attrsPtr) {
- regAttrs = attrsPtr;
+ const RegionAttributes attributes) {
+ regionAttributes = attributes;
}
-std::shared_ptr<RegionAttributes> RegionXmlCreation::getAttributes() {
- return regAttrs;
+
+RegionAttributes RegionXmlCreation::getAttributes() {
+ return regionAttributes;
}
void RegionXmlCreation::fillIn(std::shared_ptr<Region> regionPtr) {
@@ -49,7 +50,7 @@ void RegionXmlCreation::createRoot(Cache* cache) {
std::shared_ptr<Region> rootRegPtr = nullptr;
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache);
- cacheImpl->createRegion(regionName.c_str(), regAttrs, rootRegPtr);
+ cacheImpl->createRegion(regionName.c_str(), regionAttributes, rootRegPtr);
fillIn(rootRegPtr);
}
@@ -57,12 +58,11 @@ void RegionXmlCreation::create(std::shared_ptr<Region> parent) {
GF_D_ASSERT(!(this->isRoot));
std::shared_ptr<Region> subRegPtr = nullptr;
- subRegPtr = parent->createSubregion(regionName.c_str(), regAttrs);
+ subRegPtr = parent->createSubregion(regionName.c_str(), regionAttributes);
fillIn(subRegPtr);
}
-RegionXmlCreation::RegionXmlCreation(char* name, bool isRootRegion)
- : regAttrs(nullptr) {
+RegionXmlCreation::RegionXmlCreation(char* name, bool isRootRegion) {
std::string tempName(name);
regionName = tempName;
isRoot = isRootRegion;
diff --git a/cppcache/src/RegionXmlCreation.hpp b/cppcache/src/RegionXmlCreation.hpp
index 37bd8ff..fd6a68f 100644
--- a/cppcache/src/RegionXmlCreation.hpp
+++ b/cppcache/src/RegionXmlCreation.hpp
@@ -40,9 +40,9 @@ class Cache;
*/
class _GEODE_EXPORT RegionXmlCreation {
private:
- /** An <code>AttributesFactory</code> for creating default
+ /** An <code>RegionAttributesFactory</code> for creating default
* <code>RegionAttribute</code>s */
- AttributesFactory attrFactory;
+ RegionAttributesFactory regionAttributeFactory;
/** The name of this region */
std::string regionName;
@@ -54,7 +54,7 @@ class _GEODE_EXPORT RegionXmlCreation {
bool isRoot;
/** The attributes of this region */
- std::shared_ptr<RegionAttributes> regAttrs;
+ RegionAttributes regionAttributes;
/** This region's subregions */
std::vector<std::shared_ptr<RegionXmlCreation>> subRegions;
@@ -83,12 +83,12 @@ class _GEODE_EXPORT RegionXmlCreation {
/**
* Sets the attributes of this region
*/
- void setAttributes(std::shared_ptr<RegionAttributes> attrsPtr);
+ void setAttributes(const RegionAttributes attributes);
/**
* Gets the attributes of this region
*/
- std::shared_ptr<RegionAttributes> getAttributes();
+ RegionAttributes getAttributes();
/**
* Creates a root {@link Region} in a given <code>Cache</code>
diff --git a/cppcache/src/TcrDistributionManager.cpp b/cppcache/src/TcrDistributionManager.cpp
index 3c6e832..2e5512d 100644
--- a/cppcache/src/TcrDistributionManager.cpp
+++ b/cppcache/src/TcrDistributionManager.cpp
@@ -27,12 +27,12 @@ TcrDistributionManager::TcrDistributionManager(
: ThinClientDistributionManager(connManager, region) {
GF_R_ASSERT(region != nullptr);
m_clientNotification =
- region->getAttributes()->getClientNotificationEnabled();
+ region->getAttributes().getClientNotificationEnabled();
}
void TcrDistributionManager::getEndpointNames(
std::unordered_set<std::string>& endpointNames) {
- Utils::parseEndpointNamesString(m_region->getAttributes()->getEndpoints(),
+ Utils::parseEndpointNamesString(m_region->getAttributes().getEndpoints(),
endpointNames);
}
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index 6f3bc10..b119884 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -2181,11 +2181,11 @@ TcrMessagePutAll::TcrMessagePutAll(
// Version tags are not sent back if dp is EMPTY or concurrency
// checks are disabled.
int flags = 0;
- if (!region->getAttributes()->getCachingEnabled()) {
+ if (!region->getAttributes().getCachingEnabled()) {
flags |= TcrMessage::m_flag_empty;
LOGDEBUG("TcrMessage::PUTALL datapolicy empty flags = %d ", flags);
}
- if (region->getAttributes()->getConcurrencyChecksEnabled()) {
+ if (region->getAttributes().getConcurrencyChecksEnabled()) {
flags |= TcrMessage::m_flag_concurrency_checks;
LOGDEBUG("TcrMessage::PUTALL ConcurrencyChecksEnabled flags = %d ", flags);
}
@@ -2234,11 +2234,11 @@ TcrMessageRemoveAll::TcrMessageRemoveAll(
// Version tags are not sent back if dp is EMPTY or concurrency
// checks are disabled.
int flags = 0;
- if (!region->getAttributes()->getCachingEnabled()) {
+ if (!region->getAttributes().getCachingEnabled()) {
flags |= TcrMessage::m_flag_empty;
LOGDEBUG("TcrMessage::REMOVE_ALL datapolicy empty flags = %d ", flags);
}
- if (region->getAttributes()->getConcurrencyChecksEnabled()) {
+ if (region->getAttributes().getConcurrencyChecksEnabled()) {
flags |= TcrMessage::m_flag_concurrency_checks;
LOGDEBUG("TcrMessage::REMOVE_ALL ConcurrencyChecksEnabled flags = %d ",
flags);
diff --git a/cppcache/src/ThinClientHARegion.cpp b/cppcache/src/ThinClientHARegion.cpp
index 8a5a17d..6e33c1d 100644
--- a/cppcache/src/ThinClientHARegion.cpp
+++ b/cppcache/src/ThinClientHARegion.cpp
@@ -29,11 +29,11 @@ namespace client {
ThinClientHARegion::ThinClientHARegion(
const std::string& name, CacheImpl* cache,
const std::shared_ptr<RegionInternal>& rPtr,
- const std::shared_ptr<RegionAttributes>& attributes,
+ RegionAttributes attributes,
const std::shared_ptr<CacheStatistics>& stats, bool shared,
bool enableNotification)
: ThinClientRegion(name, cache, rPtr, attributes, stats, shared),
- m_attribute(attributes),
+ m_attributes(attributes),
m_processedMarker(false),
m_poolDM(false) {
setClientNotificationEnabled(enableNotification);
@@ -41,7 +41,7 @@ ThinClientHARegion::ThinClientHARegion(
void ThinClientHARegion::initTCR() {
try {
- const bool isPool = !m_attribute->getPoolName().empty();
+ const bool isPool = !m_attributes.getPoolName().empty();
if (m_cacheImpl->getDistributedSystem()
.getSystemProperties()
.isGridClient()) {
@@ -57,7 +57,7 @@ void ThinClientHARegion::initTCR() {
m_tcrdm = dynamic_cast<ThinClientPoolHADM*>(
m_cacheImpl->getCache()
->getPoolManager()
- .find(m_attribute->getPoolName())
+ .find(m_attributes.getPoolName())
.get());
if (m_tcrdm) {
m_poolDM = true;
diff --git a/cppcache/src/ThinClientHARegion.hpp b/cppcache/src/ThinClientHARegion.hpp
index b7b397e..71f92fd 100644
--- a/cppcache/src/ThinClientHARegion.hpp
+++ b/cppcache/src/ThinClientHARegion.hpp
@@ -48,7 +48,7 @@ class _GEODE_EXPORT ThinClientHARegion : public ThinClientRegion {
*/
ThinClientHARegion(const std::string& name, CacheImpl* cache,
const std::shared_ptr<RegionInternal>& rPtr,
- const std::shared_ptr<RegionAttributes>& attributes,
+ RegionAttributes attributes,
const std::shared_ptr<CacheStatistics>& stats,
bool shared = false, bool enableNotification = true);
@@ -69,7 +69,7 @@ class _GEODE_EXPORT ThinClientHARegion : public ThinClientRegion {
std::shared_ptr<VersionTag>& versionTag);
private:
- std::shared_ptr<RegionAttributes> m_attribute;
+ RegionAttributes m_attributes;
volatile bool m_processedMarker;
void handleMarker();
diff --git a/cppcache/src/ThinClientPoolRegion.cpp b/cppcache/src/ThinClientPoolRegion.cpp
index 31f31c9..e44fe4c 100644
--- a/cppcache/src/ThinClientPoolRegion.cpp
+++ b/cppcache/src/ThinClientPoolRegion.cpp
@@ -32,7 +32,7 @@ using namespace apache::geode::client;
ThinClientPoolRegion::ThinClientPoolRegion(
const std::string& name, CacheImpl* cache,
const std::shared_ptr<RegionInternal>& rPtr,
- const std::shared_ptr<RegionAttributes>& attributes,
+ RegionAttributes attributes,
const std::shared_ptr<CacheStatistics>& stats, bool shared)
: ThinClientRegion(name, cache, rPtr, attributes, stats, shared) {}
@@ -43,7 +43,7 @@ void ThinClientPoolRegion::initTCR() {
ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(
getCache()
.getPoolManager()
- .find(m_regionAttributes->getPoolName())
+ .find(m_regionAttributes.getPoolName())
.get());
m_tcrdm = dynamic_cast<ThinClientBaseDM*>(poolDM);
if (!m_tcrdm) {
diff --git a/cppcache/src/ThinClientPoolRegion.hpp b/cppcache/src/ThinClientPoolRegion.hpp
index 8fdba1f..9e79255 100644
--- a/cppcache/src/ThinClientPoolRegion.hpp
+++ b/cppcache/src/ThinClientPoolRegion.hpp
@@ -38,7 +38,7 @@ class ThinClientPoolRegion : public ThinClientRegion {
*/
ThinClientPoolRegion(const std::string& name, CacheImpl* cache,
const std::shared_ptr<RegionInternal>& rPtr,
- const std::shared_ptr<RegionAttributes>& attributes,
+ RegionAttributes attributes,
const std::shared_ptr<CacheStatistics>& stats,
bool shared = false);
diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp
index 2b78d7d..3017916 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -346,7 +346,7 @@ class RemoveAllWork : public PooledWork<GfErrType>,
ThinClientRegion::ThinClientRegion(
const std::string& name, CacheImpl* cacheImpl,
const std::shared_ptr<RegionInternal>& rPtr,
- const std::shared_ptr<RegionAttributes>& attributes,
+ RegionAttributes attributes,
const std::shared_ptr<CacheStatistics>& stats, bool shared)
: LocalRegion(name, cacheImpl, rPtr, attributes, stats, shared),
m_tcrdm((ThinClientBaseDM*)0),
@@ -363,12 +363,12 @@ ThinClientRegion::ThinClientRegion(
void ThinClientRegion::initTCR() {
bool subscription = false;
auto pool = m_cacheImpl->getCache()->getPoolManager().find(
- getAttributes()->getPoolName());
+ getAttributes().getPoolName());
if (pool != nullptr) {
subscription = pool->getSubscriptionEnabled();
}
bool notificationEnabled =
- getAttributes()->getClientNotificationEnabled() || subscription;
+ getAttributes().getClientNotificationEnabled() || subscription;
if (notificationEnabled) {
if (m_cacheImpl->getDistributedSystem()
.getSystemProperties()
@@ -397,7 +397,7 @@ void ThinClientRegion::registerKeys(
const std::vector<std::shared_ptr<CacheableKey>>& keys, bool isDurable,
bool getInitialValues, bool receiveValues) {
auto pool = m_cacheImpl->getCache()->getPoolManager().find(
- getAttributes()->getPoolName());
+ getAttributes().getPoolName());
if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
@@ -442,7 +442,7 @@ void ThinClientRegion::registerKeys(
void ThinClientRegion::unregisterKeys(
const std::vector<std::shared_ptr<CacheableKey>>& keys) {
auto pool = m_cacheImpl->getCache()->getPoolManager().find(
- getAttributes()->getPoolName());
+ getAttributes().getPoolName());
if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
@@ -454,7 +454,7 @@ void ThinClientRegion::unregisterKeys(
"only if pool subscription-enabled attribute is true.");
}
} else {
- if (!getAttributes()->getClientNotificationEnabled()) {
+ if (!getAttributes().getClientNotificationEnabled()) {
LOGERROR(
"Unregister keys is supported "
"only if region client-notification attribute is true.");
@@ -476,7 +476,7 @@ void ThinClientRegion::unregisterKeys(
void ThinClientRegion::registerAllKeys(bool isDurable, bool getInitialValues,
bool receiveValues) {
auto pool = m_cacheImpl->getCache()->getPoolManager().find(
- getAttributes()->getPoolName());
+ getAttributes().getPoolName());
if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
@@ -526,7 +526,7 @@ void ThinClientRegion::registerRegex(const std::string& regex, bool isDurable,
bool getInitialValues,
bool receiveValues) {
auto pool = m_cacheImpl->getCache()->getPoolManager().find(
- getAttributes()->getPoolName());
+ getAttributes().getPoolName());
if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
@@ -578,7 +578,7 @@ void ThinClientRegion::registerRegex(const std::string& regex, bool isDurable,
void ThinClientRegion::unregisterRegex(const std::string& regex) {
auto pool = m_cacheImpl->getCache()->getPoolManager().find(
- getAttributes()->getPoolName());
+ getAttributes().getPoolName());
if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
@@ -602,7 +602,7 @@ void ThinClientRegion::unregisterRegex(const std::string& regex) {
void ThinClientRegion::unregisterAllKeys() {
auto pool = m_cacheImpl->getCache()->getPoolManager().find(
- getAttributes()->getPoolName());
+ getAttributes().getPoolName());
if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
@@ -669,7 +669,7 @@ bool ThinClientRegion::existsValue(const std::string& predicate,
GfErrType ThinClientRegion::unregisterKeysBeforeDestroyRegion() {
auto pool = m_cacheImpl->getCache()->getPoolManager().find(
- getAttributes()->getPoolName());
+ getAttributes().getPoolName());
if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGDEBUG(
@@ -1206,8 +1206,8 @@ GfErrType ThinClientRegion::getAllNoThrow_remote(
GfErrType err = GF_NOERR;
MapOfUpdateCounters updateCountMap;
int32_t destroyTracker = 0;
- addToLocalCache = addToLocalCache && m_regionAttributes->getCachingEnabled();
- if (addToLocalCache && !m_regionAttributes->getConcurrencyChecksEnabled()) {
+ addToLocalCache = addToLocalCache && m_regionAttributes.getCachingEnabled();
+ if (addToLocalCache && !m_regionAttributes.getConcurrencyChecksEnabled()) {
// start tracking the entries
if (keys == nullptr) {
// track all entries with destroy tracking for non-existent entries
@@ -1237,7 +1237,7 @@ GfErrType ThinClientRegion::getAllNoThrow_remote(
reply.setChunkedResultHandler(resultCollector);
err = m_tcrdm->sendSyncRequest(request, reply);
- if (addToLocalCache && !m_regionAttributes->getConcurrencyChecksEnabled()) {
+ if (addToLocalCache && !m_regionAttributes.getConcurrencyChecksEnabled()) {
// remove the tracking for remaining keys in case some keys do not have
// values from server in GII
for (MapOfUpdateCounters::const_iterator iter = updateCountMap.begin();
@@ -2278,7 +2278,7 @@ GfErrType ThinClientRegion::registerKeysNoThrow(
TcrMessageRegisterInterestList request(
m_cache->createDataOutput(), this, keys, isDurable,
- getAttributes()->getCachingEnabled(), receiveValues, interestPolicy,
+ getAttributes().getCachingEnabled(), receiveValues, interestPolicy,
m_tcrdm);
ACE_Recursive_Thread_Mutex responseLock;
TcrChunkedResult* resultCollector = nullptr;
@@ -2455,7 +2455,7 @@ GfErrType ThinClientRegion::registerRegexNoThrow(
// TODO:
TcrMessageRegisterInterest request(
m_cache->createDataOutput(), m_fullPath, regex.c_str(), interestPolicy,
- isDurable, getAttributes()->getCachingEnabled(), receiveValues, m_tcrdm);
+ isDurable, getAttributes().getCachingEnabled(), receiveValues, m_tcrdm);
ACE_Recursive_Thread_Mutex responseLock;
if (reply == nullptr) {
TcrMessageReply replyLocal(true, m_tcrdm);
@@ -2852,7 +2852,7 @@ void ThinClientRegion::invalidateInterestList(
std::shared_ptr<MapEntryImpl> me;
std::shared_ptr<Cacheable> oldValue;
- if (!m_regionAttributes->getCachingEnabled()) {
+ if (!m_regionAttributes.getCachingEnabled()) {
return;
}
for (const auto& iter : interestList) {
@@ -2879,7 +2879,7 @@ void ThinClientRegion::localInvalidateForRegisterInterest(
CHECK_DESTROY_PENDING(TryReadGuard,
ThinClientRegion::localInvalidateForRegisterInterest);
- if (!m_regionAttributes->getCachingEnabled()) {
+ if (!m_regionAttributes.getCachingEnabled()) {
return;
}
diff --git a/cppcache/src/ThinClientRegion.hpp b/cppcache/src/ThinClientRegion.hpp
index cd63bed..cdd85bf 100644
--- a/cppcache/src/ThinClientRegion.hpp
+++ b/cppcache/src/ThinClientRegion.hpp
@@ -60,7 +60,7 @@ class _GEODE_EXPORT ThinClientRegion : public LocalRegion {
*/
ThinClientRegion(const std::string& name, CacheImpl* cache,
const std::shared_ptr<RegionInternal>& rPtr,
- const std::shared_ptr<RegionAttributes>& attributes,
+ RegionAttributes attributes,
const std::shared_ptr<CacheStatistics>& stats,
bool shared = false);
virtual void initTCR();
diff --git a/cppcache/test/AttributesFactoryTest.cpp b/cppcache/test/AttributesFactoryTest.cpp
deleted file mode 100644
index 0d16bd8..0000000
--- a/cppcache/test/AttributesFactoryTest.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-
-#include <geode/AttributesFactory.hpp>
-
-using namespace apache::geode::client;
-
-TEST(AttributesFactoryTest, setEntryIdleTimeoutSeconds) {
- AttributesFactory attributesFactory;
- std::shared_ptr<RegionAttributes> regionAttributes =
- attributesFactory
- .setEntryIdleTimeout(ExpirationAction::DESTROY,
- std::chrono::seconds(10))
- .createRegionAttributes();
- EXPECT_EQ(std::chrono::seconds(10), regionAttributes->getEntryIdleTimeout());
-}
-
-TEST(AttributesFactoryTest, setEntryTimeToLiveSeconds) {
- AttributesFactory attributesFactory;
- std::shared_ptr<RegionAttributes> regionAttributes =
- attributesFactory
- .setEntryTimeToLive(ExpirationAction::DESTROY,
- std::chrono::seconds(10))
- .createRegionAttributes();
- EXPECT_EQ(std::chrono::seconds(10), regionAttributes->getEntryTimeToLive());
-}
-
-TEST(AttributesFactoryTest, setRegionIdleTimeoutSeconds) {
- AttributesFactory attributesFactory;
- std::shared_ptr<RegionAttributes> regionAttributes =
- attributesFactory
- .setRegionIdleTimeout(ExpirationAction::DESTROY,
- std::chrono::seconds(10))
- .createRegionAttributes();
- EXPECT_EQ(std::chrono::seconds(10), regionAttributes->getRegionIdleTimeout());
-}
-
-TEST(AttributesFactoryTest, setRegionTimeToLiveSeconds) {
- AttributesFactory attributesFactory;
- std::shared_ptr<RegionAttributes> regionAttributes =
- attributesFactory
- .setRegionTimeToLive(ExpirationAction::DESTROY,
- std::chrono::seconds(10))
- .createRegionAttributes();
- EXPECT_EQ(std::chrono::seconds(10), regionAttributes->getRegionTimeToLive());
-}
-
-TEST(AttributesFactoryTest, setInitialCapacity) {
- AttributesFactory* af = new AttributesFactory();
- EXPECT_NE(af, nullptr);
- std::unique_ptr<RegionAttributes> rattrs =
- af->setLruEntriesLimit(2).setInitialCapacity(5).createRegionAttributes();
- EXPECT_NE(rattrs, nullptr);
- EXPECT_EQ(rattrs->getInitialCapacity(), 5);
-}
-
-TEST(AttributesFactoryTest, setLruEntriesLimit) {
- AttributesFactory* af = new AttributesFactory();
- EXPECT_NE(af, nullptr);
- std::unique_ptr<RegionAttributes> rattrs =
- af->setLruEntriesLimit(2).setInitialCapacity(5).createRegionAttributes();
- EXPECT_NE(rattrs, nullptr);
- EXPECT_EQ(rattrs->getLruEntriesLimit(), 2);
-}
diff --git a/cppcache/test/RegionAttributesFactoryTest.cpp b/cppcache/test/RegionAttributesFactoryTest.cpp
new file mode 100644
index 0000000..e5d9311
--- /dev/null
+++ b/cppcache/test/RegionAttributesFactoryTest.cpp
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <geode/RegionAttributesFactory.hpp>
+
+using namespace apache::geode::client;
+
+TEST(RegionAttributesFactoryTest, setEntryIdleTimeoutSeconds) {
+ RegionAttributesFactory regionAttributesFactory;
+ auto regionAttributes =
+ regionAttributesFactory
+ .setEntryIdleTimeout(ExpirationAction::DESTROY,
+ std::chrono::seconds(10))
+ .create();
+ EXPECT_EQ(std::chrono::seconds(10), regionAttributes.getEntryIdleTimeout());
+}
+
+TEST(RegionAttributesFactoryTest, setEntryTimeToLiveSeconds) {
+ RegionAttributesFactory regionAttributesFactory;
+ auto regionAttributes =
+ regionAttributesFactory
+ .setEntryTimeToLive(ExpirationAction::DESTROY,
+ std::chrono::seconds(10))
+ .create();
+ EXPECT_EQ(std::chrono::seconds(10), regionAttributes.getEntryTimeToLive());
+}
+
+TEST(RegionAttributesFactoryTest, setRegionIdleTimeoutSeconds) {
+ RegionAttributesFactory regionAttributesFactory;
+ auto regionAttributes =
+ regionAttributesFactory
+ .setRegionIdleTimeout(ExpirationAction::DESTROY,
+ std::chrono::seconds(10))
+ .create();
+ EXPECT_EQ(std::chrono::seconds(10), regionAttributes.getRegionIdleTimeout());
+}
+
+TEST(RegionAttributesFactoryTest, setRegionTimeToLiveSeconds) {
+ RegionAttributesFactory regionAttributesFactory;
+ auto regionAttributes =
+ regionAttributesFactory
+ .setRegionTimeToLive(ExpirationAction::DESTROY,
+ std::chrono::seconds(10))
+ .create();
+ EXPECT_EQ(std::chrono::seconds(10), regionAttributes.getRegionTimeToLive());
+}
+
+TEST(RegionAttributesFactoryTest, setInitialCapacity) {
+ RegionAttributesFactory* regionAttributesFactory = new RegionAttributesFactory();
+ EXPECT_NE(regionAttributesFactory, nullptr);
+ auto regionAttributes =
+ regionAttributesFactory->setLruEntriesLimit(2).setInitialCapacity(5).create();
+ EXPECT_EQ(regionAttributes.getInitialCapacity(), 5);
+}
+
+TEST(RegionAttributesFactoryTest, setLruEntriesLimit) {
+ RegionAttributesFactory* regionAttributesFactory = new RegionAttributesFactory();
+ EXPECT_NE(regionAttributesFactory, nullptr);
+ auto regionAttributes =
+ regionAttributesFactory->setLruEntriesLimit(2).setInitialCapacity(5).create();
+ EXPECT_EQ(regionAttributes.getLruEntriesLimit(), 2);
+}
diff --git a/tests/cli/FwkUtil/FwkData.cs b/tests/cli/FwkUtil/FwkData.cs
index f8bbcad..d4757f1 100644
--- a/tests/cli/FwkUtil/FwkData.cs
+++ b/tests/cli/FwkUtil/FwkData.cs
@@ -137,7 +137,7 @@ namespace Apache.Geode.Client.FwkLib
}
[Serializable]
- public class FwkData
+ public class FwkData
{
#region Private members
@@ -180,21 +180,21 @@ namespace Apache.Geode.Client.FwkLib
}
}
#endregion
-
+
public FwkData(object data1, object data2, DataKind kind)
{
m_data1 = data1;
m_data2 = data2;
m_kind = kind;
}
-
+
public static Dictionary<string, FwkData> ReadDataNodes(XmlNode node)
{
throw new Exception();
}
- public static void SetThisAttribute(string name, XmlNode node, Apache.Geode.Client.AttributesFactory<string, string> af)
+ public static void SetThisAttribute(string name, XmlNode node, Apache.Geode.Client.RegionAttributesFactory<string, string> regionAttributesFactory)
{
string value = node.Value;
switch (name)
@@ -202,42 +202,42 @@ namespace Apache.Geode.Client.FwkLib
case "caching-enabled":
if (value == "true")
{
- af.SetCachingEnabled(true);
+ regionAttributesFactory.SetCachingEnabled(true);
}
else
{
- af.SetCachingEnabled(false);
+ regionAttributesFactory.SetCachingEnabled(false);
}
break;
case "load-factor":
float lf = float.Parse(value);
- af.SetLoadFactor(lf);
+ regionAttributesFactory.SetLoadFactor(lf);
break;
case "concurrency-level":
int cl = int.Parse(value);
- af.SetConcurrencyLevel(cl);
+ regionAttributesFactory.SetConcurrencyLevel(cl);
break;
case "lru-entries-limit":
uint lel = uint.Parse(value);
- af.SetLruEntriesLimit(lel);
+ regionAttributesFactory.SetLruEntriesLimit(lel);
break;
case "initial-capacity":
int ic = int.Parse(value);
- af.SetInitialCapacity(ic);
+ regionAttributesFactory.SetInitialCapacity(ic);
break;
case "disk-policy":
if (value == "none")
{
- af.SetDiskPolicy(Apache.Geode.Client.DiskPolicyType.None);
+ regionAttributesFactory.SetDiskPolicy(Apache.Geode.Client.DiskPolicyType.None);
}
else if (value == "overflows")
{
- af.SetDiskPolicy(Apache.Geode.Client.DiskPolicyType.Overflows);
+ regionAttributesFactory.SetDiskPolicy(Apache.Geode.Client.DiskPolicyType.Overflows);
}
else
{
@@ -247,11 +247,11 @@ namespace Apache.Geode.Client.FwkLib
case "pool-name":
if (value.Length != 0)
{
- af.SetPoolName(value);
+ regionAttributesFactory.SetPoolName(value);
}
else
{
- af.SetPoolName(value);
+ regionAttributesFactory.SetPoolName(value);
}
break;
@@ -265,7 +265,7 @@ namespace Apache.Geode.Client.FwkLib
XmlAttributeCollection exAttrColl = nlrttl.Attributes;
Apache.Geode.Client.ExpirationAction action = StrToExpirationAction(exAttrColl["action"].Value);
string rttl = exAttrColl["timeout"].Value;
- af.SetRegionTimeToLive(action, TimeSpan.FromSeconds(uint.Parse(rttl)));
+ regionAttributesFactory.SetRegionTimeToLive(action, TimeSpan.FromSeconds(uint.Parse(rttl)));
}
else
{
@@ -280,7 +280,7 @@ namespace Apache.Geode.Client.FwkLib
XmlAttributeCollection exAttrColl = nlrit.Attributes;
Apache.Geode.Client.ExpirationAction action = StrToExpirationAction(exAttrColl["action"].Value);
string rit = exAttrColl["timeout"].Value;
- af.SetRegionIdleTimeout(action, TimeSpan.FromSeconds(uint.Parse(rit)));
+ regionAttributesFactory.SetRegionIdleTimeout(action, TimeSpan.FromSeconds(uint.Parse(rit)));
}
else
{
@@ -295,7 +295,7 @@ namespace Apache.Geode.Client.FwkLib
XmlAttributeCollection exAttrColl = nlettl.Attributes;
Apache.Geode.Client.ExpirationAction action = StrToExpirationAction(exAttrColl["action"].Value);
string ettl = exAttrColl["timeout"].Value;
- af.SetEntryTimeToLive(action, TimeSpan.FromSeconds(uint.Parse(ettl)));
+ regionAttributesFactory.SetEntryTimeToLive(action, TimeSpan.FromSeconds(uint.Parse(ettl)));
}
else
{
@@ -310,7 +310,7 @@ namespace Apache.Geode.Client.FwkLib
XmlAttributeCollection exAttrColl = nleit.Attributes;
Apache.Geode.Client.ExpirationAction action = StrToExpirationAction(exAttrColl["action"].Value);
string eit = exAttrColl["timeout"].Value;
- af.SetEntryIdleTimeout(action, TimeSpan.FromSeconds(uint.Parse(eit)));
+ regionAttributesFactory.SetEntryIdleTimeout(action, TimeSpan.FromSeconds(uint.Parse(eit)));
}
else
{
@@ -346,7 +346,7 @@ namespace Apache.Geode.Client.FwkLib
loaderlibrary + '.' + loaderfunction;
loaderlibrary = "FwkLib";
}
- af.SetCacheLoader(loaderlibrary, loaderfunction);
+ regionAttributesFactory.SetCacheLoader(loaderlibrary, loaderfunction);
}
break;
@@ -377,9 +377,9 @@ namespace Apache.Geode.Client.FwkLib
listenerfunction = myType.Namespace + '.' +
listenerlibrary + '.' + listenerfunction;
listenerlibrary = "FwkLib";
-
+
}
- af.SetCacheListener(listenerlibrary, listenerfunction);
+ regionAttributesFactory.SetCacheListener(listenerlibrary, listenerfunction);
}
break;
@@ -411,7 +411,7 @@ namespace Apache.Geode.Client.FwkLib
writerlibrary + '.' + writerfunction;
writerlibrary = "FwkLib";
}
- af.SetCacheWriter(writerlibrary, writerfunction);
+ regionAttributesFactory.SetCacheWriter(writerlibrary, writerfunction);
}
break;
@@ -459,7 +459,7 @@ namespace Apache.Geode.Client.FwkLib
}
}
}
- af.SetPersistenceManager(pmlibrary, pmfunction, prop);
+ regionAttributesFactory.SetPersistenceManager(pmlibrary, pmfunction, prop);
break;
}
}
diff --git a/tests/cli/NewFwkLib/EventTest/EventTests.cs b/tests/cli/NewFwkLib/EventTest/EventTests.cs
index 6f3f8f1..d3a8f3a 100644
--- a/tests/cli/NewFwkLib/EventTest/EventTests.cs
+++ b/tests/cli/NewFwkLib/EventTest/EventTests.cs
@@ -1358,10 +1358,10 @@ namespace Apache.Geode.Client.FwkLib
{
string fullName = parentRegion.FullPath;
- RegionAttributes atts = parentRegion.Attributes;
- AttributesFactory fact = new AttributesFactory(atts);
- atts = fact.CreateRegionAttributes();
- region = parentRegion.CreateSubRegion(sRegionName, atts);
+ var regionAttributes = parentRegion.Attributes;
+ var regionAttributesFactory = new AttributesFactory(regionAttributes);
+ regionAttributes = regionAttributesFactory.Create();
+ region = parentRegion.CreateSubRegion(sRegionName, regionAttributes);
Util.BBSet(EventCountersBB, sRegionName, fullName);
}
diff --git a/tests/cpp/fwklib/FrameworkTest.cpp b/tests/cpp/fwklib/FrameworkTest.cpp
index 1e40031..33172dd 100644
--- a/tests/cpp/fwklib/FrameworkTest.cpp
+++ b/tests/cpp/fwklib/FrameworkTest.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-#include <geode/AttributesFactory.hpp>
+#include <geode/RegionAttributesFactory.hpp>
#include <geode/PoolFactory.hpp>
#include <geode/internal/chrono/duration.hpp>
diff --git a/tests/cpp/fwklib/FwkObjects.hpp b/tests/cpp/fwklib/FwkObjects.hpp
index 9f3526e..acd7539 100644
--- a/tests/cpp/fwklib/FwkObjects.hpp
+++ b/tests/cpp/fwklib/FwkObjects.hpp
@@ -33,7 +33,7 @@
#include <geode/Properties.hpp>
#include <geode/ExpirationAction.hpp>
#include <geode/RegionAttributes.hpp>
-#include <geode/AttributesFactory.hpp>
+#include <geode/RegionAttributesFactory.hpp>
#include <geode/PoolManager.hpp>
#include <geode/internal/chrono/duration.hpp>
@@ -365,7 +365,7 @@ class PersistManager {
// ----------------------------------------------------------------------------
class Attributes {
- AttributesFactory m_factory;
+ RegionAttributesFactory m_factory;
bool m_isLocal;
bool m_withPool;
@@ -440,8 +440,8 @@ class Attributes {
public:
Attributes(const DOMNode* node);
- std::shared_ptr<RegionAttributes> getAttributes() {
- return m_factory.createRegionAttributes();
+ RegionAttributes getAttributes() {
+ return m_factory.create();
}
void setPoolName(std::string val) {
@@ -477,8 +477,10 @@ class FwkRegion {
}
const std::string& getName() const { return m_name; }
+
Attributes* getAttributes() { return m_attributes; }
- const std::shared_ptr<RegionAttributes> getAttributesPtr() const {
+
+ const RegionAttributes getRegionAttributes() const {
return m_attributes->getAttributes();
}
void print() const { FWKINFO("FwkRegion " << m_name); }
diff --git a/tests/cpp/fwklib/RegionHelper.hpp b/tests/cpp/fwklib/RegionHelper.hpp
index 11031f8..5f23202 100644
--- a/tests/cpp/fwklib/RegionHelper.hpp
+++ b/tests/cpp/fwklib/RegionHelper.hpp
@@ -62,7 +62,7 @@ class RegionHelper {
}
std::string regionAttributesToString() {
- auto atts = m_region->getAttributesPtr();
+ auto atts = m_region->getRegionAttributes();
return regionAttributesToString(atts);
}
@@ -71,15 +71,15 @@ class RegionHelper {
const std::string specName() { return m_spec; }
std::string regionTag() {
- auto atts = m_region->getAttributesPtr();
+ auto atts = m_region->getRegionAttributes();
return regionTag(atts);
}
- static std::string regionTag(std::shared_ptr<RegionAttributes> attr) {
+ static std::string regionTag(RegionAttributes regionAttributes) {
std::string sString;
- sString += attr->getCachingEnabled() ? "Caching" : "NoCache";
- sString += (attr->getCacheListener() == nullptr) ? "Nlstnr" : "Lstnr";
+ sString += regionAttributes.getCachingEnabled() ? "Caching" : "NoCache";
+ sString += (regionAttributes.getCacheListener() == nullptr) ? "Nlstnr" : "Lstnr";
return sString;
}
@@ -103,121 +103,121 @@ class RegionHelper {
* @retval A String representing aRegion.
*/
static std::string regionAttributesToString(
- std::shared_ptr<RegionAttributes>& attr) {
+ RegionAttributes regionAttributes) {
std::string sString;
sString += "\ncaching: ";
- sString += attr->getCachingEnabled() ? "Enabled" : "Disabled";
+ sString += regionAttributes.getCachingEnabled() ? "Enabled" : "Disabled";
sString += "\nendpoints: ";
- sString += attr->getEndpoints();
+ sString += regionAttributes.getEndpoints();
sString += "\nclientNotification: ";
- sString += attr->getClientNotificationEnabled() ? "Enabled" : "Disabled";
+ sString += regionAttributes.getClientNotificationEnabled() ? "Enabled" : "Disabled";
sString += "\ninitialCapacity: ";
- sString += std::to_string(attr->getInitialCapacity());
+ sString += std::to_string(regionAttributes.getInitialCapacity());
sString += "\nloadFactor: ";
- sString += std::to_string(attr->getLoadFactor());
+ sString += std::to_string(regionAttributes.getLoadFactor());
sString += "\nconcurrencyLevel: ";
- sString += std::to_string(attr->getConcurrencyLevel());
+ sString += std::to_string(regionAttributes.getConcurrencyLevel());
sString += "\nlruEntriesLimit: ";
- sString += std::to_string(attr->getLruEntriesLimit());
+ sString += std::to_string(regionAttributes.getLruEntriesLimit());
sString += "\nlruEvictionAction: ";
- sString += to_string(attr->getLruEvictionAction());
+ sString += to_string(regionAttributes.getLruEvictionAction());
sString += "\nentryTimeToLive: ";
sString += apache::geode::internal::chrono::duration::to_string(
- attr->getEntryTimeToLive());
+ regionAttributes.getEntryTimeToLive());
sString += "\nentryTimeToLiveAction: ";
- sString += to_string(attr->getEntryTimeToLiveAction());
+ sString += to_string(regionAttributes.getEntryTimeToLiveAction());
sString += "\nentryIdleTimeout: ";
sString += apache::geode::internal::chrono::duration::to_string(
- attr->getEntryIdleTimeout());
+ regionAttributes.getEntryIdleTimeout());
sString += "\nentryIdleTimeoutAction: ";
- sString += to_string(attr->getEntryIdleTimeoutAction());
+ sString += to_string(regionAttributes.getEntryIdleTimeoutAction());
sString += "\nregionTimeToLive: ";
sString += apache::geode::internal::chrono::duration::to_string(
- attr->getRegionTimeToLive());
+ regionAttributes.getRegionTimeToLive());
sString += "\nregionTimeToLiveAction: ";
- sString += to_string(attr->getRegionTimeToLiveAction());
+ sString += to_string(regionAttributes.getRegionTimeToLiveAction());
sString += "\nregionIdleTimeout: ";
sString += apache::geode::internal::chrono::duration::to_string(
- attr->getRegionIdleTimeout());
+ regionAttributes.getRegionIdleTimeout());
sString += "\nregionIdleTimeoutAction: ";
- sString += to_string(attr->getRegionIdleTimeoutAction());
+ sString += to_string(regionAttributes.getRegionIdleTimeoutAction());
sString += "\npoolName: ";
- sString += attr->getPoolName();
+ sString += regionAttributes.getPoolName();
sString += "\nCacheLoader: ";
- sString += (attr->getCacheLoaderLibrary().empty() ||
- attr->getCacheLoaderFactory().empty())
+ sString += (regionAttributes.getCacheLoaderLibrary().empty() ||
+ regionAttributes.getCacheLoaderFactory().empty())
? "Disabled"
: "Enabled";
sString += "\nCacheWriter: ";
- sString += (attr->getCacheWriterLibrary().empty() ||
- attr->getCacheWriterFactory().empty())
+ sString += (regionAttributes.getCacheWriterLibrary().empty() ||
+ regionAttributes.getCacheWriterFactory().empty())
? "Disabled"
: "Enabled";
sString += "\nCacheListener: ";
- sString += (attr->getCacheListenerLibrary().empty() ||
- attr->getCacheListenerFactory().empty())
+ sString += (regionAttributes.getCacheListenerLibrary().empty() ||
+ regionAttributes.getCacheListenerFactory().empty())
? "Disabled"
: "Enabled";
sString += "\nConcurrencyChecksEnabled: ";
- sString += attr->getConcurrencyChecksEnabled() ? "Enabled" : "Disabled";
+ sString += regionAttributes.getConcurrencyChecksEnabled() ? "Enabled" : "Disabled";
sString += "\n";
return sString;
}
void setRegionAttributes(RegionFactory& regionFac) {
- auto atts = m_region->getAttributesPtr();
- regionFac.setCachingEnabled(atts->getCachingEnabled());
- if (!(atts->getCacheListenerLibrary().empty() ||
- atts->getCacheListenerFactory().empty())) {
- regionFac.setCacheListener(atts->getCacheListenerLibrary(),
- atts->getCacheListenerFactory());
+ auto regionAttributes = m_region->getRegionAttributes();
+ regionFac.setCachingEnabled(regionAttributes.getCachingEnabled());
+ if (!(regionAttributes.getCacheListenerLibrary().empty() ||
+ regionAttributes.getCacheListenerFactory().empty())) {
+ regionFac.setCacheListener(regionAttributes.getCacheListenerLibrary(),
+ regionAttributes.getCacheListenerFactory());
}
- if (!(atts->getCacheLoaderLibrary().empty() ||
- atts->getCacheLoaderFactory().empty())) {
- regionFac.setCacheLoader(atts->getCacheLoaderLibrary(),
- atts->getCacheLoaderFactory());
+ if (!(regionAttributes.getCacheLoaderLibrary().empty() ||
+ regionAttributes.getCacheLoaderFactory().empty())) {
+ regionFac.setCacheLoader(regionAttributes.getCacheLoaderLibrary(),
+ regionAttributes.getCacheLoaderFactory());
}
- if (!(atts->getCacheWriterLibrary().empty() ||
- atts->getCacheWriterFactory().empty())) {
- regionFac.setCacheWriter(atts->getCacheWriterLibrary(),
- atts->getCacheWriterFactory());
+ if (!(regionAttributes.getCacheWriterLibrary().empty() ||
+ regionAttributes.getCacheWriterFactory().empty())) {
+ regionFac.setCacheWriter(regionAttributes.getCacheWriterLibrary(),
+ regionAttributes.getCacheWriterFactory());
}
- if (atts->getEntryIdleTimeout().count() != 0) {
- regionFac.setEntryIdleTimeout(atts->getEntryIdleTimeoutAction(),
- atts->getEntryIdleTimeout());
+ if (regionAttributes.getEntryIdleTimeout().count() != 0) {
+ regionFac.setEntryIdleTimeout(regionAttributes.getEntryIdleTimeoutAction(),
+ regionAttributes.getEntryIdleTimeout());
}
- if (atts->getEntryTimeToLive().count() != 0) {
- regionFac.setEntryTimeToLive(atts->getEntryTimeToLiveAction(),
- atts->getEntryTimeToLive());
+ if (regionAttributes.getEntryTimeToLive().count() != 0) {
+ regionFac.setEntryTimeToLive(regionAttributes.getEntryTimeToLiveAction(),
+ regionAttributes.getEntryTimeToLive());
}
- if (atts->getRegionIdleTimeout().count() != 0) {
- regionFac.setRegionIdleTimeout(atts->getRegionIdleTimeoutAction(),
- atts->getRegionIdleTimeout());
+ if (regionAttributes.getRegionIdleTimeout().count() != 0) {
+ regionFac.setRegionIdleTimeout(regionAttributes.getRegionIdleTimeoutAction(),
+ regionAttributes.getRegionIdleTimeout());
}
- if (atts->getRegionTimeToLive().count() != 0) {
- regionFac.setRegionTimeToLive(atts->getRegionTimeToLiveAction(),
- atts->getRegionTimeToLive());
+ if (regionAttributes.getRegionTimeToLive().count() != 0) {
+ regionFac.setRegionTimeToLive(regionAttributes.getRegionTimeToLiveAction(),
+ regionAttributes.getRegionTimeToLive());
}
- if (!(atts->getPartitionResolverLibrary().empty() ||
- atts->getPartitionResolverFactory().empty())) {
- regionFac.setPartitionResolver(atts->getPartitionResolverLibrary(),
- atts->getPartitionResolverFactory());
+ if (!(regionAttributes.getPartitionResolverLibrary().empty() ||
+ regionAttributes.getPartitionResolverFactory().empty())) {
+ regionFac.setPartitionResolver(regionAttributes.getPartitionResolverLibrary(),
+ regionAttributes.getPartitionResolverFactory());
}
- if (!(atts->getPersistenceLibrary().empty() ||
- atts->getPersistenceFactory().empty())) {
- regionFac.setPersistenceManager(atts->getPersistenceLibrary(),
- atts->getPersistenceFactory(),
- atts->getPersistenceProperties());
+ if (!(regionAttributes.getPersistenceLibrary().empty() ||
+ regionAttributes.getPersistenceFactory().empty())) {
+ regionFac.setPersistenceManager(regionAttributes.getPersistenceLibrary(),
+ regionAttributes.getPersistenceFactory(),
+ regionAttributes.getPersistenceProperties());
}
- regionFac.setInitialCapacity(atts->getInitialCapacity());
- regionFac.setLoadFactor(atts->getLoadFactor());
- regionFac.setConcurrencyLevel(atts->getConcurrencyLevel());
- regionFac.setLruEntriesLimit(atts->getLruEntriesLimit());
- regionFac.setDiskPolicy(atts->getDiskPolicy());
- regionFac.setCloningEnabled(atts->getCloningEnabled());
- regionFac.setPoolName(atts->getPoolName());
- regionFac.setConcurrencyChecksEnabled(atts->getConcurrencyChecksEnabled());
+ regionFac.setInitialCapacity(regionAttributes.getInitialCapacity());
+ regionFac.setLoadFactor(regionAttributes.getLoadFactor());
+ regionFac.setConcurrencyLevel(regionAttributes.getConcurrencyLevel());
+ regionFac.setLruEntriesLimit(regionAttributes.getLruEntriesLimit());
+ regionFac.setDiskPolicy(regionAttributes.getDiskPolicy());
+ regionFac.setCloningEnabled(regionAttributes.getCloningEnabled());
+ regionFac.setPoolName(regionAttributes.getPoolName());
+ regionFac.setConcurrencyChecksEnabled(regionAttributes.getConcurrencyChecksEnabled());
}
std::shared_ptr<Region> createRootRegion(std::shared_ptr<Cache>& cachePtr) {
@@ -241,8 +241,8 @@ class RegionHelper {
auto regionFac =
cachePtr->createRegionFactory(RegionShortcut::CACHING_PROXY);
setRegionAttributes(regionFac);
- auto atts = m_region->getAttributesPtr();
- const auto& poolName = atts->getPoolName();
+ auto regionAttributes = m_region->getRegionAttributes();
+ const auto& poolName = regionAttributes.getPoolName();
auto region = regionFac.create(regionName.c_str());
FWKINFO("Region created with name = " << regionName + " and pool name= "
<< poolName);
--
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.