geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [07/51] [partial] geode git commit: Software Grant Agreement (SGA) from Pivotal for Apache Geode
Date Fri, 13 Jan 2017 22:45:51 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/DistributedSystem.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DistributedSystem.cpp b/src/clicache/src/DistributedSystem.cpp
new file mode 100644
index 0000000..c9c2d14
--- /dev/null
+++ b/src/clicache/src/DistributedSystem.cpp
@@ -0,0 +1,897 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+//#include "gf_includes.hpp"
+#include "version.h"
+#include "Serializable.hpp"
+#include "DistributedSystem.hpp"
+#include "SystemProperties.hpp"
+#include "CacheFactory.hpp"
+#include "CacheableDate.hpp"
+#include "CacheableFileName.hpp"
+#include "CacheableHashMap.hpp"
+#include "CacheableHashSet.hpp"
+#include "CacheableHashTable.hpp"
+#include "CacheableIdentityHashMap.hpp"
+#include "CacheableObjectArray.hpp"
+#include "CacheableString.hpp"
+#include "CacheableStringArray.hpp"
+#include "CacheableUndefined.hpp"
+#include "CacheableVector.hpp"
+#include "CacheableArrayList.hpp"
+#include "CacheableStack.hpp"
+#include "CacheableObject.hpp"
+#include "CacheableObjectXml.hpp"
+#include "CacheableBuiltins.hpp"
+#include "Log.hpp"
+#include "Struct.hpp"
+#include "impl/MemoryPressureHandler.hpp"
+#include <gfcpp/CacheLoader.hpp>
+#include <gfcpp/CacheListener.hpp>
+#include <gfcpp/FixedPartitionResolver.hpp>
+#include <gfcpp/CacheWriter.hpp>
+#include <gfcpp/GemfireTypeIds.hpp>
+#include <CacheImpl.hpp>
+#include <PooledBasePool.hpp>
+#include <CacheXmlParser.hpp>
+#include "impl/SafeConvert.hpp"
+#include <DistributedSystemImpl.hpp>
+#include "impl/PdxType.hpp"
+#include "impl/EnumInfo.hpp"
+#include "impl/ManagedPersistenceManager.hpp"
+#include "impl/AppDomainContext.hpp"
+
+// disable spurious warning
+#pragma warning(disable:4091)
+#include <msclr/lock.h>
+#pragma warning(default:4091)
+#include <ace/Process.h> // Added to get rid of unresolved token warning
+
+
+using namespace System;
+
+using namespace GemStone::GemFire::Cache;
+
+namespace gemfire
+{
+  class ManagedCacheLoaderGeneric
+    : public CacheLoader
+  {
+  public:
+
+    static CacheLoader* create(const char* assemblyPath,
+      const char* factoryFunctionName);
+  };
+
+  class ManagedCacheListenerGeneric
+    : public CacheListener
+  {
+  public:
+
+    static CacheListener* create(const char* assemblyPath,
+      const char* factoryFunctionName);
+  };
+
+  class ManagedFixedPartitionResolverGeneric
+    : public FixedPartitionResolver
+  {
+  public:
+
+    static PartitionResolver* create(const char* assemblyPath,
+      const char* factoryFunctionName);
+  };
+
+  class ManagedCacheWriterGeneric
+    : public CacheWriter
+  {
+  public:
+
+    static CacheWriter* create(const char* assemblyPath,
+      const char* factoryFunctionName);
+  };
+
+  class ManagedAuthInitializeGeneric
+    : public AuthInitialize
+  {
+  public:
+
+    static AuthInitialize* create(const char* assemblyPath,
+      const char* factoryFunctionName);
+  };
+}
+
+
+namespace GemStone
+{
+  namespace GemFire
+  {
+    namespace Cache
+    {
+      namespace Generic
+      {
+      DistributedSystem^ DistributedSystem::Connect(String^ name)
+      {
+        return DistributedSystem::Connect(name, nullptr);
+      }
+
+      DistributedSystem^ DistributedSystem::Connect(String^ name, Properties<String^, String^>^ config)
+      {
+        gemfire::DistributedSystemImpl::acquireDisconnectLock();
+
+        _GF_MG_EXCEPTION_TRY2
+
+          ManagedString mg_name(name);
+
+          gemfire::PropertiesPtr nativepropsptr(
+            GetNativePtr<gemfire::Properties>(config));
+          
+         // gemfire::PropertiesPtr nativepropsptr;
+          DistributedSystem::AppDomainInstanceInitialization(nativepropsptr);
+
+          // this we are calling after all .NET initialization required in
+          // each AppDomain
+          gemfire::DistributedSystemPtr& nativeptr(
+            gemfire::DistributedSystem::connect(mg_name.CharPtr,
+            nativepropsptr));
+
+          ManagedPostConnect();
+
+//          DistributedSystem::AppDomainInstancePostInitialization();
+
+          return Create(nativeptr.ptr());
+
+        _GF_MG_EXCEPTION_CATCH_ALL2
+
+        finally {
+          gemfire::DistributedSystemImpl::releaseDisconnectLock();
+        }
+      }
+
+      void DistributedSystem::Disconnect()
+      {
+        gemfire::DistributedSystemImpl::acquireDisconnectLock();
+
+        _GF_MG_EXCEPTION_TRY2
+
+          if (gemfire::DistributedSystem::isConnected()) {
+           // gemfire::CacheImpl::expiryTaskManager->cancelTask(
+             // s_memoryPressureTaskID);
+            Serializable::UnregisterNativesGeneric();
+            DistributedSystem::UnregisterBuiltinManagedTypes();
+          }
+          gemfire::DistributedSystem::disconnect();
+      
+        _GF_MG_EXCEPTION_CATCH_ALL2
+
+        finally {
+          gemfire::DistributedSystemImpl::releaseDisconnectLock();
+        }
+      }
+
+
+    /*  DistributedSystem^ DistributedSystem::ConnectOrGetInstance(String^ name)
+      {
+        return DistributedSystem::ConnectOrGetInstance(name, nullptr);
+      }
+
+      DistributedSystem^ DistributedSystem::ConnectOrGetInstance(String^ name,
+          Properties^ config)
+      {
+        gemfire::DistributedSystemImpl::acquireDisconnectLock();
+
+        _GF_MG_EXCEPTION_TRY
+
+          ManagedString mg_name(name);
+          gemfire::PropertiesPtr nativepropsptr(
+            GetNativePtr<gemfire::Properties>(config));
+          DistributedSystem::AppDomainInstanceInitialization(nativepropsptr);
+
+          // this we are calling after all .NET initialization required in
+          // each AppDomain
+          gemfire::DistributedSystemPtr& nativeptr(
+            gemfire::DistributedSystem::connectOrGetInstance(mg_name.CharPtr,
+            nativepropsptr));
+
+          if (gemfire::DistributedSystem::currentInstances() == 1) {
+            // stuff to be done only for the first connect
+            ManagedPostConnect();
+          }
+
+          DistributedSystem::AppDomainInstancePostInitialization();
+
+          return Create(nativeptr.ptr());
+          
+        _GF_MG_EXCEPTION_CATCH_ALL
+
+        finally {
+          gemfire::DistributedSystemImpl::releaseDisconnectLock();
+        }
+      }
+*/
+   /*   int DistributedSystem::DisconnectInstance()
+      {
+        gemfire::DistributedSystemImpl::acquireDisconnectLock();
+
+        _GF_MG_EXCEPTION_TRY
+
+          int remainingInstances =
+            gemfire::DistributedSystem::currentInstances();
+          if (remainingInstances <= 0) {
+            throw gcnew NotConnectedException("DistributedSystem."
+              "DisconnectInstance: no remaining instance connections");
+          }
+
+          //gemfire::CacheImpl::expiryTaskManager->cancelTask(
+            //s_memoryPressureTaskID);
+          Serializable::UnregisterNatives();
+
+          if (remainingInstances == 1) { // last instance
+            DistributedSystem::UnregisterBuiltinManagedTypes();
+          }
+          return gemfire::DistributedSystem::disconnectInstance();
+
+        _GF_MG_EXCEPTION_CATCH_ALL
+
+        finally {
+          gemfire::DistributedSystemImpl::releaseDisconnectLock();
+        }
+      }
+*/
+
+      void DistributedSystem::AppDomainInstanceInitialization(
+        const gemfire::PropertiesPtr& nativepropsptr)
+      {
+        _GF_MG_EXCEPTION_TRY2
+          
+          // Register wrapper types for built-in types, this are still cpp wrapper
+           
+          /*
+            Serializable::RegisterWrapperGeneric(
+              gcnew WrapperDelegateGeneric(GemStone::GemFire::Cache::CacheableHashSet::Create),
+              gemfire::GemfireTypeIds::CacheableHashSet);
+            
+             Serializable::RegisterWrapperGeneric(
+              gcnew WrapperDelegateGeneric(GemStone::GemFire::Cache::CacheableLinkedHashSet::Create),
+              gemfire::GemfireTypeIds::CacheableLinkedHashSet);
+
+             Serializable::RegisterWrapperGeneric(
+              gcnew WrapperDelegateGeneric(GemStone::GemFire::Cache::Struct::Create),
+              gemfire::GemfireTypeIds::Struct);
+            
+             Serializable::RegisterWrapperGeneric(
+              gcnew WrapperDelegateGeneric(GemStone::GemFire::Cache::Properties::CreateDeserializable),
+              gemfire::GemfireTypeIds::Properties);
+
+          // End register wrapper types for built-in types
+
+  // Register with cpp using unmanaged Cacheablekey wrapper
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableByte,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableByte::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableBoolean,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableBoolean::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableBytes,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableBytes::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::BooleanArray, 
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::BooleanArray::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableWideChar,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableCharacter::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CharArray,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CharArray::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableDouble,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableDouble::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableDoubleArray,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableDoubleArray::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableFloat,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableFloat::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableFloatArray,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableFloatArray::CreateDeserializable));
+
+           
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableHashSet,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableHashSet::CreateDeserializable));
+
+           Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableLinkedHashSet,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableLinkedHashSet::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt16,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableInt16::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt16Array,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableInt16Array::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt32,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableInt32::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt32Array,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableInt32Array::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt64,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableInt64::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt64Array,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableInt64Array::CreateDeserializable));
+              */
+
+            /*Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableASCIIString,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableString::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableASCIIStringHuge,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableString::createDeserializableHuge));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableString,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableString::createUTFDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableStringHuge,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableString::createUTFDeserializableHuge));*/
+
+            /*
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableNullString,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableString::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableStringArray,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableStringArray::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::Struct,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::Struct::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::Properties,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::Properties::CreateDeserializable));
+            */
+            
+            // End register other built-in types
+
+            //primitive types are still C++, as these are used as keys mostly
+          // Register generic wrapper types for built-in types
+          //byte
+
+         /* Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableByte::Create),
+            gemfire::GemfireTypeIds::CacheableByte, Byte::typeid);*/
+
+          Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableByte::Create),
+            gemfire::GemfireTypeIds::CacheableByte, SByte::typeid);
+          
+          //boolean
+          Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableBoolean::Create),
+            gemfire::GemfireTypeIds::CacheableBoolean, Boolean::typeid);
+          //wide char
+          Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableCharacter::Create),
+            gemfire::GemfireTypeIds::CacheableWideChar, Char::typeid);
+          //double
+          Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableDouble::Create),
+            gemfire::GemfireTypeIds::CacheableDouble, Double::typeid);
+          //ascii string
+          Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableString::Create),
+            gemfire::GemfireTypeIds::CacheableASCIIString, String::typeid);
+            
+          //TODO:
+          ////ascii string huge
+          //Serializable::RegisterWrapperGeneric(
+          //  gcnew WrapperDelegateGeneric(CacheableString::Create),
+          //  gemfire::GemfireTypeIds::CacheableASCIIStringHuge, String::typeid);
+          ////string
+          //Serializable::RegisterWrapperGeneric(
+          //  gcnew WrapperDelegateGeneric(CacheableString::Create),
+          //  gemfire::GemfireTypeIds::CacheableString, String::typeid);
+          ////string huge
+          //Serializable::RegisterWrapperGeneric(
+          //  gcnew WrapperDelegateGeneric(CacheableString::Create),
+          //  gemfire::GemfireTypeIds::CacheableStringHuge, String::typeid);
+          //float
+
+          Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableFloat::Create),
+            gemfire::GemfireTypeIds::CacheableFloat, float::typeid);
+          //int 16
+          Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableInt16::Create),
+            gemfire::GemfireTypeIds::CacheableInt16, Int16::typeid);
+          //int32
+          Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableInt32::Create),
+            gemfire::GemfireTypeIds::CacheableInt32, Int32::typeid);
+          //int64
+          Serializable::RegisterWrapperGeneric(
+            gcnew WrapperDelegateGeneric(CacheableInt64::Create),
+            gemfire::GemfireTypeIds::CacheableInt64, Int64::typeid);
+
+          ////uint16
+          //Serializable::RegisterWrapperGeneric(
+          //  gcnew WrapperDelegateGeneric(CacheableInt16::Create),
+          //  gemfire::GemfireTypeIds::CacheableInt16, UInt16::typeid);
+          ////uint32
+          //Serializable::RegisterWrapperGeneric(
+          //  gcnew WrapperDelegateGeneric(CacheableInt32::Create),
+          //  gemfire::GemfireTypeIds::CacheableInt32, UInt32::typeid);
+          ////uint64
+          //Serializable::RegisterWrapperGeneric(
+          //  gcnew WrapperDelegateGeneric(CacheableInt64::Create),
+          //  gemfire::GemfireTypeIds::CacheableInt64, UInt64::typeid);
+          //=======================================================================
+
+            //Now onwards all will be wrap in managed cacheable key..
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableBytes,
+              gcnew TypeFactoryMethodGeneric(CacheableBytes::CreateDeserializable), 
+              Type::GetType("System.Byte[]"));
+
+           /* Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableBytes,
+              gcnew TypeFactoryMethodGeneric(CacheableBytes::CreateDeserializable), 
+              Type::GetType("System.SByte[]"));*/
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableDoubleArray,
+              gcnew TypeFactoryMethodGeneric(CacheableDoubleArray::CreateDeserializable),
+              Type::GetType("System.Double[]"));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableFloatArray,
+              gcnew TypeFactoryMethodGeneric(CacheableFloatArray::CreateDeserializable),
+              Type::GetType("System.Single[]"));
+
+           //TODO:
+            //as it is
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableHashSet,
+              gcnew TypeFactoryMethodGeneric(CacheableHashSet::CreateDeserializable),
+              nullptr);
+
+            //as it is
+           Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableLinkedHashSet,
+              gcnew TypeFactoryMethodGeneric(CacheableLinkedHashSet::CreateDeserializable),
+              nullptr);
+
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt16Array,
+              gcnew TypeFactoryMethodGeneric(CacheableInt16Array::CreateDeserializable),
+              Type::GetType("System.Int16[]"));
+
+          /*  Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt16Array,
+              gcnew TypeFactoryMethodGeneric(CacheableInt16Array::CreateDeserializable),
+              Type::GetType("System.UInt16[]"));*/
+
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt32Array,
+              gcnew TypeFactoryMethodGeneric(CacheableInt32Array::CreateDeserializable),
+              Type::GetType("System.Int32[]"));
+
+           /* Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt32Array,
+              gcnew TypeFactoryMethodGeneric(CacheableInt32Array::CreateDeserializable),
+              Type::GetType("System.UInt32[]"));*/
+
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt64Array,
+              gcnew TypeFactoryMethodGeneric(CacheableInt64Array::CreateDeserializable),
+              Type::GetType("System.Int64[]"));
+
+           /* Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableInt64Array,
+              gcnew TypeFactoryMethodGeneric(CacheableInt64Array::CreateDeserializable),
+              Type::GetType("System.UInt64[]"));*/
+						//TODO:;split
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::BooleanArray,
+              gcnew TypeFactoryMethodGeneric(BooleanArray::CreateDeserializable),
+              Type::GetType("System.Boolean[]"));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CharArray,
+              gcnew TypeFactoryMethodGeneric(CharArray::CreateDeserializable),
+              Type::GetType("System.Char[]"));
+
+            //TODO::
+
+            //Serializable::RegisterTypeGeneric(
+            //  gemfire::GemfireTypeIds::CacheableNullString,
+            //  gcnew TypeFactoryMethodNew(GemStone::GemFire::Cache::CacheableString::CreateDeserializable));
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableStringArray,
+              gcnew TypeFactoryMethodGeneric(CacheableStringArray::CreateDeserializable),
+              Type::GetType("System.String[]"));
+
+            //as it is
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::Struct,
+              gcnew TypeFactoryMethodGeneric(Struct::CreateDeserializable),
+              nullptr);
+
+            //as it is
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::Properties,
+              gcnew TypeFactoryMethodGeneric(Properties<String^, String^>::CreateDeserializable),
+              nullptr);
+              
+          /*  Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::PdxType,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::Generic::Internal::PdxType::CreateDeserializable),
+              nullptr);*/
+
+            Serializable::RegisterTypeGeneric(
+              gemfire::GemfireTypeIds::EnumInfo,
+              gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::Generic::Internal::EnumInfo::CreateDeserializable),
+              nullptr);
+          
+          // End register generic wrapper types for built-in types
+
+          if (!gemfire::DistributedSystem::isConnected()) 
+          {
+            // Set the Generic ManagedAuthInitialize factory function
+            gemfire::SystemProperties::managedAuthInitializeFn =
+              gemfire::ManagedAuthInitializeGeneric::create;
+
+            // Set the Generic ManagedCacheLoader/Listener/Writer factory functions.
+            gemfire::CacheXmlParser::managedCacheLoaderFn =
+              gemfire::ManagedCacheLoaderGeneric::create;
+            gemfire::CacheXmlParser::managedCacheListenerFn =
+              gemfire::ManagedCacheListenerGeneric::create;
+            gemfire::CacheXmlParser::managedCacheWriterFn =
+              gemfire::ManagedCacheWriterGeneric::create;
+
+            // Set the Generic ManagedPartitionResolver factory function
+            gemfire::CacheXmlParser::managedPartitionResolverFn =
+              gemfire::ManagedFixedPartitionResolverGeneric::create;
+
+            // Set the Generic ManagedPersistanceManager factory function
+            gemfire::CacheXmlParser::managedPersistenceManagerFn =
+              gemfire::ManagedPersistenceManagerGeneric::create;
+          }
+
+        _GF_MG_EXCEPTION_CATCH_ALL2
+      }
+
+      void DistributedSystem::ManagedPostConnect()
+      {
+        //  The registration into the native map should be after
+        // native connect since it can be invoked only once
+
+        // Register other built-in types
+        /*
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableDate,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableDate::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableFileName,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableFileName::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableHashMap,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableHashMap::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableHashTable,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableHashTable::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableIdentityHashMap,
+          gcnew TypeFactoryMethodGeneric(
+          GemStone::GemFire::Cache::CacheableIdentityHashMap::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableUndefined,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableUndefined::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableVector,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableVector::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableObjectArray,
+          gcnew TypeFactoryMethodGeneric(
+          GemStone::GemFire::Cache::CacheableObjectArray::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableArrayList,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableArrayList::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableStack,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableStack::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          GemFireClassIds::CacheableManagedObject - 0x80000000,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableObject::CreateDeserializable));
+        Serializable::RegisterTypeGeneric(
+          GemFireClassIds::CacheableManagedObjectXml - 0x80000000,
+          gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::CacheableObjectXml::CreateDeserializable));
+          */
+        // End register other built-in types
+
+        // Register other built-in types for generics
+        //c# datatime
+        
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableDate,
+          gcnew TypeFactoryMethodGeneric(CacheableDate::CreateDeserializable),
+          Type::GetType("System.DateTime"));
+        
+        //as it is
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableFileName,
+          gcnew TypeFactoryMethodGeneric(CacheableFileName::CreateDeserializable),
+          nullptr);
+        
+        //for generic dictionary define its type in static constructor of Serializable.hpp
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableHashMap,
+          gcnew TypeFactoryMethodGeneric(CacheableHashMap::CreateDeserializable),
+          nullptr);
+
+        //c# hashtable
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableHashTable,
+          gcnew TypeFactoryMethodGeneric(CacheableHashTable::CreateDeserializable),
+          Type::GetType("System.Collections.Hashtable"));
+
+        //Need to keep public as no counterpart in c#
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableIdentityHashMap,
+          gcnew TypeFactoryMethodGeneric(
+          CacheableIdentityHashMap::CreateDeserializable),
+          nullptr);
+        
+        //keep as it is
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableUndefined,
+          gcnew TypeFactoryMethodGeneric(CacheableUndefined::CreateDeserializable),
+          nullptr);
+
+        //c# arraylist
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableVector,
+          gcnew TypeFactoryMethodGeneric(CacheableVector::CreateDeserializable),
+          nullptr);
+
+        //as it is
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableObjectArray,
+          gcnew TypeFactoryMethodGeneric(
+          CacheableObjectArray::CreateDeserializable),
+          nullptr);
+
+        //Generic::List
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableArrayList,
+          gcnew TypeFactoryMethodGeneric(CacheableArrayList::CreateDeserializable),
+          nullptr);
+        
+        //c# generic stack 
+        Serializable::RegisterTypeGeneric(
+          gemfire::GemfireTypeIds::CacheableStack,
+          gcnew TypeFactoryMethodGeneric(CacheableStack::CreateDeserializable),
+          nullptr);
+
+        //as it is
+        Serializable::RegisterTypeGeneric(
+          GemFireClassIds::CacheableManagedObject - 0x80000000,
+          gcnew TypeFactoryMethodGeneric(CacheableObject::CreateDeserializable),
+          nullptr);
+
+        //as it is
+        Serializable::RegisterTypeGeneric(
+          GemFireClassIds::CacheableManagedObjectXml - 0x80000000,
+          gcnew TypeFactoryMethodGeneric(CacheableObjectXml::CreateDeserializable),
+          nullptr);
+        
+        // End register other built-in types
+
+        // TODO: what will happen for following if first appDomain unload ??
+        // Testing shows that there are problems; need to discuss -- maybe
+        // maintain per AppDomainID functions in C++ layer.
+
+        // Log the version of the C# layer being used
+       Log::Config(".NET layer assembly version: {0}({1})", System::Reflection::
+          Assembly::GetExecutingAssembly()->GetName()->Version->ToString(), 
+          System::Reflection::Assembly::GetExecutingAssembly()->ImageRuntimeVersion);
+        
+        Log::Config(".NET runtime version: {0} ",System::Environment::Version);
+        Log::Config(".NET layer source repository (revision): {0} ({1})",
+          GEMFIRE_SOURCE_REPOSITORY, GEMFIRE_SOURCE_REVISION);
+      }
+
+      void DistributedSystem::AppDomainInstancePostInitialization()
+      {
+        //to create .net memory pressure handler 
+        Create(gemfire::DistributedSystem::getInstance().ptr());
+
+        // Register managed AppDomain context with unmanaged.
+        gemfire::createAppDomainContext = &GemStone::GemFire::Cache::Generic::createAppDomainContext;
+      }
+
+      void DistributedSystem::UnregisterBuiltinManagedTypes()
+      {
+         _GF_MG_EXCEPTION_TRY2
+
+         gemfire::DistributedSystemImpl::acquireDisconnectLock();
+
+         Serializable::UnregisterNativesGeneric();
+         
+         int remainingInstances =
+           gemfire::DistributedSystemImpl::currentInstances();
+
+          if (remainingInstances == 0) { // last instance
+           
+            
+            Serializable::UnregisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableDate);
+            Serializable::UnregisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableFileName);
+            Serializable::UnregisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableHashMap);
+            Serializable::UnregisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableHashTable);
+            Serializable::UnregisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableIdentityHashMap);
+            Serializable::UnregisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableVector);
+            Serializable::UnregisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableObjectArray);
+            Serializable::UnregisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableArrayList);
+            Serializable::UnregisterTypeGeneric(
+              gemfire::GemfireTypeIds::CacheableStack);
+            Serializable::UnregisterTypeGeneric(
+              GemFireClassIds::CacheableManagedObject - 0x80000000);
+            Serializable::UnregisterTypeGeneric(
+              GemFireClassIds::CacheableManagedObjectXml - 0x80000000);            
+              
+          }
+
+           _GF_MG_EXCEPTION_CATCH_ALL2
+
+        finally {
+          gemfire::DistributedSystemImpl::releaseDisconnectLock();
+        }
+      }
+
+      GemStone::GemFire::Cache::Generic::SystemProperties^ DistributedSystem::SystemProperties::get()
+      {
+        _GF_MG_EXCEPTION_TRY2
+
+          //  TODO
+					return GemStone::GemFire::Cache::Generic::SystemProperties::Create(
+            gemfire::DistributedSystem::getSystemProperties());
+            
+         //return nullptr;
+
+        _GF_MG_EXCEPTION_CATCH_ALL2
+      }
+
+      String^ DistributedSystem::Name::get()
+      {
+        return ManagedString::Get(NativePtr->getName());
+      }
+
+      bool DistributedSystem::IsConnected::get()
+      {
+        return gemfire::DistributedSystem::isConnected();
+      }
+
+      DistributedSystem^ DistributedSystem::GetInstance()
+      {
+        gemfire::DistributedSystemPtr& nativeptr(
+          gemfire::DistributedSystem::getInstance());
+        return Create(nativeptr.ptr());
+      }
+
+      void DistributedSystem::HandleMemoryPressure(System::Object^ state)
+      {
+        ACE_Time_Value dummy(1);
+        MemoryPressureHandler handler;
+        handler.handle_timeout(dummy, nullptr);
+      }
+
+      DistributedSystem^ DistributedSystem::Create(
+        gemfire::DistributedSystem* nativeptr)
+      {
+        if (m_instance == nullptr) {
+          msclr::lock lockInstance(m_singletonSync);
+          if (m_instance == nullptr) {
+            m_instance = (nativeptr != nullptr
+                ? gcnew DistributedSystem(nativeptr) : nullptr);
+          }
+        }
+        DistributedSystem^ instance = (DistributedSystem^)m_instance;
+        return instance;
+      }
+
+      DistributedSystem::DistributedSystem(gemfire::DistributedSystem* nativeptr)
+        : SBWrap(nativeptr) 
+      {
+        System::Threading::TimerCallback^ timerCallback = gcnew System::
+          Threading::TimerCallback(&DistributedSystem::HandleMemoryPressure);
+        m_memoryPressureHandler = gcnew System::Threading::Timer(
+          timerCallback, "MemoryPressureHandler", 3*60000, 3*60000);
+      }
+
+      DistributedSystem::~DistributedSystem()
+      {
+        m_memoryPressureHandler->Dispose(nullptr);
+      }
+
+      void DistributedSystem::acquireDisconnectLock()
+      {
+        gemfire::DistributedSystemImpl::acquireDisconnectLock();
+      }
+
+      void DistributedSystem::disconnectInstance()
+      {
+        gemfire::DistributedSystemImpl::disconnectInstance();
+      }
+
+      void DistributedSystem::releaseDisconnectLock()
+      {
+        gemfire::DistributedSystemImpl::releaseDisconnectLock();
+      }
+
+      void DistributedSystem::connectInstance()
+      {
+        gemfire::DistributedSystemImpl::connectInstance();
+      }
+
+      void DistributedSystem::registerCliCallback()
+      {
+        m_cliCallBackObj = gcnew CliCallbackDelegate();
+        cliCallback^ nativeCallback =
+          gcnew cliCallback(m_cliCallBackObj,
+          &CliCallbackDelegate::Callback);
+
+        gemfire::DistributedSystemImpl::registerCliCallback( System::Threading::Thread::GetDomainID(),
+              (gemfire::CliCallbackMethod)System::Runtime::InteropServices::
+							Marshal::GetFunctionPointerForDelegate(
+							nativeCallback).ToPointer());
+      }
+
+      void DistributedSystem::unregisterCliCallback()
+      {
+        gemfire::DistributedSystemImpl::unregisterCliCallback( System::Threading::Thread::GetDomainID());
+      }
+      } // end namespace generic
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/DistributedSystem.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DistributedSystem.hpp b/src/clicache/src/DistributedSystem.hpp
new file mode 100644
index 0000000..f00ac5c
--- /dev/null
+++ b/src/clicache/src/DistributedSystem.hpp
@@ -0,0 +1,209 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "gf_defs.hpp"
+#include <gfcpp/DistributedSystem.hpp>
+//#include "impl/NativeWrapper.hpp"
+#include "SystemProperties.hpp"
+#include "Properties.hpp"
+#include "impl/CliCallbackDelgate.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+  namespace GemFire
+  {
+    namespace Cache
+    {
+      namespace Generic
+      {
+      /// <summary>
+      /// DistributedSystem encapsulates this applications "connection" into the
+      /// GemFire Java servers.
+      /// </summary>
+      /// <remarks>
+      /// In order to participate as a client in the GemFire Java servers
+      /// distributed system, each application needs to connect to the
+      /// DistributedSystem.
+      /// </remarks>
+      public ref class DistributedSystem sealed
+				: public Generic::Internal::SBWrap<gemfire::DistributedSystem>
+      {
+      public:
+
+        /// <summary>
+        /// Initializes the Native Client system to be able to connect to the GemFire Java servers.
+        /// </summary>
+        /// <param name="name">the name of the system to connect to</param>
+        /// <exception cref="IllegalArgumentException">if name is null</exception>
+        /// <exception cref="NoSystemException">
+        /// if the connecting target is not running
+        /// </exception>
+        /// <exception cref="AlreadyConnectedException">
+        /// if trying a second connect.
+        /// An application can have one only one connection to a DistributedSystem.
+        /// </exception>
+        /// <exception cref="UnknownException">otherwise</exception>
+        static DistributedSystem^ Connect( String^ name );
+
+        /// <summary>
+        /// Initializes the Native Client system to be able to connect to the
+        /// GemFire Java servers.
+        /// </summary>
+        /// <param name="name">the name of the system to connect to</param>
+        /// <param name="config">the set of properties</param>
+        /// <exception cref="IllegalArgumentException">if name is null</exception>
+        /// <exception cref="NoSystemException">
+        /// if the connecting target is not running
+        /// </exception>
+        /// <exception cref="AlreadyConnectedException">
+        /// if trying a second connect.
+        /// An application can have one only one connection to a DistributedSystem.
+        /// </exception>
+        /// <exception cref="UnknownException">otherwise</exception>
+        static DistributedSystem^ Connect( String^ name, Properties<String^, String^>^ config );
+        
+        /// <summary>
+        /// Disconnect from the distributed system.
+        /// </summary>
+        /// <exception cref="IllegalStateException">if not connected</exception>
+        static void Disconnect();
+
+        /// <summary>
+        /// Returns the SystemProperties used to create this instance of a
+        /// <c>DistributedSystem</c>.
+        /// </summary>
+        /// <returns>the SystemProperties</returns>
+        static property GemStone::GemFire::Cache::Generic::SystemProperties^ SystemProperties
+        {
+          static GemStone::GemFire::Cache::Generic::SystemProperties^ get( );
+        }
+
+        /// <summary>
+        /// Get the name that identifies this DistributedSystem instance.
+        /// </summary>
+        /// <returns>the name of the DistributedSystem instance.</returns>
+        property String^ Name
+        {
+          String^ get( );
+        }
+
+        /// <summary>
+        /// The current connection status of this client to the <c>DistributedSystem</c>.
+        /// </summary>
+        /// <returns>true if connected, false otherwise</returns>
+        static property bool IsConnected
+        {
+          static bool get( );
+        }
+
+        /// <summary>
+        /// Returns a reference to this DistributedSystem instance.
+        /// </summary>
+        /// <returns>the DistributedSystem instance</returns>
+        static DistributedSystem^ GetInstance( );
+
+
+      internal:
+
+        /// <summary>
+        /// Internal factory function to wrap a native object pointer inside
+        /// this managed class with null pointer check.
+        /// </summary>
+        /// <param name="nativeptr">The native object pointer</param>
+        /// <returns>
+        /// The managed wrapper object; null if the native pointer is null.
+        /// </returns>
+        static DistributedSystem^ Create(gemfire::DistributedSystem* nativeptr);
+
+        static void acquireDisconnectLock();
+
+        static void disconnectInstance();
+
+        static void releaseDisconnectLock();
+
+        static void connectInstance();
+
+        delegate void cliCallback();
+
+        static void registerCliCallback();
+
+        static void unregisterCliCallback();
+          /// <summary>
+        /// Stuff that needs to be done for Connect in each AppDomain.
+        /// </summary>
+        static void AppDomainInstanceInitialization(
+          const gemfire::PropertiesPtr& nativepropsptr);
+
+        /// <summary>
+        /// Managed registrations and other stuff to be done for the manage
+        /// layer after the first connect.
+        /// </summary>
+        static void ManagedPostConnect();
+
+        /// <summary>
+        /// Stuff that needs to be done for Connect in each AppDomain but
+        /// only after the first Connect has completed.
+        /// </summary>
+        static void AppDomainInstancePostInitialization();
+
+        /// <summary>
+        /// Unregister the builtin managed types like CacheableObject.
+        /// </summary>
+        static void UnregisterBuiltinManagedTypes();
+
+      private:
+
+        ///// <summary>
+        ///// Stores the task ID of the task that adjusts unmanaged memory
+        ///// pressure in managed GC.
+        ///// </summary>
+        //static long s_memoryPressureTaskID = -1;
+
+        /// <summary>
+        /// Private constructor to wrap a native object pointer
+        /// </summary>
+        /// <param name="nativeptr">The native object pointer</param>
+        DistributedSystem(gemfire::DistributedSystem* nativeptr);
+
+        /// <summary>
+        /// Finalizer for the singleton instance of this class.
+        /// </summary>
+        ~DistributedSystem();
+
+       
+
+        /// <summary>
+        /// Periodically adjust memory pressure of unmanaged heap for GC.
+        /// </summary>
+        static void HandleMemoryPressure(System::Object^ state);
+
+        /// <summary>
+        /// Timer task to periodically invoke <c>HandleMemoryPressure</c>.
+        /// </summary>
+        System::Threading::Timer^ m_memoryPressureHandler;
+
+        /// <summary>
+        /// Singleton instance of this class.
+        /// </summary>
+        static volatile DistributedSystem^ m_instance;
+
+        /// <summary>
+        /// Static lock object to protect the singleton instance of this class.
+        /// </summary>
+        static System::Object^ m_singletonSync = gcnew System::Object();
+
+        static CliCallbackDelegate^ m_cliCallBackObj;
+      };
+      } // end namespace generic
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/EntryEvent.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/EntryEvent.cpp b/src/clicache/src/EntryEvent.cpp
new file mode 100644
index 0000000..ba8f37c
--- /dev/null
+++ b/src/clicache/src/EntryEvent.cpp
@@ -0,0 +1,86 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+//#include "gf_includes.hpp"
+#include "EntryEvent.hpp"
+#include "Region.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+  namespace GemFire
+  {
+    namespace Cache { namespace Generic
+    {
+
+      generic<class TKey, class TValue>
+      EntryEvent<TKey, TValue>::EntryEvent(IRegion<TKey, TValue>^ region,
+        TKey key, TValue oldValue,
+        TValue newValue, Object^ aCallbackArgument,
+        bool remoteOrigin)
+        : UMWrap( )
+      {
+        //TODO:: from where this gets called
+        /*gemfire::RegionPtr regionptr( GetNativePtr<gemfire::Region>( region ) );
+        gemfire::CacheableKeyPtr keyptr( SafeMKeyConvert( key ) );
+        gemfire::CacheablePtr oldptr( SafeMSerializableConvert( oldValue ) );
+        gemfire::CacheablePtr newptr( SafeMSerializableConvert( newValue ) );
+        gemfire::UserDataPtr callbackptr(SafeMSerializableConvert(
+            aCallbackArgument));
+
+        SetPtr(new gemfire::EntryEvent(regionptr, keyptr,
+          oldptr, newptr, callbackptr, remoteOrigin), true);*/
+      }
+
+      generic<class TKey, class TValue>
+      IRegion<TKey, TValue>^ EntryEvent<TKey, TValue>::Region::get( )
+      {
+        gemfire::RegionPtr& regionptr( NativePtr->getRegion( ) );
+        return Generic::Region<TKey, TValue>::Create( regionptr.ptr( ) );
+      }
+
+      generic<class TKey, class TValue>
+      TKey EntryEvent<TKey, TValue>::Key::get( )
+      {
+        gemfire::CacheableKeyPtr& keyptr( NativePtr->getKey( ) );
+        return Serializable::GetManagedValueGeneric<TKey>( keyptr );
+      }
+
+      generic<class TKey, class TValue>
+      TValue EntryEvent<TKey, TValue>::OldValue::get( )
+      {
+        gemfire::CacheablePtr& valptr( NativePtr->getOldValue( ) );
+        return Serializable::GetManagedValueGeneric<TValue>( valptr );
+      }
+
+      generic<class TKey, class TValue>
+      TValue EntryEvent<TKey, TValue>::NewValue::get( )
+      {
+        gemfire::CacheablePtr& valptr( NativePtr->getNewValue( ) );
+        return Serializable::GetManagedValueGeneric<TValue>( valptr );
+      }
+
+      generic<class TKey, class TValue>
+      Object^ EntryEvent<TKey, TValue>::CallbackArgument::get()
+      {
+        gemfire::UserDataPtr& valptr(NativePtr->getCallbackArgument());
+        return Serializable::GetManagedValueGeneric<Object^>( valptr );
+      }
+
+      generic<class TKey, class TValue>
+      bool EntryEvent<TKey, TValue>::RemoteOrigin::get( )
+      {
+        return NativePtr->remoteOrigin( );
+      }
+
+    }
+  }
+}
+ } //namespace 

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/EntryEvent.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/EntryEvent.hpp b/src/clicache/src/EntryEvent.hpp
new file mode 100644
index 0000000..5077d96
--- /dev/null
+++ b/src/clicache/src/EntryEvent.hpp
@@ -0,0 +1,115 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "gf_defs.hpp"
+#include <gfcpp/EntryEvent.hpp>
+#include "impl/NativeWrapper.hpp"
+#include "IRegion.hpp"
+//#include "Region.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+  namespace GemFire
+  {
+    namespace Cache {
+      namespace Generic
+      {
+        interface class IGFSerializable;
+
+     // ref class Region;
+      //interface class ICacheableKey;
+
+      /// <summary>
+      /// This class encapsulates events that occur for an entry in a region.
+      /// </summary>
+      generic<class TKey, class TValue>
+      public ref class EntryEvent sealed
+        : public Internal::UMWrap<gemfire::EntryEvent>
+      {
+      public:
+
+        /// <summary>
+        /// Constructor to create an <c>EntryEvent</c> for the given region.
+        /// </summary>
+        EntryEvent(IRegion<TKey, TValue>^ region, TKey key, TValue oldValue,
+          TValue newValue, Object^ aCallbackArgument,
+          bool remoteOrigin );
+
+        /// <summary>
+        /// Return the region this event occurred in.
+        /// </summary>
+        property IRegion<TKey, TValue>^ Region
+        {
+          IRegion<TKey, TValue>^ get( );
+        }
+
+        /// <summary>
+        /// Returns the key this event describes.
+        /// </summary>
+        property TKey Key
+        {
+          TKey get( );
+        }
+
+        /// <summary>
+        /// Returns 'null' if there was no value in the cache. If the prior state
+        ///  of the entry was invalid, or non-existent/destroyed, then the old
+        /// value will be 'null'.
+        /// </summary>
+        property TValue OldValue
+        {
+          TValue get( );
+        }
+
+        /// <summary>
+        /// Return the updated value from this event. If the event is a destroy
+        /// or invalidate operation, then the new value will be NULL.
+        /// </summary>
+        property TValue NewValue
+        {
+          TValue get( );
+        }
+
+        /// <summary>
+        /// Returns the callbackArgument passed to the method that generated
+        /// this event. See the <see cref="Region" /> interface methods
+        /// that take a callbackArgument parameter.
+        /// </summary>
+        property Object^ CallbackArgument
+        {
+          Object^ get();
+        }
+
+        /// <summary>
+        /// If the event originated in a remote process, returns true.
+        /// </summary>
+        property bool RemoteOrigin
+        {
+          bool get( );
+        }
+
+
+      internal:
+
+        /// <summary>
+        /// Private constructor to wrap a native object pointer
+        /// </summary>
+        /// <param name="nativeptr">The native object pointer</param>
+        inline EntryEvent<TKey, TValue>( const gemfire::EntryEvent* nativeptr )
+          : Internal::UMWrap<gemfire::EntryEvent>(
+            const_cast<gemfire::EntryEvent*>( nativeptr ), false ) { }
+      };
+
+    }
+  }
+}
+ } //namespace 

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/ExceptionTypes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ExceptionTypes.cpp b/src/clicache/src/ExceptionTypes.cpp
new file mode 100644
index 0000000..2409c6b
--- /dev/null
+++ b/src/clicache/src/ExceptionTypes.cpp
@@ -0,0 +1,153 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+//#include "gf_includes.hpp"
+#include "ExceptionTypes.hpp"
+#include <stdlib.h>
+
+using namespace System;
+
+namespace GemStone
+{
+  namespace GemFire
+  {
+    namespace Cache
+    {
+      namespace Generic
+      {
+
+#define _GF_MG_EXCEPTION_ADD3(x) { "gemfire::" #x, gcnew CreateException2( x::Create ) }
+#define _GF_MG_EXCEPTION_ADD4(x,y) { "gemfire::" #y, gcnew CreateException2( x::Create ) }
+
+      Dictionary<String^, CreateException2^>^ GemFireException::Init( )
+      {
+        if (Native2ManagedExMap != nullptr)
+        {
+          return Native2ManagedExMap;
+        }
+        array<NameDelegatePair>^ exNamesDelegates = gcnew array<NameDelegatePair> {
+          _GF_MG_EXCEPTION_ADD3( AssertionException ),
+          _GF_MG_EXCEPTION_ADD3( IllegalArgumentException ),
+          _GF_MG_EXCEPTION_ADD3( IllegalStateException ),
+          _GF_MG_EXCEPTION_ADD3( CacheExistsException ),
+          _GF_MG_EXCEPTION_ADD3( CacheXmlException ),
+          _GF_MG_EXCEPTION_ADD3( TimeoutException ),
+          _GF_MG_EXCEPTION_ADD3( CacheWriterException ),
+          _GF_MG_EXCEPTION_ADD3( CacheListenerException ),
+          _GF_MG_EXCEPTION_ADD3( RegionExistsException ),
+          _GF_MG_EXCEPTION_ADD3( CacheClosedException ),
+          _GF_MG_EXCEPTION_ADD3( LeaseExpiredException ),
+          _GF_MG_EXCEPTION_ADD3( CacheLoaderException ),
+          _GF_MG_EXCEPTION_ADD3( RegionDestroyedException ),
+          _GF_MG_EXCEPTION_ADD3( EntryDestroyedException ),
+          _GF_MG_EXCEPTION_ADD3( NoSystemException ),
+          _GF_MG_EXCEPTION_ADD3( AlreadyConnectedException ),
+          _GF_MG_EXCEPTION_ADD3( FileNotFoundException ),          
+          _GF_MG_EXCEPTION_ADD3( InterruptedException ),
+          _GF_MG_EXCEPTION_ADD3( UnsupportedOperationException ),
+          _GF_MG_EXCEPTION_ADD3( StatisticsDisabledException ),
+          _GF_MG_EXCEPTION_ADD3( ConcurrentModificationException ),
+          _GF_MG_EXCEPTION_ADD3( UnknownException ),
+          _GF_MG_EXCEPTION_ADD3( ClassCastException ),
+          _GF_MG_EXCEPTION_ADD3( EntryNotFoundException ),
+          _GF_MG_EXCEPTION_ADD4( GemFireIOException, GemfireIOException ),
+          _GF_MG_EXCEPTION_ADD4( GemFireConfigException, GemfireConfigException ),
+          _GF_MG_EXCEPTION_ADD3( NullPointerException ),
+          _GF_MG_EXCEPTION_ADD3( EntryExistsException ),
+          _GF_MG_EXCEPTION_ADD3( NotConnectedException ),
+          _GF_MG_EXCEPTION_ADD3( CacheProxyException ),
+          _GF_MG_EXCEPTION_ADD3( OutOfMemoryException ),
+          _GF_MG_EXCEPTION_ADD3( NotOwnerException ),
+          _GF_MG_EXCEPTION_ADD3( WrongRegionScopeException ),
+          _GF_MG_EXCEPTION_ADD3( BufferSizeExceededException ),
+          _GF_MG_EXCEPTION_ADD3( RegionCreationFailedException ),
+          _GF_MG_EXCEPTION_ADD3( FatalInternalException ),
+          _GF_MG_EXCEPTION_ADD3( DiskFailureException ),
+          _GF_MG_EXCEPTION_ADD3( DiskCorruptException ),
+          _GF_MG_EXCEPTION_ADD3( InitFailedException ),
+          _GF_MG_EXCEPTION_ADD3( ShutdownFailedException ),
+          _GF_MG_EXCEPTION_ADD3( CacheServerException ),
+          _GF_MG_EXCEPTION_ADD3( OutOfRangeException ),
+          _GF_MG_EXCEPTION_ADD3( QueryException ),
+          _GF_MG_EXCEPTION_ADD3( MessageException ),
+          _GF_MG_EXCEPTION_ADD3( NotAuthorizedException ),
+          _GF_MG_EXCEPTION_ADD3( AuthenticationFailedException ),
+          _GF_MG_EXCEPTION_ADD3( AuthenticationRequiredException ),
+          _GF_MG_EXCEPTION_ADD3( DuplicateDurableClientException ),
+          _GF_MG_EXCEPTION_ADD3( NoAvailableLocatorsException ),
+          _GF_MG_EXCEPTION_ADD3( FunctionExecutionException ),
+          _GF_MG_EXCEPTION_ADD3( CqInvalidException ),
+          _GF_MG_EXCEPTION_ADD3( CqExistsException ),
+          _GF_MG_EXCEPTION_ADD3( CqQueryException ),
+          _GF_MG_EXCEPTION_ADD3( CqClosedException ),
+          _GF_MG_EXCEPTION_ADD3( CqException ),
+          _GF_MG_EXCEPTION_ADD3( AllConnectionsInUseException ),
+          _GF_MG_EXCEPTION_ADD3( InvalidDeltaException ),
+          _GF_MG_EXCEPTION_ADD3( KeyNotFoundException ),
+          _GF_MG_EXCEPTION_ADD3( CommitConflictException ),
+		  _GF_MG_EXCEPTION_ADD3( TransactionDataNodeHasDepartedException ),
+		  _GF_MG_EXCEPTION_ADD3( TransactionDataRebalancedException )
+        };
+
+        Native2ManagedExMap = gcnew Dictionary<String^, CreateException2^>( );
+        for (int32_t index = 0; index < exNamesDelegates->Length; index++)
+        {
+          Native2ManagedExMap[ exNamesDelegates[ index ].m_name ] =
+            exNamesDelegates[ index ].m_delegate;
+        }
+        return Native2ManagedExMap;
+      }
+
+      System::Exception^ GemFireException::Get(const gemfire::Exception& nativeEx)
+      {
+        Exception^ innerException = nullptr;
+        const gemfire::ExceptionPtr& cause = nativeEx.getCause();
+        if (cause != NULLPTR) {
+          innerException = GemFireException::Get(*cause);
+        }
+        String^ exName = gcnew String( nativeEx.getName( ) );
+        CreateException2^ exDelegate;
+        if (Native2ManagedExMap->TryGetValue(exName, exDelegate)) {
+          return exDelegate(nativeEx, innerException);
+        }
+        String^ exMsg = ManagedString::Get( nativeEx.getMessage( ) );
+        if ( exMsg->StartsWith( GemFireException::MgSysExPrefix ) ) {
+          // Get the exception type
+          String^ mgExStr = exMsg->Substring(
+            GemFireException::MgSysExPrefix->Length );
+          int32_t colonIndex = mgExStr->IndexOf( ':' );
+          if ( colonIndex > 0 ) {
+            String^ mgExName = mgExStr->Substring( 0, colonIndex )->Trim( );
+            // Try to load this class by reflection
+            Type^ mgExType = Type::GetType( mgExName, false, true );
+            if ( mgExType != nullptr ) {
+              System::Reflection::ConstructorInfo^ cInfo = mgExType->
+                GetConstructor(gcnew array<Type^>{ String::typeid, Exception::typeid });
+              if ( cInfo != nullptr ) {
+                String^ mgMsg = mgExStr->Substring( colonIndex + 1 );
+                Exception^ mgEx = dynamic_cast<Exception^>(cInfo->Invoke(
+                      gcnew array<Object^>{ mgMsg, innerException }));
+                if ( mgEx != nullptr ) {
+                  return mgEx;
+                }
+              }
+            }
+          }
+        }
+        if (innerException == nullptr) {
+          return gcnew GemFireException(exName + ": " + exMsg,
+              gcnew GemFireException(GetStackTrace(nativeEx)));
+        }
+        else {
+          return gcnew GemFireException(exName + ": " + exMsg, innerException);
+        }
+      }
+      } // end namespace generic
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/ExceptionTypes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ExceptionTypes.hpp b/src/clicache/src/ExceptionTypes.hpp
new file mode 100644
index 0000000..b925110
--- /dev/null
+++ b/src/clicache/src/ExceptionTypes.hpp
@@ -0,0 +1,677 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "gf_defs.hpp"
+#include <gfcpp/ExceptionTypes.hpp>
+#include "impl/ManagedString.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+using namespace System::Runtime::Serialization;
+
+namespace GemStone
+{
+  namespace GemFire
+  {
+    namespace Cache
+    {
+      namespace Generic
+      {
+
+      ref class GemFireException;
+
+      /// <summary>
+      /// Factory delegate to create a managed GemFire exception.
+      /// </summary>
+      /// <remarks>
+      /// For each managed exception class, its factory delegate is registered
+      /// and maintained in a static dictionary mapped to its corresponding
+      /// native GemFire C++ exception name.
+      /// </remarks>
+      delegate GemFireException^ CreateException2(
+        const gemfire::Exception& nativeEx, System::Exception^ innerException);
+
+      /// <summary>
+      /// The base exception class of all managed GemFire exceptions.
+      /// </summary>
+      [Serializable]
+      public ref class GemFireException
+        : public System::Exception
+      {
+      private:
+
+        /// <summary>
+        /// Prefix for distiguishing managed system exceptions
+        /// </summary>
+        literal String^ MgSysExPrefix = "GFCLI_EXCEPTION:";
+
+        /// <summary>
+        /// This contains a mapping of the native GemFire exception class
+        /// name to the factory delegate of the corresponding managed GemFire
+        /// exception class.
+        /// </summary>
+        static Dictionary<String^, CreateException2^>^ Native2ManagedExMap =
+          Init( );
+
+        /// <summary>
+        /// Name and delegate pair class. The Native2ManagedExMap dictionary
+        /// is populated from a static array of this class.
+        /// </summary>
+        value class NameDelegatePair
+        {
+        public:
+
+          /// <summary>
+          /// The name of the native GemFire exception class.
+          /// </summary>
+          String^ m_name;
+
+          /// <summary>
+          /// The factory delegate of the managed GemFire exception class
+          /// corresponding to <c>m_name</c>
+          /// </summary>
+          CreateException2^ m_delegate;
+        };
+
+
+      internal:
+
+        /// <summary>
+        /// Static method to associate the native exception names with
+        /// the corresponding managed exception factory delegates.
+        /// </summary>
+        /// <remarks>
+        /// This method is not thread-safe and should be called in a single thread.
+        /// </remarks>
+        static Dictionary<String^, CreateException2^>^ Init( );
+
+        /// <summary>
+        /// Create the managed GemFire exception for a given native GemFire exception.
+        /// As a special case normal system exceptions are also created when the
+        /// native exception is a wrapper of a managed system exception.
+        /// </summary>
+        /// <remarks>
+        /// Wherever the native GemFire C++ code raises a <c>gemfire::Exception</c>,
+        /// the CLI wrapper code should have a catch-all for those and use
+        /// this function to create the corresponding managed GemFire exception.
+        /// If no managed GemFire exception has been defined (or has not been
+        /// added using _GF_MG_EXCEPTION_ADD3 in ExceptionTypesMN.cpp) then a
+        /// generic <c>GemFireException</c> exception is returned.
+        /// </remarks>
+        /// <param name="nativeEx">The native GemFire exception object</param>
+        /// <returns>
+        /// The managed GemFire exception object corresponding to the provided
+        /// native GemFire exception object.
+        /// </returns>
+        static Exception^ Get(const gemfire::Exception& nativeEx);
+
+        /// <summary>
+        /// Get the stack trace for the given native exception.
+        /// </summary>
+        /// <param name="nativeEx">The native GemFire exception object</param>
+        /// <returns>The stack trace of the native exception.</returns>
+        inline static String^ GetStackTrace(
+          const gemfire::Exception& nativeEx )
+        {
+          char nativeExStack[2048] = { '\0' };
+#ifndef _WIN64
+          nativeEx.getStackTrace(nativeExStack, 2047);
+#endif
+          return ManagedString::Get(nativeExStack);
+        }
+
+        /// <summary>
+        /// Gets the C++ native exception object for a given managed exception.
+        /// </summary>
+        /// <remarks>
+        /// This method is to handle conversion of managed exceptions to
+        /// C++ exception for those thrown by managed callbacks.
+        /// For non-Gemfire .NET exceptions we wrap it inside the generic
+        /// <c>GemfireException</c> with a special prefix in message.
+        /// While converting the exception back from C++ to .NET if the
+        /// prefix is found in the message, then it tries to construct
+        /// the original exception by reflection on the name of exception
+        /// contained in the message. Note that in this process the
+        /// original stacktrace is appended to the message of the exception.
+        /// </remarks>
+        inline static gemfire::ExceptionPtr GetNative(Exception^ ex)
+        {
+          if (ex != nullptr) {
+            GemFireException^ gfEx = dynamic_cast<GemFireException^>(ex);
+            if (gfEx != nullptr) {
+              return gfEx->GetNative();
+            }
+            else {
+              gemfire::ExceptionPtr cause;
+              if (ex->InnerException != nullptr) {
+                cause = GemFireException::GetNative(ex->InnerException);
+              }
+              ManagedString mg_exStr(MgSysExPrefix + ex->ToString());
+              return gemfire::ExceptionPtr(new gemfire::Exception(
+                  mg_exStr.CharPtr, NULL, false, cause));
+            }
+          }
+          return NULLPTR;
+        }
+
+        /// <summary>
+        /// Gets the C++ native exception object for this managed
+        /// <c>GemFireException</c>.
+        /// </summary>
+        virtual gemfire::ExceptionPtr GetNative()
+        {
+          String^ msg = this->Message + ": " + this->StackTrace;
+          ManagedString mg_msg(msg);
+          gemfire::ExceptionPtr cause;
+          if (this->InnerException != nullptr) {
+            cause = GemFireException::GetNative(this->InnerException);
+          }
+          return gemfire::ExceptionPtr(new gemfire::Exception(mg_msg.CharPtr,
+              NULL, false, cause));
+        }
+
+        /// <summary>
+        /// Throws the C++ native exception object for the given .NET exception.
+        /// </summary>
+        /// <remarks>
+        /// This method is to handle conversion of managed exceptions to
+        /// C++ exception for those thrown by managed callbacks.
+        /// For non-Gemfire .NET exceptions we wrap it inside the generic
+        /// <c>GemfireException</c> with a special prefix in message.
+        /// While converting the exception back from C++ to .NET if the
+        /// prefix is found in the message, then it tries to construct
+        /// the original exception by reflection on the name of exception
+        /// contained in the message. Note that in this process the
+        /// original stacktrace is appended to the message of the exception.
+        /// </remarks>
+        inline static void ThrowNative(Exception^ ex)
+        {
+          if (ex != nullptr) {
+            gemfire::ExceptionPtr cause;
+            if (ex->InnerException != nullptr) {
+              cause = GemFireException::GetNative(ex->InnerException);
+            }
+            ManagedString mg_exStr(MgSysExPrefix + ex->ToString());
+            throw gemfire::Exception(mg_exStr.CharPtr, NULL, false, cause);
+          }
+        }
+
+        /// <summary>
+        /// Throws the C++ native exception object for this managed
+        /// <c>GemFireException</c>.
+        /// </summary>
+        inline void ThrowNative()
+        {
+          GetNative()->raise();
+        }
+
+
+      public:
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        inline GemFireException( )
+          : Exception( ) { }
+
+        /// <summary>
+        /// Constructor to create an exception object with the given message.
+        /// </summary>
+        /// <param name="message">The exception message.</param>
+        inline GemFireException( String^ message )
+          : Exception( message ) { }
+
+        /// <summary>
+        /// Constructor to create an exception object with the given message
+        /// and with the given inner exception.
+        /// </summary>
+        /// <param name="message">The exception message.</param>
+        /// <param name="innerException">The inner exception object.</param>
+        inline GemFireException( String^ message, System::Exception^ innerException )
+          : Exception( message, innerException ) { }
+
+      protected:
+
+        /// <summary>
+        /// Initializes a new instance of the <c>GemFireException</c> class with
+        /// serialized data.
+        /// This allows deserialization of this exception in .NET remoting.
+        /// </summary>
+        /// <param name="info">
+        /// holds the serialized object data about
+        /// the exception being thrown
+        /// </param>
+        /// <param name="context">
+        /// contains contextual information about
+        /// the source or destination
+        /// </param>
+        inline GemFireException( SerializationInfo^ info, StreamingContext context )
+          : Exception( info, context ) { }
+      };
+
+/// Handle gemfire exceptions from native layer and convert to managed
+/// exceptions.
+#define _GF_MG_EXCEPTION_TRY2        \
+      try {
+#define _GF_MG_EXCEPTION_CATCH_ALL2  \
+      } \
+      catch (const gemfire::Exception& ex) { \
+      throw GemStone::GemFire::Cache::Generic::GemFireException::Get(ex); \
+      } \
+      catch (System::AccessViolationException^ ex) { \
+        throw ex; \
+      }
+
+
+/// Creates a class <c>x</c> named for each exception <c>y</c>.
+#define _GF_MG_EXCEPTION_DEF4(x,y) \
+      [Serializable] \
+      public ref class x: public GemFireException \
+      { \
+      public: \
+      \
+        /** <summary>Default constructor</summary> */ \
+        x( ) \
+          : GemFireException( ) { } \
+        \
+        /** <summary>
+         *  Constructor to create an exception object with the given message.
+         *  </summary>
+         *  <param name="message">The exception message.</param>
+         */ \
+        x( String^ message ) \
+          : GemFireException( message ) { } \
+        \
+        /** <summary>
+         *  Constructor to create an exception object with the given message
+         *  and with the given inner exception.
+         *  </summary>
+         *  <param name="message">The exception message.</param>
+         *  <param name="innerException">The inner exception object.</param>
+         */ \
+        x( String^ message, System::Exception^ innerException ) \
+          : GemFireException( message, innerException ) { } \
+        \
+      protected: \
+      \
+        /** <summary>
+         *  Initializes a new instance of the class with serialized data.
+         *  This allows deserialization of this exception in .NET remoting.
+         *  </summary>
+         *  <param name="info">
+         *  holds the serialized object data about the exception being thrown
+         *  </param>
+         *  <param name="context">
+         *  contains contextual information about the source or destination
+         *  </param>
+         */ \
+        x( SerializationInfo^ info, StreamingContext context ) \
+          : GemFireException( info, context ) { } \
+      \
+      internal: \
+        x(const gemfire::y& nativeEx) \
+          : GemFireException(ManagedString::Get(nativeEx.getMessage()), \
+              gcnew GemFireException(GemFireException::GetStackTrace( \
+                nativeEx))) { } \
+        \
+        x(const gemfire::y& nativeEx, Exception^ innerException) \
+          : GemFireException(ManagedString::Get(nativeEx.getMessage()), \
+              innerException) { } \
+        \
+        static GemFireException^ Create(const gemfire::Exception& ex, \
+            Exception^ innerException) \
+        { \
+          const gemfire::y* nativeEx = dynamic_cast<const gemfire::y*>( &ex ); \
+          if (nativeEx != nullptr) { \
+            if (innerException == nullptr) { \
+              return gcnew x(*nativeEx); \
+            } \
+            else { \
+              return gcnew x(*nativeEx, innerException); \
+            } \
+          } \
+          return nullptr; \
+        } \
+        virtual gemfire::ExceptionPtr GetNative() override \
+        { \
+          String^ msg = this->Message + ": " + this->StackTrace; \
+          ManagedString mg_msg(msg); \
+          gemfire::ExceptionPtr cause; \
+          if (this->InnerException != nullptr) { \
+            cause = GemFireException::GetNative(this->InnerException); \
+          } \
+          return gemfire::ExceptionPtr(new gemfire::y(mg_msg.CharPtr, \
+              NULL, false, cause)); \
+        } \
+      }
+
+/// Creates a class named for each exception <c>x</c>.
+#define _GF_MG_EXCEPTION_DEF3(x) _GF_MG_EXCEPTION_DEF4(x,x)
+
+
+      // For all the native GemFire C++ exceptions, a corresponding definition
+      // should be added below *AND* it should also be added to the static array
+      // in ExceptionTypesMN.cpp using _GF_MG_EXCEPTION_ADD3( x )
+
+      /// <summary>
+      /// A gemfire assertion exception.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( AssertionException );
+
+      /// <summary>
+      /// Thrown when an argument to a method is illegal.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( IllegalArgumentException );
+
+      /// <summary>
+      /// Thrown when the state of cache is manipulated to be illegal.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( IllegalStateException );
+
+      /// <summary>
+      /// Thrown when an attempt is made to create an existing cache.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CacheExistsException );
+
+      /// <summary>
+      /// Thrown when the cache xml is incorrect.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CacheXmlException );
+
+      /// <summary>
+      /// Thrown when a timout occurs.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( TimeoutException );
+
+      /// <summary>
+      /// Thrown when the cache writer aborts the operation.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CacheWriterException );
+
+      /// <summary>
+      /// Thrown when the cache listener throws an exception.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CacheListenerException );
+
+      /// <summary>
+      /// Thrown when an attempt is made to create an existing region.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( RegionExistsException );
+
+      /// <summary>
+      /// Thrown when an operation is attempted on a closed cache.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CacheClosedException );
+
+      /// <summary>
+      /// Thrown when lease of cache proxy has expired.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( LeaseExpiredException );
+
+      /// <summary>
+      /// Thrown when the cache loader aborts the operation.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CacheLoaderException );
+
+      /// <summary>
+      /// Thrown when an operation is attempted on a destroyed region.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( RegionDestroyedException );
+
+      /// <summary>
+      /// Thrown when an operation is attempted on a destroyed entry.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( EntryDestroyedException );
+
+      /// <summary>
+      /// Thrown when the connecting target is not running.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( NoSystemException );
+
+      /// <summary>
+      /// Thrown when an attempt is made to connect to
+      /// DistributedSystem second time.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( AlreadyConnectedException );
+
+      /// <summary>
+      /// Thrown when a non-existing file is accessed.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( FileNotFoundException );
+
+      /// <summary>
+      /// Thrown when an operation is interrupted.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( InterruptedException );
+
+      /// <summary>
+      /// Thrown when an operation unsupported by the
+      /// current configuration is attempted.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( UnsupportedOperationException );
+
+      /// <summary>
+      /// Thrown when statistics are invoked for a region where
+      /// they are disabled.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( StatisticsDisabledException );
+
+      /// <summary>
+      /// Thrown when a concurrent operation fails.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( ConcurrentModificationException );
+
+      /// <summary>
+      /// An unknown exception occurred.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( UnknownException );
+
+      /// <summary>
+      /// Thrown when a cast operation fails.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( ClassCastException );
+
+      /// <summary>
+      /// Thrown when an operation is attempted on a non-existent entry.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( EntryNotFoundException );
+
+      /// <summary>
+      /// Thrown when there is an input/output error.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF4( GemFireIOException, GemfireIOException );
+
+      /// <summary>
+      /// Thrown when gemfire configuration file is incorrect.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF4( GemFireConfigException, GemfireConfigException );
+
+      /// <summary>
+      /// Thrown when a null argument is provided to a method
+      /// where it is expected to be non-null.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( NullPointerException );
+
+      /// <summary>
+      /// Thrown when attempt is made to create an existing entry.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( EntryExistsException );
+
+      /// <summary>
+      /// Thrown when an operation is attempted before connecting
+      /// to the distributed system.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( NotConnectedException );
+
+      /// <summary>
+      /// Thrown when there is an error in the cache proxy.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CacheProxyException );
+
+      /// <summary>
+      /// Thrown when the system cannot allocate any more memory.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( OutOfMemoryException );
+
+      /// <summary>
+      /// Thrown when an attempt is made to release a lock not
+      /// owned by the thread.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( NotOwnerException );
+
+      /// <summary>
+      /// Thrown when a region is created in an incorrect scope.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( WrongRegionScopeException );
+
+      /// <summary>
+      /// Thrown when the internal buffer size is exceeded.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( BufferSizeExceededException );
+
+      /// <summary>
+      /// Thrown when a region creation operation fails.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( RegionCreationFailedException );
+
+      /// <summary>
+      /// Thrown when there is a fatal internal exception in GemFire.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( FatalInternalException );
+
+      /// <summary>
+      /// Thrown by the persistence manager when a write
+      /// fails due to disk failure.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( DiskFailureException );
+
+      /// <summary>
+      /// Thrown by the persistence manager when the data
+      /// to be read from disk is corrupt.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( DiskCorruptException );
+
+      /// <summary>
+      /// Thrown when persistence manager fails to initialize.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( InitFailedException );
+
+      /// <summary>
+      /// Thrown when persistence manager fails to close properly.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( ShutdownFailedException );
+
+      /// <summary>
+      /// Thrown when an exception occurs on the cache server.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CacheServerException );
+
+      /// <summary>
+      /// Thrown when bound of array/vector etc. is exceeded.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( OutOfRangeException );
+
+      /// <summary>
+      /// Thrown when query exception occurs at the server.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( QueryException );
+
+      /// <summary>
+      /// Thrown when an unknown message is received from the server.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( MessageException );
+
+      /// <summary>
+      /// Thrown when a client operation is not authorized on the server.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( NotAuthorizedException );
+
+      /// <summary>
+      /// Thrown when authentication to the server fails.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( AuthenticationFailedException );
+
+      /// <summary>
+      /// Thrown when credentials are not provided to a server which expects them.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( AuthenticationRequiredException );
+
+      /// <summary>
+      /// Thrown when a duplicate durable client id is provided to the server.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( DuplicateDurableClientException );
+
+      /// <summary>
+      /// Thrown when a client is unable to contact any locators.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( NoAvailableLocatorsException );
+
+      /// <summary>
+      /// Thrown when all connections in a pool are in use..
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( AllConnectionsInUseException );
+
+      /// <summary>
+      /// Thrown when cq is invalid
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CqInvalidException );
+
+      /// <summary>
+      /// Thrown when function execution failed
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( FunctionExecutionException );
+
+      /// <summary>
+      /// Thrown during continuous query execution time.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CqException );
+
+      /// <summary>
+      /// Thrown if the Cq on which the operaion performed is closed
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CqClosedException );
+
+      /// <summary>
+      /// Thrown if the Cq Query failed
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CqQueryException );
+
+      /// <summary>
+      /// Thrown if a Cq by this name already exists on this client
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CqExistsException );
+
+      _GF_MG_EXCEPTION_DEF3( InvalidDeltaException );
+
+      /// <summary>
+      /// Thrown if a Key is not present in the region.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( KeyNotFoundException );
+
+      /// <summary>
+      /// Thrown if commit fails.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( CommitConflictException );
+
+	        /// <summary>
+      /// Thrown if transaction delegate went down.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( TransactionDataNodeHasDepartedException );
+
+	        /// <summary>
+      /// Thrown if commit rebalance happens during a transaction.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF3( TransactionDataRebalancedException );
+
+      } // end namespace Generic
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/Execution.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Execution.cpp b/src/clicache/src/Execution.cpp
new file mode 100644
index 0000000..a7275f6
--- /dev/null
+++ b/src/clicache/src/Execution.cpp
@@ -0,0 +1,97 @@
+/*=========================================================================
+* Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+*=========================================================================
+*/
+
+//#include "gf_includes.hpp"
+#include "Execution.hpp"
+#include <gfcpp/Execution.hpp>
+#include "ResultCollector.hpp"
+#include "impl/ManagedResultCollector.hpp"
+
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+  namespace GemFire
+  {
+    namespace Cache { namespace Generic
+    {
+
+      generic<class TResult>
+      generic<class TFilter>
+      Execution<TResult>^ Execution<TResult>::WithFilter(System::Collections::Generic::ICollection<TFilter>^ routingObj)
+      {
+        if (routingObj != nullptr) {
+          _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+          gemfire::CacheableVectorPtr rsptr = gemfire::CacheableVector::create();
+        
+          for each(TFilter item in routingObj)
+          {
+            rsptr->push_back(Serializable::GetUnmanagedValueGeneric<TFilter>( item ));
+          }
+          
+          return Execution<TResult>::Create(NativePtr->withFilter(rsptr).ptr(), this->m_rc);
+          _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+        }
+        else {
+          throw gcnew IllegalArgumentException("Execution<TResult>::WithFilter: null TFilter provided");
+        }
+      }
+
+      generic<class TResult>
+      generic<class TArgs>
+      Execution<TResult>^ Execution<TResult>::WithArgs( TArgs args )
+      {
+        _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+          
+          gemfire::CacheablePtr argsptr( Serializable::GetUnmanagedValueGeneric<TArgs>( args ) );
+        return Execution<TResult>::Create(NativePtr->withArgs(argsptr).ptr(), this->m_rc);
+        _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+      }
+
+      generic<class TResult>
+      Execution<TResult>^ Execution<TResult>::WithCollector(Generic::IResultCollector<TResult>^ rc)
+      {
+        _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+          gemfire::ResultCollectorPtr rcptr;
+        if ( rc != nullptr ) {
+          ResultCollectorGeneric<TResult>^ rcg = gcnew ResultCollectorGeneric<TResult>();
+          rcg->SetResultCollector(rc);
+          
+          rcptr = new gemfire::ManagedResultCollectorGeneric(  rcg );
+          //((gemfire::ManagedResultCollectorGeneric*)rcptr.ptr())->setptr(rcg);
+        }
+        return Execution<TResult>::Create( NativePtr->withCollector(rcptr).ptr(), rc);
+        _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+      }
+
+      generic<class TResult>
+      IResultCollector<TResult>^ Execution<TResult>::Execute(String^ func, UInt32 timeout)
+      {
+        _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+          ManagedString mg_function( func );
+        gemfire::ResultCollectorPtr rc = NativePtr->execute(mg_function.CharPtr, timeout);
+        if(m_rc == nullptr)
+          return gcnew ResultCollector<TResult>(rc.ptr());
+        else
+          return m_rc;
+        _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+      }
+
+      generic<class TResult>
+      IResultCollector<TResult>^ Execution<TResult>::Execute(String^ func)
+      {
+        return Execute(func, DEFAULT_QUERY_RESPONSE_TIMEOUT);
+      }
+    }
+    }
+  }
+} //namespace 


Mime
View raw message