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 2017/10/10 18:28:55 UTC
[geode-native] branch develop updated: GEODE-3765: Rethrow test
client exceptions in testing framework
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 1a1ad55 GEODE-3765: Rethrow test client exceptions in testing framework
1a1ad55 is described below
commit 1a1ad55e1cc65edfc4e3e352e8f0dab1335c0f89
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Tue Oct 10 11:28:50 2017 -0700
GEODE-3765: Rethrow test client exceptions in testing framework
- Fix broken tests that showed up after identifying flaw in test framework
- Converts global PdxTypeRegistry to instance.
- Pass managed cache to each child class.
- Fixes CLI FunctionExecutionTests
- Pass all manage Cache creation through CacheResolver
- Fixes CLI ThinClientQueryTestsN
- GEODE-3565: Remove default Server/Locator with Pool
---
.../integration-test/ThinClientCallbackArgN.cs | 5 +-
.../ThinClientFunctionExecutionTestsN.cs | 6 +-
clicache/integration-test/ThinClientPdxTests.cs | 10 +-
clicache/integration-test/ThinClientPoolTestsN.cs | 6 +-
clicache/integration-test/ThinClientQueryTestsN.cs | 162 ++++++----
clicache/src/CMakeLists.txt | 2 +-
clicache/src/Cache.cpp | 16 +-
clicache/src/Cache.hpp | 38 ++-
clicache/src/CacheFactory.cpp | 6 +-
clicache/src/CacheableBuiltins.hpp | 27 +-
clicache/src/CacheableHashSet.hpp | 6 +-
clicache/src/DataInput.cpp | 20 +-
clicache/src/DataInput.hpp | 17 +-
clicache/src/DataOutput.cpp | 21 +-
clicache/src/DataOutput.hpp | 28 +-
clicache/src/Execution.cpp | 4 +-
clicache/src/IGeodeCache.hpp | 7 +-
clicache/src/IRegion.hpp | 1 -
clicache/src/IRegionService.hpp | 18 +-
clicache/src/LocalRegion.cpp | 86 +++---
clicache/src/Properties.cpp | 8 +-
clicache/src/Properties.hpp | 13 -
clicache/src/Query.cpp | 2 +-
clicache/src/Region.cpp | 112 +++----
clicache/src/ResultCollector.cpp | 2 +-
clicache/src/Serializable.cpp | 88 +++---
clicache/src/Serializable.hpp | 18 +-
clicache/src/StatisticsFactory.cpp | 11 -
clicache/src/TransactionEvent.cpp | 9 +-
clicache/src/impl/AuthenticatedCache.cpp | 2 +-
clicache/src/impl/CacheLoader.hpp | 3 +-
clicache/src/impl/CacheResolver.cpp | 45 +++
clicache/src/impl/CacheResolver.hpp | 58 ++++
clicache/src/impl/DelegateWrapper.hpp | 23 +-
clicache/src/impl/FixedPartitionResolver.hpp | 2 +-
clicache/src/impl/ManagedCacheListener.cpp | 6 +-
clicache/src/impl/ManagedCacheWriter.cpp | 6 +-
clicache/src/impl/ManagedCacheableDelta.cpp | 23 +-
clicache/src/impl/ManagedCacheableDelta.hpp | 1 +
clicache/src/impl/ManagedCacheableDeltaBytes.cpp | 338 ---------------------
clicache/src/impl/ManagedCacheableDeltaBytes.hpp | 218 -------------
clicache/src/impl/ManagedCacheableKey.cpp | 9 +-
clicache/src/impl/ManagedCacheableKey.hpp | 20 +-
clicache/src/impl/ManagedCacheableKeyBytes.cpp | 282 -----------------
clicache/src/impl/ManagedCacheableKeyBytes.hpp | 208 -------------
clicache/src/impl/PartitionResolver.hpp | 2 +-
clicache/src/impl/PdxHelper.cpp | 97 +++---
clicache/src/impl/PdxHelper.hpp | 4 +-
clicache/src/impl/PdxInstanceFactoryImpl.cpp | 10 +-
clicache/src/impl/PdxInstanceFactoryImpl.hpp | 12 +-
clicache/src/impl/PdxInstanceImpl.cpp | 20 +-
clicache/src/impl/PdxInstanceImpl.hpp | 22 +-
clicache/src/impl/PdxLocalReader.cpp | 9 +-
clicache/src/impl/PdxLocalReader.hpp | 4 +-
clicache/src/impl/PdxLocalWriter.cpp | 43 ++-
clicache/src/impl/PdxLocalWriter.hpp | 37 +--
clicache/src/impl/PdxManagedCacheableKey.cpp | 27 +-
clicache/src/impl/PdxManagedCacheableKey.hpp | 4 +-
clicache/src/impl/PdxManagedCacheableKeyBytes.cpp | 289 ------------------
clicache/src/impl/PdxManagedCacheableKeyBytes.hpp | 247 ---------------
clicache/src/impl/PdxRemoteWriter.cpp | 4 +-
clicache/src/impl/PdxRemoteWriter.hpp | 2 +-
clicache/src/impl/PdxType.cpp | 25 +-
clicache/src/impl/PdxType.hpp | 10 +-
clicache/src/impl/PdxTypeRegistry.cpp | 23 +-
clicache/src/impl/PdxTypeRegistry.hpp | 65 ++--
clicache/src/impl/PersistenceManagerProxy.hpp | 2 +-
clicache/src/impl/SafeConvert.hpp | 208 ++++---------
cppcache/integration-test/CacheHelper.cpp | 1 +
cppcache/src/PoolFactory.cpp | 6 -
.../src/statistics/StatisticDescriptorImpl.cpp | 27 +-
.../src/statistics/StatisticDescriptorImpl.hpp | 56 ++--
tests/cli/FwkClient/ClientComm.cs | 1 +
73 files changed, 845 insertions(+), 2405 deletions(-)
diff --git a/clicache/integration-test/ThinClientCallbackArgN.cs b/clicache/integration-test/ThinClientCallbackArgN.cs
index 8d8ff5b..745689a 100644
--- a/clicache/integration-test/ThinClientCallbackArgN.cs
+++ b/clicache/integration-test/ThinClientCallbackArgN.cs
@@ -248,6 +248,8 @@ namespace Apache.Geode.Client.UnitTests
GIRegion region = null;
region = CacheHelper.CreateTCRegion_Pool<int, object>(RegionName, true, caching,
callbackLis, locators, "__TESTPOOL1_", true);
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
}
public void ValidateLocalListenerWriterData()
@@ -341,9 +343,6 @@ namespace Apache.Geode.Client.UnitTests
{
m_isSet = true;
m_callbackarg = new Portfolio(1, 1);
- //TODO:;split
- Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
- Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
}
}
diff --git a/clicache/integration-test/ThinClientFunctionExecutionTestsN.cs b/clicache/integration-test/ThinClientFunctionExecutionTestsN.cs
index 2fcb1ba..8ce4f8e 100644
--- a/clicache/integration-test/ThinClientFunctionExecutionTestsN.cs
+++ b/clicache/integration-test/ThinClientFunctionExecutionTestsN.cs
@@ -973,7 +973,7 @@ namespace Apache.Geode.Client.UnitTests
Util.Log("filter count= {0}.", filter.Length);
Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
- IResultCollector<object> rc = exc.WithArgs<Object>(args).WithFilter<object>(filter).Execute(FuncTimeOutName, 5000);
+ IResultCollector<object> rc = exc.WithArgs<Object>(args).WithFilter<object>(filter).Execute(FuncTimeOutName, 5000 * 1000);
ICollection<object> FunctionResult = rc.GetResult();
Util.Log("ExecuteFETimeOut onRegion FunctionResult.Count = {0} ", FunctionResult.Count);
foreach (Boolean item in FunctionResult)
@@ -987,7 +987,7 @@ namespace Apache.Geode.Client.UnitTests
Pool pool = CacheHelper.DCache.GetPoolManager().Find(poolName);
Execution<object> excs = Client.FunctionService<object>.OnServer(pool);
- IResultCollector<object> rcs = excs.WithArgs<Object>(args).Execute(FuncTimeOutName, 5000);
+ IResultCollector<object> rcs = excs.WithArgs<Object>(args).Execute(FuncTimeOutName, 5000 * 1000);
ICollection<object> ServerFunctionResult = rcs.GetResult();
Util.Log("ExecuteFETimeOut onServer FunctionResult.Count = {0} ", ServerFunctionResult.Count);
foreach (Boolean item in ServerFunctionResult)
@@ -999,7 +999,7 @@ namespace Apache.Geode.Client.UnitTests
Execution<object> excss = Client.FunctionService<object>.OnServers(pool);
- IResultCollector<object> rcss = excss.WithArgs<Object>(args).Execute(FuncTimeOutName, 5000);
+ IResultCollector<object> rcss = excss.WithArgs<Object>(args).Execute(FuncTimeOutName, 5000 * 1000);
ICollection<object> ServerFunctionResults = rcss.GetResult();
Util.Log("ExecuteFETimeOut onServer FunctionResult.Count = {0} ", ServerFunctionResults.Count);
foreach (Boolean item in ServerFunctionResults)
diff --git a/clicache/integration-test/ThinClientPdxTests.cs b/clicache/integration-test/ThinClientPdxTests.cs
index 66a7935..9276d50 100755
--- a/clicache/integration-test/ThinClientPdxTests.cs
+++ b/clicache/integration-test/ThinClientPdxTests.cs
@@ -1296,11 +1296,11 @@ namespace Apache.Geode.Client.UnitTests
region0[1] = pRet;
if (m_useWeakHashMap == false)
{
- Assert.AreEqual(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData(), 0);
+ Assert.AreEqual(CacheHelper.DCache.GetPdxTypeRegistry().testNumberOfPreservedData(), 0);
}
else
{
- Assert.IsTrue(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData() > 0);
+ Assert.IsTrue(CacheHelper.DCache.GetPdxTypeRegistry().testNumberOfPreservedData() > 0);
}
}
@@ -1323,12 +1323,12 @@ namespace Apache.Geode.Client.UnitTests
if (m_useWeakHashMap == false)
{
- Assert.AreEqual(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData(), 0);
+ Assert.AreEqual(CacheHelper.DCache.GetPdxTypeRegistry().testNumberOfPreservedData(), 0);
}
else
{
//it has extra fields, so no need to preserve data
- Assert.IsTrue(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData() == 0);
+ Assert.IsTrue(CacheHelper.DCache.GetPdxTypeRegistry().testNumberOfPreservedData() == 0);
}
}
@@ -2516,7 +2516,7 @@ namespace Apache.Geode.Client.UnitTests
ret = region0[2];
Util.Log("Put from pool-2 completed");
- int pdxIds = Apache.Geode.Client.Internal.PdxTypeRegistry.testGetNumberOfPdxIds();
+ int pdxIds = CacheHelper.DCache.GetPdxTypeRegistry().testGetNumberOfPdxIds();
Assert.AreEqual(3, pdxIds);
}
diff --git a/clicache/integration-test/ThinClientPoolTestsN.cs b/clicache/integration-test/ThinClientPoolTestsN.cs
index 32e0d5e..d2a3538 100644
--- a/clicache/integration-test/ThinClientPoolTestsN.cs
+++ b/clicache/integration-test/ThinClientPoolTestsN.cs
@@ -263,9 +263,9 @@ namespace Apache.Geode.Client.UnitTests
Assert.AreEqual("test_pool_2", poolNameRegion2);
Assert.AreEqual("test_pool_2", poolNameSubRegion);
- Pool poolOfRegion1 = CacheHelper.DCache.GetPoolManager().Find(poolNameRegion1);
- Pool poolOfRegion2 = CacheHelper.DCache.GetPoolManager().Find(poolNameRegion2);
- Pool poolOfSubRegion = CacheHelper.DCache.GetPoolManager().Find(poolNameSubRegion);
+ Pool poolOfRegion1 = cache.GetPoolManager().Find(poolNameRegion1);
+ Pool poolOfRegion2 = cache.GetPoolManager().Find(poolNameRegion2);
+ Pool poolOfSubRegion = cache.GetPoolManager().Find(poolNameSubRegion);
string[] locators = new string[1] { "localhost:" + CacheHelper.LOCATOR_PORT_1 };
string[] servers = new string[2] { "localhost:" + CacheHelper.HOST_PORT_1, "localhost:" + CacheHelper.HOST_PORT_2 };
diff --git a/clicache/integration-test/ThinClientQueryTestsN.cs b/clicache/integration-test/ThinClientQueryTestsN.cs
index ef6c0e1..63d8e8a 100644
--- a/clicache/integration-test/ThinClientQueryTestsN.cs
+++ b/clicache/integration-test/ThinClientQueryTestsN.cs
@@ -64,7 +64,9 @@ namespace Apache.Geode.Client.UnitTests
[TearDown]
public override void EndTest()
{
- CacheHelper.StopJavaServers();
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+ CacheHelper.StopJavaServers();
base.EndTest();
}
@@ -91,16 +93,20 @@ namespace Apache.Geode.Client.UnitTests
m_isPdx = isPdx;
try
{
- QueryService<object, object> qsFail = null;
- qsFail = CacheHelper.DCache.GetPoolManager().CreateFactory().Create("_TESTFAILPOOL_", CacheHelper.DCache).GetQueryService<object, object>();
- Query<object> qryFail = qsFail.NewQuery("select distinct * from /" + QERegionName);
- ISelectResults<object> resultsFail = qryFail.Execute();
+ var poolFail = CacheHelper.DCache.GetPoolManager().CreateFactory().Create("_TESTFAILPOOL_", CacheHelper.DCache);
+ var qsFail = poolFail.GetQueryService<object, object>();
+ var qryFail = qsFail.NewQuery("select distinct * from /" + QERegionName);
+ var resultsFail = qryFail.Execute();
Assert.Fail("Since no endpoints defined, so exception expected");
}
catch (IllegalStateException ex)
{
Util.Log("Got expected exception: {0}", ex);
}
+ catch (Exception e) {
+ Util.Log("Caught unexpected exception: {0}", e);
+ throw e;
+ }
CacheHelper.CreateTCRegion_Pool<object, object>(QERegionName, true, true,
null, locators, "__TESTPOOL1_", true);
@@ -1863,62 +1869,85 @@ namespace Apache.Geode.Client.UnitTests
static bool m_isPdx = false;
[Test]
- public void RemoteQueryRS()
+ public void RemoteQueryRSWithPdx()
{
- for (int i = 0; i < 2; i++)
- {
- runRemoteQueryRS();
- m_isPdx = true;
- }
- m_isPdx = false;
+ m_isPdx = true;
+ runRemoteQueryRS();
}
- [Test]
- public void RemoteParamQueryRS()
+
+ [Test]
+ public void RemoteQueryRSWithoutPdx()
+ {
+ m_isPdx = false;
+ runRemoteQueryRS();
+ }
+
+ [Test]
+ public void RemoteParamQueryRSWithPdx()
{
- for (int i = 0; i < 2; i++)
- {
- runRemoteParamQueryRS();
- m_isPdx = true;
- }
- m_isPdx = false;
+ m_isPdx = true;
+ runRemoteParamQueryRS();
+
}
- [Test]
- public void RemoteQuerySS()
+ [Test]
+ public void RemoteParamQueryRSWithoutPdx()
+ {
+ m_isPdx = false;
+ runRemoteParamQueryRS();
+
+ }
+
+ [Test]
+ public void RemoteQuerySSWithPdx()
{
- for (int i = 0; i < 2; i++)
- {
- runRemoteQuerySS();
- m_isPdx = true;
- }
- m_isPdx = false;
+ m_isPdx = true;
+ runRemoteQuerySS();
+
}
- [Test]
- public void RemoteParamQuerySS()
+ [Test]
+ public void RemoteQuerySSWithoutPdx()
+ {
+ m_isPdx = false;
+ runRemoteQuerySS();
+
+ }
+
+ [Test]
+ public void RemoteParamQuerySSWithoutPdx()
{
- for (int i = 0; i < 2; i++)
- {
- runRemoteParamQuerySS();
- m_isPdx = true;
- }
+
m_isPdx = false;
+ runRemoteParamQuerySS();
+
}
- [Test]
- [Ignore]
- public void RemoteQueryFailover()
+ [Test]
+ public void RemoteParamQuerySSWithPdx()
+ {
+
+ m_isPdx = true;
+ runRemoteParamQuerySS();
+
+ }
+
+ [Test]
+ public void RemoteQueryFailoverWithPdx()
{
- for (int i = 0; i < 2; i++)
- {
- runRemoteQueryFailover();
- m_isPdx = true;
- }
- m_isPdx = false;
+ m_isPdx = true;
+ runRemoteQueryFailover();
}
- [Test]
+ [Test]
+ public void RemoteQueryFailoverWithoutPdx()
+ {
+ m_isPdx = false;
+ runRemoteQueryFailover();
+ }
+
+ [Test]
[Ignore]
public void RemoteParamQueryFailover()
{
@@ -1931,18 +1960,23 @@ namespace Apache.Geode.Client.UnitTests
}
[Test]
- public void QueryExclusiveness()
+ public void QueryExclusivenessWithoutPdx()
{
- for (int i = 0; i < 2; i++)
- {
- runQueryExclusiveness();
- m_isPdx = true;
- }
- m_isPdx = false;
+ m_isPdx = false;
+ runQueryExclusiveness();
+
}
- [Test]
- [Ignore]
+
+ [Test]
+ public void QueryExclusivenessWithPdx()
+ {
+ m_isPdx = true;
+ runQueryExclusiveness();
+ }
+
+ [Test]
+ [Ignore]
public void QueryTimeout()
{
for (int i = 0; i < 2; i++)
@@ -1965,16 +1999,18 @@ namespace Apache.Geode.Client.UnitTests
m_isPdx = false;
}
- //Successful@8th_march
- [Test]
- public void RegionQuery()
+ [Test]
+ public void RegionQueryWithPdx()
+ {
+ m_isPdx = true;
+ runRegionQuery();
+ }
+
+ [Test]
+ public void RegionQueryWithoutPdx()
{
- for (int i = 0; i < 2; i++)
- {
- runRegionQuery();
- m_isPdx = true;
- }
- m_isPdx = false;
+ m_isPdx = false;
+ runRegionQuery();
}
}
diff --git a/clicache/src/CMakeLists.txt b/clicache/src/CMakeLists.txt
index 80b0c1c..ec43bee 100644
--- a/clicache/src/CMakeLists.txt
+++ b/clicache/src/CMakeLists.txt
@@ -48,7 +48,7 @@ target_link_libraries(Apache.Geode
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clr /wd4947 /doc")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clr /wd4947 /wd4251 /doc")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SHARED_LINKER_FLAGS_STRONG_KEY}")
include_directories(${CMAKE_SOURCE_DIR}/clicache/include)
diff --git a/clicache/src/Cache.cpp b/clicache/src/Cache.cpp
index 3d5d0e1..8fd30c4 100644
--- a/clicache/src/Cache.cpp
+++ b/clicache/src/Cache.cpp
@@ -33,6 +33,8 @@
#include "impl/SafeConvert.hpp"
#include "impl/PdxTypeRegistry.hpp"
#include "impl/PdxInstanceFactoryImpl.hpp"
+#include "CacheTransactionManager.hpp"
+#include "PoolManager.hpp"
#pragma warning(disable:4091)
@@ -46,6 +48,12 @@ namespace Apache
{
namespace native = apache::geode::client;
+ Cache::Cache(native::CachePtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Cache>(nativeptr);
+ m_pdxTypeRegistry = gcnew Apache::Geode::Client::Internal::PdxTypeRegistry(this);
+ }
+
String^ Cache::Name::get( )
{
try
@@ -349,24 +357,24 @@ namespace Apache
IPdxInstanceFactory^ Cache::CreatePdxInstanceFactory(String^ className)
{
- return gcnew Internal::PdxInstanceFactoryImpl(className, (m_nativeptr->get()));
+ return gcnew Internal::PdxInstanceFactoryImpl(className, this);
}
DataInput^ Cache::CreateDataInput(array<Byte>^ buffer, System::Int32 len)
{
- return gcnew DataInput(buffer, len, m_nativeptr->get());
+ return gcnew DataInput(buffer, len, this);
}
DataInput^ Cache::CreateDataInput(array<Byte>^ buffer)
{
- return gcnew DataInput(buffer, m_nativeptr->get());
+ return gcnew DataInput(buffer, this);
}
DataOutput^ Cache::CreateDataOutput()
{
- return gcnew DataOutput( m_nativeptr->get());
+ return gcnew DataOutput(this);
}
PoolFactory^ Cache::GetPoolFactory()
diff --git a/clicache/src/Cache.hpp b/clicache/src/Cache.hpp
index 666e562..20edfc2 100644
--- a/clicache/src/Cache.hpp
+++ b/clicache/src/Cache.hpp
@@ -18,11 +18,8 @@
#pragma once
#include "geode_defs.hpp"
-#include "RegionShortcut.hpp"
#include "IGeodeCache.hpp"
-#include "IRegion.hpp"
-#include "RegionAttributes.hpp"
-#include "PoolManager.hpp"
+#include "native_shared_ptr.hpp"
using namespace System;
@@ -32,16 +29,35 @@ namespace Apache
{
namespace Client
{
+ namespace Internal {
+ ref class PdxTypeRegistry;
+ } // namespace Internal
+
namespace native = apache::geode::client;
generic<class TKey, class TResult>
ref class QueryService;
ref class RegionFactory;
+
enum class ExpirationAction;
+
+ enum class RegionShortcut;
+
ref class DistributedSystem;
+
ref class CacheTransactionManager2PC;
- //ref class FunctionService;
+
+ generic<class TPropKey, class TPropValue>
+ ref class Properties;
+
+ ref class PoolFactory;
+
+ ref class PoolManager;
+
+ ref class DataInput;
+
+ ref class DataOutput;
/// <summary>
/// Provides a distributed cache.
@@ -283,18 +299,22 @@ namespace Apache
return m_nativeptr->get_shared_ptr();
}
+ Apache::Geode::Client::Internal::PdxTypeRegistry^ GetPdxTypeRegistry()
+ {
+ return m_pdxTypeRegistry;
+ }
+
private:
/// <summary>
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Cache(native::CachePtr nativeptr)
- {
- m_nativeptr = gcnew native_shared_ptr<native::Cache>(nativeptr);
- }
+ Cache(native::CachePtr nativeptr);
native_shared_ptr<native::Cache>^ m_nativeptr;
+
+ Apache::Geode::Client::Internal::PdxTypeRegistry^ m_pdxTypeRegistry;
};
} // namespace Client
} // namespace Geode
diff --git a/clicache/src/CacheFactory.cpp b/clicache/src/CacheFactory.cpp
index 385fa41..e418d0c 100644
--- a/clicache/src/CacheFactory.cpp
+++ b/clicache/src/CacheFactory.cpp
@@ -23,6 +23,7 @@
#include "impl/SafeConvert.hpp"
#include "impl/PdxTypeRegistry.hpp"
#include "impl/AppDomainContext.hpp"
+#include "impl/CacheResolver.hpp"
using namespace System;
@@ -66,6 +67,7 @@ namespace Apache
nativeCache = m_nativeptr->get()->create( );
auto cache = Cache::Create( nativeCache );
+ CacheResolver::Add(nativeCache.get(), cache);
if(!m_connected)
{
@@ -108,9 +110,7 @@ namespace Apache
_GF_MG_EXCEPTION_CATCH_ALL2
finally {
GC::KeepAlive(m_nativeptr);
- Apache::Geode::Client::Internal::PdxTypeRegistry::PdxIgnoreUnreadFields = pdxIgnoreUnreadFields;
- Apache::Geode::Client::Internal::PdxTypeRegistry::PdxReadSerialized = pdxReadSerialized;
- DistributedSystem::releaseDisconnectLock();
+ DistributedSystem::releaseDisconnectLock();
}
}
diff --git a/clicache/src/CacheableBuiltins.hpp b/clicache/src/CacheableBuiltins.hpp
index cb3875d..39d145f 100644
--- a/clicache/src/CacheableBuiltins.hpp
+++ b/clicache/src/CacheableBuiltins.hpp
@@ -107,23 +107,22 @@ namespace Apache
/// It invokes the '==' operator of the underlying
/// native object.
/// </summary>
- virtual bool Equals(CacheableBuiltinKey^ other) override
+ virtual bool Equals(ICacheableKey^ other) override
{
- if (other == nullptr)
- {
- return false;
+ if (auto o = dynamic_cast<CacheableBuiltinKey^>(other)) {
+ try
+ {
+ return static_cast<TNative*>(m_nativeptr->get())->operator==(
+ *static_cast<TNative*>(o->m_nativeptr->get()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ GC::KeepAlive(o->m_nativeptr);
+ }
}
- try
- {
- return static_cast<TNative*>(m_nativeptr->get())->operator==(
- *static_cast<TNative*>(other->m_nativeptr->get()));
- }
- finally
- {
- GC::KeepAlive(m_nativeptr);
- GC::KeepAlive(other->m_nativeptr);
- }
+ return false;
}
/// <summary>
diff --git a/clicache/src/CacheableHashSet.hpp b/clicache/src/CacheableHashSet.hpp
index 2b8f09d..3b5e97e 100644
--- a/clicache/src/CacheableHashSet.hpp
+++ b/clicache/src/CacheableHashSet.hpp
@@ -379,7 +379,7 @@ namespace Apache
try
{
- static_cast<HSTYPE*>(m_nativeptr->get())->insert(Serializable::GetUnmanagedValueGeneric(item, nullptr));
+ static_cast<HSTYPE*>(m_nativeptr->get())->insert(Serializable::GetUnmanagedValueGeneric(item));
}
finally
{
@@ -419,7 +419,7 @@ namespace Apache
{
try
{
- return static_cast<HSTYPE*>(m_nativeptr->get())->find(Serializable::GetUnmanagedValueGeneric(item, nullptr)) != static_cast<HSTYPE*>(m_nativeptr->get())->end();
+ return static_cast<HSTYPE*>(m_nativeptr->get())->find(Serializable::GetUnmanagedValueGeneric(item)) != static_cast<HSTYPE*>(m_nativeptr->get())->end();
}
finally
{
@@ -509,7 +509,7 @@ namespace Apache
{
try
{
- return (static_cast<HSTYPE*>(m_nativeptr->get())->erase(Serializable::GetUnmanagedValueGeneric(item, nullptr)) > 0);
+ return (static_cast<HSTYPE*>(m_nativeptr->get())->erase(Serializable::GetUnmanagedValueGeneric(item)) > 0);
}
finally
{
diff --git a/clicache/src/DataInput.cpp b/clicache/src/DataInput.cpp
index a3ca689..85e0363 100644
--- a/clicache/src/DataInput.cpp
+++ b/clicache/src/DataInput.cpp
@@ -20,6 +20,7 @@
#include <GeodeTypeIdsImpl.hpp>
#include "SerializationRegistry.hpp"
#include "CacheRegionHelper.hpp"
+#include "CacheImpl.hpp"
#include "end_native.hpp"
#include <vcclr.h>
@@ -36,6 +37,7 @@
#include "CacheableObjectArray.hpp"
#include "Serializable.hpp"
#include "impl/PdxHelper.hpp"
+#include "impl/PdxWrapper.hpp"
using namespace System;
using namespace System::IO;
@@ -49,7 +51,7 @@ namespace Apache
{
namespace native = apache::geode::client;
- DataInput::DataInput(System::Byte* buffer, int size, const native::Cache* cache)
+ DataInput::DataInput(System::Byte* buffer, int size, Apache::Geode::Client::Cache^ cache)
{
m_ispdxDesrialization = false;
m_isRootObjectPdx = false;
@@ -57,7 +59,7 @@ namespace Apache
if (buffer != nullptr && size > 0) {
_GF_MG_EXCEPTION_TRY2
- m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(cache->createDataInput(buffer, size));
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(cache->GetNative()->createDataInput(buffer, size));
m_cursor = 0;
m_isManagedObject = false;
m_forStringDecode = gcnew array<Char>(100);
@@ -80,7 +82,7 @@ namespace Apache
}
}
- DataInput::DataInput(array<Byte>^ buffer, const native::Cache * cache)
+ DataInput::DataInput(array<Byte>^ buffer, Apache::Geode::Client::Cache^ cache)
{
m_ispdxDesrialization = false;
m_isRootObjectPdx = false;
@@ -92,7 +94,7 @@ namespace Apache
GF_NEW(m_buffer, System::Byte[len]);
pin_ptr<const Byte> pin_buffer = &buffer[0];
memcpy(m_buffer, (void*)pin_buffer, len);
- m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(m_cache->createDataInput(m_buffer, len));
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(m_cache->GetNative()->createDataInput(m_buffer, len));
m_cursor = 0;
m_isManagedObject = false;
@@ -116,7 +118,7 @@ namespace Apache
}
}
- DataInput::DataInput(array<Byte>^ buffer, System::Int32 len, const native::Cache* cache)
+ DataInput::DataInput(array<Byte>^ buffer, System::Int32 len, Apache::Geode::Client::Cache^ cache)
{
m_ispdxDesrialization = false;
m_isRootObjectPdx = false;
@@ -134,7 +136,7 @@ namespace Apache
GF_NEW(m_buffer, System::Byte[len]);
pin_ptr<const Byte> pin_buffer = &buffer[0];
memcpy(m_buffer, (void*)pin_buffer, len);
- m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(m_cache->createDataInput(m_buffer, len));
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(m_cache->GetNative()->createDataInput(m_buffer, len));
try
{
@@ -663,7 +665,7 @@ namespace Apache
int cacheCursor = m_cursor;
System::Byte* cacheBuffer = m_buffer;
unsigned int cacheBufferLength = m_bufferLength;
- Object^ ret = Internal::PdxHelper::DeserializePdx(this, false, CacheRegionHelper::getCacheImpl(m_cache)->getSerializationRegistry().get());
+ Object^ ret = Internal::PdxHelper::DeserializePdx(this, false, CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry().get());
int tmp = m_nativeptr->get()->getBytesRemaining();
m_cursor = cacheBufferLength - tmp;
m_buffer = cacheBuffer;
@@ -672,7 +674,7 @@ namespace Apache
if (ret != nullptr)
{
- PdxWrapper^ pdxWrapper = dynamic_cast<PdxWrapper^>(ret);
+ Apache::Geode::Client::PdxWrapper^ pdxWrapper = dynamic_cast<Apache::Geode::Client::PdxWrapper^>(ret);
if (pdxWrapper != nullptr)
{
@@ -814,7 +816,7 @@ namespace Apache
}
else if (compId == GeodeClassIds::PDX)
{
- return Internal::PdxHelper::DeserializePdx(this, false, CacheRegionHelper::getCacheImpl(m_cache)->getSerializationRegistry().get());
+ return Internal::PdxHelper::DeserializePdx(this, false, CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry().get());
}
else if (compId == GeodeTypeIds::CacheableNullString) {
//return SerializablePtr(CacheableString::createDeserializable());
diff --git a/clicache/src/DataInput.hpp b/clicache/src/DataInput.hpp
index 80ed2b0..0199cf7 100644
--- a/clicache/src/DataInput.hpp
+++ b/clicache/src/DataInput.hpp
@@ -40,6 +40,8 @@ namespace Apache
interface class IGeodeSerializable;
+ ref class Cache;
+
/// <summary>
/// Provides operations for reading primitive data values, byte arrays,
/// strings, <c>IGeodeSerializable</c> objects from a byte stream.
@@ -57,7 +59,7 @@ namespace Apache
/// <exception cref="IllegalArgumentException">
/// if the buffer is null
/// </exception>
- DataInput( array<Byte>^ buffer, const native::Cache* cache );
+ DataInput( array<Byte>^ buffer, Cache^ cache );
/// <summary>
/// Construct <c>DataInput</c> using a given length of an array of
@@ -72,7 +74,7 @@ namespace Apache
/// <exception cref="IllegalArgumentException">
/// if the buffer is null
/// </exception>
- DataInput( array<Byte>^ buffer, System::Int32 len, const native::Cache* cache );
+ DataInput( array<Byte>^ buffer, System::Int32 len, Cache^ cache );
/// <summary>
/// Dispose: frees the internal buffer.
@@ -193,6 +195,11 @@ namespace Apache
System::UInt32 get();
}
+ property Apache::Geode::Client::Cache^ Cache
+ {
+ Apache::Geode::Client::Cache^ get() { return m_cache; }
+ }
+
/// <summary>
/// Advance the cursor of the buffer by the given offset.
/// </summary>
@@ -656,7 +663,7 @@ namespace Apache
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline DataInput( apache::geode::client::DataInput* nativeptr, bool managedObject, const native::Cache* cache )
+ inline DataInput( apache::geode::client::DataInput* nativeptr, bool managedObject, Apache::Geode::Client::Cache^ cache )
{
m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(nativeptr);
m_ispdxDesrialization = false;
@@ -674,7 +681,7 @@ namespace Apache
}
}
- DataInput( System::Byte* buffer, int size, const native::Cache* cache );
+ DataInput( System::Byte* buffer, int size, Apache::Geode::Client::Cache^ cache );
bool IsManagedObject()
{
@@ -694,7 +701,7 @@ namespace Apache
/// </summary>
bool m_ispdxDesrialization;
bool m_isRootObjectPdx;
- const native::Cache* m_cache;
+ Apache::Geode::Client::Cache^ m_cache;
System::Byte* m_buffer;
unsigned int m_bufferLength;
int m_cursor;
diff --git a/clicache/src/DataOutput.cpp b/clicache/src/DataOutput.cpp
index 8b1d1cc..ae50af2 100644
--- a/clicache/src/DataOutput.cpp
+++ b/clicache/src/DataOutput.cpp
@@ -28,6 +28,7 @@
#include "CacheableObjectArray.hpp"
#include "impl/PdxHelper.hpp"
#include "impl/PdxWrapper.hpp"
+#include "Cache.hpp"
using namespace System;
using namespace System::Runtime::InteropServices;
@@ -40,6 +41,24 @@ namespace Apache
namespace Client
{
+ DataOutput::DataOutput(Apache::Geode::Client::Cache^ cache)
+ {
+ m_cache = cache;
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataOutput>(cache->GetNative()->createDataOutput());
+ m_isManagedObject = true;
+ m_cursor = 0;
+ try
+ {
+ m_bytes = const_cast<System::Byte *>(m_nativeptr->get()->getCursor());
+ m_remainingBufferLength = (System::Int32)m_nativeptr->get()->getRemainingBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ m_ispdxSerialization = false;
+ }
+
void DataOutput::WriteByte(Byte value)
{
EnsureCapacity(1);
@@ -456,7 +475,7 @@ namespace Apache
if (m_ispdxSerialization && obj->GetType()->IsEnum)
{
//need to set
- int enumVal = Internal::PdxHelper::GetEnumValue(obj->GetType()->FullName, Enum::GetName(obj->GetType(), obj), obj->GetHashCode(), m_nativeptr->get()->getCache());
+ int enumVal = Internal::PdxHelper::GetEnumValue(obj->GetType()->FullName, Enum::GetName(obj->GetType(), obj), obj->GetHashCode(), m_cache);
WriteByte(GeodeClassIds::PDX_ENUM);
WriteByte(enumVal >> 24);
WriteArrayLen(enumVal & 0xFFFFFF);
diff --git a/clicache/src/DataOutput.hpp b/clicache/src/DataOutput.hpp
index c98245c..dbb0368 100644
--- a/clicache/src/DataOutput.hpp
+++ b/clicache/src/DataOutput.hpp
@@ -20,7 +20,6 @@
#include "geode_defs.hpp"
#include "begin_native.hpp"
#include <geode/DataOutput.hpp>
-#include <geode/Cache.hpp>
#include "end_native.hpp"
#include "native_conditional_unique_ptr.hpp"
@@ -45,6 +44,7 @@ namespace Apache
{
namespace native = apache::geode::client;
+ ref class Cache;
interface class IGeodeSerializable;
/// <summary>
@@ -61,28 +61,14 @@ namespace Apache
System::Int32 m_remainingBufferLength;
bool m_ispdxSerialization;
native_conditional_unique_ptr<native::DataOutput>^ m_nativeptr;
+ Apache::Geode::Client::Cache^ m_cache;
public:
/// <summary>
/// Default constructor.
/// </summary>
- inline DataOutput(native::Cache* cache)
- {
- m_nativeptr = gcnew native_conditional_unique_ptr<native::DataOutput>(cache->createDataOutput());
- m_isManagedObject = true;
- m_cursor = 0;
- try
- {
- m_bytes = const_cast<System::Byte *>(m_nativeptr->get()->getCursor());
- m_remainingBufferLength = (System::Int32)m_nativeptr->get()->getRemainingBufferLength();
- }
- finally
- {
- GC::KeepAlive(m_nativeptr);
- }
- m_ispdxSerialization = false;
- }
+ DataOutput(Apache::Geode::Client::Cache^ cache);
/// <summary>
/// Write length of the array to the <c>DataOutput</c>.
@@ -286,6 +272,11 @@ namespace Apache
{
System::UInt32 get( );
}
+
+ property Apache::Geode::Client::Cache^ Cache
+ {
+ Apache::Geode::Client::Cache^ get() { return m_cache; }
+ }
/// <summary>
/// Reset the cursor to the start of the buffer.
@@ -640,8 +631,9 @@ namespace Apache
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline DataOutput( apache::geode::client::DataOutput* nativeptr, bool managedObject )
+ inline DataOutput(apache::geode::client::DataOutput* nativeptr, bool managedObject, Apache::Geode::Client::Cache^ cache)
{
+ m_cache = cache;
m_nativeptr = gcnew native_conditional_unique_ptr<native::DataOutput>(nativeptr);
m_isManagedObject = managedObject;
m_cursor = 0;
diff --git a/clicache/src/Execution.cpp b/clicache/src/Execution.cpp
index 2ba9187..0a43e9b 100644
--- a/clicache/src/Execution.cpp
+++ b/clicache/src/Execution.cpp
@@ -49,7 +49,7 @@ namespace Apache
for each(TFilter item in routingObj)
{
- rsptr->push_back(Serializable::GetUnmanagedValueGeneric<TFilter>( item, nullptr ));
+ rsptr->push_back(Serializable::GetUnmanagedValueGeneric<TFilter>( item ));
}
try
@@ -74,7 +74,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
try
{
- auto argsptr = Serializable::GetUnmanagedValueGeneric<TArgs>( args, nullptr );
+ auto argsptr = Serializable::GetUnmanagedValueGeneric<TArgs>( args );
return Execution<TResult>::Create(m_nativeptr->get()->withArgs(argsptr), this->m_rc);
}
finally
diff --git a/clicache/src/IGeodeCache.hpp b/clicache/src/IGeodeCache.hpp
index 69bf539..d15d14d 100644
--- a/clicache/src/IGeodeCache.hpp
+++ b/clicache/src/IGeodeCache.hpp
@@ -19,8 +19,7 @@
#include "geode_defs.hpp"
#include "IRegionService.hpp"
-#include "DistributedSystem.hpp"
-#include "CacheTransactionManager.hpp"
+
using namespace System;
using namespace System::Collections::Generic;
@@ -31,6 +30,10 @@ namespace Apache
namespace Client
{
+ ref class DistributedSystem;
+
+ ref class CacheTransactionManager;
+
/// <summary>
/// GeodeCache represents the singleton cache that must be created
/// in order to connect to Geode server.
diff --git a/clicache/src/IRegion.hpp b/clicache/src/IRegion.hpp
index cbbf2eb..01bbb92 100644
--- a/clicache/src/IRegion.hpp
+++ b/clicache/src/IRegion.hpp
@@ -2074,4 +2074,3 @@ namespace Apache
} // namespace Client
} // namespace Geode
} // namespace Apache
- //namespace
diff --git a/clicache/src/IRegionService.hpp b/clicache/src/IRegionService.hpp
index 51f4049..2a4bb96 100644
--- a/clicache/src/IRegionService.hpp
+++ b/clicache/src/IRegionService.hpp
@@ -18,14 +18,6 @@
#pragma once
#include "geode_defs.hpp"
-//#include "geode_includes.hpp"
-#include "QueryService.hpp"
-#include "Region.hpp"
-
-using namespace System;
-using namespace System::Collections::Generic;
-
-
namespace Apache
{
@@ -34,7 +26,17 @@ namespace Apache
namespace Client
{
+ using namespace System;
+ using namespace System::Collections::Generic;
+
+ generic<class TKey, class TValue>
+ interface class IRegion;
+
+ generic<class TKey, class TResult>
+ ref class QueryService;
+
interface class IPdxInstanceFactory;
+
/// <summary>
/// A RegionService provides access to existing regions that exist
/// in a <see cref="Cache" />.
diff --git a/clicache/src/LocalRegion.cpp b/clicache/src/LocalRegion.cpp
index ae80b27..0061364 100644
--- a/clicache/src/LocalRegion.cpp
+++ b/clicache/src/LocalRegion.cpp
@@ -27,6 +27,7 @@
#include "RegionEntry.hpp"
#include "impl/AuthenticatedCache.hpp"
#include "impl/SafeConvert.hpp"
+#include "impl/CacheResolver.hpp"
using namespace System;
@@ -40,7 +41,7 @@ namespace Apache
generic<class TKey, class TValue>
TValue LocalRegion<TKey, TValue>::Get(TKey key, Object^ callbackArg)
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
auto nativeptr= this->getRegionEntryValue(keyptr);
if (nativeptr == nullptr)
{
@@ -77,9 +78,9 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value, m_nativeptr->get()->getCache().get() );
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value );
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
m_nativeptr->get()->localPut( keyptr, valueptr, callbackptr );
}
finally
@@ -93,7 +94,7 @@ namespace Apache
generic<class TKey, class TValue>
TValue LocalRegion<TKey, TValue>::default::get(TKey key)
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
auto nativeptr = this->getRegionEntryValue(keyptr);
if (nativeptr == nullptr)
{
@@ -110,8 +111,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value, m_nativeptr->get()->getCache().get() );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value );
m_nativeptr->get()->localPut( keyptr, valueptr );
}
finally
@@ -220,7 +221,7 @@ namespace Apache
generic<class TKey, class TValue>
bool LocalRegion<TKey, TValue>::Contains(KeyValuePair<TKey,TValue> keyValuePair)
{
- auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key, m_nativeptr->get()->getCache().get() );
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key );
auto nativeptr = this->getRegionEntryValue(keyptr);
//This means that key is not present.
if (nativeptr == nullptr) {
@@ -237,7 +238,7 @@ namespace Apache
try
{
- auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
return m_nativeptr->get()->containsKey(keyptr);
}
finally
@@ -251,7 +252,7 @@ namespace Apache
generic<class TKey, class TValue>
bool LocalRegion<TKey, TValue>::TryGetValue(TKey key, TValue %val)
{
- auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
auto nativeptr = this->getRegionEntryValue(keyptr);
if (nativeptr == nullptr) {
val = TValue();
@@ -325,8 +326,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value, m_nativeptr->get()->getCache().get() );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value );
m_nativeptr->get()->localCreate( keyptr, valueptr );
}
finally
@@ -344,8 +345,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key, m_nativeptr->get()->getCache().get() );
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value, m_nativeptr->get()->getCache().get() );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value );
m_nativeptr->get()->localCreate( keyptr, valueptr );
}
finally
@@ -363,9 +364,9 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value, m_nativeptr->get()->getCache().get() );
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value );
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
m_nativeptr->get()->localCreate( keyptr, valueptr, callbackptr );
}
finally
@@ -383,7 +384,7 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
m_nativeptr->get()->localDestroy(keyptr);
return true;
}
@@ -406,8 +407,8 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
m_nativeptr->get()->localDestroy(keyptr, callbackptr);
return true;
}
@@ -429,8 +430,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key, m_nativeptr->get()->getCache().get() );
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value, m_nativeptr->get()->getCache().get() );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value );
return m_nativeptr->get()->localRemove(keyptr, valueptr);
}
finally
@@ -448,9 +449,9 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
return m_nativeptr->get()->localRemove(keyptr, valueptr, callbackptr);
}
finally
@@ -478,7 +479,7 @@ namespace Apache
try
{
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
m_nativeptr->get()->localInvalidateRegion( callbackptr );
}
finally
@@ -505,7 +506,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
try
{
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
m_nativeptr->get()->localDestroyRegion( callbackptr );
}
finally
@@ -533,8 +534,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
m_nativeptr->get()->localInvalidate( keyptr, callbackptr );
}
finally
@@ -779,7 +780,7 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
auto nativeptr = m_nativeptr->get()->getEntry(keyptr);
return RegionEntry<TKey, TValue>::Create(nativeptr);
}
@@ -822,26 +823,7 @@ namespace Apache
generic<class TKey, class TValue>
IRegionService^ LocalRegion<TKey, TValue>::RegionService::get()
{
- _GF_MG_EXCEPTION_TRY2/* due to auto replace */
-
- try
- {
- auto regionService = m_nativeptr->get()->getRegionService();
- if (auto realCache = std::dynamic_pointer_cast<apache::geode::client::Cache>(regionService))
- {
- return Apache::Geode::Client::Cache::Create(realCache);
- }
- else
- {
- return Apache::Geode::Client::AuthenticatedCache::Create(regionService);
- }
- }
- finally
- {
- GC::KeepAlive(m_nativeptr);
- }
-
- _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return CacheResolver::Lookup(m_nativeptr->get()->getCache().get());
}
generic<class TKey, class TValue>
@@ -851,7 +833,7 @@ namespace Apache
try
{
- return m_nativeptr->get()->containsValueForKey(Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get()));
+ return m_nativeptr->get()->containsValueForKey(Serializable::GetUnmanagedValueGeneric<TKey>(key));
}
finally
{
@@ -886,7 +868,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
try
{
- m_nativeptr->get()->localClear(Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() ) );
+ m_nativeptr->get()->localClear(Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
}
finally
{
diff --git a/clicache/src/Properties.cpp b/clicache/src/Properties.cpp
index 851b3ff..a8312b3 100644
--- a/clicache/src/Properties.cpp
+++ b/clicache/src/Properties.cpp
@@ -69,7 +69,7 @@ namespace Apache
{
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key, nullptr);
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key);
auto nativeptr = m_nativeptr->get()->find(keyptr);
return Serializable::GetManagedValueGeneric<TPropValue>(nativeptr);
}
@@ -82,8 +82,8 @@ namespace Apache
generic<class TPropKey, class TPropValue>
void Properties<TPropKey, TPropValue>::Insert( TPropKey key, TPropValue value )
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key, true, nullptr);
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TPropValue>(value, true, nullptr);
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key, true);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TPropValue>(value, true);
_GF_MG_EXCEPTION_TRY2
@@ -102,7 +102,7 @@ namespace Apache
generic<class TPropKey, class TPropValue>
void Properties<TPropKey, TPropValue>::Remove( TPropKey key)
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key, nullptr);
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key);
_GF_MG_EXCEPTION_TRY2
diff --git a/clicache/src/Properties.hpp b/clicache/src/Properties.hpp
index 25732c3..689cb32 100644
--- a/clicache/src/Properties.hpp
+++ b/clicache/src/Properties.hpp
@@ -283,21 +283,8 @@ namespace Apache
private:
Apache::Geode::Client::PropertyVisitorGeneric<TPropKey, TPropValue>^ m_visitor;
-
};
- /* ref class PropertiesFactory {
- public:
- PropertiesFactory(native::SerializationRegistryPtr serializationRegistry)
- {
- m_serializationRegistry = gcnew native_shared_ptr<native::SerializationRegistry>(serializationRegistry);
- }
- IGeodeSerializable^ CreateDeserializable() {
- return Properties<String^, String^>::CreateDeserializable(m_serializationRegistry->get_shared_ptr());
- }
- private:
- native_shared_ptr<native::SerializationRegistry>^ m_serializationRegistry;
- };*/
} // namespace Client
} // namespace Geode
} // namespace Apache
diff --git a/clicache/src/Query.cpp b/clicache/src/Query.cpp
index 071c51f..f1041f8 100644
--- a/clicache/src/Query.cpp
+++ b/clicache/src/Query.cpp
@@ -70,7 +70,7 @@ namespace Apache
auto rsptr = apache::geode::client::CacheableVector::create();
for( int index = 0; index < paramList->Length; index++ )
{
- auto valueptr = Serializable::GetUnmanagedValueGeneric<Object^>(paramList[index]->GetType(), (Object^)paramList[index], nullptr);
+ auto valueptr = Serializable::GetUnmanagedValueGeneric<Object^>(paramList[index]->GetType(), (Object^)paramList[index]);
rsptr->push_back(valueptr);
}
diff --git a/clicache/src/Region.cpp b/clicache/src/Region.cpp
index ca8ec95..b4985fb 100644
--- a/clicache/src/Region.cpp
+++ b/clicache/src/Region.cpp
@@ -36,6 +36,7 @@
#include "Pool.hpp"
#include "PoolManager.hpp"
#include "SystemProperties.hpp"
+#include "impl/CacheResolver.hpp"
namespace Apache
{
@@ -50,8 +51,8 @@ namespace Apache
generic<class TKey, class TValue>
TValue Region<TKey, TValue>::Get(TKey key, Object^ callbackArg)
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
GC::KeepAlive(m_nativeptr);
auto nativeptr = this->get(keyptr, callbackptr);
if (nativeptr == nullptr)
@@ -116,9 +117,9 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
m_nativeptr->get()->put(keyptr, valueptr, callbackptr);
}
finally
@@ -132,7 +133,7 @@ namespace Apache
generic<class TKey, class TValue>
TValue Region<TKey, TValue>::default::get(TKey key)
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
GC::KeepAlive(m_nativeptr);
auto nativeptr = this->get(keyptr);
if (nativeptr == nullptr)
@@ -150,8 +151,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
m_nativeptr->get()->put(keyptr, valueptr);
}
finally
@@ -263,7 +264,7 @@ namespace Apache
generic<class TKey, class TValue>
bool Region<TKey, TValue>::Contains(KeyValuePair<TKey, TValue> keyValuePair)
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key);
GC::KeepAlive(m_nativeptr);
auto nativeptr = this->get(keyptr);
//This means that key is not present.
@@ -281,7 +282,7 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
return m_nativeptr->get()->containsKeyOnServer(keyptr);
}
finally
@@ -296,7 +297,7 @@ namespace Apache
bool Region<TKey, TValue>::TryGetValue(TKey key, TValue %val)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
GC::KeepAlive(m_nativeptr);
auto nativeptr = this->get(keyptr);
if (nativeptr == nullptr) {
@@ -370,8 +371,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
m_nativeptr->get()->create(keyptr, valueptr);
}
finally
@@ -389,8 +390,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value);
m_nativeptr->get()->create(keyptr, valueptr);
}
finally
@@ -408,9 +409,9 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
m_nativeptr->get()->create(keyptr, valueptr, callbackptr);
}
finally
@@ -428,7 +429,7 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
return m_nativeptr->get()->removeEx(keyptr);
}
finally
@@ -447,8 +448,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
return m_nativeptr->get()->removeEx(keyptr, callbackptr);
}
finally
@@ -466,8 +467,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value);
return m_nativeptr->get()->remove(keyptr, valueptr);
}
finally
@@ -485,9 +486,9 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
GC::KeepAlive(m_nativeptr);
return m_nativeptr->get()->remove(keyptr, valueptr, callbackptr);
}
@@ -516,7 +517,7 @@ namespace Apache
try
{
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
m_nativeptr->get()->invalidateRegion(callbackptr);
}
finally
@@ -544,7 +545,7 @@ namespace Apache
try
{
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
m_nativeptr->get()->destroyRegion(callbackptr);
}
finally
@@ -573,8 +574,8 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
m_nativeptr->get()->invalidate(keyptr, callbackptr);
}
finally
@@ -604,8 +605,8 @@ namespace Apache
native::HashMapOfCacheable nativeMap;
for each (KeyValuePair<TKey, TValue> keyValPair in map)
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value);
nativeMap.emplace(keyptr, valueptr);
}
try
@@ -629,11 +630,11 @@ namespace Apache
native::HashMapOfCacheable nativeMap;
for each (KeyValuePair<TKey, TValue> keyValPair in map)
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key, m_nativeptr->get()->getCache().get());
- native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value);
nativeMap.emplace(keyptr, valueptr);
}
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
try
{
m_nativeptr->get()->putAll(nativeMap, timeout, callbackptr);
@@ -674,7 +675,7 @@ namespace Apache
for each(TKey item in keys)
{
vecKeys.push_back(
- Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+ Serializable::GetUnmanagedValueGeneric<TKey>(item));
}
native::HashMapOfCacheablePtr valuesPtr;
@@ -729,7 +730,7 @@ namespace Apache
for each(TKey item in keys)
{
vecKeys.push_back(
- Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+ Serializable::GetUnmanagedValueGeneric<TKey>(item));
}
native::HashMapOfCacheablePtr valuesPtr;
@@ -741,7 +742,7 @@ namespace Apache
exceptionsPtr = std::make_shared<native::HashMapOfException>();
}
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
try
{
@@ -792,9 +793,9 @@ namespace Apache
native::VectorOfCacheableKey vecKeys;
for each(TKey item in keys)
- vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+ vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item));
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
try
{
@@ -981,7 +982,7 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
auto nativeptr = m_nativeptr->get()->getEntry(keyptr);
return RegionEntry<TKey, TValue>::Create(nativeptr);
}
@@ -1025,26 +1026,7 @@ namespace Apache
generic<class TKey, class TValue>
IRegionService^ Region<TKey, TValue>::RegionService::get()
{
- _GF_MG_EXCEPTION_TRY2/* due to auto replace */
-
- try
- {
- auto regionService = m_nativeptr->get()->getRegionService();
- if (auto realCache = std::dynamic_pointer_cast<native::Cache>(regionService))
- {
- return Apache::Geode::Client::Cache::Create(realCache);
- }
- else
- {
- return Apache::Geode::Client::AuthenticatedCache::Create(regionService);
- }
- }
- finally
- {
- GC::KeepAlive(m_nativeptr);
- }
-
- _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return CacheResolver::Lookup(m_nativeptr->get()->getCache().get());
}
generic<class TKey, class TValue>
@@ -1054,7 +1036,7 @@ namespace Apache
try
{
- native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
return m_nativeptr->get()->containsValueForKey(keyptr);
}
finally
@@ -1092,7 +1074,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
try
{
- native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ native::SerializablePtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
m_nativeptr->get()->clear(callbackptr);
}
finally
@@ -1183,7 +1165,7 @@ namespace Apache
for each(TKey item in keys)
{
- vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+ vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item));
}
try
{
@@ -1210,7 +1192,7 @@ namespace Apache
for each(TKey item in keys)
{
vecKeys.push_back(
- Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+ Serializable::GetUnmanagedValueGeneric<TKey>(item));
}
try
diff --git a/clicache/src/ResultCollector.cpp b/clicache/src/ResultCollector.cpp
index 595bd9c..9b0e249 100644
--- a/clicache/src/ResultCollector.cpp
+++ b/clicache/src/ResultCollector.cpp
@@ -40,7 +40,7 @@ namespace Apache
try
{
- auto result = std::shared_ptr<native::Cacheable>(SafeGenericMSerializableConvert((IGeodeSerializable^)rs, nullptr));
+ auto result = std::shared_ptr<native::Cacheable>(SafeGenericMSerializableConvert((IGeodeSerializable^)rs));
m_nativeptr->get()->addResult(result);
}
finally
diff --git a/clicache/src/Serializable.cpp b/clicache/src/Serializable.cpp
index 144f3f5..e9e07d7 100644
--- a/clicache/src/Serializable.cpp
+++ b/clicache/src/Serializable.cpp
@@ -252,27 +252,27 @@ namespace Apache
return (Apache::Geode::Client::Serializable^)CacheableStringArray::Create(value);
}
- System::Int32 Serializable::GetPDXIdForType(const char* poolName, IGeodeSerializable^ pdxType, const native::Cache* cache)
+ System::Int32 Serializable::GetPDXIdForType(const char* poolName, IGeodeSerializable^ pdxType, Cache^ cache)
{
native::CacheablePtr kPtr(SafeMSerializableConvertGeneric(pdxType));
- return CacheRegionHelper::getCacheImpl(cache)->getSerializationRegistry()->GetPDXIdForType(cache->getPoolManager().find(poolName), kPtr);
+ return CacheRegionHelper::getCacheImpl(cache->GetNative().get())->getSerializationRegistry()->GetPDXIdForType(cache->GetNative()->getPoolManager().find(poolName), kPtr);
}
- IGeodeSerializable^ Serializable::GetPDXTypeById(const char* poolName, System::Int32 typeId, const native::Cache* cache)
+ IGeodeSerializable^ Serializable::GetPDXTypeById(const char* poolName, System::Int32 typeId, Cache^ cache)
{
- SerializablePtr sPtr = CacheRegionHelper::getCacheImpl(cache)->getSerializationRegistry()->GetPDXTypeById(cache->getPoolManager().find(poolName), typeId);
+ SerializablePtr sPtr = CacheRegionHelper::getCacheImpl(cache->GetNative().get())->getSerializationRegistry()->GetPDXTypeById(cache->GetNative()->getPoolManager().find(poolName), typeId);
return SafeUMSerializableConvertGeneric(sPtr);
}
- int Serializable::GetEnumValue(Internal::EnumInfo^ ei, const native::Cache* cache)
+ int Serializable::GetEnumValue(Internal::EnumInfo^ ei, Cache^ cache)
{
native::CacheablePtr kPtr(SafeMSerializableConvertGeneric(ei));
- return CacheRegionHelper::getCacheImpl(cache)->getSerializationRegistry()->GetEnumValue(cache->getPoolManager().getAll().begin()->second, kPtr);
+ return CacheRegionHelper::getCacheImpl(cache->GetNative().get())->getSerializationRegistry()->GetEnumValue(cache->GetNative()->getPoolManager().getAll().begin()->second, kPtr);
}
- Internal::EnumInfo^ Serializable::GetEnum(int val, const native::Cache* cache)
+ Internal::EnumInfo^ Serializable::GetEnum(int val, Cache^ cache)
{
- SerializablePtr sPtr = CacheRegionHelper::getCacheImpl(cache)->getSerializationRegistry()->GetEnum(cache->getPoolManager().getAll().begin()->second, val);
+ SerializablePtr sPtr = CacheRegionHelper::getCacheImpl(cache->GetNative().get())->getSerializationRegistry()->GetEnum(cache->GetNative()->getPoolManager().getAll().begin()->second, val);
return (Internal::EnumInfo^)SafeUMSerializableConvertGeneric(sPtr);
}
@@ -510,7 +510,7 @@ namespace Apache
void Serializable::RegisterPDXManagedCacheableKey(Cache^ cache)
{
- auto *cacheImpl = CacheRegionHelper::getCacheImpl(cache->GetNative().get());
+ auto cacheImpl = CacheRegionHelper::getCacheImpl(cache->GetNative().get());
cacheImpl->getSerializationRegistry()->setPdxTypeHandler([](native::DataInput& dataInput){
auto obj = std::make_shared<native::PdxManagedCacheableKey>();
obj->fromData(dataInput);
@@ -532,7 +532,7 @@ namespace Apache
if (!ManagedDelegatesGeneric->ContainsKey(classId))
ManagedDelegatesGeneric->Add(classId, creationMethod);
- DelegateWrapperGeneric^ delegateObj = gcnew DelegateWrapperGeneric(creationMethod, cache);
+ DelegateWrapperGeneric^ delegateObj = gcnew DelegateWrapperGeneric(creationMethod);
TypeFactoryNativeMethodGeneric^ nativeDelegate =
gcnew TypeFactoryNativeMethodGeneric(delegateObj,
&DelegateWrapperGeneric::NativeDelegateGeneric);
@@ -560,7 +560,7 @@ namespace Apache
throw gcnew IllegalArgumentException("Serializable.RegisterType(): "
"null TypeFactoryMethod delegate passed");
}
- DelegateWrapperGeneric^ delegateObj = gcnew DelegateWrapperGeneric(creationMethod, cache);
+ DelegateWrapperGeneric^ delegateObj = gcnew DelegateWrapperGeneric(creationMethod);
TypeFactoryNativeMethodGeneric^ nativeDelegate =
gcnew TypeFactoryNativeMethodGeneric(delegateObj,
&DelegateWrapperGeneric::NativeDelegateGeneric);
@@ -927,23 +927,19 @@ namespace Apache
}
generic<class TKey>
- native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key, native::Cache* cache)
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key)
{
- //System::Type^ managedType = TKey::typeid;
if (key != nullptr) {
- //System::Type^ managedType = key->GetType();
- return GetUnmanagedValueGeneric(key->GetType(), key, cache);
+ return GetUnmanagedValueGeneric(key->GetType(), key);
}
return nullptr;
}
generic<class TKey>
- native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key, bool isAciiChar, native::Cache* cache)
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key, bool isAciiChar)
{
- //System::Type^ managedType = TKey::typeid;
if (key != nullptr) {
- //System::Type^ managedType = key->GetType();
- return GetUnmanagedValueGeneric(key->GetType(), key, isAciiChar, cache);
+ return GetUnmanagedValueGeneric(key->GetType(), key, isAciiChar);
}
return nullptr;
}
@@ -1058,14 +1054,14 @@ namespace Apache
generic<class TKey>
native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
- Type^ managedType, TKey key, native::Cache* cache)
+ Type^ managedType, TKey key)
{
- return GetUnmanagedValueGeneric(managedType, key, false, cache);
+ return GetUnmanagedValueGeneric(managedType, key, false);
}
generic<class TKey>
native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
- Type^ managedType, TKey key, bool isAsciiChar, native::Cache* cache)
+ Type^ managedType, TKey key, bool isAsciiChar)
{
Byte typeId = Apache::Geode::Client::Serializable::GetManagedTypeMappingGeneric(managedType);
@@ -1099,122 +1095,122 @@ namespace Apache
}
case native::GeodeTypeIds::CacheableBytes:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableBytes::Create((array<Byte>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableBytes::Create((array<Byte>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableDoubleArray:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDoubleArray::Create((array<Double>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDoubleArray::Create((array<Double>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableFloatArray:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableFloatArray::Create((array<float>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableFloatArray::Create((array<float>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableInt16Array:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt16Array::Create((array<Int16>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt16Array::Create((array<Int16>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableInt32Array:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt32Array::Create((array<Int32>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt32Array::Create((array<Int32>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableInt64Array:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt64Array::Create((array<Int64>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt64Array::Create((array<Int64>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableStringArray:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableStringArray::Create((array<String^>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableStringArray::Create((array<String^>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableFileName:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)(Apache::Geode::Client::CacheableFileName^)key, cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)(Apache::Geode::Client::CacheableFileName^)key));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableHashTable://collection::hashtable
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashTable::Create((System::Collections::Hashtable^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashTable::Create((System::Collections::Hashtable^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableHashMap://generic dictionary
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashMap::Create((System::Collections::IDictionary^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashMap::Create((System::Collections::IDictionary^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableVector://collection::arraylist
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)CacheableVector::Create((System::Collections::IList^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)CacheableVector::Create((System::Collections::IList^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableArrayList://generic ilist
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableArrayList::Create((System::Collections::IList^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableArrayList::Create((System::Collections::IList^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableLinkedList://generic linked list
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableLinkedList::Create((System::Collections::Generic::LinkedList<Object^>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableLinkedList::Create((System::Collections::Generic::LinkedList<Object^>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableStack:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableStack::Create((System::Collections::ICollection^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableStack::Create((System::Collections::ICollection^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case 7: //GeodeClassIds::CacheableManagedObject
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObject^)key, cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObject^)key));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case 8://GeodeClassIds::CacheableManagedObjectXml
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectXml^)key, cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectXml^)key));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableObjectArray:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectArray^)key, cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectArray^)key));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableIdentityHashMap:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableIdentityHashMap::Create((System::Collections::IDictionary^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableIdentityHashMap::Create((System::Collections::IDictionary^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableHashSet^)key, cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableHashSet^)key));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableLinkedHashSet^)key, cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableLinkedHashSet^)key));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CacheableDate:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDate::Create((System::DateTime)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDate::Create((System::DateTime)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::BooleanArray:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::BooleanArray::Create((array<bool>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::BooleanArray::Create((array<bool>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case native::GeodeTypeIds::CharArray:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CharArray::Create((array<Char>^)key), cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CharArray::Create((array<Char>^)key)));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
default:
{
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert(key, cache));
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(key));
return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
}
diff --git a/clicache/src/Serializable.hpp b/clicache/src/Serializable.hpp
index 9fcc1df..bab74bd 100644
--- a/clicache/src/Serializable.hpp
+++ b/clicache/src/Serializable.hpp
@@ -299,8 +299,8 @@ namespace Apache
internal:
- static System::Int32 GetPDXIdForType(const char* poolName, IGeodeSerializable^ pdxType, const native::Cache* cache);
- static IGeodeSerializable^ GetPDXTypeById(const char* poolName, System::Int32 typeId, const native::Cache* cache);
+ static System::Int32 GetPDXIdForType(const char* poolName, IGeodeSerializable^ pdxType, Cache^ cache);
+ static IGeodeSerializable^ GetPDXTypeById(const char* poolName, System::Int32 typeId, Cache^ cache);
static IPdxSerializable^ Serializable::GetPdxType(String^ className);
static void RegisterPDXManagedCacheableKey(Cache^ cache);
static bool IsObjectAndPdxSerializerRegistered(String^ className);
@@ -312,8 +312,8 @@ namespace Apache
static Type^ GetType(String^ className);
- static int GetEnumValue(Internal::EnumInfo^ ei, const native::Cache* cache);
- static Internal::EnumInfo^ GetEnum(int val, const native::Cache* cache);
+ static int GetEnumValue(Internal::EnumInfo^ ei, Cache^ cache);
+ static Internal::EnumInfo^ GetEnum(int val, Cache^ cache);
static Dictionary<String^, PdxTypeFactoryMethod^>^ PdxDelegateMap =
gcnew Dictionary<String^, PdxTypeFactoryMethod^>();
@@ -455,18 +455,16 @@ namespace Apache
static TValue GetManagedValueGeneric(native::SerializablePtr val);
generic<class TKey>
- static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key, native::Cache* cache);
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key);
generic<class TKey>
- static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key, bool isAciiChar, native::Cache* cache);
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key, bool isAciiChar);
generic<class TKey>
- static native::CacheableKeyPtr GetUnmanagedValueGeneric(
- Type^ managedType, TKey key, native::Cache* cache);
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(Type^ managedType, TKey key);
generic<class TKey>
- static native::CacheableKeyPtr GetUnmanagedValueGeneric(
- Type^ managedType, TKey key, bool isAsciiChar, native::Cache* cache);
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(Type^ managedType, TKey key, bool isAsciiChar);
/// <summary>
/// Static map of <c>TypeFactoryMethod</c> delegates created
diff --git a/clicache/src/StatisticsFactory.cpp b/clicache/src/StatisticsFactory.cpp
index 79cfc44..69e0a76 100644
--- a/clicache/src/StatisticsFactory.cpp
+++ b/clicache/src/StatisticsFactory.cpp
@@ -36,17 +36,6 @@ namespace Apache
namespace Client
{
- // TODO globals - pass in distributed system
- //StatisticsFactory^ StatisticsFactory::GetExistingInstance(DistributedSystem^ distributedSystem)
- //{
- // _GF_MG_EXCEPTION_TRY2/* due to auto replace */
-
-
- // return StatisticsFactory::Create(distributedSystem->getStatisticsManager()->getStatisticsFactory());
-
- // _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
- //}
-
StatisticDescriptor^ StatisticsFactory::CreateIntCounter( String^ name, String^ description,String^ units )
{
return CreateIntCounter(name,description,units,true);
diff --git a/clicache/src/TransactionEvent.cpp b/clicache/src/TransactionEvent.cpp
index d4d694c..35d2750 100644
--- a/clicache/src/TransactionEvent.cpp
+++ b/clicache/src/TransactionEvent.cpp
@@ -23,7 +23,7 @@
#include "Cache.hpp"
#include "EntryEvent.hpp"
#include "Cache.hpp"
-
+#include "impl/CacheResolver.hpp"
using namespace System;
using namespace Apache::Geode::Client;
@@ -39,11 +39,8 @@ namespace Apache
generic<class TKey, class TValue>
Cache^ TransactionEvent<TKey, TValue>::Cache::get( )
{
- apache::geode::client::CachePtr & nativeptr(
- NativePtr->getCache( ) );
-
- return Apache::Geode::Client::Cache::Create(
- nativeptr.get() );
+ auto cache = NativePtr->getCache();
+ return CacheResolver::Lookup(cache);
}
generic<class TKey, class TValue>
diff --git a/clicache/src/impl/AuthenticatedCache.cpp b/clicache/src/impl/AuthenticatedCache.cpp
index acd96c0..d721493 100644
--- a/clicache/src/impl/AuthenticatedCache.cpp
+++ b/clicache/src/impl/AuthenticatedCache.cpp
@@ -129,7 +129,7 @@ namespace Apache
IPdxInstanceFactory^ AuthenticatedCache::CreatePdxInstanceFactory(String^ className)
{
- return gcnew Internal::PdxInstanceFactoryImpl(className, native::CacheRegionHelper::getCacheImpl(m_nativeptr->get())->getCache());
+ return gcnew Internal::PdxInstanceFactoryImpl(className, (Cache^)this);
}
} // namespace Client
} // namespace Geode
diff --git a/clicache/src/impl/CacheLoader.hpp b/clicache/src/impl/CacheLoader.hpp
index cc47cc3..b8b3ca0 100644
--- a/clicache/src/impl/CacheLoader.hpp
+++ b/clicache/src/impl/CacheLoader.hpp
@@ -69,8 +69,7 @@ namespace Apache
Object^ ghelper = Serializable::GetManagedValueGeneric<Object^>(helper);
- //return SafeMSerializableConvertGeneric(m_loader->Load(gregion, gkey, ghelper));
- return Serializable::GetUnmanagedValueGeneric<TValue>(m_loader->Load(gregion, gkey, ghelper), nullptr);
+ return Serializable::GetUnmanagedValueGeneric<TValue>(m_loader->Load(gregion, gkey, ghelper));
}
virtual void close( const apache::geode::client::RegionPtr& region )
diff --git a/clicache/src/impl/CacheResolver.cpp b/clicache/src/impl/CacheResolver.cpp
new file mode 100644
index 0000000..cd8692a
--- /dev/null
+++ b/clicache/src/impl/CacheResolver.cpp
@@ -0,0 +1,45 @@
+/*
+ * 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 "begin_native.hpp"
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
+#include "Cache.hpp"
+
+#include "CacheResolver.hpp"
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ Apache::Geode::Client::Cache^ CacheResolver::Lookup(const Cache* nativeCache)
+ {
+ return nativeToManagedCacheMap[IntPtr((void*)nativeCache)];
+ }
+
+ void CacheResolver::Add(const Cache* nativeCache, Apache::Geode::Client::Cache^ managedCache)
+ {
+ nativeToManagedCacheMap[IntPtr((void*)nativeCache)] = managedCache;
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
diff --git a/clicache/src/impl/CacheResolver.hpp b/clicache/src/impl/CacheResolver.hpp
new file mode 100644
index 0000000..b21d591
--- /dev/null
+++ b/clicache/src/impl/CacheResolver.hpp
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class Cache;
+
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+ class Cache;
+
+ using namespace System;
+ using namespace System::Collections::Concurrent;
+
+ ref class CacheResolver
+ {
+ public:
+ static Apache::Geode::Client::Cache^ Lookup(const Cache* nativeCache);
+
+ static void Add(const Cache* nativeCache, Apache::Geode::Client::Cache^ managedCache);
+
+ private:
+ static ConcurrentDictionary<IntPtr, Apache::Geode::Client::Cache^> nativeToManagedCacheMap;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
diff --git a/clicache/src/impl/DelegateWrapper.hpp b/clicache/src/impl/DelegateWrapper.hpp
index 68da9f9..14e3ec3 100644
--- a/clicache/src/impl/DelegateWrapper.hpp
+++ b/clicache/src/impl/DelegateWrapper.hpp
@@ -22,7 +22,6 @@
#include "CacheRegionHelper.hpp"
#include "end_native.hpp"
-#include "Cache.hpp"
#include "../geode_defs.hpp"
#include "../Serializable.hpp"
#include "ManagedCacheableKey.hpp"
@@ -69,8 +68,8 @@ namespace Apache
/// <summary>
/// Constructor to wrap the given managed delegate.
/// </summary>
- inline DelegateWrapperGeneric( TypeFactoryMethodGeneric^ typeDelegate, Cache^ cache )
- : m_delegate( typeDelegate ), m_cache(cache) { }
+ inline DelegateWrapperGeneric( TypeFactoryMethodGeneric^ typeDelegate )
+ : m_delegate( typeDelegate ) { }
/// <summary>
/// Returns the native <c>apache::geode::client::Serializable</c> object by invoking the
@@ -82,20 +81,15 @@ namespace Apache
/// </returns>
apache::geode::client::Serializable* NativeDelegateGeneric( )
{
- IGeodeSerializable^ tempObj = m_delegate( );
- IGeodeDelta^ tempDelta =
- dynamic_cast<IGeodeDelta^>(tempObj);
- if( tempDelta != nullptr )
+ auto tempObj = m_delegate( );
+ if(auto tempDelta = dynamic_cast<IGeodeDelta^>(tempObj))
{
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new apache::geode::client::ManagedCacheableDeltaGeneric( tempDelta );
- else
- return new apache::geode::client::ManagedCacheableDeltaBytesGeneric( tempDelta, false );
+ return new apache::geode::client::ManagedCacheableDeltaGeneric(tempDelta);
}
- else if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new apache::geode::client::ManagedCacheableKeyGeneric( tempObj, CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry().get());
else
- return new apache::geode::client::ManagedCacheableKeyBytesGeneric( tempObj, false);
+ {
+ return new apache::geode::client::ManagedCacheableKeyGeneric(tempObj);
+ }
}
@@ -103,7 +97,6 @@ namespace Apache
TypeFactoryMethodGeneric^ m_delegate;
- Cache^ m_cache;
};
} // namespace Client
} // namespace Geode
diff --git a/clicache/src/impl/FixedPartitionResolver.hpp b/clicache/src/impl/FixedPartitionResolver.hpp
index 38a3fa3..03f57c9 100644
--- a/clicache/src/impl/FixedPartitionResolver.hpp
+++ b/clicache/src/impl/FixedPartitionResolver.hpp
@@ -60,7 +60,7 @@ namespace Apache
{
EntryEvent<TKey, TValue> gevent(&ev);
Object^ groutingobject = m_resolver->GetRoutingObject(%gevent);
- return Serializable::GetUnmanagedValueGeneric<Object^>(groutingobject, nullptr);
+ return Serializable::GetUnmanagedValueGeneric<Object^>(groutingobject);
}
virtual const char * getName()
diff --git a/clicache/src/impl/ManagedCacheListener.cpp b/clicache/src/impl/ManagedCacheListener.cpp
index 171eeb4..844231f 100644
--- a/clicache/src/impl/ManagedCacheListener.cpp
+++ b/clicache/src/impl/ManagedCacheListener.cpp
@@ -330,8 +330,7 @@ namespace apache
void ManagedCacheListenerGeneric::close(const apache::geode::client::RegionPtr& region)
{
try {
- Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
- Apache::Geode::Client::Region<Object^, Object^>::Create(region);
+ auto mregion = Apache::Geode::Client::Region<Object^, Object^>::Create(region);
m_managedptr->Close(mregion);
}
@@ -345,8 +344,7 @@ namespace apache
void ManagedCacheListenerGeneric::afterRegionDisconnected(const apache::geode::client::RegionPtr& region)
{
try {
- Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
- Apache::Geode::Client::Region<Object^, Object^>::Create(region);
+ auto mregion = Apache::Geode::Client::Region<Object^, Object^>::Create(region);
m_managedptr->AfterRegionDisconnected(mregion);
}
catch (Apache::Geode::Client::GeodeException^ ex) {
diff --git a/clicache/src/impl/ManagedCacheWriter.cpp b/clicache/src/impl/ManagedCacheWriter.cpp
index 646cf7e..821e27a 100644
--- a/clicache/src/impl/ManagedCacheWriter.cpp
+++ b/clicache/src/impl/ManagedCacheWriter.cpp
@@ -297,10 +297,8 @@ namespace apache
void ManagedCacheWriterGeneric::close(const RegionPtr& rp)
{
try {
- Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
- Apache::Geode::Client::Region<Object^, Object^>::Create(rp);
-
- m_managedptr->Close(reinterpret_cast<Apache::Geode::Client::Region<Object^, Object^>^>(mregion));
+ auto mregion = Apache::Geode::Client::Region<Object^, Object^>::Create(rp);
+ m_managedptr->Close(mregion);
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
diff --git a/clicache/src/impl/ManagedCacheableDelta.cpp b/clicache/src/impl/ManagedCacheableDelta.cpp
index 33ba766..c0538e0 100644
--- a/clicache/src/impl/ManagedCacheableDelta.cpp
+++ b/clicache/src/impl/ManagedCacheableDelta.cpp
@@ -25,7 +25,7 @@
#include "../CacheableString.hpp"
#include "../ExceptionTypes.hpp"
#include "SafeConvert.hpp"
-
+#include "CacheResolver.hpp"
using namespace System;
@@ -40,11 +40,12 @@ namespace apache
{
try {
System::UInt32 pos = (int)output.getBufferLength();
- Apache::Geode::Client::DataOutput mg_output(&output, true);
+ auto cache = CacheResolver::Lookup(output.getCache());
+ Apache::Geode::Client::DataOutput mg_output(&output, true, cache);
m_managedSerializableptr->ToData(%mg_output);
//this will move the cursor in c++ layer
mg_output.WriteBytesToUMDataOutput();
- ManagedCacheableDeltaGeneric* tmp = const_cast<ManagedCacheableDeltaGeneric*>(this);
+ auto tmp = const_cast<ManagedCacheableDeltaGeneric*>(this);
tmp->m_objectSize = (int)(output.getBufferLength() - pos);
}
catch (Apache::Geode::Client::GeodeException^ ex) {
@@ -59,7 +60,8 @@ namespace apache
{
try {
int pos = input.getBytesRead();
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ auto cache = CacheResolver::Lookup(input.getCache());
+ Apache::Geode::Client::DataInput mg_input(&input, true, cache);
m_managedSerializableptr->FromData(%mg_input);
//this will move the cursor in c++ layer
@@ -161,7 +163,8 @@ namespace apache
void ManagedCacheableDeltaGeneric::toDelta(DataOutput& output) const
{
try {
- Apache::Geode::Client::DataOutput mg_output(&output, true);
+ auto cache = CacheResolver::Lookup(output.getCache());
+ Apache::Geode::Client::DataOutput mg_output(&output, true, cache);
m_managedptr->ToDelta(%mg_output);
//this will move the cursor in c++ layer
mg_output.WriteBytesToUMDataOutput();
@@ -177,7 +180,8 @@ namespace apache
void ManagedCacheableDeltaGeneric::fromDelta(DataInput& input)
{
try {
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ auto cache = CacheResolver::Lookup(input.getCache());
+ Apache::Geode::Client::DataInput mg_input(&input, true, cache);
m_managedptr->FromDelta(%mg_input);
//this will move the cursor in c++ layer
@@ -196,10 +200,9 @@ namespace apache
DeltaPtr ManagedCacheableDeltaGeneric::clone()
{
try {
- ICloneable^ cloneable = dynamic_cast<ICloneable^>((
- Apache::Geode::Client::IGeodeDelta^) m_managedptr);
- if (cloneable) {
- Apache::Geode::Client::IGeodeSerializable^ Mclone =
+ if (auto cloneable = dynamic_cast<ICloneable^>((
+ Apache::Geode::Client::IGeodeDelta^) m_managedptr)) {
+ auto Mclone =
dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(cloneable->Clone());
return DeltaPtr(static_cast<ManagedCacheableDeltaGeneric*>(
SafeMSerializableConvertGeneric(Mclone)));
diff --git a/clicache/src/impl/ManagedCacheableDelta.hpp b/clicache/src/impl/ManagedCacheableDelta.hpp
index efeb2c9..ab16802 100644
--- a/clicache/src/impl/ManagedCacheableDelta.hpp
+++ b/clicache/src/impl/ManagedCacheableDelta.hpp
@@ -179,6 +179,7 @@ namespace apache
/// </summary>
gcroot<Apache::Geode::Client::IGeodeDelta^> m_managedptr;
gcroot<Apache::Geode::Client::IGeodeSerializable^> m_managedSerializableptr;
+
// Disable the copy and assignment constructors
ManagedCacheableDeltaGeneric(const ManagedCacheableDeltaGeneric&);
ManagedCacheableDeltaGeneric& operator = (const ManagedCacheableDeltaGeneric&);
diff --git a/clicache/src/impl/ManagedCacheableDeltaBytes.cpp b/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
deleted file mode 100644
index 8a8ac3c..0000000
--- a/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
+++ /dev/null
@@ -1,338 +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 "begin_native.hpp"
-#include <GeodeTypeIdsImpl.hpp>
-#include "end_native.hpp"
-
-#include "ManagedCacheableDeltaBytes.hpp"
-#include "../DataInput.hpp"
-#include "../DataOutput.hpp"
-#include "../CacheableString.hpp"
-#include "../ExceptionTypes.hpp"
-#include "SafeConvert.hpp"
-
-
-using namespace System;
-
-namespace apache
-{
- namespace geode
- {
- namespace client
- {
-
- void ManagedCacheableDeltaBytesGeneric::toData(DataOutput& output) const
- {
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
- try {
- output.writeBytesOnly(m_bytes, m_size);
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- void ManagedCacheableDeltaBytesGeneric::fromData(DataInput& input)
- {
- try {
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromData: classid " + m_classId);
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
- const System::Byte* objStartPos = input.currentBufferPosition();
-
- Apache::Geode::Client::IGeodeSerializable^ obj =
- Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
- obj->FromData(%mg_input);
- input.advanceCursor(mg_input.BytesReadInternally);
-
- m_hashCode = obj->GetHashCode();
-
- const System::Byte* objEndPos = input.currentBufferPosition();
-
- //m_size = mg_input.BytesRead;
- m_size = (System::UInt32)(objEndPos - objStartPos);
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromData: objectSize = " + m_size + " m_hashCode = " + m_hashCode);
- m_bytes = input.getBufferCopyFrom(objStartPos, m_size);
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- System::UInt32 ManagedCacheableDeltaBytesGeneric::objectSize() const
- {
- try {
- return m_size;
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return 0;
- }
-
- System::Int32 ManagedCacheableDeltaBytesGeneric::classId() const
- {
- System::UInt32 classId;
- try {
- classId = m_classId;
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return (classId >= 0x80000000 ? 0 : classId);
- }
-
- int8_t ManagedCacheableDeltaBytesGeneric::typeId() const
- {
- try {
- System::UInt32 classId = m_classId;
- if (classId >= 0x80000000) {
- return (int8_t)((classId - 0x80000000) % 0x20000000);
- }
- else if (classId <= 0x7F) {
- return (int8_t)GeodeTypeIdsImpl::CacheableUserData;
- }
- else if (classId <= 0x7FFF) {
- return (int8_t)GeodeTypeIdsImpl::CacheableUserData2;
- }
- else {
- return (int8_t)GeodeTypeIdsImpl::CacheableUserData4;
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return 0;
- }
-
- int8_t ManagedCacheableDeltaBytesGeneric::DSFID() const
- {
- // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
- // [0xa000000, 0xc0000000) is for FixedIDByte,
- // [0xc0000000, 0xe0000000) is for FixedIDShort
- // and [0xe0000000, 0xffffffff] is for FixedIDInt
- // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
- // and FixedIDInt is 3; if this changes then correct this accordingly
- System::UInt32 classId = m_classId;
- if (classId >= 0x80000000) {
- return (int8_t)((classId - 0x80000000) / 0x20000000);
- }
- return 0;
- }
-
- bool ManagedCacheableDeltaBytesGeneric::hasDelta()
- {
- //Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
- //return deltaObj->HasDelta();
- return m_hasDelta;
- }
-
- void ManagedCacheableDeltaBytesGeneric::toDelta(DataOutput& output) const
- {
- try {
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
- Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
- Apache::Geode::Client::DataOutput mg_output(&output, true);
- deltaObj->ToDelta(%mg_output);
- mg_output.WriteBytesToUMDataOutput();
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- void ManagedCacheableDeltaBytesGeneric::fromDelta(DataInput& input)
- {
- try {
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta:");
- Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
- deltaObj->FromDelta(%mg_input);
-
- Apache::Geode::Client::IGeodeSerializable^ managedptr =
- dynamic_cast <Apache::Geode::Client::IGeodeSerializable^> (deltaObj);
- if (managedptr != nullptr)
- {
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: classid " + managedptr->ClassId + " : " + managedptr->ToString());
- auto dataOut = input.getCache()->createDataOutput();
- Apache::Geode::Client::DataOutput mg_output(dataOut.get(), true);
- managedptr->ToData(%mg_output);
-
- //move cursor
- //dataOut.advanceCursor(mg_output.BufferLength);
- mg_output.WriteBytesToUMDataOutput();
-
- GF_SAFE_DELETE(m_bytes);
- m_bytes = dataOut->getBufferCopy();
- m_size = dataOut->getBufferLength();
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta objectSize = " + m_size + " m_hashCode = " + m_hashCode);
- m_hashCode = managedptr->GetHashCode();
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- DeltaPtr ManagedCacheableDeltaBytesGeneric::clone()
- {
- try {
- Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
- ICloneable^ cloneable = dynamic_cast<ICloneable^>((Apache::Geode::Client::IGeodeDelta^) deltaObj);
- if (cloneable) {
- Apache::Geode::Client::IGeodeSerializable^ Mclone =
- dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(cloneable->Clone());
- return DeltaPtr(static_cast<ManagedCacheableDeltaBytesGeneric*>(
- SafeMSerializableConvertGeneric(Mclone)));
- }
- else {
- return Delta::clone();
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return nullptr;
- }
-
- Apache::Geode::Client::IGeodeDelta^
- ManagedCacheableDeltaBytesGeneric::getManagedObject() const
- {
-
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::getManagedObject");
-
- auto dinp = m_cache->createDataInput(m_bytes, m_size);
- Apache::Geode::Client::DataInput mg_dinp(dinp.get(), true, m_cache);
- Apache::Geode::Client::TypeFactoryMethodGeneric^ creationMethod =
- Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId);
- Apache::Geode::Client::IGeodeSerializable^ newObj = creationMethod();
-
- newObj->FromData(%mg_dinp);
-
- Apache::Geode::Client::IGeodeDelta^ managedDeltaptr =
- dynamic_cast <Apache::Geode::Client::IGeodeDelta^> (newObj);
- return managedDeltaptr;
- }
-
- bool ManagedCacheableDeltaBytesGeneric::operator ==(const apache::geode::client::CacheableKey& other) const
- {
- try {
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal");
- // now checking classId(), typeId(), DSFID() etc. will be much more
- // expensive than just a dynamic_cast
- const ManagedCacheableDeltaBytesGeneric* p_other =
- dynamic_cast<const ManagedCacheableDeltaBytesGeneric*>(&other);
- if (p_other != NULL) {
- auto di = m_cache->createDataInput(m_bytes, m_size);
- Apache::Geode::Client::DataInput mg_input(di.get(), true, m_cache);
- Apache::Geode::Client::IGeodeSerializable^ obj =
- Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
- obj->FromData(%mg_input);
- bool ret = obj->Equals(p_other->ptr());
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal return VAL = " + ret);
- return ret;
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal returns false");
- return false;
- }
-
- bool ManagedCacheableDeltaBytesGeneric::operator ==(const ManagedCacheableDeltaBytesGeneric& other) const
- {
- try {
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal. ");
- auto di = m_cache->createDataInput(m_bytes, m_size);
- Apache::Geode::Client::DataInput mg_input(di.get(), true, m_cache);
- Apache::Geode::Client::IGeodeSerializable^ obj =
- Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
- obj->FromData(%mg_input);
- bool ret = obj->Equals(other.ptr());
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal return VAL = " + ret);
- return ret;
- //return obj->Equals(other.get());
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal return false");
- return false;
- }
-
- System::Int32 ManagedCacheableDeltaBytesGeneric::hashcode() const
- {
- throw gcnew System::NotSupportedException;
- }
-
- size_t ManagedCacheableDeltaBytesGeneric::logString(char* buffer, size_t maxLength) const
- {
- try {
- Apache::Geode::Client::IGeodeDelta^ manageObject = getManagedObject();
- if (manageObject != nullptr)
- {
- if (maxLength > 0) {
- String^ logstr = manageObject->GetType()->Name + '(' +
- manageObject->ToString() + ')';
- Apache::Geode::Client::ManagedString mg_str(logstr);
- return snprintf(buffer, maxLength, "%s", mg_str.CharPtr);
- }
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return 0;
- }
- } // namespace client
- } // namespace geode
-} // namespace apache
diff --git a/clicache/src/impl/ManagedCacheableDeltaBytes.hpp b/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
deleted file mode 100644
index b45c737..0000000
--- a/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
+++ /dev/null
@@ -1,218 +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.
- */
-
-#pragma once
-
-#include "../geode_defs.hpp"
-#include <vcclr.h>
-#include "begin_native.hpp"
-#include "SerializationRegistry.hpp"
-#include <geode/Cache.hpp>
-#include <geode/Delta.hpp>
-#include <geode/DataOutput.hpp>
-#include "end_native.hpp"
-
-#include "../Log.hpp"
-#include "../DataOutput.hpp"
-
-using namespace System;
-
-namespace Apache
-{
- namespace Geode
- {
- namespace Client
- {
-
- interface class IGeodeSerializable;
- interface class IGeodeDelta;
- } // namespace Client
- } // namespace Geode
-} // namespace Apache
-
-
-namespace apache
-{
- namespace geode
- {
- namespace client
- {
-
-
- /// <summary>
- /// Wraps the managed <see cref="Apache.Geode.Client.IGeodeDelta" />
- /// object and implements the native <c>apache::geode::client::CacheableKey</c> interface.
- /// </summary>
- class ManagedCacheableDeltaBytesGeneric
- : public CacheableKey, public Delta
- {
- public:
-
- /// <summary>
- /// Constructor to initialize with the provided managed object.
- /// </summary>
- /// <param name="managedDeltaptr">
- /// The managed object.
- /// </param>
- inline ManagedCacheableDeltaBytesGeneric(
- Apache::Geode::Client::IGeodeDelta^ managedDeltaptr, bool storeBytes)
- :Delta(nullptr), m_domainId(System::Threading::Thread::GetDomainID()),
- m_classId(0),
- m_bytes(NULL),
- m_size(0),
- m_hasDelta(false),
- m_hashCode(0)
- {
- if (storeBytes)
- m_hasDelta = managedDeltaptr->HasDelta();
- Apache::Geode::Client::IGeodeSerializable^ managedptr =
- dynamic_cast <Apache::Geode::Client::IGeodeSerializable^> (managedDeltaptr);
- if (managedptr != nullptr)
- {
- m_classId = managedptr->ClassId;
- Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
- Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: class ID " + managedptr->ClassId + " : " + managedptr->ToString() + " storeBytes:" + storeBytes);
- if (storeBytes)
- {
- auto dataOut = m_cache->createDataOutput();
- Apache::Geode::Client::DataOutput mg_output(dataOut.get(), true);
- managedptr->ToData(%mg_output);
-
- //move cursor
- //dataOut.advanceCursor(mg_output.BufferLength);
- mg_output.WriteBytesToUMDataOutput();
-
- m_bytes = dataOut->getBufferCopy();
- m_size = dataOut->getBufferLength();
- m_hashCode = managedptr->GetHashCode();
- Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor objectSize = " + m_size + " m_hashCode = " + m_hashCode);
- }
- }
- }
-
- /// <summary>
- /// serialize this object
- /// </summary>
- virtual void toData(apache::geode::client::DataOutput& output) const;
-
- /// <summary>
- /// deserialize this object, typical implementation should return
- /// the 'this' pointer.
- /// </summary>
- virtual void fromData(apache::geode::client::DataInput& input);
-
- virtual void toDelta(apache::geode::client::DataOutput& output) const;
-
- virtual void fromDelta(apache::geode::client::DataInput& input);
-
- /// <summary>
- /// return the size of this object in bytes
- /// </summary>
- virtual System::UInt32 objectSize() const;
-
- /// <summary>
- /// return the classId of the instance being serialized.
- /// This is used by deserialization to determine what instance
- /// type to create and deserialize into.
- /// </summary>
- virtual System::Int32 classId() const;
-
- /// <summary>
- /// return the typeId of the instance being serialized.
- /// This is used by deserialization to determine what instance
- /// type to create and deserialize into.
- /// </summary>
- virtual int8_t typeId() const;
-
- /// <summary>
- /// return the Data Serialization Fixed ID type.
- /// This is used to determine what instance type to create
- /// and deserialize into.
- ///
- /// Note that this should not be overridden by custom implementations
- /// and is reserved only for builtin types.
- /// </summary>
- virtual int8_t DSFID() const;
-
- virtual bool hasDelta();
-
- virtual apache::geode::client::DeltaPtr clone();
-
- /// <summary>
- /// return the hashcode for this key.
- /// </summary>
- virtual System::Int32 hashcode() const;
-
- /// <summary>
- /// return true if this key matches other CacheableKey
- /// </summary>
- virtual bool operator == (const CacheableKey& other) const;
-
- /// <summary>
- /// return true if this key matches other ManagedCacheableDeltaBytesGeneric
- /// </summary>
- virtual bool operator == (const ManagedCacheableDeltaBytesGeneric& other) const;
-
- /// <summary>
- /// Copy the string form of a key into a char* buffer for logging purposes.
- /// implementations should only generate a string as long as maxLength chars,
- /// and return the number of chars written. buffer is expected to be large
- /// enough to hold at least maxLength chars.
- /// The default implementation renders the classname and instance address.
- /// </summary>
- virtual size_t logString(char* buffer, size_t maxLength) const;
-
- /// <summary>
- /// Returns the wrapped managed object reference.
- /// </summary>
- inline Apache::Geode::Client::IGeodeDelta^ ptr() const
- {
- return getManagedObject();
- }
-
- inline ~ManagedCacheableDeltaBytesGeneric()
- {
- Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Destructor current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
- GF_SAFE_DELETE(m_bytes);
- }
-
- private:
- Apache::Geode::Client::IGeodeDelta^ getManagedObject() const;
- /// <summary>
- /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
- /// Note: not using auto_gcroot since it will result in 'Dispose' of the IGeodeDelta
- /// to be called which is not what is desired when this object is destroyed. Normally this
- /// managed object may be created by the user and will be handled automatically by the GC.
- /// </summary>
- //gcroot<Apache::Geode::Client::IGeodeDelta^> m_managedptr;
- //gcroot<Apache::Geode::Client::IGeodeSerializable^> m_managedSerializableptr;
-
- int m_domainId;
- UInt32 m_classId;
- System::Byte * m_bytes;
- System::UInt32 m_size;
- System::UInt32 m_hashCode;
- bool m_hasDelta;
-
- // Disable the copy and assignment constructors
- ManagedCacheableDeltaBytesGeneric(const ManagedCacheableDeltaBytesGeneric&);
- ManagedCacheableDeltaBytesGeneric& operator = (const ManagedCacheableDeltaBytesGeneric&);
- };
-
- }
- }
-}
diff --git a/clicache/src/impl/ManagedCacheableKey.cpp b/clicache/src/impl/ManagedCacheableKey.cpp
index 2357c0c..2ba6596 100644
--- a/clicache/src/impl/ManagedCacheableKey.cpp
+++ b/clicache/src/impl/ManagedCacheableKey.cpp
@@ -26,6 +26,7 @@
#include "../CacheableString.hpp"
#include "../ExceptionTypes.hpp"
#include "../Log.hpp"
+#include "CacheResolver.hpp"
using namespace System;
@@ -40,8 +41,9 @@ namespace apache
{
try {
System::UInt32 pos = (int)output.getBufferLength();
- //Apache::Geode::Client::Log::Debug("ManagedCacheableKeyGeneric::toData");
- Apache::Geode::Client::DataOutput mg_output(&output, true);
+ //Apache::Geode::Client::Log::Debug("ManagedCacheableKeyGeneric::toData");
+ auto cache = CacheResolver::Lookup(output.getCache());
+ Apache::Geode::Client::DataOutput mg_output(&output, true, cache);
m_managedptr->ToData(%mg_output);
//this will move the cursor in c++ layer
mg_output.WriteBytesToUMDataOutput();
@@ -61,7 +63,8 @@ namespace apache
{
try {
int pos = input.getBytesRead();
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ auto cache = CacheResolver::Lookup(input.getCache());
+ Apache::Geode::Client::DataInput mg_input(&input, true, cache);
m_managedptr->FromData(%mg_input);
//this will move the cursor in c++ layer
diff --git a/clicache/src/impl/ManagedCacheableKey.hpp b/clicache/src/impl/ManagedCacheableKey.hpp
index bc40f09..7793743 100644
--- a/clicache/src/impl/ManagedCacheableKey.hpp
+++ b/clicache/src/impl/ManagedCacheableKey.hpp
@@ -22,13 +22,23 @@
#include "begin_native.hpp"
#include <geode/CacheableKey.hpp>
#include <GeodeTypeIdsImpl.hpp>
-#include "SerializationRegistry.hpp"
#include "end_native.hpp"
#include "../IGeodeSerializable.hpp"
using namespace System;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ ref class Cache;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
namespace apache
{
namespace geode
@@ -47,16 +57,14 @@ namespace apache
private:
int m_hashcode;
int m_classId;
- native::SerializationRegistry* m_serializationRegistry;
int m_objectSize;
public:
inline ManagedCacheableKeyGeneric(
- Apache::Geode::Client::IGeodeSerializable^ managedptr, int hashcode, int classId, native::SerializationRegistry * serializationRegistry)
+ Apache::Geode::Client::IGeodeSerializable^ managedptr, int hashcode, int classId)
: m_managedptr(managedptr) {
m_hashcode = hashcode;
m_classId = classId;
- m_serializationRegistry = serializationRegistry;
m_objectSize = 0;
}
/// <summary>
@@ -65,12 +73,10 @@ namespace apache
/// <param name="managedptr">
/// The managed object.
/// </param>
- inline ManagedCacheableKeyGeneric(Apache::Geode::Client::IGeodeSerializable^ managedptr, native::SerializationRegistry * serializationRegistry)
+ inline ManagedCacheableKeyGeneric(Apache::Geode::Client::IGeodeSerializable^ managedptr)
: m_managedptr(managedptr) {
- // m_hashcode = managedptr->GetHashCode();
m_hashcode = 0;
m_classId = managedptr->ClassId;
- m_serializationRegistry = serializationRegistry;
m_objectSize = 0;
}
diff --git a/clicache/src/impl/ManagedCacheableKeyBytes.cpp b/clicache/src/impl/ManagedCacheableKeyBytes.cpp
deleted file mode 100644
index 6fcac00..0000000
--- a/clicache/src/impl/ManagedCacheableKeyBytes.cpp
+++ /dev/null
@@ -1,282 +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 "begin_native.hpp"
-#include <geode/Cache.hpp>
-#include <GeodeTypeIdsImpl.hpp>
-#include "DataInputInternal.hpp"
-#include "end_native.hpp"
-
-#include "ManagedCacheableKeyBytes.hpp"
-#include "../DataInput.hpp"
-#include "../DataOutput.hpp"
-#include "../Serializable.hpp"
-#include "../CacheableString.hpp"
-#include "../ExceptionTypes.hpp"
-#include "ManagedString.hpp"
-
-
-using namespace System;
-
-namespace apache
-{
- namespace geode
- {
- namespace client
- {
- void ManagedCacheableKeyBytesGeneric::toData(apache::geode::client::DataOutput& output) const
- {
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
- try {
- //TODO: I think this should work as it is
- output.writeBytesOnly(m_bytes, m_size);
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- void ManagedCacheableKeyBytesGeneric::fromData(apache::geode::client::DataInput& input)
- {
- try {
-
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::fromData: classid " + m_classId + "aid = " + +System::Threading::Thread::GetDomainID());
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
- const System::Byte* objStartPos = input.currentBufferPosition();
-
- Apache::Geode::Client::IGeodeSerializable^ obj = Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
- obj->FromData(%mg_input);
-
- input.advanceCursor(mg_input.BytesReadInternally);
-
- m_hashCode = obj->GetHashCode();
-
- const System::Byte* objEndPos = input.currentBufferPosition();
-
- //m_size = mg_input.BytesRead;
- m_size = (System::UInt32)(objEndPos - objStartPos);
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::fromData: objectSize = " + m_size + " m_hashCode = " + m_hashCode);
- m_bytes = input.getBufferCopyFrom(objStartPos, m_size);
-
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- System::UInt32 ManagedCacheableKeyBytesGeneric::objectSize() const
- {
- try {
- //return m_managedptr->ObjectSize;
- return m_size;
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return 0;
- }
-
- System::Int32 ManagedCacheableKeyBytesGeneric::classId() const
- {
- System::UInt32 classId;
- try {
- //classId = m_managedptr->ClassId;
- classId = m_classId;
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return (classId >= 0x80000000 ? 0 : classId);
- }
-
- int8_t ManagedCacheableKeyBytesGeneric::typeId() const
- {
- try {
- //System::UInt32 classId = m_managedptr->ClassId;
- System::UInt32 classId = m_classId;
- if (classId >= 0x80000000) {
- return (int8_t)((classId - 0x80000000) % 0x20000000);
- }
- else if (classId <= 0x7F) {
- return (int8_t)apache::geode::client::GeodeTypeIdsImpl::CacheableUserData;
- }
- else if (classId <= 0x7FFF) {
- return (int8_t)apache::geode::client::GeodeTypeIdsImpl::CacheableUserData2;
- }
- else {
- return (int8_t)apache::geode::client::GeodeTypeIdsImpl::CacheableUserData4;
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return 0;
- }
-
- int8_t ManagedCacheableKeyBytesGeneric::DSFID() const
- {
- // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
- // [0xa000000, 0xc0000000) is for FixedIDByte,
- // [0xc0000000, 0xe0000000) is for FixedIDShort
- // and [0xe0000000, 0xffffffff] is for FixedIDInt
- // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
- // and FixedIDInt is 3; if this changes then correct this accordingly
- //System::UInt32 classId = m_managedptr->ClassId;
- System::UInt32 classId = m_classId;
- if (classId >= 0x80000000) {
- return (int8_t)((classId - 0x80000000) / 0x20000000);
- }
- return 0;
- }
-
- apache::geode::client::CacheableStringPtr ManagedCacheableKeyBytesGeneric::toString() const
- {
- try {
- Apache::Geode::Client::IGeodeSerializable^ manageObject = getManagedObject();
- if (manageObject != nullptr)
- {
- apache::geode::client::CacheableStringPtr cStr;
- Apache::Geode::Client::CacheableString::GetCacheableString(
- manageObject->ToString(), cStr);
- return cStr;
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return nullptr;
- }
-
- bool ManagedCacheableKeyBytesGeneric::operator ==(const apache::geode::client::CacheableKey& other) const
- {
- try {
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal");
- // now checking classId(), typeId(), DSFID() etc. will be much more
- // expensive than just a dynamic_cast
- const ManagedCacheableKeyBytesGeneric* p_other =
- dynamic_cast<const ManagedCacheableKeyBytesGeneric*>(&other);
- if (p_other != NULL) {
- DataInputInternal di(m_bytes, m_size, nullptr);
- Apache::Geode::Client::DataInput mg_input(&di, true, nullptr);
- Apache::Geode::Client::IGeodeSerializable^ obj =
- Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
- obj->FromData(%mg_input);
- bool ret = obj->Equals(p_other->ptr());
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal return VAL = " + ret);
- return ret;
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal returns false");
- return false;
- }
-
- bool ManagedCacheableKeyBytesGeneric::operator ==(const ManagedCacheableKeyBytesGeneric& other) const
- {
- try {
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal. ");
- DataInputInternal di(m_bytes, m_size, nullptr);
- Apache::Geode::Client::DataInput mg_input(&di, true, nullptr);
- Apache::Geode::Client::IGeodeSerializable^ obj =
- Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
- obj->FromData(%mg_input);
- bool ret = obj->Equals(other.ptr());
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal return VAL = " + ret);
- return ret;
- //return obj->Equals(other.get());
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal return false");
- return false;
- }
-
- System::Int32 ManagedCacheableKeyBytesGeneric::hashcode() const
- {
- return m_hashCode;
- }
-
- size_t ManagedCacheableKeyBytesGeneric::logString(char* buffer, size_t maxLength) const
- {
- try {
- Apache::Geode::Client::IGeodeSerializable^ manageObject = getManagedObject();
- if (manageObject != nullptr)
- {
- if (maxLength > 0) {
- String^ logstr = manageObject->GetType()->Name + '(' +
- manageObject->ToString() + ')';
- Apache::Geode::Client::ManagedString mg_str(logstr);
- return snprintf(buffer, maxLength, "%s", mg_str.CharPtr);
- }
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return 0;
- }
-
- Apache::Geode::Client::IGeodeSerializable^
- ManagedCacheableKeyBytesGeneric::getManagedObject() const
- {
-
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::getManagedObject " + m_size);
-
- DataInputInternal dinp(m_bytes, m_size, nullptr);
- Apache::Geode::Client::DataInput mg_dinp(&dinp, true, nullptr);
- Apache::Geode::Client::TypeFactoryMethodGeneric^ creationMethod =
- Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId);
- Apache::Geode::Client::IGeodeSerializable^ newObj = creationMethod();
-
- newObj->FromData(%mg_dinp);
-
- return newObj;
- }
-
- } // namespace client
- } // namespace geode
-} // namespace apache
diff --git a/clicache/src/impl/ManagedCacheableKeyBytes.hpp b/clicache/src/impl/ManagedCacheableKeyBytes.hpp
deleted file mode 100644
index 2e47899..0000000
--- a/clicache/src/impl/ManagedCacheableKeyBytes.hpp
+++ /dev/null
@@ -1,208 +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.
- */
-
-#pragma once
-
-#include "../geode_defs.hpp"
-#include <vcclr.h>
-#include "begin_native.hpp"
-#include <geode/CacheableKey.hpp>
-#include "DataOutputInternal.hpp"
-#include "end_native.hpp"
-
-#include "../Log.hpp"
-#include "../DataOutput.hpp"
-
-
-using namespace System;
-
-namespace Apache
-{
- namespace Geode
- {
- namespace Client
- {
-
- interface class IGeodeSerializable;
- } // namespace Client
- } // namespace Geode
-} // namespace Apache
-
-
-namespace apache
-{
- namespace geode
- {
- namespace client
- {
-
- /// <summary>
- /// Wraps the managed <see cref="Apache.Geode.Client.IGeodeSerializable" />
- /// object and implements the native <c>apache::geode::client::CacheableKey</c> interface.
- /// </summary>
- class ManagedCacheableKeyBytesGeneric
- : public apache::geode::client::CacheableKey
- {
- public:
-
- /// <summary>
- /// Constructor to initialize with the provided managed object.
- /// </summary>
- /// <param name="managedptr">
- /// The managed object.
- /// </param>
- inline ManagedCacheableKeyBytesGeneric(
- Apache::Geode::Client::IGeodeSerializable^ managedptr, bool storeBytes)
- : m_domainId(System::Threading::Thread::GetDomainID()),
- m_classId(managedptr->ClassId),
- m_bytes(NULL),
- m_size(0),
- m_hashCode(0)
- {
- if (managedptr != nullptr)
- {
- if (storeBytes)//if value is from app
- {
- DataOutputInternal dataOut;
- Apache::Geode::Client::DataOutput mg_output(&dataOut, true);
- managedptr->ToData(%mg_output);
-
- //move cursor
- //dataOut.advanceCursor(mg_output.BufferLength);
- mg_output.WriteBytesToUMDataOutput();
-
- m_bytes = dataOut.getBufferCopy();
- m_size = dataOut.getBufferLength();
-
- m_hashCode = managedptr->GetHashCode();
- Apache::Geode::Client::Log::Fine(
- "ManagedCacheableKeyBytes::Constructor objectSize = " + m_size + " m_hashCode = " + m_hashCode);
- }
- }
- }
-
- /// <summary>
- /// serialize this object
- /// </summary>
- virtual void toData(apache::geode::client::DataOutput& output) const;
-
- /// <summary>
- /// deserialize this object, typical implementation should return
- /// the 'this' pointer.
- /// </summary>
- virtual void fromData(apache::geode::client::DataInput& input);
-
-
- /// <summary>
- /// return the size of this object in bytes
- /// </summary>
- virtual System::UInt32 objectSize() const;
-
- /// <summary>
- /// return the classId of the instance being serialized.
- /// This is used by deserialization to determine what instance
- /// type to create and deserialize into.
- /// </summary>
- virtual System::Int32 classId() const;
-
- /// <summary>
- /// return the typeId of the instance being serialized.
- /// This is used by deserialization to determine what instance
- /// type to create and deserialize into.
- /// </summary>
- virtual int8_t typeId() const;
-
- /// <summary>
- /// return the Data Serialization Fixed ID type.
- /// This is used to determine what instance type to create
- /// and deserialize into.
- ///
- /// Note that this should not be overridden by custom implementations
- /// and is reserved only for builtin types.
- /// </summary>
- virtual int8_t DSFID() const;
-
- /// <summary>
- /// Display this object as 'string', which depends on the implementation in
- /// the managed class
- /// </summary>
- virtual apache::geode::client::CacheableStringPtr toString() const;
-
- /// <summary>
- /// return true if this key matches other CacheableKey
- /// </summary>
- virtual bool operator == (const apache::geode::client::CacheableKey& other) const;
- /// <summary>
- /// return true if this key matches other ManagedCacheableKeyBytes
- /// </summary>
- virtual bool operator == (const ManagedCacheableKeyBytesGeneric& other) const;
-
- /// <summary>
- /// return the hashcode for this key.
- /// </summary>
- virtual System::Int32 hashcode() const;
-
- /// <summary>
- /// Copy the string form of a key into a char* buffer for logging purposes.
- /// implementations should only generate a string as long as maxLength chars,
- /// and return the number of chars written. buffer is expected to be large
- /// enough to hold at least maxLength chars.
- /// The default implementation renders the classname and instance address.
- /// </summary>
- virtual size_t logString(char* buffer, size_t maxLength) const;
-
- /// <summary>
- /// Returns the wrapped managed object reference.
- /// </summary>
- inline Apache::Geode::Client::IGeodeSerializable^ ptr() const
- {
- return getManagedObject();
- }
-
- inline ~ManagedCacheableKeyBytesGeneric()
- {
- Apache::Geode::Client::Log::Fine(
- "ManagedCacheableKeyBytes::Destructor current AppDomain ID: " +
- System::Threading::Thread::GetDomainID() + " for object: " +
- System::Convert::ToString((UInt64) this) + " with its AppDomain ID: " + m_domainId);
- GF_SAFE_DELETE(m_bytes);
- }
-
- private:
-
- Apache::Geode::Client::IGeodeSerializable^ getManagedObject() const;
-
- /// <summary>
- /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
- /// Note: not using auto_gcroot since it will result in 'Dispose' of the IGeodeSerializable
- /// to be called which is not what is desired when this object is destroyed. Normally this
- /// managed object may be created by the user and will be handled automatically by the GC.
- /// </summary>
- // gcroot<IGeodeSerializable^> m_managedptr;
- int m_domainId;
- UInt32 m_classId;
- System::Byte * m_bytes;
- System::UInt32 m_size;
- System::UInt32 m_hashCode;
- // Disable the copy and assignment constructors
- ManagedCacheableKeyBytesGeneric(const ManagedCacheableKeyBytesGeneric&);
- ManagedCacheableKeyBytesGeneric& operator = (const ManagedCacheableKeyBytesGeneric&);
- };
-
- } // namespace client
- } // namespace geode
-} // namespace apache
diff --git a/clicache/src/impl/PartitionResolver.hpp b/clicache/src/impl/PartitionResolver.hpp
index 8223e19..543ea07 100644
--- a/clicache/src/impl/PartitionResolver.hpp
+++ b/clicache/src/impl/PartitionResolver.hpp
@@ -59,7 +59,7 @@ namespace Apache
{
EntryEvent<TKey, TValue> gevent(&ev);
Object^ groutingobject = m_resolver->GetRoutingObject(%gevent);
- return Serializable::GetUnmanagedValueGeneric<Object^>(groutingobject, nullptr);
+ return Serializable::GetUnmanagedValueGeneric<Object^>(groutingobject);
}
virtual const char * getName()
diff --git a/clicache/src/impl/PdxHelper.cpp b/clicache/src/impl/PdxHelper.cpp
index f611146..ec4fe62 100644
--- a/clicache/src/impl/PdxHelper.cpp
+++ b/clicache/src/impl/PdxHelper.cpp
@@ -33,6 +33,7 @@
#include "PdxWrapper.hpp"
#include "../Log.hpp"
#include "PdxInstanceImpl.hpp"
+#include "Cache.hpp"
using namespace System;
@@ -70,7 +71,7 @@ namespace Apache
PdxType^ piPt = pdxII->getPdxType();
if(piPt != nullptr && piPt->TypeId == 0)//from pdxInstance factory need to get typeid from server
{
- int typeId = PdxTypeRegistry::GetPDXIdForType(piPt, dataOutput->GetPoolName(), dataOutput->GetNative()->getCache());
+ int typeId = dataOutput->Cache->GetPdxTypeRegistry()->GetPDXIdForType(piPt, dataOutput->GetPoolName());
pdxII->setPdxId(typeId);
}
PdxLocalWriter^ plw = gcnew PdxLocalWriter(dataOutput, piPt);
@@ -90,7 +91,7 @@ namespace Apache
}
pdxClassname = Serializable::GetPdxTypeName(pdxType->FullName);
- PdxType^ localPdxType = PdxTypeRegistry::GetLocalPdxType(pdxClassname);
+ PdxType^ localPdxType = dataOutput->Cache->GetPdxTypeRegistry()->GetLocalPdxType(pdxClassname);
if(localPdxType == nullptr)
{
@@ -99,17 +100,17 @@ namespace Apache
pdxObject->ToData(ptc);
PdxType^ nType = ptc->PdxLocalType;//local type
- nType->InitializeType();//initialize it
+ nType->InitializeType(dataOutput->Cache);//initialize it
//get type id from server and then set it
- int nTypeId = PdxTypeRegistry::GetPDXIdForType(pdxType,
- dataOutput->GetPoolName(), nType, true, dataOutput->GetNative()->getCache());
+ int nTypeId = dataOutput->Cache->GetPdxTypeRegistry()->GetPDXIdForType(pdxType,
+ dataOutput->GetPoolName(), nType, true);
nType->TypeId = nTypeId;
ptc->EndObjectWriting();//now write typeid
- PdxTypeRegistry::AddLocalPdxType(pdxClassname, nType);//add classname VS pdxType
- PdxTypeRegistry::AddPdxType(nTypeId, nType);//add typeid vs pdxtype
+ dataOutput->Cache->GetPdxTypeRegistry()->AddLocalPdxType(pdxClassname, nType);//add classname VS pdxType
+ dataOutput->Cache->GetPdxTypeRegistry()->AddPdxType(nTypeId, nType);//add typeid vs pdxtype
//This is for pdx Statistics
System::Byte* stPos = dataOutput->GetStartBufferPosition() + ptc->getStartPositionOffset();
@@ -121,14 +122,14 @@ namespace Apache
else//we know locasl type, need to see preerved data
{
//if object got from server than create instance of RemoteWriter otherwise local writer.
- PdxRemotePreservedData^ pd = PdxTypeRegistry::GetPreserveData(pdxObject);
+ PdxRemotePreservedData^ pd = dataOutput->Cache->GetPdxTypeRegistry()->GetPreserveData(pdxObject);
//now always remotewriter as we have API Read/WriteUnreadFields
//so we don't know whether user has used those or not;; Can we do some trick here?
PdxRemoteWriter^ prw = nullptr;
if(pd != nullptr)
{
- PdxType^ mergedPdxType = PdxTypeRegistry::GetPdxType(pd->MergedTypeId);
+ PdxType^ mergedPdxType = dataOutput->Cache->GetPdxTypeRegistry()->GetPdxType(pd->MergedTypeId);
prw = gcnew PdxRemoteWriter(dataOutput, mergedPdxType, pd);
}
@@ -160,11 +161,11 @@ namespace Apache
dataInput->AdvanceUMCursor();//it will increase the cursor in c++ layer
dataInput->SetBuffer();//it will c++ buffer in cli layer
- PdxType^ pType = PdxTypeRegistry::GetPdxType(typeId);
+ PdxType^ pType = dataInput->Cache->GetPdxTypeRegistry()->GetPdxType(typeId);
PdxType^ pdxLocalType = nullptr;
if(pType != nullptr)//this may happen with PdxInstanceFactory
- pdxLocalType = PdxTypeRegistry::GetLocalPdxType(pType->PdxClassName);//this should be fine for IPdxTypeMapper
+ pdxLocalType = dataInput->Cache->GetPdxTypeRegistry()->GetLocalPdxType(pType->PdxClassName);//this should be fine for IPdxTypeMapper
if(pType != nullptr && pdxLocalType != nullptr)//type found
{
@@ -183,10 +184,10 @@ namespace Apache
PdxRemoteReader^ prr = gcnew PdxRemoteReader(dataInput, pType, len);
pdxObject->FromData(prr);
- PdxType^ mergedVersion = PdxTypeRegistry::GetMergedType(pType->TypeId);
+ PdxType^ mergedVersion = dataInput->Cache->GetPdxTypeRegistry()->GetMergedType(pType->TypeId);
PdxRemotePreservedData^ preserveData = prr->GetPreservedData(mergedVersion, pdxObject);
if(preserveData != nullptr)
- PdxTypeRegistry::SetPreserveData(pdxObject, preserveData);//it will set data in weakhashmap
+ dataInput->Cache->GetPdxTypeRegistry()->SetPreserveData(pdxObject, preserveData);//it will set data in weakhashmap
prr->MoveStream();
}
}
@@ -194,8 +195,8 @@ namespace Apache
{
if(pType == nullptr)
{
- pType = (PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPoolName(), typeId, dataInput->GetNative()->getCache()));
- pdxLocalType = PdxTypeRegistry::GetLocalPdxType(pType->PdxClassName);//this should be fine for IPdxTypeMappers
+ pType = (PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPoolName(), typeId, dataInput->Cache));
+ pdxLocalType = dataInput->Cache->GetPdxTypeRegistry()->GetLocalPdxType(pType->PdxClassName);//this should be fine for IPdxTypeMappers
}
pdxClassname = pType->PdxClassName;
@@ -230,41 +231,41 @@ namespace Apache
if(pType->Equals(pdxLocalType))//same
{
- PdxTypeRegistry::AddLocalPdxType(pdxClassname, pType);
- PdxTypeRegistry::AddPdxType(pType->TypeId, pType);
+ dataInput->Cache->GetPdxTypeRegistry()->AddLocalPdxType(pdxClassname, pType);
+ dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(pType->TypeId, pType);
pType->IsLocal = true;
}
else
{
//need to know local type and then merge type
- pdxLocalType->InitializeType();
- pdxLocalType->TypeId = PdxTypeRegistry::GetPDXIdForType(pdxObject->GetType(),
+ pdxLocalType->InitializeType(dataInput->Cache);
+ pdxLocalType->TypeId = dataInput->Cache->GetPdxTypeRegistry()->GetPDXIdForType(pdxObject->GetType(),
dataInput->GetPoolName(),
- pdxLocalType, true, dataInput->GetNative()->getCache());
+ pdxLocalType, true);
pdxLocalType->IsLocal = true;
- PdxTypeRegistry::AddLocalPdxType(pdxClassname, pdxLocalType);//added local type
- PdxTypeRegistry::AddPdxType(pdxLocalType->TypeId, pdxLocalType);
+ dataInput->Cache->GetPdxTypeRegistry()->AddLocalPdxType(pdxClassname, pdxLocalType);//added local type
+ dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(pdxLocalType->TypeId, pdxLocalType);
- pType->InitializeType();
- PdxTypeRegistry::AddPdxType(pType->TypeId, pType); //adding remote type
+ pType->InitializeType(dataInput->Cache);
+ dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(pType->TypeId, pType); //adding remote type
//pdxLocalType->AddOtherVersion(pType);
//pdxLocalType->AddOtherVersion(pdxLocalType);//no need to add local type
//need to create merge type
CreateMergedType(pdxLocalType, pType, dataInput, serializationRegistry);
- PdxType^ mergedVersion = PdxTypeRegistry::GetMergedType(pType->TypeId);
+ PdxType^ mergedVersion = dataInput->Cache->GetPdxTypeRegistry()->GetMergedType(pType->TypeId);
PdxRemotePreservedData^ preserveData = prtc->GetPreservedData(mergedVersion, pdxObject);
if(preserveData != nullptr)
- PdxTypeRegistry::SetPreserveData(pdxObject, preserveData);
+ dataInput->Cache->GetPdxTypeRegistry()->SetPreserveData(pdxObject, preserveData);
}
prtc->MoveStream();
}
else//remote reader will come here as local type is there
{
- pType->InitializeType();
+ pType->InitializeType(dataInput->Cache);
//Log::Debug("Adding type " + pType->TypeId);
- PdxTypeRegistry::AddPdxType(pType->TypeId, pType); //adding remote type
+ dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(pType->TypeId, pType); //adding remote type
//pdxLocalType->AddOtherVersion(pType);
PdxRemoteReader^ prr = gcnew PdxRemoteReader(dataInput, pType, len);
@@ -277,10 +278,10 @@ namespace Apache
//need to create merge type
CreateMergedType(pdxLocalType, pType, dataInput, serializationRegistry);
- PdxType^ mergedVersion = PdxTypeRegistry::GetMergedType(pType->TypeId);
+ PdxType^ mergedVersion = dataInput->Cache->GetPdxTypeRegistry()->GetMergedType(pType->TypeId);
PdxRemotePreservedData^ preserveData = prr->GetPreservedData(mergedVersion, pdxObject);
if(preserveData != nullptr)
- PdxTypeRegistry::SetPreserveData(pdxObject, preserveData);
+ dataInput->Cache->GetPdxTypeRegistry()->SetPreserveData(pdxObject, preserveData);
prr->MoveStream();
}
}//end type not found
@@ -292,7 +293,7 @@ namespace Apache
try
{
dataInput->setPdxdeserialization(true);
- if(PdxTypeRegistry::PdxReadSerialized == false || forceDeserialize ||dataInput->isRootObjectPdx())
+ if(dataInput->Cache->GetPdxReadSerialized() == false || forceDeserialize ||dataInput->isRootObjectPdx())
{
//here we are reading length and typeId..Note; our internal typeid already read in c++ layer
@@ -313,19 +314,19 @@ namespace Apache
// Log::Debug(" len " + len + " " + typeId + " readbytes " + dataInput->BytesReadInternally);
- PdxType^ pType = PdxTypeRegistry::GetPdxType(typeId);
+ PdxType^ pType = dataInput->Cache->GetPdxTypeRegistry()->GetPdxType(typeId);
if(pType == nullptr)
{
- PdxType^ pType = (PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPoolName(), typeId, dataInput->GetNative()->getCache()));
+ PdxType^ pType = (PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPoolName(), typeId, dataInput->Cache));
//this should be fine for IPdxTypeMapper
- PdxTypeRegistry::AddLocalPdxType(pType->PdxClassName, pType);
- PdxTypeRegistry::AddPdxType(pType->TypeId, pType);
+ dataInput->Cache->GetPdxTypeRegistry()->AddLocalPdxType(pType->PdxClassName, pType);
+ dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(pType->TypeId, pType);
//pType->IsLocal = true; ?????
}
// pdxObject = gcnew PdxInstanceImpl(gcnew DataInput(dataInput->GetBytes(dataInput->GetCursor(), len + 8 ), len + 8));
- pdxObject = gcnew PdxInstanceImpl(dataInput->GetBytes(dataInput->GetCursor(), len ), len, typeId, true, dataInput->GetNative()->getCache());
+ pdxObject = gcnew PdxInstanceImpl(dataInput->GetBytes(dataInput->GetCursor(), len ), len, typeId, true, dataInput->Cache);
dataInput->AdvanceCursorPdx(len );
@@ -343,17 +344,17 @@ namespace Apache
}
}
- Int32 PdxHelper::GetEnumValue(String^ enumClassName, String^ enumName, int hashcode, const native::Cache* cache)
+ Int32 PdxHelper::GetEnumValue(String^ enumClassName, String^ enumName, int hashcode, Cache^ cache)
{
//in case app want different name
enumClassName = Serializable::GetPdxTypeName(enumClassName);
EnumInfo^ ei = gcnew EnumInfo(enumClassName, enumName, hashcode);
- return PdxTypeRegistry::GetEnumValue(ei, cache);
+ return cache->GetPdxTypeRegistry()->GetEnumValue(ei);
}
- Object^ PdxHelper::GetEnum(int enumId, const native::Cache* cache)
+ Object^ PdxHelper::GetEnum(int enumId, Cache^ cache)
{
- EnumInfo^ ei = PdxTypeRegistry::GetEnum(enumId, cache);
+ EnumInfo^ ei = cache->GetPdxTypeRegistry()->GetEnum(enumId);
return ei->GetEnum();
}
@@ -363,22 +364,22 @@ namespace Apache
if(mergedVersion->Equals(localType))
{
- PdxTypeRegistry::SetMergedType(remoteType->TypeId, localType);
+ dataInput->Cache->GetPdxTypeRegistry()->SetMergedType(remoteType->TypeId, localType);
}
else if(mergedVersion->Equals(remoteType))
{
- PdxTypeRegistry::SetMergedType(remoteType->TypeId, remoteType);
+ dataInput->Cache->GetPdxTypeRegistry()->SetMergedType(remoteType->TypeId, remoteType);
}
else
{//need to create new version
- mergedVersion->InitializeType();
+ mergedVersion->InitializeType(dataInput->Cache);
if(mergedVersion->TypeId == 0)
- mergedVersion->TypeId = Serializable::GetPDXIdForType(dataInput->GetPoolName(), mergedVersion, dataInput->GetNative()->getCache());
+ mergedVersion->TypeId = Serializable::GetPDXIdForType(dataInput->GetPoolName(), mergedVersion, dataInput->Cache);
- // PdxTypeRegistry::AddPdxType(remoteType->TypeId, mergedVersion);
- PdxTypeRegistry::AddPdxType(mergedVersion->TypeId, mergedVersion);
- PdxTypeRegistry::SetMergedType(remoteType->TypeId, mergedVersion);
- PdxTypeRegistry::SetMergedType(mergedVersion->TypeId, mergedVersion);
+ // dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(remoteType->TypeId, mergedVersion);
+ dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(mergedVersion->TypeId, mergedVersion);
+ dataInput->Cache->GetPdxTypeRegistry()->SetMergedType(remoteType->TypeId, mergedVersion);
+ dataInput->Cache->GetPdxTypeRegistry()->SetMergedType(mergedVersion->TypeId, mergedVersion);
}
}
diff --git a/clicache/src/impl/PdxHelper.hpp b/clicache/src/impl/PdxHelper.hpp
index 7cc9c82..a7a9c17 100644
--- a/clicache/src/impl/PdxHelper.hpp
+++ b/clicache/src/impl/PdxHelper.hpp
@@ -65,9 +65,9 @@ namespace Apache
static Int32 ReadInt(System::Byte* offsetPosition, int size);
- static Int32 GetEnumValue(String^ enumClassName, String^ enumName, int hashcode, const native::Cache* cache);
+ static Int32 GetEnumValue(String^ enumClassName, String^ enumName, int hashcode, Cache^ cache);
- static Object^ GetEnum(int enumId, const native::Cache* cache);
+ static Object^ GetEnum(int enumId, Cache^ cache);
private:
static void CreateMergedType(PdxType^ localType, PdxType^ remoteType, DataInput^ dataInput, const native::SerializationRegistry* serializationRegistry);
diff --git a/clicache/src/impl/PdxInstanceFactoryImpl.cpp b/clicache/src/impl/PdxInstanceFactoryImpl.cpp
index 230972a..fa97d3f 100644
--- a/clicache/src/impl/PdxInstanceFactoryImpl.cpp
+++ b/clicache/src/impl/PdxInstanceFactoryImpl.cpp
@@ -16,13 +16,11 @@
*/
#pragma once
-#include "begin_native.hpp"
-#include "CacheRegionHelper.hpp"
-#include "CacheImpl.hpp"
-#include "end_native.hpp"
+
#include "PdxInstanceFactoryImpl.hpp"
#include "PdxInstanceImpl.hpp"
#include "DotNetTypes.hpp"
+
using namespace System::Text;
namespace Apache
@@ -34,7 +32,7 @@ namespace Apache
namespace Internal
{
- PdxInstanceFactoryImpl::PdxInstanceFactoryImpl(String^ className, native::Cache* cache)
+ PdxInstanceFactoryImpl::PdxInstanceFactoryImpl(String^ className, Cache^ cache)
{
if (className == nullptr)
throw gcnew IllegalStateException(
@@ -53,7 +51,7 @@ namespace Apache
"The IPdxInstanceFactory.Create() method can only be called once.");
}
//need to get typeid;
- IPdxInstance^ pi = gcnew PdxInstanceImpl(m_FieldVsValues, m_pdxType, &CacheRegionHelper::getCacheImpl(m_cache)->getCachePerfStats(), m_cache);
+ IPdxInstance^ pi = gcnew PdxInstanceImpl(m_FieldVsValues, m_pdxType, m_cache);
m_created = true;
return pi;
}
diff --git a/clicache/src/impl/PdxInstanceFactoryImpl.hpp b/clicache/src/impl/PdxInstanceFactoryImpl.hpp
index cce22e4..20ba337 100644
--- a/clicache/src/impl/PdxInstanceFactoryImpl.hpp
+++ b/clicache/src/impl/PdxInstanceFactoryImpl.hpp
@@ -16,9 +16,6 @@
*/
#pragma once
-#include "begin_native.hpp"
-#include <geode/Cache.hpp>
-#include "end_native.hpp"
#include "../IPdxInstanceFactory.hpp"
#include "../IPdxSerializable.hpp"
@@ -32,20 +29,21 @@ namespace Apache
namespace Client
{
+ ref class Cache;
+
namespace Internal
{
- namespace native = apache::geode::client;
-
ref class PdxInstanceFactoryImpl : IPdxInstanceFactory
{
private:
bool m_created;
PdxType^ m_pdxType;
Dictionary<String^, Object^>^ m_FieldVsValues;
- native::Cache* m_cache;
+ Cache^ m_cache;
+
internal:
- PdxInstanceFactoryImpl(String^ className, native::Cache* cache);
+ PdxInstanceFactoryImpl(String^ className, Cache^ cache);
void isFieldAdded(String^ fieldName);
diff --git a/clicache/src/impl/PdxInstanceImpl.cpp b/clicache/src/impl/PdxInstanceImpl.cpp
index 785d997..5fc8598 100755
--- a/clicache/src/impl/PdxInstanceImpl.cpp
+++ b/clicache/src/impl/PdxInstanceImpl.cpp
@@ -32,6 +32,7 @@
#include "../DataInput.hpp"
#include "DotNetTypes.hpp"
#include "PdxType.hpp"
+#include "Cache.hpp"
using namespace System::Text;
@@ -45,7 +46,7 @@ namespace Apache
namespace Internal
{
//this is for PdxInstanceFactory
- PdxInstanceImpl::PdxInstanceImpl(Dictionary<String^, Object^>^ fieldVsValue, PdxType^ pdxType, CachePerfStats* cachePerfStats, const native::Cache* cache)
+ PdxInstanceImpl::PdxInstanceImpl(Dictionary<String^, Object^>^ fieldVsValue, PdxType^ pdxType, Apache::Geode::Client::Cache^ cache)
{
m_updatedFields = fieldVsValue;
m_typeId = 0;
@@ -54,13 +55,13 @@ namespace Apache
m_bufferLength = 0;
m_pdxType = pdxType;
m_cache = cache;
- m_cachePerfStats = cachePerfStats;
- m_pdxType->InitializeType();//to generate static position map
+ m_cachePerfStats = &CacheRegionHelper::getCacheImpl(cache->GetNative().get())->getCachePerfStats();
+ m_pdxType->InitializeType(cache);//to generate static position map
//need to initiailize stream. this will call todata and in toData we will have stream
- auto output = m_cache->createDataOutput();
+ auto output = m_cache->GetNative()->createDataOutput();
- Apache::Geode::Client::DataOutput mg_output(output.get(), true);
+ Apache::Geode::Client::DataOutput mg_output(output.get(), true, cache);
Apache::Geode::Client::Internal::PdxHelper::SerializePdx(%mg_output, this);
}
@@ -68,7 +69,7 @@ namespace Apache
{
if (m_typeId != 0)
{
- PdxType^ pdxtype = Internal::PdxTypeRegistry::GetPdxType(m_typeId);
+ PdxType^ pdxtype = m_cache->GetPdxTypeRegistry()->GetPdxType(m_typeId);
if (pdxtype == nullptr)//will it ever happen
throw gcnew IllegalStateException("PdxType is not defined for PdxInstance: " + m_typeId);
return pdxtype->PdxClassName;
@@ -81,7 +82,7 @@ namespace Apache
DataInput^ dataInput = gcnew DataInput(m_buffer, m_bufferLength, m_cache);
dataInput->setRootObjectPdx(true);
System::Int64 sampleStartNanos = Utils::startStatOpTime();
- Object^ ret = Internal::PdxHelper::DeserializePdx(dataInput, true, m_typeId, m_bufferLength, CacheRegionHelper::getCacheImpl(m_cache)->getSerializationRegistry().get());
+ Object^ ret = Internal::PdxHelper::DeserializePdx(dataInput, true, m_typeId, m_bufferLength, CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry().get());
//dataInput->ResetPdx(0);
if(m_cachePerfStats)
@@ -1090,11 +1091,8 @@ namespace Apache
}
return m_pdxType;
}
- /*m_dataInput->ResetAndAdvanceCursorPdx(0);
- int typeId= Internal::PdxHelper::ReadInt32(m_dataInput->GetCursor() + 4);
- PdxType^ pType = Internal::PdxTypeRegistry::GetPdxType(typeId);*/
- PdxType^ pType = Internal::PdxTypeRegistry::GetPdxType(m_typeId);
+ PdxType^ pType = m_cache->GetPdxTypeRegistry()->GetPdxType(m_typeId);
return pType;
}
diff --git a/clicache/src/impl/PdxInstanceImpl.hpp b/clicache/src/impl/PdxInstanceImpl.hpp
index 4e44022..ac302ec 100755
--- a/clicache/src/impl/PdxInstanceImpl.hpp
+++ b/clicache/src/impl/PdxInstanceImpl.hpp
@@ -16,9 +16,9 @@
*/
#pragma once
+
#include "begin_native.hpp"
-#include "CachePerfStats.hpp"
-#include "SerializationRegistry.hpp"
+#include <CachePerfStats.hpp>
#include "end_native.hpp"
#include "../IPdxInstance.hpp"
@@ -32,6 +32,7 @@ namespace Apache
{
namespace Client
{
+ ref class Cache;
namespace Internal
{
@@ -67,14 +68,13 @@ namespace Apache
void cleanup();
- //DataInput^ m_dataInput;
CachePerfStats* m_cachePerfStats;
System::Byte* m_buffer;
int m_bufferLength;
int m_typeId;
bool m_own;
PdxType^ m_pdxType;
- const native::Cache* m_cache;
+ Apache::Geode::Client::Cache^ m_cache;
internal:
Dictionary<String^, Object^>^ m_updatedFields;
@@ -125,9 +125,8 @@ namespace Apache
void updatePdxStream(System::Byte* newPdxStream, int len);
public:
- PdxInstanceImpl(System::Byte* buffer, int length, int typeId, bool own, const native::Cache* cache)
+ PdxInstanceImpl(System::Byte* buffer, int length, int typeId, bool own, Apache::Geode::Client::Cache^ cache)
{
- //m_dataInput = dataInput;
m_buffer = buffer;
m_bufferLength = length;
m_typeId = typeId;
@@ -138,7 +137,7 @@ namespace Apache
}
//for pdxInstance factory
- PdxInstanceImpl(Dictionary<String^, Object^>^ fieldVsValue, PdxType^ pdxType, CachePerfStats* cachePerfStats, const native::Cache* cache);
+ PdxInstanceImpl(Dictionary<String^, Object^>^ fieldVsValue, PdxType^ pdxType, Cache^ cache);
~PdxInstanceImpl()
{
@@ -291,8 +290,7 @@ namespace Apache
virtual void FromData(IPdxReader^ reader);
};
- } // namespace Client
- } // namespace Geode
- } // namespace Apache
-
-}
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
diff --git a/clicache/src/impl/PdxLocalReader.cpp b/clicache/src/impl/PdxLocalReader.cpp
index e92ba9a..5046d88 100644
--- a/clicache/src/impl/PdxLocalReader.cpp
+++ b/clicache/src/impl/PdxLocalReader.cpp
@@ -19,6 +19,7 @@
#include "PdxTypeRegistry.hpp"
#include "../DataInput.hpp"
#include "DotNetTypes.hpp"
+#include "Cache.hpp"
using namespace System;
@@ -63,13 +64,13 @@ namespace Apache
PdxRemotePreservedData^ PdxLocalReader::GetPreservedData(PdxType^ mergedVersion, IPdxSerializable^ pdxObject)
{
int nFieldExtra = m_pdxType->NumberOfFieldsExtra;
- if(nFieldExtra > 0 && PdxTypeRegistry::PdxIgnoreUnreadFields == false)
+ if(nFieldExtra > 0 && m_dataInput->Cache->GetPdxIgnoreUnreadFields() == false)
{
//m_pdxRemotePreserveData = gcnew PdxRemotePreservedData(m_pdxType!=nullptr? m_pdxType->TypeId : 0, mergedVersion->TypeId,nFieldExtra);
m_pdxRemotePreserveData->Initialize(m_pdxType!=nullptr? m_pdxType->TypeId : 0, mergedVersion->TypeId,nFieldExtra,pdxObject);
- m_localToRemoteMap = m_pdxType->GetLocalToRemoteMap();
- m_remoteToLocalMap = m_pdxType->GetRemoteToLocalMap();
+ m_localToRemoteMap = m_pdxType->GetLocalToRemoteMap(m_dataInput->Cache);
+ m_remoteToLocalMap = m_pdxType->GetRemoteToLocalMap(m_dataInput->Cache);
int currentIdx = 0;
for(int i = 0; i < m_remoteToLocalMap->Length; i++)
@@ -107,7 +108,7 @@ namespace Apache
IPdxUnreadFields^ PdxLocalReader::ReadUnreadFields()
{
//Log::Debug("PdxLocalReader::ReadUnreadFields:: " + m_isDataNeedToPreserve + " ignore property " + PdxTypeRegistry::PdxIgnoreUnreadFields);
- if(PdxTypeRegistry::PdxIgnoreUnreadFields == true)
+ if(m_dataInput->Cache->GetPdxIgnoreUnreadFields() == true)
return nullptr;
m_isDataNeedToPreserve = false;
return m_pdxRemotePreserveData;
diff --git a/clicache/src/impl/PdxLocalReader.hpp b/clicache/src/impl/PdxLocalReader.hpp
index bbe4971..78eafcd 100644
--- a/clicache/src/impl/PdxLocalReader.hpp
+++ b/clicache/src/impl/PdxLocalReader.hpp
@@ -65,8 +65,8 @@ namespace Apache
m_pdxType = pdxType;
m_serializedLengthWithOffsets = pdxLen;
- m_localToRemoteMap = pdxType->GetLocalToRemoteMap();
- m_remoteToLocalMap = pdxType->GetRemoteToLocalMap();
+ m_localToRemoteMap = pdxType->GetLocalToRemoteMap(dataInput->Cache);
+ m_remoteToLocalMap = pdxType->GetRemoteToLocalMap(dataInput->Cache);
m_pdxRemotePreserveData = gcnew PdxRemotePreservedData();
m_isDataNeedToPreserve = true;
initialize();
diff --git a/clicache/src/impl/PdxLocalWriter.cpp b/clicache/src/impl/PdxLocalWriter.cpp
index 8280a14..2f87437 100644
--- a/clicache/src/impl/PdxLocalWriter.cpp
+++ b/clicache/src/impl/PdxLocalWriter.cpp
@@ -20,6 +20,8 @@
#include "PdxTypeRegistry.hpp"
#include "../DataOutput.hpp"
#include "DotNetTypes.hpp"
+#include "Cache.hpp"
+
using namespace System;
namespace Apache
@@ -32,6 +34,28 @@ namespace Apache
namespace Internal
{
+ PdxLocalWriter::PdxLocalWriter(DataOutput^ dataOutput, PdxType^ pdxType)
+ {
+ m_dataOutput = dataOutput;
+ m_pdxType = pdxType;
+ m_currentOffsetIndex = 0;
+ m_preserveData = nullptr;
+ if (pdxType != nullptr)
+ m_pdxClassName = pdxType->PdxClassName;
+ //m_pdxDomainType = nullptr;
+ initialize();
+ }
+
+ PdxLocalWriter::PdxLocalWriter(DataOutput^ dataOutput, PdxType^ pdxType, String^ pdxClassName)
+ {
+ m_dataOutput = dataOutput;
+ m_pdxType = pdxType;
+ m_currentOffsetIndex = 0;
+ m_preserveData = nullptr;
+ // m_pdxDomainType = pdxDomainType;
+ m_pdxClassName = pdxClassName;
+ initialize();
+ }
void PdxLocalWriter::initialize()
{
@@ -143,11 +167,11 @@ namespace Apache
{
m_preserveData = (PdxRemotePreservedData^)unread;
- m_pdxType = PdxTypeRegistry::GetPdxType(m_preserveData->MergedTypeId);
+ m_pdxType = m_dataOutput->Cache->GetPdxTypeRegistry()->GetPdxType(m_preserveData->MergedTypeId);
if(m_pdxType == nullptr)
{//its local type
//this needs to fix for IPdxTypemapper
- m_pdxType = PdxTypeRegistry::GetLocalPdxType(m_pdxClassName);
+ m_pdxType = GetLocalPdxType(m_pdxClassName);
}
m_offsets = gcnew array<int>(m_pdxType->NumberOfVarLenFields);
}
@@ -479,12 +503,15 @@ namespace Apache
else
{
return this->WriteObject(fieldName, fieldValue);
- //throw gcnew IllegalStateException("WriteField unable to serialize "
- // + fieldName + " of " + type);
+ }
+ }
+
+ PdxType^ PdxLocalWriter::GetLocalPdxType(String^ pdxClassName)
+ {
+ return m_dataOutput->Cache->GetPdxTypeRegistry()->GetLocalPdxType(pdxClassName);
+ }
+
+ } // namespace Internal
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- }
- }
-}
diff --git a/clicache/src/impl/PdxLocalWriter.hpp b/clicache/src/impl/PdxLocalWriter.hpp
index 001d418..5c9bc16 100644
--- a/clicache/src/impl/PdxLocalWriter.hpp
+++ b/clicache/src/impl/PdxLocalWriter.hpp
@@ -22,6 +22,7 @@
#include "PdxType.hpp"
#include "../GeodeClassIds.hpp"
#include "PdxRemotePreservedData.hpp"
+
using namespace System;
namespace Apache
@@ -31,7 +32,9 @@ namespace Apache
namespace Client
{
+ ref class Cache;
ref class DataOutput;
+
namespace Internal
{
ref class PdxLocalWriter : public IPdxWriter
@@ -48,30 +51,13 @@ namespace Apache
//Type^ m_pdxDomainType;
String^ m_pdxClassName;
+ PdxType^ GetLocalPdxType(String^ pdxClassName);
+
public:
- PdxLocalWriter(DataOutput^ dataOutput, PdxType^ pdxType)
- {
- m_dataOutput = dataOutput;
- m_pdxType = pdxType;
- m_currentOffsetIndex = 0;
- m_preserveData = nullptr;
- if (pdxType != nullptr)
- m_pdxClassName = pdxType->PdxClassName;
- //m_pdxDomainType = nullptr;
- initialize();
- }
+ PdxLocalWriter(DataOutput^ dataOutput, PdxType^ pdxType);
- PdxLocalWriter(DataOutput^ dataOutput, PdxType^ pdxType, String^ pdxClassName)
- {
- m_dataOutput = dataOutput;
- m_pdxType = pdxType;
- m_currentOffsetIndex = 0;
- m_preserveData = nullptr;
- // m_pdxDomainType = pdxDomainType;
- m_pdxClassName = pdxClassName;
- initialize();
- }
+ PdxLocalWriter(DataOutput^ dataOutput, PdxType^ pdxType, String^ pdxClassName);
void initialize();
@@ -362,8 +348,7 @@ namespace Apache
virtual void WriteByte(Byte byte);//for internal purpose
};
- } // namespace Client
- } // namespace Geode
- } // namespace Apache
-
-}
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
diff --git a/clicache/src/impl/PdxManagedCacheableKey.cpp b/clicache/src/impl/PdxManagedCacheableKey.cpp
index c3d2a3b..950cc69 100644
--- a/clicache/src/impl/PdxManagedCacheableKey.cpp
+++ b/clicache/src/impl/PdxManagedCacheableKey.cpp
@@ -31,6 +31,8 @@
#include "ManagedString.hpp"
#include "PdxHelper.hpp"
#include "SafeConvert.hpp"
+#include "CacheResolver.hpp"
+
using namespace System;
namespace apache
@@ -43,7 +45,8 @@ namespace apache
{
try {
System::UInt32 pos = (int)output.getBufferLength();
- Apache::Geode::Client::DataOutput mg_output(&output, true);
+ auto cache = CacheResolver::Lookup(output.getCache());
+ Apache::Geode::Client::DataOutput mg_output(&output, true, cache);
Apache::Geode::Client::Internal::PdxHelper::SerializePdx(%mg_output, m_managedptr);
//m_managedptr->ToData( %mg_output );
//this will move the cursor in c++ layer
@@ -63,7 +66,8 @@ namespace apache
{
try {
int pos = input.getBytesRead();
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ auto cache = CacheResolver::Lookup(input.getCache());
+ Apache::Geode::Client::DataInput mg_input(&input, true, cache);
//m_managedptr = m_managedptr->FromData( %mg_input );
Apache::Geode::Client::IPdxSerializable^ tmp = Apache::Geode::Client::Internal::PdxHelper::DeserializePdx(%mg_input, false, CacheRegionHelper::getCacheImpl(input.getCache())->getSerializationRegistry().get());
m_managedptr = tmp;
@@ -246,7 +250,8 @@ namespace apache
void PdxManagedCacheableKey::toDelta(DataOutput& output) const
{
try {
- Apache::Geode::Client::DataOutput mg_output(&output, true);
+ auto cache = CacheResolver::Lookup(output.getCache());
+ Apache::Geode::Client::DataOutput mg_output(&output, true, cache);
m_managedDeltaptr->ToDelta(%mg_output);
//this will move the cursor in c++ layer
mg_output.WriteBytesToUMDataOutput();
@@ -262,7 +267,8 @@ namespace apache
void PdxManagedCacheableKey::fromDelta(native::DataInput& input)
{
try {
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ auto cache = CacheResolver::Lookup(input.getCache());
+ Apache::Geode::Client::DataInput mg_input(&input, true, cache);
m_managedDeltaptr->FromDelta(%mg_input);
//this will move the cursor in c++ layer
@@ -281,15 +287,10 @@ namespace apache
DeltaPtr PdxManagedCacheableKey::clone()
{
try {
- ICloneable^ cloneable = dynamic_cast<ICloneable^>((
- Apache::Geode::Client::IGeodeDelta^) m_managedDeltaptr);
- if (cloneable) {
- Apache::Geode::Client::IPdxSerializable^ Mclone =
- dynamic_cast<Apache::Geode::Client::IPdxSerializable^>(cloneable->Clone());
- return DeltaPtr(static_cast<PdxManagedCacheableKey*>(
- SafeGenericM2UMConvert(Mclone, m_cache)));
- }
- else {
+ if (auto cloneable = dynamic_cast<ICloneable^>((Apache::Geode::Client::IGeodeDelta^) m_managedDeltaptr)) {
+ auto Mclone = dynamic_cast<Apache::Geode::Client::IPdxSerializable^>(cloneable->Clone());
+ return DeltaPtr(static_cast<PdxManagedCacheableKey*>(SafeGenericM2UMConvert(Mclone)));
+ } else {
return Delta::clone();
}
}
diff --git a/clicache/src/impl/PdxManagedCacheableKey.hpp b/clicache/src/impl/PdxManagedCacheableKey.hpp
index b1c82c2..8a8885c 100644
--- a/clicache/src/impl/PdxManagedCacheableKey.hpp
+++ b/clicache/src/impl/PdxManagedCacheableKey.hpp
@@ -60,6 +60,7 @@ namespace apache
private:
int m_hashcode;
int m_objectSize;
+
public:
inline PdxManagedCacheableKey()
@@ -175,7 +176,8 @@ namespace apache
static Serializable* CreateDeserializable()
{
- return new PdxManagedCacheableKey();
+ throw "Not implemented";
+ //return new PdxManagedCacheableKey();
}
private:
diff --git a/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp b/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
deleted file mode 100644
index aa58ff6..0000000
--- a/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
+++ /dev/null
@@ -1,289 +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 "begin_native.hpp"
-#include <GeodeTypeIdsImpl.hpp>
-#include "end_native.hpp"
-
-#include "PdxManagedCacheableKeyBytes.hpp"
-#include "../DataInput.hpp"
-#include "../DataOutput.hpp"
-#include "../Serializable.hpp"
-#include "../CacheableString.hpp"
-#include "../ExceptionTypes.hpp"
-#include "ManagedString.hpp"
-#include "SafeConvert.hpp"
-
-using namespace System;
-
-namespace apache
-{
- namespace geode
- {
- namespace client
- {
- void PdxManagedCacheableKeyBytes::toData(apache::geode::client::DataOutput& output) const
- {
- // Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId );
- try {
- //TODO: I think this should work as it is
- output.writeBytesOnly(m_bytes, m_size);
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- void PdxManagedCacheableKeyBytes::fromData(apache::geode::client::DataInput& input)
- {
- try {
-
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
- const System::Byte* objStartPos = input.currentBufferPosition();
-
- Apache::Geode::Client::IPdxSerializable^ obj = Apache::Geode::Client::Internal::PdxHelper::DeserializePdx(%mg_input, false, CacheRegionHelper::getCacheImpl(input.getCache())->getSerializationRegistry().get());
- input.advanceCursor(mg_input.BytesReadInternally);
-
- m_hashCode = obj->GetHashCode();
-
- const System::Byte* objEndPos = input.currentBufferPosition();
-
- m_size = (System::UInt32)(objEndPos - objStartPos);
- m_bytes = input.getBufferCopyFrom(objStartPos, m_size);
-
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- System::UInt32 PdxManagedCacheableKeyBytes::objectSize() const
- {
- try {
- return m_size;
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return 0;
- }
-
- System::Int32 PdxManagedCacheableKeyBytes::classId() const
- {
- return 0;
- }
-
- int8_t PdxManagedCacheableKeyBytes::typeId() const
- {
-
- return (int8_t)GeodeTypeIdsImpl::PDX;
- }
-
- int8_t PdxManagedCacheableKeyBytes::DSFID() const
- {
- return 0;
- }
-
- apache::geode::client::CacheableStringPtr PdxManagedCacheableKeyBytes::toString() const
- {
- try {
- Apache::Geode::Client::IPdxSerializable^ manageObject = getManagedObject();
- if (manageObject != nullptr)
- {
- apache::geode::client::CacheableStringPtr cStr;
- Apache::Geode::Client::CacheableString::GetCacheableString(
- manageObject->ToString(), cStr);
- return cStr;
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return nullptr;
- }
-
- bool PdxManagedCacheableKeyBytes::operator ==(const apache::geode::client::CacheableKey& other) const
- {
- try {
- // Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::equal");
- // now checking classId(), typeId(), DSFID() etc. will be much more
- // expensive than just a dynamic_cast
- const PdxManagedCacheableKeyBytes* p_other =
- dynamic_cast<const PdxManagedCacheableKeyBytes*>(&other);
- if (p_other != NULL) {
- Apache::Geode::Client::IPdxSerializable^ obj = getManagedObject();
- bool ret = obj->Equals(p_other->ptr());
- return ret;
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- // Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::equal returns false");
- return false;
- }
-
- bool PdxManagedCacheableKeyBytes::operator ==(const PdxManagedCacheableKeyBytes& other) const
- {
- try {
- //Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::equal. ");
- Apache::Geode::Client::IPdxSerializable^ obj = getManagedObject();
- bool ret = obj->Equals(other.ptr());
- return ret;
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- // Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::equal return false");
- return false;
- }
-
- System::Int32 PdxManagedCacheableKeyBytes::hashcode() const
- {
- return m_hashCode;
- }
-
- size_t PdxManagedCacheableKeyBytes::logString(char* buffer, size_t maxLength) const
- {
- try {
- Apache::Geode::Client::IPdxSerializable^ manageObject = getManagedObject();
- if (manageObject != nullptr)
- {
- if (maxLength > 0) {
- String^ logstr = manageObject->GetType()->Name + '(' +
- manageObject->ToString() + ')';
- Apache::Geode::Client::ManagedString mg_str(logstr);
- return snprintf(buffer, maxLength, "%s", mg_str.CharPtr);
- }
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return 0;
- }
-
- Apache::Geode::Client::IPdxSerializable^
- PdxManagedCacheableKeyBytes::getManagedObject() const
- {
- auto dinp = m_cache->createDataInput(m_bytes, m_size);
- Apache::Geode::Client::DataInput mg_dinp(dinp.get(), true, m_cache);
- return Apache::Geode::Client::Internal::PdxHelper::DeserializePdx(%mg_dinp, false, CacheRegionHelper::getCacheImpl(m_cache)->getSerializationRegistry().get());
- }
-
- bool PdxManagedCacheableKeyBytes::hasDelta()
- {
- return m_hasDelta;
- }
-
- void PdxManagedCacheableKeyBytes::toDelta(DataOutput& output) const
- {
- try {
- Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
- Apache::Geode::Client::IGeodeDelta^ deltaObj = dynamic_cast<Apache::Geode::Client::IGeodeDelta^>(this->getManagedObject());
- Apache::Geode::Client::DataOutput mg_output(&output, true);
- deltaObj->ToDelta(%mg_output);
- mg_output.WriteBytesToUMDataOutput();
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- void PdxManagedCacheableKeyBytes::fromDelta(DataInput& input)
- {
- try {
- Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta:");
- Apache::Geode::Client::IGeodeDelta^ deltaObj = dynamic_cast<Apache::Geode::Client::IGeodeDelta^>(this->getManagedObject());
- Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
- deltaObj->FromDelta(%mg_input);
-
- Apache::Geode::Client::IPdxSerializable^ managedptr =
- dynamic_cast <Apache::Geode::Client::IPdxSerializable^> (deltaObj);
- {
- Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
- auto dataOut = m_cache->createDataOutput();
- Apache::Geode::Client::DataOutput mg_output(dataOut.get(), true);
- Apache::Geode::Client::Internal::PdxHelper::SerializePdx(%mg_output, managedptr);
- mg_output.WriteBytesToUMDataOutput();
-
- GF_SAFE_DELETE(m_bytes);
- m_bytes = dataOut->getBufferCopy();
- m_size = dataOut->getBufferLength();
- Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta objectSize = " + m_size + " m_hashCode = " + m_hashCode);
- m_hashCode = managedptr->GetHashCode();
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- }
-
- DeltaPtr PdxManagedCacheableKeyBytes::clone()
- {
- try {
- Apache::Geode::Client::IGeodeDelta^ deltaObj = dynamic_cast<Apache::Geode::Client::IGeodeDelta^>(this->getManagedObject());
- ICloneable^ cloneable = dynamic_cast<ICloneable^>((Apache::Geode::Client::IGeodeDelta^) deltaObj);
- if (cloneable) {
- Apache::Geode::Client::IPdxSerializable^ Mclone =
- dynamic_cast<Apache::Geode::Client::IPdxSerializable^>(cloneable->Clone());
- return DeltaPtr(static_cast<PdxManagedCacheableKeyBytes*>(
- SafeGenericM2UMConvert(Mclone, m_cache)));
- }
- else {
- return Delta::clone();
- }
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
- return nullptr;
- }
-
- } // namespace client
- } // namespace geode
-} // namespace apache
diff --git a/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp b/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
deleted file mode 100644
index 442f5ef..0000000
--- a/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
+++ /dev/null
@@ -1,247 +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.
- */
-
-#pragma once
-
-#include "../geode_defs.hpp"
-#include <vcclr.h>
-#include "begin_native.hpp"
-#include <geode/CacheableKey.hpp>
-#include <geode/Delta.hpp>
-#include "CacheRegionHelper.hpp"
-#include "CacheImpl.hpp"
-#include "end_native.hpp"
-
-#include "../Log.hpp"
-#include "../DataOutput.hpp"
-#include "PdxHelper.hpp"
-
-
-using namespace System;
-
-namespace Apache
-{
- namespace Geode
- {
- namespace Client
- {
-
- interface class IPdxSerializable;
- } // namespace Client
- } // namespace Geode
-} // namespace Apache
-
-
-namespace apache
-{
- namespace geode
- {
- namespace client
- {
-
- /// <summary>
- /// Wraps the managed <see cref="Apache.Geode.Client.IGeodeSerializable" />
- /// object and implements the native <c>apache::geode::client::CacheableKey</c> interface.
- /// </summary>
- class PdxManagedCacheableKeyBytes
- : public apache::geode::client::CacheableKey, public Delta
- {
- public:
-
- /// <summary>
- /// Constructor to initialize with the provided managed object.
- /// </summary>
- /// <param name="managedptr">
- /// The managed object.
- /// </param>
- inline PdxManagedCacheableKeyBytes(
- Apache::Geode::Client::IPdxSerializable^ managedptr, bool storeBytes, Cache* cache)
- : Delta(cache), m_domainId(System::Threading::Thread::GetDomainID()),
- m_bytes(NULL),
- m_size(0),
- m_cache(cache),
- m_hashCode(0)
- {
- m_hasDelta = false;
- if(storeBytes)
- {
- Apache::Geode::Client::IGeodeDelta^ deltaObj = dynamic_cast<Apache::Geode::Client::IGeodeDelta^>(managedptr);
-
- if(deltaObj != nullptr)
- m_hasDelta = deltaObj->HasDelta();
- }
- if(managedptr != nullptr)
- {
- if(storeBytes)//if value is from app
- {
- auto dataOut = m_cache->createDataOutput();
- Apache::Geode::Client::DataOutput mg_output(dataOut.get(), true);
- SerializationRegistry defaultSerializationRegistry;
-
- Apache::Geode::Client::Internal::PdxHelper::SerializePdx(%mg_output, managedptr);
- // managedptr->ToData( %mg_output );
-
- //move cursor
- //dataOut.advanceCursor(mg_output.BufferLength);
- mg_output.WriteBytesToUMDataOutput();
-
- m_bytes = dataOut->getBufferCopy();
- m_size = dataOut->getBufferLength();
-
- m_hashCode = managedptr->GetHashCode();
- Apache::Geode::Client::Log::Fine(
- "PdxManagedCacheableKeyBytes::Constructor objectSize = " + m_size + " m_hashCode = " + m_hashCode);
- }
- }
- }
-
- inline PdxManagedCacheableKeyBytes(Cache* cache)
- : Delta(cache), m_domainId(System::Threading::Thread::GetDomainID()),
- m_bytes(NULL),
- m_size(0),
- m_cache(cache),
- m_hashCode(0)
- {
- m_hasDelta = false;
- }
-
- /// <summary>
- /// serialize this object
- /// </summary>
- virtual void toData( apache::geode::client::DataOutput& output ) const;
-
- /// <summary>
- /// deserialize this object, typical implementation should return
- /// the 'this' pointer.
- /// </summary>
- virtual void fromData( apache::geode::client::DataInput& input );
-
- virtual void toDelta( apache::geode::client::DataOutput& output) const;
-
- virtual void fromDelta( apache::geode::client::DataInput& input );
-
- virtual bool hasDelta();
-
- virtual apache::geode::client::DeltaPtr clone();
-
- /// <summary>
- /// return the size of this object in bytes
- /// </summary>
- virtual System::UInt32 objectSize() const;
-
- /// <summary>
- /// return the classId of the instance being serialized.
- /// This is used by deserialization to determine what instance
- /// type to create and deserialize into.
- /// </summary>
- virtual System::Int32 classId( ) const;
-
- /// <summary>
- /// return the typeId of the instance being serialized.
- /// This is used by deserialization to determine what instance
- /// type to create and deserialize into.
- /// </summary>
- virtual int8_t typeId( ) const;
-
- /// <summary>
- /// return the Data Serialization Fixed ID type.
- /// This is used to determine what instance type to create
- /// and deserialize into.
- ///
- /// Note that this should not be overridden by custom implementations
- /// and is reserved only for builtin types.
- /// </summary>
- virtual int8_t DSFID() const;
-
- /// <summary>
- /// Display this object as 'string', which depends on the implementation in
- /// the managed class
- /// </summary>
- virtual apache::geode::client::CacheableStringPtr toString( ) const;
-
- /// <summary>
- /// return true if this key matches other CacheableKey
- /// </summary>
- virtual bool operator == ( const apache::geode::client::CacheableKey& other ) const;
- /// <summary>
- /// return true if this key matches other ManagedCacheableKeyBytes
- /// </summary>
- virtual bool operator == ( const PdxManagedCacheableKeyBytes& other ) const;
-
- /// <summary>
- /// return the hashcode for this key.
- /// </summary>
- virtual System::Int32 hashcode( ) const;
-
- /// <summary>
- /// Copy the string form of a key into a char* buffer for logging purposes.
- /// implementations should only generate a string as long as maxLength chars,
- /// and return the number of chars written. buffer is expected to be large
- /// enough to hold at least maxLength chars.
- /// The default implementation renders the classname and instance address.
- /// </summary>
- virtual size_t logString( char* buffer, size_t maxLength ) const;
-
- /// <summary>
- /// Returns the wrapped managed object reference.
- /// </summary>
- inline Apache::Geode::Client::IPdxSerializable^ ptr( ) const
- {
- return getManagedObject();
- }
-
- static Serializable* CreateDeserializable(Cache* cache)
- {
- return new PdxManagedCacheableKeyBytes(cache);
- }
-
- inline ~PdxManagedCacheableKeyBytes()
- {
- Apache::Geode::Client::Log::Fine(
- "ManagedCacheableKeyBytes::Destructor current AppDomain ID: " +
- System::Threading::Thread::GetDomainID() + " for object: " +
- System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
- GF_SAFE_DELETE(m_bytes);
- }
-
- private:
-
- Apache::Geode::Client::IPdxSerializable^ getManagedObject() const;
-
- /// <summary>
- /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
- /// Note: not using auto_gcroot since it will result in 'Dispose' of the IGeodeSerializable
- /// to be called which is not what is desired when this object is destroyed. Normally this
- /// managed object may be created by the user and will be handled automatically by the GC.
- /// </summary>
-// gcroot<IGeodeSerializable^> m_managedptr;
- int m_domainId;
- UInt32 m_classId;
- System::Byte * m_bytes;
- System::UInt32 m_size;
- Cache* m_cache;
- bool m_hasDelta;
- System::Int32 m_hashCode;
- // Disable the copy and assignment constructors
- PdxManagedCacheableKeyBytes( const PdxManagedCacheableKeyBytes& );
- PdxManagedCacheableKeyBytes& operator = ( const PdxManagedCacheableKeyBytes& );
- };
-
- } // namespace client
- } // namespace geode
-} // namespace apache
-
diff --git a/clicache/src/impl/PdxRemoteWriter.cpp b/clicache/src/impl/PdxRemoteWriter.cpp
index 515429e..b9ccb6c 100644
--- a/clicache/src/impl/PdxRemoteWriter.cpp
+++ b/clicache/src/impl/PdxRemoteWriter.cpp
@@ -67,7 +67,7 @@ namespace Apache
if (m_preserveData == nullptr)
{
//this needs to fix for IPdxTypeMapper
- m_pdxType = PdxTypeRegistry::GetLocalPdxType(m_pdxClassName);
+ m_pdxType = GetLocalPdxType(m_pdxClassName);
m_offsets = gcnew array<int>(m_pdxType->NumberOfVarLenFields);
}
}
@@ -80,7 +80,7 @@ namespace Apache
IPdxWriter^ PdxRemoteWriter::WriteUnreadFields(IPdxUnreadFields^ unread)
{
PdxLocalWriter::WriteUnreadFields(unread);
- m_remoteTolocalMap = m_pdxType->GetRemoteToLocalMap();
+ m_remoteTolocalMap = m_pdxType->GetRemoteToLocalMap(m_dataOutput->Cache);
return this;
}
diff --git a/clicache/src/impl/PdxRemoteWriter.hpp b/clicache/src/impl/PdxRemoteWriter.hpp
index 13af9fb..b47335f 100644
--- a/clicache/src/impl/PdxRemoteWriter.hpp
+++ b/clicache/src/impl/PdxRemoteWriter.hpp
@@ -49,7 +49,7 @@ namespace Apache
m_pdxType = pdxType;
m_preserveData = preservedData;
m_preserveDataIdx = 0;
- m_remoteTolocalMap = m_pdxType->GetRemoteToLocalMap();
+ m_remoteTolocalMap = m_pdxType->GetRemoteToLocalMap(dataOutput->Cache);
m_currentDataIdx = -1;
m_pdxClassName = pdxType->PdxClassName;
initialize();
diff --git a/clicache/src/impl/PdxType.cpp b/clicache/src/impl/PdxType.cpp
index 9204e0d..dbff9ee 100644
--- a/clicache/src/impl/PdxType.cpp
+++ b/clicache/src/impl/PdxType.cpp
@@ -23,6 +23,7 @@
#include "../Log.hpp"
#include <msclr/lock.h>
#include "PdxWrapper.hpp"
+#include "Cache.hpp"
using namespace System;
namespace Apache
@@ -126,13 +127,13 @@ namespace Apache
else if (foundVarLenType)
m_numberOfVarLenFields = 1;
- InitializeType();
+ InitializeType(input->Cache);
}
- void PdxType::InitializeType()
+ void PdxType::InitializeType(Cache^ cache)
{
- initRemoteToLocal();//for writing
- initLocalToRemote();//for reading
+ initRemoteToLocal(cache);//for writing
+ initLocalToRemote(cache);//for reading
generatePositionMap();
@@ -314,7 +315,7 @@ namespace Apache
return newone;
}
- array<int>^ PdxType::GetLocalToRemoteMap()
+ array<int>^ PdxType::GetLocalToRemoteMap(Cache^ cache)
{
if (m_localToRemoteFieldMap != nullptr)
return m_localToRemoteFieldMap;
@@ -322,12 +323,12 @@ namespace Apache
msclr::lock lockInstance(m_lockObj);
if (m_localToRemoteFieldMap != nullptr)
return m_localToRemoteFieldMap;
- initLocalToRemote();
+ initLocalToRemote(cache);
return m_localToRemoteFieldMap;
}
- array<int>^ PdxType::GetRemoteToLocalMap()
+ array<int>^ PdxType::GetRemoteToLocalMap(Cache^ cache)
{
//return m_remoteToLocalFieldMap;
@@ -337,7 +338,7 @@ namespace Apache
msclr::lock lockInstance(m_lockObj);
if (m_remoteToLocalFieldMap != nullptr)
return m_remoteToLocalFieldMap;
- initRemoteToLocal();
+ initRemoteToLocal(cache);
return m_remoteToLocalFieldMap;
}
@@ -345,11 +346,11 @@ namespace Apache
/*
* this is write data on remote type(this will always have all fields)
*/
- void PdxType::initRemoteToLocal()
+ void PdxType::initRemoteToLocal(Cache^ cache)
{
//get local type from type Registry and then map local fields.
//need to generate static map
- PdxType^ localPdxType = PdxTypeRegistry::GetLocalPdxType(m_className);
+ PdxType^ localPdxType = cache->GetPdxTypeRegistry()->GetLocalPdxType(m_className);
m_numberOfFieldsExtra = 0;
if (localPdxType != nullptr)
@@ -386,9 +387,9 @@ namespace Apache
}
}
}
- void PdxType::initLocalToRemote()
+ void PdxType::initLocalToRemote(Cache^ cache)
{
- PdxType^ localPdxType = PdxTypeRegistry::GetLocalPdxType(m_className);
+ PdxType^ localPdxType = cache->GetPdxTypeRegistry()->GetLocalPdxType(m_className);
if (localPdxType != nullptr)
{
diff --git a/clicache/src/impl/PdxType.hpp b/clicache/src/impl/PdxType.hpp
index cb4f3c8..6b5a6bd 100644
--- a/clicache/src/impl/PdxType.hpp
+++ b/clicache/src/impl/PdxType.hpp
@@ -62,8 +62,8 @@ namespace Apache
bool m_isVarLenFieldAdded;
bool m_noJavaClass;
- void initRemoteToLocal();
- void initLocalToRemote();
+ void initRemoteToLocal(Cache^ cache);
+ void initLocalToRemote(Cache^ cache);
//first has more fields than second
PdxType^ isContains(PdxType^ first, PdxType^ second);
PdxType^ clone();
@@ -159,8 +159,8 @@ namespace Apache
m_otherVersions->Add(otherVersion);
}
- array<int>^ GetLocalToRemoteMap();
- array<int>^ GetRemoteToLocalMap();
+ array<int>^ GetLocalToRemoteMap(Cache^ cache);
+ array<int>^ GetRemoteToLocalMap(Cache^ cache);
property Int32 NumberOfVarLenFields
{
Int32 get(){ return m_numberOfVarLenFields; }
@@ -186,7 +186,7 @@ namespace Apache
}
void AddFixedLengthTypeField(String^ fieldName, String^ className, Byte typeId, Int32 size);
void AddVariableLengthTypeField(String^ fieldName, String^ className, Byte typeId);
- void InitializeType();
+ void InitializeType(Cache^ cache);
PdxType^ MergeVersion(PdxType^ otherVersion);
Int32 GetFieldPosition(String^ fieldName, System::Byte* offsetPosition, Int32 offsetSize, Int32 pdxStreamlen);
Int32 GetFieldPosition(Int32 fieldIdx, System::Byte* offsetPosition, Int32 offsetSize, Int32 pdxStreamlen);
diff --git a/clicache/src/impl/PdxTypeRegistry.cpp b/clicache/src/impl/PdxTypeRegistry.cpp
index de739a0..98ce7c4 100644
--- a/clicache/src/impl/PdxTypeRegistry.cpp
+++ b/clicache/src/impl/PdxTypeRegistry.cpp
@@ -16,9 +16,16 @@
*/
#pragma once
+
+#include "begin_native.hpp"
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
#include "PdxTypeRegistry.hpp"
#include "../Serializable.hpp"
#include "PdxWrapper.hpp"
+#include "Cache.hpp"
+
using namespace System;
namespace Apache
@@ -40,7 +47,7 @@ namespace Apache
return preserveData->Count;
}
- Int32 PdxTypeRegistry::GetPDXIdForType(Type^ pdxType, const char* poolname, PdxType^ nType, bool checkIfThere, const native::Cache* cache)
+ Int32 PdxTypeRegistry::GetPDXIdForType(Type^ pdxType, const char* poolname, PdxType^ nType, bool checkIfThere)
{
if(checkIfThere)
{
@@ -62,7 +69,7 @@ namespace Apache
return lpdx->TypeId;
}
}
- return Serializable::GetPDXIdForType(poolname, nType, cache);
+ return Serializable::GetPDXIdForType(poolname, nType, m_cache);
}
finally
{
@@ -71,7 +78,7 @@ namespace Apache
}
- Int32 PdxTypeRegistry::GetPDXIdForType(PdxType^ pType, const char* poolname, const native::Cache* cache)
+ Int32 PdxTypeRegistry::GetPDXIdForType(PdxType^ pType, const char* poolname)
{
IDictionary<PdxType^, Int32>^ tmp = pdxTypeToTypeId;
Int32 typeId = 0;
@@ -92,7 +99,7 @@ namespace Apache
return typeId;
}
- typeId = Serializable::GetPDXIdForType(poolname, pType, cache);
+ typeId = Serializable::GetPDXIdForType(poolname, pType, m_cache);
pType->TypeId = typeId;
IDictionary<PdxType^, Int32>^ newDict = gcnew Dictionary<PdxType^, Int32>(pdxTypeToTypeId);
@@ -255,7 +262,7 @@ namespace Apache
return nullptr;
}
- Int32 PdxTypeRegistry::GetEnumValue(EnumInfo^ ei, const native::Cache* cache)
+ Int32 PdxTypeRegistry::GetEnumValue(EnumInfo^ ei)
{
IDictionary<EnumInfo^, Int32>^ tmp = enumToInt;
if(tmp->ContainsKey(ei))
@@ -267,7 +274,7 @@ namespace Apache
if(tmp->ContainsKey(ei))
return tmp[ei];
- int val = Serializable::GetEnumValue(ei, cache);
+ int val = Serializable::GetEnumValue(ei, m_cache);
tmp = gcnew Dictionary<EnumInfo^, Int32>(enumToInt);
tmp[ei] = val;
enumToInt = tmp;
@@ -280,7 +287,7 @@ namespace Apache
return 0;
}
- EnumInfo^ PdxTypeRegistry::GetEnum(Int32 enumVal, const native::Cache* cache)
+ EnumInfo^ PdxTypeRegistry::GetEnum(Int32 enumVal)
{
IDictionary<Int32, EnumInfo^>^ tmp = intToEnum;
EnumInfo^ ret = nullptr;
@@ -298,7 +305,7 @@ namespace Apache
if(ret != nullptr)
return ret;
- ret = Serializable::GetEnum(enumVal, cache);
+ ret = Serializable::GetEnum(enumVal, m_cache);
tmp = gcnew Dictionary<Int32, EnumInfo^>(intToEnum);
tmp[enumVal] = ret;
intToEnum = tmp;
diff --git a/clicache/src/impl/PdxTypeRegistry.hpp b/clicache/src/impl/PdxTypeRegistry.hpp
index a35fd81..aae7474 100644
--- a/clicache/src/impl/PdxTypeRegistry.hpp
+++ b/clicache/src/impl/PdxTypeRegistry.hpp
@@ -24,6 +24,7 @@
#include "../IPdxSerializable.hpp"
#include "WeakhashMap.hpp"
#include "EnumInfo.hpp"
+
using namespace System;
using namespace System::Threading;
using namespace System::Collections::Generic;
@@ -43,75 +44,61 @@ namespace Apache
PdxTypeRegistry(Cache^ cache) :m_cache(cache) {}
//test hook;
- static int testGetNumberOfPdxIds();
+ int testGetNumberOfPdxIds();
//test hook
- static int testNumberOfPreservedData();
+ int testNumberOfPreservedData();
- static void AddPdxType(Int32 typeId, PdxType^ pdxType);
+ void AddPdxType(Int32 typeId, PdxType^ pdxType);
- static PdxType^ GetPdxType(Int32 typeId);
+ PdxType^ GetPdxType(Int32 typeId);
- static void AddLocalPdxType(String^ localType, PdxType^ pdxType);
+ void AddLocalPdxType(String^ localType, PdxType^ pdxType);
- static PdxType^ GetLocalPdxType(String^ localType);
+ PdxType^ GetLocalPdxType(String^ localType);
- static void SetMergedType(Int32 remoteTypeId, PdxType^ mergedType);
+ void SetMergedType(Int32 remoteTypeId, PdxType^ mergedType);
- static PdxType^ GetMergedType(Int32 remoteTypeId);
+ PdxType^ GetMergedType(Int32 remoteTypeId);
- static void SetPreserveData(IPdxSerializable^ obj, PdxRemotePreservedData^ preserveData);
+ void SetPreserveData(IPdxSerializable^ obj, PdxRemotePreservedData^ preserveData);
- static PdxRemotePreservedData^ GetPreserveData(IPdxSerializable^ obj);
+ PdxRemotePreservedData^ GetPreserveData(IPdxSerializable^ obj);
void clear();
- static Int32 GetPDXIdForType(Type^ type, const char* poolname, PdxType^ nType, bool checkIfThere, const native::Cache* cache);
-
- static Int32 GetPDXIdForType(PdxType^ type, const char* poolname, const native::Cache* cache);
-
- static property bool PdxIgnoreUnreadFields
- {
- bool get() {return pdxIgnoreUnreadFields;}
- void set(bool value){pdxIgnoreUnreadFields = value;}
- }
+ Int32 GetPDXIdForType(Type^ type, const char* poolname, PdxType^ nType, bool checkIfThere);
- static property bool PdxReadSerialized
- {
- bool get() {return pdxReadSerialized;}
- void set(bool value){pdxReadSerialized= value;}
- }
+ Int32 GetPDXIdForType(PdxType^ type, const char* poolname);
- static Int32 GetEnumValue(EnumInfo^ ei, const native::Cache* cache);
+ Int32 GetEnumValue(EnumInfo^ ei);
- static EnumInfo^ GetEnum(Int32 enumVal, const native::Cache* cache);
+ EnumInfo^ GetEnum(Int32 enumVal);
private:
Cache^ m_cache;
- static IDictionary<Int32, PdxType^>^ typeIdToPdxType = gcnew Dictionary<Int32, PdxType^>();
+ IDictionary<Int32, PdxType^>^ typeIdToPdxType = gcnew Dictionary<Int32, PdxType^>();
- static IDictionary<PdxType^, Int32>^ pdxTypeToTypeId = gcnew Dictionary<PdxType^, Int32>();
+ IDictionary<PdxType^, Int32>^ pdxTypeToTypeId = gcnew Dictionary<PdxType^, Int32>();
- static IDictionary<Int32, PdxType^>^ remoteTypeIdToMergedPdxType = gcnew Dictionary<Int32, PdxType^>();
+ IDictionary<Int32, PdxType^>^ remoteTypeIdToMergedPdxType = gcnew Dictionary<Int32, PdxType^>();
- static IDictionary<String^, PdxType^>^ localTypeToPdxType = gcnew Dictionary<String^, PdxType^>();
+ IDictionary<String^, PdxType^>^ localTypeToPdxType = gcnew Dictionary<String^, PdxType^>();
- static IDictionary<EnumInfo^, Int32>^ enumToInt = gcnew Dictionary<EnumInfo^, Int32>();
+ IDictionary<EnumInfo^, Int32>^ enumToInt = gcnew Dictionary<EnumInfo^, Int32>();
- static IDictionary<Int32, EnumInfo^>^ intToEnum = gcnew Dictionary<Int32, EnumInfo^>();
+ IDictionary<Int32, EnumInfo^>^ intToEnum = gcnew Dictionary<Int32, EnumInfo^>();
- //TODO: this will be weak hashmap
- //static IDictionary<IPdxSerializable^ , PdxRemotePreservedData^>^ preserveData = gcnew Dictionary<IPdxSerializable^ , PdxRemotePreservedData^>();
- static WeakHashMap^ preserveData = gcnew WeakHashMap();
+ WeakHashMap^ preserveData = gcnew WeakHashMap();
- static ReaderWriterLock^ g_readerWriterLock = gcnew ReaderWriterLock();
+ ReaderWriterLock^ g_readerWriterLock = gcnew ReaderWriterLock();
- static bool pdxIgnoreUnreadFields = false;
- static bool pdxReadSerialized = false;
+ bool pdxIgnoreUnreadFields = false;
+ bool pdxReadSerialized = false;
};
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-}
diff --git a/clicache/src/impl/PersistenceManagerProxy.hpp b/clicache/src/impl/PersistenceManagerProxy.hpp
index 6b519f6..a88d0bd 100644
--- a/clicache/src/impl/PersistenceManagerProxy.hpp
+++ b/clicache/src/impl/PersistenceManagerProxy.hpp
@@ -72,7 +72,7 @@ namespace Apache
virtual CacheablePtr read(const CacheableKeyPtr& key/*, void *& PersistenceInfo*/)
{
TKey gKey = Serializable::GetManagedValueGeneric<TKey>(key);
- return Serializable::GetUnmanagedValueGeneric<TValue>(m_persistenceManager->Read(gKey), nullptr);
+ return Serializable::GetUnmanagedValueGeneric<TValue>(m_persistenceManager->Read(gKey));
}
virtual bool readAll()
diff --git a/clicache/src/impl/SafeConvert.hpp b/clicache/src/impl/SafeConvert.hpp
index 200c5d0..ae1ee46 100644
--- a/clicache/src/impl/SafeConvert.hpp
+++ b/clicache/src/impl/SafeConvert.hpp
@@ -25,14 +25,11 @@
#include "ManagedCacheableKey.hpp"
#include "ManagedCacheableDelta.hpp"
-#include "ManagedCacheableKeyBytes.hpp"
-#include "ManagedCacheableDeltaBytes.hpp"
#include "../Serializable.hpp"
#include "../Log.hpp"
#include "../CacheableKey.hpp"
#include "../CqEvent.hpp"
#include "PdxManagedCacheableKey.hpp"
-#include "PdxManagedCacheableKeyBytes.hpp"
#include "PdxWrapper.hpp"
//TODO::split
#include "../CqEvent.hpp"
@@ -67,26 +64,13 @@ namespace Apache
{
if (obj == nullptr) return nullptr;
- if (SafeConvertClassGeneric::isAppDomainEnabled)
+ if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
{
- if (auto mg_bytesObj = std::dynamic_pointer_cast<native::ManagedCacheableKeyBytesGeneric>(obj))
- {
- return mg_bytesObj->ptr();
- }
- if (auto mg_bytesObj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaBytesGeneric>(obj))
- {
- return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_bytesObj_delta->ptr());
- }
+ return mg_obj->ptr();
}
- else {
- if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
- {
- return mg_obj->ptr();
- }
- if (auto mg_obj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaGeneric>(obj))
- {
- return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_obj_delta->ptr());
- }
+ if (auto mg_obj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaGeneric>(obj))
+ {
+ return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_obj_delta->ptr());
}
if (obj->typeId() == 0)
@@ -133,39 +117,18 @@ namespace Apache
typename NativeType, typename NativeWrapper>
inline static NativeType* SafeM2UMConvertGeneric( ManagedType^ mg_obj )
{
- /*
- *return SafeM2UMConvertGeneric<IGeodeSerializable, native::ManagedCacheableKey,
- native::Serializable, Serializable>( mg_obj );
- */
- //TODO: need to look this further for all types
- if (mg_obj == nullptr) return NULL;
+ if (mg_obj == nullptr) return __nullptr;
NativeWrapper^ obj = dynamic_cast<NativeWrapper^>( mg_obj );
- //if (obj != nullptr) {
- // // this should not be
- // throw gcnew Exception("Something is worng");
- // return obj->_NativePtr;
- //}
- //else
+ if(auto sDelta = dynamic_cast<Apache::Geode::Client::IGeodeDelta^> (mg_obj))
{
- Apache::Geode::Client::IGeodeDelta^ sDelta =
- dynamic_cast<Apache::Geode::Client::IGeodeDelta^> (mg_obj);
- if(sDelta != nullptr){
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new native::ManagedCacheableDeltaGeneric( sDelta);
- else
- return new native::ManagedCacheableDeltaBytesGeneric( sDelta, true);
- }
- else{
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new ManagedWrapper(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId, nullptr);
- else
- return new native::ManagedCacheableKeyBytesGeneric(mg_obj, true);
- }
+ return new native::ManagedCacheableDeltaGeneric(sDelta);
+ }
+ else
+ {
+ return new ManagedWrapper(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
}
- //if (mg_obj == nullptr) return NULL;
- //return new ManagedWrapperGeneric(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
}
template<typename NativeType, typename ManagedType>
@@ -180,26 +143,14 @@ namespace Apache
if (obj == nullptr) return TValue();
- if (SafeConvertClassGeneric::isAppDomainEnabled)
+ if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
{
- if (auto mg_bytesObj = std::dynamic_pointer_cast<native::ManagedCacheableKeyBytesGeneric>(obj))
- {
- return (TValue)mg_bytesObj->ptr();
- }
- if (auto mg_bytesObj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaBytesGeneric>(obj))
- {
- return safe_cast<TValue>(mg_bytesObj_delta->ptr());
- }
- } else {
- if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
- {
- return (TValue)mg_obj->ptr();
- }
+ return (TValue)mg_obj->ptr();
+ }
- if (auto mg_obj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaGeneric>(obj))
- {
- return safe_cast<TValue>(mg_obj_delta->ptr());
- }
+ if (auto mg_obj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaGeneric>(obj))
+ {
+ return safe_cast<TValue>(mg_obj_delta->ptr());
}
if (obj->typeId() == 0)
@@ -230,78 +181,43 @@ namespace Apache
//it is called for cacheables types only
return SafeM2UMConvertGeneric<Apache::Geode::Client::IGeodeSerializable,
native::ManagedCacheableKeyGeneric, native::Serializable,
- Apache::Geode::Client::Serializable>( mg_obj );
+ Apache::Geode::Client::Serializable>(mg_obj);
}
generic<class TValue>
- inline static native::Cacheable* SafeGenericM2UMConvert( TValue mg_val, native::Cache* cache )
+ inline static native::Cacheable* SafeGenericM2UMConvert( TValue mg_val)
{
if (mg_val == nullptr) return NULL;
Object^ mg_obj = (Object^)mg_val;
- /*ICacheableKey^ iKey = dynamic_cast<ICacheableKey^>(obj);
-
- if(iKey != nullptr)
+ if(auto pdxType = dynamic_cast<IPdxSerializable^>(mg_obj))
{
- if(!SafeConvertClass::isAppDomainEnabled)
- return new vmware::ManagedCacheableKey(iKey);
- else
- return new vmware::ManagedCacheableKeyBytes( iKey, true);
- }*/
-
- IPdxSerializable^ pdxType = dynamic_cast<IPdxSerializable^>(mg_obj);
-
- if(pdxType != nullptr)
- {
- //TODO:: probably need to do for appdomain
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new native::PdxManagedCacheableKey(pdxType);
- else
- return new native::PdxManagedCacheableKeyBytes(pdxType, true, cache);
+ return new native::PdxManagedCacheableKey(pdxType);
}
- Apache::Geode::Client::IGeodeDelta^ sDelta =
- dynamic_cast<Apache::Geode::Client::IGeodeDelta^> (mg_obj);
- if(sDelta != nullptr)
- {
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new native::ManagedCacheableDeltaGeneric( sDelta);
- else
- return new native::ManagedCacheableDeltaBytesGeneric( sDelta, true);
- }
- else
- {
- Apache::Geode::Client::IGeodeSerializable^ tmpIGFS =
- dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_obj);
- if(tmpIGFS != nullptr)
- {
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- {
- return new native::ManagedCacheableKeyGeneric( tmpIGFS, nullptr);
- }
- else
- {
- return new native::ManagedCacheableKeyBytesGeneric( tmpIGFS, true);
- }
- }
+ if(auto sDelta = dynamic_cast<IGeodeDelta^> (mg_obj))
+ {
+ return new native::ManagedCacheableDeltaGeneric(sDelta);
+ }
+
+ if(auto tmpIGFS = dynamic_cast<IGeodeSerializable^>(mg_obj))
+ {
+ return new native::ManagedCacheableKeyGeneric(tmpIGFS);
+ }
- if(Serializable::IsObjectAndPdxSerializerRegistered(mg_obj->GetType()->FullName))
- {
- //TODO:: probably need to do for appdomain
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new native::PdxManagedCacheableKey(gcnew PdxWrapper(mg_obj));
- else
- return new native::PdxManagedCacheableKeyBytes(gcnew PdxWrapper(mg_obj), true, nullptr);
- }
- throw gcnew Apache::Geode::Client::IllegalStateException(String::Format("Unable to map object type {0}. Possible Object type may not be registered or PdxSerializer is not registered. ", mg_obj->GetType()));
- }
+ if(Serializable::IsObjectAndPdxSerializerRegistered(mg_obj->GetType()->FullName))
+ {
+ return new native::PdxManagedCacheableKey(gcnew PdxWrapper(mg_obj));
+ }
+
+ throw gcnew Apache::Geode::Client::IllegalStateException(String::Format("Unable to map object type {0}. Possible Object type may not be registered or PdxSerializer is not registered. ", mg_obj->GetType()));
}
generic<class TValue>
- inline static native::Cacheable* SafeGenericMSerializableConvert( TValue mg_obj, native::Cache* cache )
+ inline static native::Cacheable* SafeGenericMSerializableConvert( TValue mg_obj )
{
- return SafeGenericM2UMConvert<TValue>( mg_obj, cache );
+ return SafeGenericM2UMConvert<TValue>( mg_obj );
}
inline static IPdxSerializable^ SafeUMSerializablePDXConvert( native::SerializablePtr obj )
@@ -309,9 +225,6 @@ namespace Apache
if(auto mg_obj = std::dynamic_pointer_cast<native::PdxManagedCacheableKey>( obj ))
return mg_obj->ptr();
- if(auto mg_bytes = std::dynamic_pointer_cast<native::PdxManagedCacheableKeyBytes>( obj ))
- return mg_bytes->ptr();
-
throw gcnew IllegalStateException("Not be able to deserialize managed type");
}
@@ -325,13 +238,6 @@ namespace Apache
//All cacheables will be ManagedCacheableKey only
if (obj == nullptr) return nullptr;
- if (SafeConvertClassGeneric::isAppDomainEnabled)
- {
- if (auto mg_bytesObj = std::dynamic_pointer_cast<native::ManagedCacheableKeyBytesGeneric>(obj))
- {
- return (Client::ICacheableKey^)mg_bytesObj->ptr( );
- }
- }
if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
{
return (Client::ICacheableKey^)mg_obj->ptr( );
@@ -345,23 +251,20 @@ namespace Apache
return gcnew Client::CacheableKey( obj );
}
- generic <class TKey>
- inline static native::CacheableKey* SafeGenericMKeyConvert( TKey mg_obj )
- {
- if (mg_obj == nullptr) return NULL;
- auto obj = Apache::Geode::Client::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj, nullptr );
- if (obj.get() != nullptr)
- {
- return obj.get();
- }
- else
- {
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new native::ManagedCacheableKeyGeneric(SafeUMSerializableConvertGeneric(obj), nullptr);
- else
- return new native::ManagedCacheableKeyBytesGeneric(SafeUMSerializableConvertGeneric(obj), true);
- }
- }
+ //generic <class TKey>
+ //inline static native::CacheableKey* SafeGenericMKeyConvert( TKey mg_obj, Cache^ cache )
+ //{
+ // if (mg_obj == nullptr) return NULL;
+ // auto obj = Apache::Geode::Client::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj, cache );
+ // if (obj.get() != nullptr)
+ // {
+ // return obj.get();
+ // }
+ // else
+ // {
+ // return new native::ManagedCacheableKeyGeneric(SafeUMSerializableConvertGeneric(obj));
+ // }
+ //}
template<typename NativeType, typename ManagedType>
inline static NativeType* GetNativePtr2( ManagedType^ mg_obj )
@@ -370,10 +273,7 @@ namespace Apache
//for cacheables types
//return new native::ManagedCacheableKey(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
{
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new native::ManagedCacheableKeyGeneric( mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId );
- else
- return new native::ManagedCacheableKeyBytesGeneric( mg_obj, true, nullptr);
+ return new native::ManagedCacheableKeyGeneric( mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId );
}
}
diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp
index d47df91..4b7713a 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -126,6 +126,7 @@ CacheHelper::CacheHelper(const PropertiesPtr& configPtr,
cachePtr = CacheFactory::createCacheFactory(pp)->create();
auto poolFactory = cachePtr->getPoolManager().createFactory();
+ addServerLocatorEPs("localhost:40404", poolFactory);
poolFactory->create("__CACHE_HELPER_POOL__");
m_doDisconnect = false;
diff --git a/cppcache/src/PoolFactory.cpp b/cppcache/src/PoolFactory.cpp
index 6a273ed..4b77280 100644
--- a/cppcache/src/PoolFactory.cpp
+++ b/cppcache/src/PoolFactory.cpp
@@ -29,9 +29,6 @@
#include "CacheRegionHelper.hpp"
using namespace apache::geode::client;
-#define DEFAULT_SERVER_PORT 40404
-#define DEFAULT_SERVER_HOST "localhost"
-
constexpr const char* PoolFactory::DEFAULT_SERVER_GROUP;
PoolFactory::PoolFactory(const Cache& cache)
@@ -121,9 +118,6 @@ PoolPtr PoolFactory::create(const char* name) {
if (m_cache.getPoolManager().find(name) != nullptr) {
throw IllegalStateException("Pool with the same name already exists");
}
- if (!m_addedServerOrLocator) {
- addServer(DEFAULT_SERVER_HOST, DEFAULT_SERVER_PORT);
- }
// Create a clone of Attr;
PoolAttributesPtr copyAttrs = m_attrs->clone();
diff --git a/cppcache/src/statistics/StatisticDescriptorImpl.cpp b/cppcache/src/statistics/StatisticDescriptorImpl.cpp
index bddca4a..db7ad88 100644
--- a/cppcache/src/statistics/StatisticDescriptorImpl.cpp
+++ b/cppcache/src/statistics/StatisticDescriptorImpl.cpp
@@ -66,7 +66,7 @@ StatisticDescriptorImpl::~StatisticDescriptorImpl() {}
StatisticDescriptor* StatisticDescriptorImpl::createIntCounter(
const char* statName, const char* description, const char* units,
- bool isLargerBetter) throw(OutOfMemoryException) {
+ bool isLargerBetter) {
FieldType fieldType = INT_TYPE;
StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
statName, fieldType, description, units, true, isLargerBetter);
@@ -79,7 +79,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createIntCounter(
StatisticDescriptor* StatisticDescriptorImpl::createLongCounter(
const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(OutOfMemoryException) {
+ bool isLargerBetter) {
FieldType fieldType = LONG_TYPE;
StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
name, fieldType, description, units, true, isLargerBetter);
@@ -92,7 +92,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createLongCounter(
StatisticDescriptor* StatisticDescriptorImpl::createDoubleCounter(
const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(OutOfMemoryException) {
+ bool isLargerBetter) {
FieldType fieldType = DOUBLE_TYPE;
StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
name, fieldType, description, units, true, isLargerBetter);
@@ -105,7 +105,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createDoubleCounter(
StatisticDescriptor* StatisticDescriptorImpl::createIntGauge(
const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(OutOfMemoryException) {
+ bool isLargerBetter) {
FieldType fieldType = INT_TYPE;
StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
name, fieldType, description, units, false, isLargerBetter);
@@ -118,7 +118,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createIntGauge(
StatisticDescriptor* StatisticDescriptorImpl::createLongGauge(
const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(OutOfMemoryException) {
+ bool isLargerBetter) {
FieldType fieldType = LONG_TYPE;
StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
name, fieldType, description, units, false, isLargerBetter);
@@ -132,7 +132,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createLongGauge(
StatisticDescriptor* StatisticDescriptorImpl::createDoubleGauge(
const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(OutOfMemoryException) {
+ bool isLargerBetter) {
FieldType fieldType = DOUBLE_TYPE;
StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
name, fieldType, description, units, false, isLargerBetter);
@@ -156,8 +156,7 @@ int32_t StatisticDescriptorImpl::getStorageBits() {
return getTypeCodeBits(descriptorType);
}
-const char* StatisticDescriptorImpl::getTypeCodeName(FieldType code) throw(
- IllegalArgumentException) {
+const char* StatisticDescriptorImpl::getTypeCodeName(FieldType code) {
switch (code) {
case INT_TYPE:
return IntTypeName;
@@ -180,8 +179,7 @@ const char* StatisticDescriptorImpl::getTypeCodeName(FieldType code) throw(
* @throws IllegalArgumentException/
* <code>code</code> is an unknown type
*/
-int32_t StatisticDescriptorImpl::getTypeCodeBits(FieldType code) throw(
- IllegalArgumentException) {
+int32_t StatisticDescriptorImpl::getTypeCodeBits(FieldType code) {
switch (code) {
case INT_TYPE:
return 32;
@@ -210,8 +208,7 @@ const char* StatisticDescriptorImpl::getUnit() { return unit.c_str(); }
* doesn't allow it to be thrown.
* This will cause a call to unexpected() which usually calls terminate().
*/
-// int32_t StatisticDescriptorImpl::getId() throw(IllegalArgumentException)
-int32_t StatisticDescriptorImpl::getId() throw(IllegalStateException) {
+int32_t StatisticDescriptorImpl::getId() {
if (id == -1) {
std::string s = "The id has not been initialized yet.";
throw IllegalStateException(s.c_str());
@@ -225,7 +222,7 @@ FieldType StatisticDescriptorImpl::getTypeCode() { return descriptorType; }
void StatisticDescriptorImpl::setId(int32_t statId) { id = statId; }
-int32_t StatisticDescriptorImpl::checkInt() throw(IllegalArgumentException) {
+int32_t StatisticDescriptorImpl::checkInt() {
if (descriptorType != INT_TYPE) {
std::string sb;
std::string typeCode(getTypeCodeName(getTypeCode()));
@@ -236,7 +233,7 @@ int32_t StatisticDescriptorImpl::checkInt() throw(IllegalArgumentException) {
}
return id;
}
-int32_t StatisticDescriptorImpl::checkLong() throw(IllegalArgumentException) {
+int32_t StatisticDescriptorImpl::checkLong() {
if (descriptorType != LONG_TYPE) {
std::string sb;
std::string typeCode(getTypeCodeName(getTypeCode()));
@@ -248,7 +245,7 @@ int32_t StatisticDescriptorImpl::checkLong() throw(IllegalArgumentException) {
return id;
}
-int32_t StatisticDescriptorImpl::checkDouble() throw(IllegalArgumentException) {
+int32_t StatisticDescriptorImpl::checkDouble() {
if (descriptorType != DOUBLE_TYPE) {
std::string sb;
std::string typeCode(getTypeCodeName(getTypeCode()));
diff --git a/cppcache/src/statistics/StatisticDescriptorImpl.hpp b/cppcache/src/statistics/StatisticDescriptorImpl.hpp
index 9e8f0cb..bd44c7d 100644
--- a/cppcache/src/statistics/StatisticDescriptorImpl.hpp
+++ b/cppcache/src/statistics/StatisticDescriptorImpl.hpp
@@ -117,8 +117,7 @@ class StatisticDescriptorImpl : public StatisticDescriptor {
* @throws IllegalArgumentException
* <code>code</code> is an unknown type
*/
- static const char* getTypeCodeName(FieldType code) throw(
- IllegalArgumentException);
+ static const char* getTypeCodeName(FieldType code);
/**
* Returns the number of bits needed to represent a value of the given type
@@ -127,8 +126,7 @@ class StatisticDescriptorImpl : public StatisticDescriptor {
* @throws IllegalArgumentException
* <code>code</code> is an unknown type
*/
- static int32_t getTypeCodeBits(FieldType code) throw(
- IllegalArgumentException);
+ static int32_t getTypeCodeBits(FieldType code);
///////////////////////////Create methods ////////////////////////////////////
@@ -137,54 +135,60 @@ class StatisticDescriptorImpl : public StatisticDescriptor {
* whose value behaves like a counter
* @throws OutOfMemoryException
*/
- static StatisticDescriptor* createIntCounter(
- const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(apache::geode::client::OutOfMemoryException);
+ static StatisticDescriptor* createIntCounter(const char* name,
+ const char* description,
+ const char* units,
+ bool isLargerBetter);
/**
* Creates a descriptor of Long type
* whose value behaves like a counter
* @throws OutOfMemoryException
*/
- static StatisticDescriptor* createLongCounter(
- const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(apache::geode::client::OutOfMemoryException);
+ static StatisticDescriptor* createLongCounter(const char* name,
+ const char* description,
+ const char* units,
+ bool isLargerBetter);
/**
* Creates a descriptor of Double type
* whose value behaves like a counter
* @throws OutOfMemoryException
*/
- static StatisticDescriptor* createDoubleCounter(
- const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(apache::geode::client::OutOfMemoryException);
+ static StatisticDescriptor* createDoubleCounter(const char* name,
+ const char* description,
+ const char* units,
+ bool isLargerBetter);
/**
* Creates a descriptor of Integer type
* whose value behaves like a gauge
* @throws OutOfMemoryException
*/
- static StatisticDescriptor* createIntGauge(
- const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(apache::geode::client::OutOfMemoryException);
+ static StatisticDescriptor* createIntGauge(const char* name,
+ const char* description,
+ const char* units,
+ bool isLargerBetter);
/**
* Creates a descriptor of Long type
* whose value behaves like a gauge
* @throws OutOfMemoryException
*/
- static StatisticDescriptor* createLongGauge(
- const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(apache::geode::client::OutOfMemoryException);
+ static StatisticDescriptor* createLongGauge(const char* name,
+ const char* description,
+ const char* units,
+ bool isLargerBetter);
/**
* Creates a descriptor of Double type
* whose value behaves like a gauge
* @throws OutOfMemoryException
*/
- static StatisticDescriptor* createDoubleGauge(
- const char* name, const char* description, const char* units,
- bool isLargerBetter) throw(apache::geode::client::OutOfMemoryException);
+ static StatisticDescriptor* createDoubleGauge(const char* name,
+ const char* description,
+ const char* units,
+ bool isLargerBetter);
///////////////// StatisticDescriptor(Base class) Methods
///////////////////////
@@ -201,7 +205,7 @@ class StatisticDescriptorImpl : public StatisticDescriptor {
const char* getUnit();
- int32_t getId() throw(IllegalStateException);
+ int32_t getId();
///////////////////////////// Instance Methods ////////////////////////////
@@ -225,20 +229,20 @@ class StatisticDescriptorImpl : public StatisticDescriptor {
* Checks whether the descriptor is of type int and returns the id if it is
* @throws IllegalArgumentException
*/
- int32_t checkInt() throw(IllegalArgumentException);
+ int32_t checkInt();
/**
* Checks whether the descriptor is of type long and returns the id if it is
* @throws IllegalArgumentException
*/
- int32_t checkLong() throw(IllegalArgumentException);
+ int32_t checkLong();
/**
* Checks whether the descriptor is of type double and returns the id if it i
s
* @throws IllegalArgumentException
*/
- int32_t checkDouble() throw(IllegalArgumentException);
+ int32_t checkDouble();
private:
static const char* IntTypeName;
diff --git a/tests/cli/FwkClient/ClientComm.cs b/tests/cli/FwkClient/ClientComm.cs
index d91916c..fe79960 100644
--- a/tests/cli/FwkClient/ClientComm.cs
+++ b/tests/cli/FwkClient/ClientComm.cs
@@ -151,6 +151,7 @@ namespace Apache.Geode.Client.FwkClient
catch (TargetInvocationException tie)
{
Util.Log(Util.LogLevel.Error, tie.InnerException.StackTrace.ToString());
+ throw tie;
}
}
else {
--
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].