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/08/11 23:52:35 UTC

[19/52] [partial] geode-native git commit: GEODE-3165: Reogranized sources relative to the root for better CMake IDE integration.

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ExceptionTypes.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/ExceptionTypes.cpp b/clicache/src/ExceptionTypes.cpp
new file mode 100644
index 0000000..e8eeb0c
--- /dev/null
+++ b/clicache/src/ExceptionTypes.cpp
@@ -0,0 +1,159 @@
+/*
+ * 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 "ExceptionTypes.hpp"
+#include <cstdlib>
+
+using namespace System;
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+#define _GF_MG_EXCEPTION_ADD3(x) { "apache::geode::client::" #x, gcnew CreateException2( x::Create ) }
+#define _GF_MG_EXCEPTION_ADD4(x,y) { "apache::geode::client::" #y, gcnew CreateException2( x::Create ) }
+
+      Dictionary<String^, CreateException2^>^ GeodeException::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( GeodeIOException, GeodeIOException ),
+          _GF_MG_EXCEPTION_ADD4( GeodeConfigException, GeodeConfigException ),
+          _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 (System::Int32 index = 0; index < exNamesDelegates->Length; index++)
+        {
+          Native2ManagedExMap[ exNamesDelegates[ index ].m_name ] =
+            exNamesDelegates[ index ].m_delegate;
+        }
+        return Native2ManagedExMap;
+      }
+
+      System::Exception^ GeodeException::Get(const apache::geode::client::Exception& nativeEx)
+      {
+        Exception^ innerException = nullptr;
+        const apache::geode::client::ExceptionPtr& cause = nativeEx.getCause();
+        if (cause != nullptr) {
+          innerException = GeodeException::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( GeodeException::MgSysExPrefix ) ) {
+          // Get the exception type
+          String^ mgExStr = exMsg->Substring(
+            GeodeException::MgSysExPrefix->Length );
+          System::Int32 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;
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache
+
+        }
+        if (innerException == nullptr) {
+          return gcnew GeodeException(exName + ": " + exMsg,
+              gcnew GeodeException(GetStackTrace(nativeEx)));
+        }
+        else {
+          return gcnew GeodeException(exName + ": " + exMsg, innerException);
+        }
+      }
+      } // end namespace generic
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ExceptionTypes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ExceptionTypes.hpp b/clicache/src/ExceptionTypes.hpp
new file mode 100644
index 0000000..491dfcb
--- /dev/null
+++ b/clicache/src/ExceptionTypes.hpp
@@ -0,0 +1,686 @@
+/*
+ * 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 "begin_native.hpp"
+#include <geode/ExceptionTypes.hpp>
+#include "end_native.hpp"
+
+#include "impl/ManagedString.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+using namespace System::Runtime::Serialization;
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+      ref class GeodeException;
+
+      /// <summary>
+      /// Factory delegate to create a managed Geode exception.
+      /// </summary>
+      /// <remarks>
+      /// For each managed exception class, its factory delegate is registered
+      /// and maintained in a static dictionary mapped to its corresponding
+      /// native Geode C++ exception name.
+      /// </remarks>
+      delegate GeodeException^ CreateException2(
+        const apache::geode::client::Exception& nativeEx, System::Exception^ innerException);
+
+      /// <summary>
+      /// The base exception class of all managed Geode exceptions.
+      /// </summary>
+      [Serializable]
+      public ref class GeodeException
+        : 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 Geode exception class
+        /// name to the factory delegate of the corresponding managed Geode
+        /// 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 Geode exception class.
+          /// </summary>
+          String^ m_name;
+
+          /// <summary>
+          /// The factory delegate of the managed Geode 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 Geode exception for a given native Geode 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 Geode C++ code raises a <c>apache::geode::client::Exception</c>,
+        /// the CLI wrapper code should have a catch-all for those and use
+        /// this function to create the corresponding managed Geode exception.
+        /// If no managed Geode exception has been defined (or has not been
+        /// added using _GF_MG_EXCEPTION_ADD3 in ExceptionTypesMN.cpp) then a
+        /// generic <c>GeodeException</c> exception is returned.
+        /// </remarks>
+        /// <param name="nativeEx">The native Geode exception object</param>
+        /// <returns>
+        /// The managed Geode exception object corresponding to the provided
+        /// native Geode exception object.
+        /// </returns>
+        static Exception^ Get(const apache::geode::client::Exception& nativeEx);
+
+        /// <summary>
+        /// Get the stack trace for the given native exception.
+        /// </summary>
+        /// <param name="nativeEx">The native Geode exception object</param>
+        /// <returns>The stack trace of the native exception.</returns>
+        inline static String^ GetStackTrace(
+          const apache::geode::client::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-Geode .NET exceptions we wrap it inside the generic
+        /// <c>GeodeException</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 apache::geode::client::ExceptionPtr GetNative(Exception^ ex)
+        {
+          if (ex != nullptr) {
+            GeodeException^ gfEx = dynamic_cast<GeodeException^>(ex);
+            if (gfEx != nullptr) {
+              return gfEx->GetNative();
+            }
+            else {
+              apache::geode::client::ExceptionPtr cause;
+              if (ex->InnerException != nullptr) {
+                cause = GeodeException::GetNative(ex->InnerException);
+              }
+              ManagedString mg_exStr(MgSysExPrefix + ex->ToString());
+              return std::make_shared<apache::geode::client::Exception>(
+                  mg_exStr.CharPtr, __nullptr, false, cause);
+            }
+          }
+          return nullptr;
+        }
+
+        /// <summary>
+        /// Gets the C++ native exception object for this managed
+        /// <c>GeodeException</c>.
+        /// </summary>
+        virtual apache::geode::client::ExceptionPtr GetNative()
+        {
+          String^ msg = this->Message + ": " + this->StackTrace;
+          ManagedString mg_msg(msg);
+          apache::geode::client::ExceptionPtr cause;
+          if (this->InnerException != nullptr) {
+            cause = GeodeException::GetNative(this->InnerException);
+          }
+          return std::make_shared<apache::geode::client::Exception>(mg_msg.CharPtr,
+              __nullptr, 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-Geode .NET exceptions we wrap it inside the generic
+        /// <c>GeodeException</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) {
+            apache::geode::client::ExceptionPtr cause;
+            if (ex->InnerException != nullptr) {
+              cause = GeodeException::GetNative(ex->InnerException);
+            }
+            ManagedString mg_exStr(MgSysExPrefix + ex->ToString());
+            throw apache::geode::client::Exception(mg_exStr.CharPtr, NULL, false, cause);
+          }
+        }
+
+        /// <summary>
+        /// Throws the C++ native exception object for this managed
+        /// <c>GeodeException</c>.
+        /// </summary>
+        inline void ThrowNative()
+        {
+          GetNative()->raise();
+        }
+
+
+      public:
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        inline GeodeException( )
+          : Exception( ) { }
+
+        /// <summary>
+        /// Constructor to create an exception object with the given message.
+        /// </summary>
+        /// <param name="message">The exception message.</param>
+        inline GeodeException( 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 GeodeException( String^ message, System::Exception^ innerException )
+          : Exception( message, innerException ) { }
+
+      protected:
+
+        /// <summary>
+        /// Initializes a new instance of the <c>GeodeException</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 GeodeException( SerializationInfo^ info, StreamingContext context )
+          : Exception( info, context ) { }
+      };
+
+/// Handle geode exceptions from native layer and convert to managed
+/// exceptions.
+#define _GF_MG_EXCEPTION_TRY2        \
+      try {
+#define _GF_MG_EXCEPTION_CATCH_ALL2  \
+      } \
+      catch (const apache::geode::client::Exception& ex) { \
+      throw Apache::Geode::Client::GeodeException::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 GeodeException \
+      { \
+      public: \
+      \
+        /** <summary>Default constructor</summary> */ \
+        x( ) \
+          : GeodeException( ) { } \
+        \
+        /** <summary>
+         *  Constructor to create an exception object with the given message.
+         *  </summary>
+         *  <param name="message">The exception message.</param>
+         */ \
+        x( String^ message ) \
+          : GeodeException( 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 ) \
+          : GeodeException( 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 ) \
+          : GeodeException( info, context ) { } \
+      \
+      internal: \
+        x(const apache::geode::client::y& nativeEx) \
+          : GeodeException(ManagedString::Get(nativeEx.getMessage()), \
+              gcnew GeodeException(GeodeException::GetStackTrace( \
+                nativeEx))) { } \
+        \
+        x(const apache::geode::client::y& nativeEx, Exception^ innerException) \
+          : GeodeException(ManagedString::Get(nativeEx.getMessage()), \
+              innerException) { } \
+        \
+        static GeodeException^ Create(const apache::geode::client::Exception& ex, \
+            Exception^ innerException) \
+        { \
+          const apache::geode::client::y* nativeEx = dynamic_cast<const apache::geode::client::y*>( &ex ); \
+          if (nativeEx != nullptr) { \
+            if (innerException == nullptr) { \
+              return gcnew x(*nativeEx); \
+            } \
+            else { \
+              return gcnew x(*nativeEx, innerException); \
+            } \
+          } \
+          return nullptr; \
+        } \
+        virtual apache::geode::client::ExceptionPtr GetNative() override \
+        { \
+          String^ msg = this->Message + ": " + this->StackTrace; \
+          ManagedString mg_msg(msg); \
+          apache::geode::client::ExceptionPtr cause; \
+          if (this->InnerException != nullptr) { \
+            cause = GeodeException::GetNative(this->InnerException); \
+          } \
+          return std::make_shared<apache::geode::client::y>(mg_msg.CharPtr, \
+              __nullptr, 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 Geode 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 geode 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( GeodeIOException, GeodeIOException );
+
+      /// <summary>
+      /// Thrown when geode configuration file is incorrect.
+      /// </summary>
+      _GF_MG_EXCEPTION_DEF4( GeodeConfigException, GeodeConfigException );
+
+      /// <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 Geode.
+      /// </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 );
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache
+

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Execution.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Execution.cpp b/clicache/src/Execution.cpp
new file mode 100644
index 0000000..2ba9187
--- /dev/null
+++ b/clicache/src/Execution.cpp
@@ -0,0 +1,135 @@
+/*
+ * 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 "geode_includes.hpp"
+#include "Execution.hpp"
+#include "begin_native.hpp"
+#include <geode/Execution.hpp>
+#include "end_native.hpp"
+
+#include "ResultCollector.hpp"
+#include "impl/ManagedResultCollector.hpp"
+
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+      namespace native = apache::geode::client;
+
+      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 */
+          auto rsptr = native::CacheableVector::create();
+        
+          for each(TFilter item in routingObj)
+          {
+            rsptr->push_back(Serializable::GetUnmanagedValueGeneric<TFilter>( item, nullptr ));
+          }
+          
+          try
+          {
+            return Execution<TResult>::Create(m_nativeptr->get()->withFilter(rsptr), this->m_rc);
+          }
+          finally
+          {
+            GC::KeepAlive(m_nativeptr);
+          }
+          _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 */
+          try
+          {
+            auto argsptr = Serializable::GetUnmanagedValueGeneric<TArgs>( args, nullptr );
+            return Execution<TResult>::Create(m_nativeptr->get()->withArgs(argsptr), this->m_rc);
+          }
+          finally
+          {
+            GC::KeepAlive(m_nativeptr);
+          }
+        _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+      }
+
+      generic<class TResult>
+      Execution<TResult>^ Execution<TResult>::WithCollector(Client::IResultCollector<TResult>^ rc)
+      {
+        _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+          native::ResultCollectorPtr rcptr;
+        if ( rc != nullptr ) {
+          auto rcg = gcnew ResultCollectorGeneric<TResult>();
+          rcg->SetResultCollector(rc); 
+          rcptr = std::shared_ptr<native::ManagedResultCollectorGeneric>(new native::ManagedResultCollectorGeneric(rcg));
+        }
+        try
+        {
+          return Execution<TResult>::Create( m_nativeptr->get()->withCollector(rcptr), rc);
+        }
+        finally
+        {
+          GC::KeepAlive(m_nativeptr);
+        }
+        _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 */
+        try
+        {
+          ManagedString mg_function(func);
+          auto rc = m_nativeptr->get()->execute(mg_function.CharPtr, timeout);
+          if (m_rc == nullptr)
+            return gcnew ResultCollector<TResult>(rc);
+          else
+            return m_rc;
+        }
+        finally
+        {
+          GC::KeepAlive(m_nativeptr);
+        }
+        _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 Client
+  }  // namespace Geode
+}  // namespace Apache

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Execution.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Execution.hpp b/clicache/src/Execution.hpp
new file mode 100644
index 0000000..44fcf44
--- /dev/null
+++ b/clicache/src/Execution.hpp
@@ -0,0 +1,116 @@
+/*
+ * 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 "begin_native.hpp"
+#include <geode/Execution.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+      namespace native = apache::geode::client;
+
+      generic<class TResult>
+      interface class IResultCollector;
+
+      generic<class TResult>
+      ref class ResultCollector;
+
+      /// <summary>
+      /// This class encapsulates events that occur for cq.
+      /// </summary>
+      generic<class TResult>
+      public ref class Execution sealed
+      {
+      public:
+        /// <summary>
+		/// Add a routing object, 
+        /// Return self.
+        /// </summary>
+		generic<class TFilter>
+    Execution<TResult>^ WithFilter(System::Collections::Generic::ICollection<TFilter>^ routingObj);
+
+        /// <summary>
+		/// Add an argument, 
+        /// Return self.
+        /// </summary>
+    generic<class TArgs>
+		Execution<TResult>^ WithArgs(TArgs args);
+
+        /// <summary>
+		/// Add a result collector, 
+        /// Return self.
+        /// </summary>
+		Execution<TResult>^ WithCollector(IResultCollector<TResult>^ rc);
+
+        /// <summary>
+        /// Execute a function, 
+        /// Return resultCollector.
+        /// </summary>
+		/// <param name="timeout"> Value to wait for the operation to finish before timing out.</param> 
+        IResultCollector<TResult>^ Execute(String^ func, UInt32 timeout);
+
+        /// <summary>
+        /// Execute a function, 
+        /// Return resultCollector.
+        /// </summary>
+        IResultCollector<TResult>^ Execute(String^ func);
+
+      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>
+        inline static Execution<TResult>^ Create( native::ExecutionPtr nativeptr, IResultCollector<TResult>^ rc )
+        {
+          return __nullptr == nativeptr ? nullptr :
+            gcnew Execution<TResult>( nativeptr, rc );
+	      }
+
+        /// <summary>
+        /// Private constructor to wrap a native object pointer.
+        /// </summary>
+        /// <param name="nativeptr">The native object pointer</param>
+        inline Execution( native::ExecutionPtr nativeptr, IResultCollector<TResult>^ rc )
+        {
+          m_rc = rc;
+          m_nativeptr = gcnew native_shared_ptr<native::Execution>(nativeptr);
+        }
+      private:
+        IResultCollector<TResult>^ m_rc;
+
+        native_shared_ptr<native::Execution>^ m_nativeptr;
+      };
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache
+

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ExpirationAction.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ExpirationAction.hpp b/clicache/src/ExpirationAction.hpp
new file mode 100644
index 0000000..c8a12bf
--- /dev/null
+++ b/clicache/src/ExpirationAction.hpp
@@ -0,0 +1,138 @@
+/*
+ * 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 "begin_native.hpp"
+#include <geode/ExpirationAction.hpp>
+#include "end_native.hpp"
+
+
+
+using namespace System;
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+      /// <summary>
+      /// Enumerated type for expiration (LRU) actions.
+      /// Contains values for setting an action type.
+      /// </summary>
+      public enum class ExpirationAction
+      {
+        /// <summary>
+        /// When the region or cached object expires, it is invalidated.
+        /// </summary>
+        Invalidate = 0,
+
+        /// <summary>
+        /// When expired, invalidated locally only.
+        /// </summary>
+        LocalInvalidate,
+
+        /// <summary>
+        /// When the region or cached object expires, it is destroyed.
+        /// </summary>
+        Destroy,
+
+        /// <summary>
+        /// When expired, destroyed locally only.
+        /// </summary>
+        LocalDestroy,
+
+        /// <summary>Invalid action type.</summary>
+        InvalidAction
+      };
+
+
+      /// <summary>
+      /// Static class containing convenience methods for <c>ExpirationAction</c>.
+      /// </summary>
+      public ref class Expiration STATICCLASS
+      {
+      public:
+
+        /// <summary>
+        /// Returns true if this action is distributed invalidate.
+        /// </summary>
+        /// <returns>true if this an <c>Invalidate</c></returns>
+        inline static bool IsInvalidate( ExpirationAction type ) 
+        {
+          return (type == ExpirationAction::Invalidate);
+        }
+
+        /// <summary>
+        /// Returns true if this action is local invalidate.
+        /// </summary>
+        /// <returns>true if this is a <c>LocalInvalidate</c></returns>
+        inline static bool IsLocalInvalidate( ExpirationAction type ) 
+        {
+          return (type == ExpirationAction::LocalInvalidate);
+        }
+
+        /// <summary>
+        /// Returns true if this action is distributed destroy.
+        /// </summary>
+        /// <returns>true if this is <c>Destroy</c></returns>
+        inline static bool IsDestroy( ExpirationAction type ) 
+        {
+          return (type == ExpirationAction::Destroy);
+        }
+
+        /// <summary>
+        /// Returns true if this action is local destroy.
+        /// </summary>
+        /// <returns>true if this is <c>LocalDestroy</c></returns>
+        inline static bool IsLocalDestroy( ExpirationAction type )
+        {
+          return (type == ExpirationAction::LocalDestroy);
+        }
+
+        /// <summary>
+        /// Returns true if this action is local.
+        /// </summary>
+        /// <returns>true if this is <c>LocalInvalidate</c> or
+        /// <c>LocalDestroy</c></returns>
+        inline static bool IsLocal( ExpirationAction type )
+        {
+          return (type == ExpirationAction::LocalInvalidate) ||
+            (type == ExpirationAction::LocalDestroy);
+        }
+
+        /// <summary>
+        /// Returns true if this action is distributed.
+        /// </summary>
+        /// <returns>true if this is an <c>Invalidate</c> or
+        /// a <c>Destroy</c></returns>
+        inline static bool IsDistributed( ExpirationAction type ) 
+        {
+          return (type == ExpirationAction::Invalidate) ||
+            (type == ExpirationAction::Destroy);
+        }
+      };
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache
+
+

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/FunctionService.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/FunctionService.cpp b/clicache/src/FunctionService.cpp
new file mode 100644
index 0000000..456f2e5
--- /dev/null
+++ b/clicache/src/FunctionService.cpp
@@ -0,0 +1,115 @@
+/*
+ * 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/RegionService.hpp>
+#include "end_native.hpp"
+
+#include "FunctionService.hpp"
+#include "Pool.hpp"
+#include "Region.hpp"
+#include "Execution.hpp"
+
+#include "impl/AuthenticatedCache.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+      namespace native = apache::geode::client;
+
+      generic <class TResult>
+      generic <class TKey, class TValue>
+      Execution<TResult>^ FunctionService<TResult>::OnRegion( IRegion<TKey, TValue>^ rg )
+      {
+        _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+          
+          auto nativeRegion = ((Region<TKey, TValue>^)rg)->GetNative();
+          auto execution = native::FunctionService::onRegion(nativeRegion);
+          return Execution<TResult>::Create( execution, nullptr );
+
+        _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+      }
+
+      generic <class TResult>
+      Execution<TResult>^ FunctionService<TResult>::OnServer( Pool^ pl )
+      {
+        _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+          auto nativeptr = native::FunctionService::onServer(pl->GetNative());
+          return Execution<TResult>::Create( nativeptr , nullptr);
+
+        _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+      }
+      
+      generic <class TResult>
+      Execution<TResult>^ FunctionService<TResult>::OnServers( Pool^ pl )
+      {
+        _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+          auto nativeptr = native::FunctionService::onServers(pl->GetNative());
+          return Execution<TResult>::Create( nativeptr , nullptr);
+
+        _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+      }
+
+      generic<class TResult>
+      Execution<TResult>^ FunctionService<TResult>::OnServer( IRegionService^ cache )
+      {
+        _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+          if(auto realCache = dynamic_cast<Cache^>(cache))
+          {
+            auto nativeptr = native::FunctionService::onServer(realCache->GetNative());
+            return Execution<TResult>::Create( nativeptr, nullptr );
+          }
+          else
+          {
+            auto authCache = dynamic_cast<AuthenticatedCache^>(cache);
+            auto nativeptr = native::FunctionService::onServer(authCache->GetNative());
+            return Execution<TResult>::Create( nativeptr, nullptr );
+          }
+
+        _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+      }
+
+      generic<class TResult>
+      Execution<TResult>^ FunctionService<TResult>::OnServers( IRegionService^ cache )
+      {
+        _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+          if(auto realCache = dynamic_cast<Cache^>(cache))
+          {
+            auto nativeptr = native::FunctionService::onServers(realCache->GetNative());
+            return Execution<TResult>::Create( nativeptr, nullptr );
+          }
+          else
+          {
+            auto authCache = dynamic_cast<AuthenticatedCache^>(cache);
+            auto nativeptr = native::FunctionService::onServers(authCache->GetNative());
+            return Execution<TResult>::Create( nativeptr, nullptr );
+          }
+
+        _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+      }
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/FunctionService.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/FunctionService.hpp b/clicache/src/FunctionService.hpp
new file mode 100644
index 0000000..7af9bc8
--- /dev/null
+++ b/clicache/src/FunctionService.hpp
@@ -0,0 +1,96 @@
+/*
+ * 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 "begin_native.hpp"
+#include <geode/FunctionService.hpp>
+#include "end_native.hpp"
+
+#include "Cache.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+    //  generic<class TKey, class TValue>
+      ref class Pool;
+     
+      generic<class TResult>
+      ref class Execution;
+
+      /// <summary>
+      /// A factory class used to create Execute object for function execution
+      /// </summary>
+      /// <remarks>
+      generic<class TResult>
+      public ref class FunctionService
+      {
+      public:
+
+        /// <summary>
+        /// Creates a new region Execution object
+        /// </summary>
+        /// <remarks>
+        /// If Pool is multiusersecure mode then one need to pass logical instance of Region Pool->CreateSecureUserCache(<credentials>)->getRegion(<regionPath>).
+        /// </remarks>
+        generic <class TKey, class TValue>
+        static Execution<TResult>^ OnRegion( IRegion<TKey, TValue>^ rg );
+
+        /// <summary>
+        /// Creates a new Execution object on one server
+        /// </summary>
+        /// <remarks>
+        /// </remarks>
+        /// <exception cref="UnsupportedOperationException">unsupported operation exception, when Pool is in multiusersecure mode.</exception>
+        static Execution<TResult>^ OnServer( Pool^ pl );
+
+        /// <summary>
+        /// Creates a new Execution object on all servers in the pool
+        /// </summary>
+        /// <remarks>
+        /// </remarks>
+        /// <exception cref="UnsupportedOperationException">unsupported operation exception, when Pool is in multiusersecure mode.</exception>
+        static Execution<TResult>^ OnServers( Pool^ pl );
+
+        /// <summary>
+        /// Creates a new Execution object on one server.
+        /// </summary>
+        /// <remarks>
+        /// </remarks>
+        /// <exception cref="IllegalStateException">when Pool has been closed.</exception>
+        static Execution<TResult>^ OnServer( IRegionService^ cache );
+
+        /// <summary>
+        /// Creates a new Execution object on all servers in the pool.
+        /// </summary>
+        /// <remarks>
+        /// </remarks>
+        /// <exception cref="IllegalStateException">when Pool has been closed.</exception>
+        static Execution<TResult>^ OnServers( IRegionService^ cache );
+        
+      };
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache
+

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/GeodeClassIds.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/GeodeClassIds.hpp b/clicache/src/GeodeClassIds.hpp
new file mode 100644
index 0000000..9d6eebd
--- /dev/null
+++ b/clicache/src/GeodeClassIds.hpp
@@ -0,0 +1,372 @@
+/*
+ * 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 "begin_native.hpp"
+#include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
+
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+      struct PdxTypes
+      {
+        enum PdxTypesInternal
+        {
+          BOOLEAN,
+          BYTE,
+          CHAR,
+          SHORT,
+          INT,
+          LONG,
+          FLOAT,
+          DOUBLE,
+          DATE,
+          STRING,
+          OBJECT,
+          BOOLEAN_ARRAY,
+          CHAR_ARRAY,
+          BYTE_ARRAY,
+          SHORT_ARRAY,
+          INT_ARRAY,
+          LONG_ARRAY,
+          FLOAT_ARRAY,
+          DOUBLE_ARRAY,
+          STRING_ARRAY,
+          OBJECT_ARRAY,
+          ARRAY_OF_BYTE_ARRAYS
+        };
+      };
+
+      /// <summary>
+      /// Static class containing the classIds of the built-in cacheable types.
+      /// </summary>
+      public ref class GeodeClassIds
+      {
+      public:
+
+        /// <summary>
+        /// ClassId of <c>Properties</c> class
+        /// </summary>
+        literal System::UInt32 Properties =
+          apache::geode::client::GeodeTypeIds::Properties + 0x80000000;
+
+        /// <summary>        
+        /// ClassId of <c>CharArray</c> class
+        /// </summary>
+        literal System::UInt32 CharArray =
+          apache::geode::client::GeodeTypeIds::CharArray + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>BooleanArray</c> class
+        /// </summary>
+        literal System::UInt32 BooleanArray =
+          apache::geode::client::GeodeTypeIds::BooleanArray + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>RegionAttributes</c> class
+        /// </summary>
+        literal System::UInt32 RegionAttributes =
+          apache::geode::client::GeodeTypeIds::RegionAttributes + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableUndefined</c> class
+        /// Implementation note: this has DSFID of FixedIDByte hence a
+        /// different increment.
+        /// </summary>
+        literal System::UInt32 CacheableUndefined =
+          apache::geode::client::GeodeTypeIds::CacheableUndefined + 0xa0000000;
+
+        literal System::UInt32 EnumInfo =
+          apache::geode::client::GeodeTypeIds::EnumInfo + 0xa0000000;
+
+        /// <summary>
+        /// ClassId of <c>Struct</c> class
+        /// </summary>
+        literal System::UInt32 Struct =
+          apache::geode::client::GeodeTypeIds::Struct + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableString</c> class
+        /// </summary>
+        literal System::UInt32 CacheableString =
+          apache::geode::client::GeodeTypeIds::CacheableString + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableString</c> class for huge strings
+        /// </summary>
+        literal System::UInt32 CacheableStringHuge =
+          apache::geode::client::GeodeTypeIds::CacheableStringHuge + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableBytes</c> class
+        /// </summary>
+        literal System::UInt32 CacheableBytes =
+          apache::geode::client::GeodeTypeIds::CacheableBytes + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableInt16Array</c> class
+        /// </summary>
+        literal System::UInt32 CacheableInt16Array =
+          apache::geode::client::GeodeTypeIds::CacheableInt16Array + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableInt32Array</c> class
+        /// </summary>
+        literal System::UInt32 CacheableInt32Array =
+          apache::geode::client::GeodeTypeIds::CacheableInt32Array + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableInt64Array</c> class
+        /// </summary>
+        literal System::UInt32 CacheableInt64Array =
+          apache::geode::client::GeodeTypeIds::CacheableInt64Array + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableFloatArray</c> class
+        /// </summary>
+        literal System::UInt32 CacheableFloatArray =
+          apache::geode::client::GeodeTypeIds::CacheableFloatArray + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableDoubleArray</c> class
+        /// </summary>
+        literal System::UInt32 CacheableDoubleArray =
+          apache::geode::client::GeodeTypeIds::CacheableDoubleArray + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableVector</c> class for object arrays
+        /// </summary>
+        literal System::UInt32 CacheableObjectArray =
+          apache::geode::client::GeodeTypeIds::CacheableObjectArray + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableBoolean</c> class
+        /// </summary>
+        literal System::UInt32 CacheableBoolean =
+          apache::geode::client::GeodeTypeIds::CacheableBoolean + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableInt16</c> class for wide-characters
+        /// </summary>
+        literal System::UInt32 CacheableCharacter =
+          apache::geode::client::GeodeTypeIds::CacheableWideChar + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableByte</c> class
+        /// </summary>
+        literal System::UInt32 CacheableByte =
+          apache::geode::client::GeodeTypeIds::CacheableByte + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableInt16</c> class
+        /// </summary>
+        literal System::UInt32 CacheableInt16 =
+          apache::geode::client::GeodeTypeIds::CacheableInt16 + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableInt32</c> class
+        /// </summary>
+        literal System::UInt32 CacheableInt32 =
+          apache::geode::client::GeodeTypeIds::CacheableInt32 + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableInt64</c> class
+        /// </summary>
+        literal System::UInt32 CacheableInt64 =
+          apache::geode::client::GeodeTypeIds::CacheableInt64 + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableFloat</c> class
+        /// </summary>
+        literal System::UInt32 CacheableFloat =
+          apache::geode::client::GeodeTypeIds::CacheableFloat + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableDouble</c> class
+        /// </summary>
+        literal System::UInt32 CacheableDouble =
+          apache::geode::client::GeodeTypeIds::CacheableDouble + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableDate</c> class
+        /// </summary>
+        literal System::UInt32 CacheableDate =
+          apache::geode::client::GeodeTypeIds::CacheableDate + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableFileName</c> class
+        /// </summary>
+        literal System::UInt32 CacheableFileName =
+          apache::geode::client::GeodeTypeIds::CacheableFileName + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableStringArray</c> class
+        /// </summary>
+        literal System::UInt32 CacheableStringArray =
+          apache::geode::client::GeodeTypeIds::CacheableStringArray + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableVector</c> class
+        /// </summary>
+        literal System::UInt32 CacheableVector =
+          apache::geode::client::GeodeTypeIds::CacheableVector + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableStack</c> class
+        /// </summary>
+        literal System::UInt32 CacheableStack =
+          apache::geode::client::GeodeTypeIds::CacheableStack + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableArrayList</c> class
+        /// </summary>
+        literal System::UInt32 CacheableArrayList =
+          apache::geode::client::GeodeTypeIds::CacheableArrayList + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableArrayList</c> class
+        /// </summary>
+        literal System::UInt32 CacheableLinkedList =
+          apache::geode::client::GeodeTypeIds::CacheableLinkedList + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableHashSet</c> class
+        /// </summary>
+        literal System::UInt32 CacheableHashSet =
+          apache::geode::client::GeodeTypeIds::CacheableHashSet + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableLinkedHashSet</c> class
+        /// </summary>
+        literal System::UInt32 CacheableLinkedHashSet =
+          apache::geode::client::GeodeTypeIds::CacheableLinkedHashSet + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableHashMap</c> class
+        /// </summary>
+        literal System::UInt32 CacheableHashMap =
+          apache::geode::client::GeodeTypeIds::CacheableHashMap + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableHashTable</c> class
+        /// </summary>
+        literal System::UInt32 CacheableHashTable =
+          apache::geode::client::GeodeTypeIds::CacheableHashTable + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableIdentityHashMap</c> class
+        /// </summary>
+        literal System::UInt32 CacheableIdentityHashMap =
+          apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap + 0x80000000;
+
+        /// <summary>
+        /// Not used.
+        /// </summary>
+        literal System::UInt32 CacheableTimeUnit =
+          apache::geode::client::GeodeTypeIds::CacheableTimeUnit + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableString</c> class for null strings
+        /// </summary>
+        literal System::UInt32 CacheableNullString =
+          apache::geode::client::GeodeTypeIds::CacheableNullString + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableString</c> class for ASCII strings
+        /// </summary>
+        literal System::UInt32 CacheableASCIIString =
+          apache::geode::client::GeodeTypeIds::CacheableASCIIString + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableString</c> class for huge ASCII strings
+        /// </summary>
+        literal System::UInt32 CacheableASCIIStringHuge =
+          apache::geode::client::GeodeTypeIds::CacheableASCIIStringHuge + 0x80000000;
+
+
+        // Built-in managed types.
+
+        /// <summary>
+        /// ClassId of <c>CacheableObject</c> class
+        /// </summary>
+        literal System::UInt32 CacheableManagedObject = 7 + 0x80000000;
+
+        /// <summary>
+        /// ClassId of <c>CacheableObjectXml</c> class
+        /// </summary>
+        literal System::UInt32 CacheableManagedObjectXml = 8 + 0x80000000;
+      internal:
+
+        literal System::UInt32 PdxType = apache::geode::client::GeodeTypeIds::PdxType + 0x80000000;
+
+        literal System::UInt32 DATA_SERIALIZABLE = 45;
+        literal System::UInt32 JAVA_CLASS = 43;
+
+        //internal geode typeids..
+        /*  literal Byte USERCLASS = 40;
+          literal Byte USERMAP = 94;
+          literal Byte USERCOLLECTION = 95;
+          literal Byte ARRAYOFBYTEARRAYS = 91;
+          literal Byte GEODEREGION =  98;
+
+          literal Byte BOOLEAN_TYPE = 17;
+          literal Byte CHARACTER_TYPE = 18;
+          literal Byte BYTE_TYPE = 19;
+          literal Byte SHORT_TYPE = 20;
+          literal Byte INTEGER_TYPE = 21;
+          literal Byte LONG_TYPE = 22;
+          literal Byte FLOAT_TYPE = 23;
+          literal Byte DOUBLE_TYPE = 24;
+          literal Byte VOID_TYPE = 25;   */
+
+        literal Byte PDX = 93;
+        literal Byte PDX_ENUM = 94;
+
+        literal Byte BYTE_SIZE = 1;
+
+        literal Byte BOOLEAN_SIZE = 1;
+
+        literal Byte CHAR_SIZE = 2;
+
+        literal Byte SHORT_SIZE = 2;
+
+        literal Byte INTEGER_SIZE = 4;
+
+        literal Byte FLOAT_SIZE = 4;
+
+        literal Byte LONG_SIZE = 8;
+
+        literal Byte DOUBLE_SIZE = 8;
+
+        literal Byte DATE_SIZE = 8;
+      };
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache
+
+

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IAuthInitialize.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IAuthInitialize.hpp b/clicache/src/IAuthInitialize.hpp
new file mode 100644
index 0000000..1b7decc
--- /dev/null
+++ b/clicache/src/IAuthInitialize.hpp
@@ -0,0 +1,85 @@
+/*
+ * 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 "Properties.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+      /// <summary>
+      /// Specifies the mechanism to obtain credentials for a client.
+      /// It is mandantory for clients when the server is running in secure
+      /// mode having a <c>security-client-authenticator</c> module specified.
+      /// Implementations should register the library path as
+      /// <c>security-client-auth-library</c> system property and factory
+      /// function (a zero argument function returning pointer to an
+      /// AuthInitialize object) as the <c>security-client-auth-factory</c>
+      /// system property.
+      ///
+      /// For a managed class implementing <c>IAuthInitialize</c> the fully
+      /// qualified name of the factory function should be provided in the
+      /// form {Namespace}.{Class Name}.{Method Name} as the
+      /// <c>security-client-auth-factory</c> property.
+      /// </summary>
+      public interface class IAuthInitialize
+      {
+      public:
+
+        /// <summary>
+        /// Initialize with the given set of security properties
+        /// return the credentials for the client as properties.
+        /// </summary>
+        /// <param name="props">
+        /// the set of <c>security-*</c> properties provided to the
+        /// <see cref="DistributedSystem.connect"/> method
+        /// </param>
+        /// <param name="server">
+        /// the ID of the current endpoint in the format "host:port"
+        /// </param>
+        /// <returns>
+        /// the credentials to be used for the given server
+        /// </returns>
+        /// <remarks>
+        /// This method can modify the given set of properties. For
+        /// example it may invoke external agents or even interact with
+        /// the user.
+        /// </remarks>
+        //generic <class TPropKey, class TPropValue>
+        Properties<String^, Object^>^ GetCredentials(Properties<String^, String^>^ props, String^ server);
+
+        /// <summary>
+        /// Invoked before the cache goes down.
+        /// </summary>
+        void Close();
+
+        delegate Properties<String^, Object^>^ GetCredentialsDelegate(Properties<String^, String^>^ props, String^ server);
+        delegate void CloseDelegate();
+      };
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache
+

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICacheListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICacheListener.hpp b/clicache/src/ICacheListener.hpp
new file mode 100644
index 0000000..a61632e
--- /dev/null
+++ b/clicache/src/ICacheListener.hpp
@@ -0,0 +1,210 @@
+/*
+ * 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 "IRegion.hpp"
+//#include "Region.hpp"
+
+#include "EntryEvent.hpp"
+#include "RegionEvent.hpp"
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+      /// <summary>
+      /// An application plug-in that can be installed on a region.
+      /// </summary>
+      /// <remarks>
+      /// Listeners are change notifications that are invoked
+      /// AFTER the change has occured for region update operations on a client.
+      /// Listeners also receive notifications when entries in a region are modified.
+      /// Multiple events can cause concurrent invocation
+      /// of <c>ICacheListener</c> methods.  If event A occurs before event B,
+      /// there is no guarantee that their corresponding <c>ICacheListener</c>
+      /// method invocations will occur in the same order. Any exceptions thrown by
+      /// the listener are caught by Geode and logged. If the exception is due to
+      /// listener invocation on the same thread where a region operation has been
+      /// performed, then a <c>CacheListenerException</c> is thrown back to
+      /// the application. If the exception is for a notification received from
+      /// server then that is logged and the notification thread moves on to
+      /// receiving other notifications.
+      /// <para>
+      /// A cache listener is defined in the <see cref="RegionAttributes" />.
+      /// </para>
+      ///
+      /// There are two cases in which listeners are invoked. The first is when a
+      /// region modification operation (e.g. put, create, destroy, invalidate)
+      /// is performed. For this case it is important to ensure that minimal work is
+      /// done in the listener before returning control back to Geode since the
+      /// operation will block till the listener has not completed. For example,
+      /// a listener implementation may choose to hand off the event to a thread pool
+      /// that then processes the event on its thread rather than the listener thread.
+      /// The second is when notifications are received from java server as a result
+      /// of region register interest calls (<c>Region.RegisterKeys</c> etc),
+      /// or invalidate notifications when notify-by-subscription is false on the
+      /// server. In this case the methods of <c>ICacheListener</c> are invoked
+      /// asynchronously (i.e. does not block the thread that receives notification
+      /// messages). Additionally for the latter case of notifications from server,
+      /// listener is always invoked whether or not local operation is successful
+      /// e.g. if a destroy notification is received and key does not exist in the
+      /// region, the listener will still be invoked. This is different from the
+      /// first case where listeners are invoked only when the region update
+      /// operation succeeds.
+      /// </remarks>
+      /// <seealso cref="AttributesFactory.SetCacheListener" />
+      /// <seealso cref="RegionAttributes.CacheListener" />
+      /// <seealso cref="ICacheLoader" />
+      /// <seealso cref="ICacheWriter" />
+      /// <seealso cref="CacheListenerException" />
+      generic<class TKey, class TValue>
+      public interface class ICacheListener
+      {
+        public:
+
+        /// <summary>
+        /// Handles the event of a new key being added to a region.
+        /// </summary>
+        /// <remarks>
+        /// The entry did not previously exist in this region in the local cache
+        /// (even with a null value).
+        /// <para>
+        /// This function does not throw any exception.
+        /// </para>
+        /// </remarks>
+        /// <param name="ev">
+        /// Denotes the event object associated with the entry creation.
+        /// </param>
+        /// <seealso cref="Region.Create" />
+        /// <seealso cref="Region.Put" />
+        /// <seealso cref="Region.Get" />
+        void AfterCreate(EntryEvent<TKey, TValue>^ ev);
+
+        /// <summary>
+        /// Handles the event of an entry's value being modified in a region.
+        /// </summary>
+        /// <remarks>
+        /// This entry previously existed in this region in the local cache,
+        /// but its previous value may have been null.
+        /// </remarks>
+        /// <param name="ev">
+        /// EntryEvent denotes the event object associated with updating the entry.
+        /// </param>
+        /// <seealso cref="Region.Put" />
+        void AfterUpdate(EntryEvent<TKey, TValue>^ ev);
+
+        /// <summary>
+        /// Handles the event of an entry's value being invalidated.
+        /// </summary>
+        /// <param name="ev">
+        /// EntryEvent denotes the event object associated with the entry invalidation.
+        /// </param>
+        void AfterInvalidate(EntryEvent<TKey, TValue>^ ev);
+
+        /// <summary>
+        /// Handles the event of an entry being destroyed.
+        /// </summary>
+        /// <param name="ev">
+        /// EntryEvent denotes the event object associated with the entry destruction.
+        /// </param>
+        /// <seealso cref="Region.Destroy" />
+        void AfterDestroy(EntryEvent<TKey, TValue>^ ev);
+
+        /// <summary>
+        /// Handles the event of a region being cleared.
+        /// </summary>
+        void AfterRegionClear(RegionEvent<TKey, TValue>^ ev);
+
+        /// <summary>
+        /// Handles the event of a region being invalidated.
+        /// </summary>
+        /// <remarks>
+        /// Events are not invoked for each individual value that is invalidated
+        /// as a result of the region being invalidated. Each subregion, however,
+        /// gets its own <c>RegionInvalidated</c> event invoked on its listener.
+        /// </remarks>
+        /// <param name="ev">
+        /// RegionEvent denotes the event object associated with the region invalidation.
+        /// </param>
+        /// <seealso cref="Region.InvalidateRegion" />
+        void AfterRegionInvalidate(RegionEvent<TKey, TValue>^ ev);
+
+        /// <summary>
+        /// Handles the event of a region being destroyed.
+        /// </summary>
+        /// <remarks>
+        /// Events are not invoked for each individual entry that is destroyed
+        /// as a result of the region being destroyed. Each subregion, however,
+        /// gets its own <c>AfterRegionDestroyed</c> event invoked on its listener.
+        /// </remarks>
+        /// <param name="ev">
+        /// RegionEvent denotes the event object associated with the region destruction.
+        /// </param>
+        /// <seealso cref="Region.DestroyRegion" />
+        void AfterRegionDestroy(RegionEvent<TKey, TValue>^ ev);
+
+        /// <summary>
+        /// Handles the event of a region going live.
+        /// </summary>
+        /// <remarks>
+        /// Each subregion gets its own <c>AfterRegionLive</c> event invoked on its listener.
+        /// </remarks>
+        /// <param name="ev">
+        /// RegionEvent denotes the event object associated with the region going live.
+        /// </param>
+        /// <seealso cref="Cache.ReadyForEvents" />
+        void AfterRegionLive(RegionEvent<TKey, TValue>^ ev);
+
+        /// <summary>
+        /// Called when the region containing this callback is destroyed, when
+        /// the cache is closed.
+        /// </summary>
+        /// <remarks>
+        /// Implementations should clean up any external resources,
+        /// such as database connections. Any runtime exceptions this method
+        /// throws will be logged.
+        /// </remarks>
+        /// <param>
+        /// It is possible for this method to be called multiple times on a single
+        /// callback instance, so implementations must be tolerant of this.
+        /// </param>
+        /// <seealso cref="Cache.Close" />
+        /// <seealso cref="Region.DestroyRegion" />
+        void Close(IRegion<TKey, TValue>^ region);
+
+        ///<summary>
+        ///Called when all the endpoints associated with region are down.
+        ///This will be called when all the endpoints are down for the first time.
+        ///If endpoints come up and again go down it will be called again.
+        ///This will also be called when all endpoints are down and region is attached to the pool.
+        ///</summary>
+        ///<remarks>
+        ///</remark>
+        ///<param>
+        ///region Region^ denotes the assosiated region.
+        ///</param>
+        void AfterRegionDisconnected(IRegion<TKey, TValue>^ region);
+      };
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache
+

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICacheLoader.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICacheLoader.hpp b/clicache/src/ICacheLoader.hpp
new file mode 100644
index 0000000..e5b1a8e
--- /dev/null
+++ b/clicache/src/ICacheLoader.hpp
@@ -0,0 +1,118 @@
+/*
+ * 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 "begin_native.hpp"
+#include <geode/CacheLoader.hpp>
+#include "end_native.hpp"
+
+#include "IRegion.hpp"
+//#include "Region.hpp"
+//#include "ICacheableKey.hpp"
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+      //interface class ICacheableKey;
+
+      /// <summary>
+      /// CacheLoader
+      /// </summary>
+      /// <remarks>
+      /// CacheLoader
+      /// </remarks>
+      public ref class CacheLoader STATICCLASS
+      {
+      };
+
+      /// <summary>
+      /// A data-loading application plug-in that can be installed on a region.
+      /// </summary>
+      /// <remarks>
+      /// Loaders facilitate loading of data into the cache from a third-party data source. 
+      /// When an application does a
+      /// lookup for a key in a region and it does not exist, Geode checks to
+      /// see if any loaders are available for the region in the system and
+      /// invokes them to get the value for the key into the cache.
+      /// <para>
+      /// A cache loader is defined in the <see cref="RegionAttributes" />.
+      /// </para>
+      /// When <see cref="Region.Get" /> is called for a region
+      /// entry that has a null value, the <see cref="ICacheLoader.Load" />
+      /// method of the region's cache loader is invoked.  The <c>Load</c> method
+      /// creates the value for the desired key by performing an operation such
+      /// as a database query. 
+      /// </remarks>
+      /// <seealso cref="AttributesFactory.SetCacheLoader" />
+      /// <seealso cref="RegionAttributes.CacheLoader" />
+      /// <seealso cref="ICacheListener" />
+      /// <seealso cref="ICacheWriter" />
+      generic<class TKey, class TValue>
+      public interface class ICacheLoader
+      {
+      public:
+
+        /// <summary>
+        /// Loads a value. Application writers should implement this
+        /// method to customize the loading of a value.
+        /// </summary>
+        /// <remarks>
+        /// This method is called
+        /// by the caching service when the requested value is not in the cache.
+        /// Any exception thrown by this method is propagated back to and thrown
+        /// by the invocation of <see cref="Region.Get" /> that triggered this load.
+        /// </remarks>
+        /// <param name="region">a Region for which this is called.</param>
+        /// <param name="key">the key for the cacheable</param>
+        /// <param name="callbackArgument">
+        /// </param>
+        /// <returns>
+        /// the value supplied for this key, or null if no value can be
+        /// supplied. 
+        /// If every available loader returns
+        /// a null value, <see cref="Region.Get" /> will return null.
+        /// </returns>
+        /// <seealso cref="Region.Get" />
+        TValue Load(IRegion<TKey, TValue>^ region, TKey key,
+                    Object^ callbackArgument);
+
+        /// <summary>
+        /// Called when the region containing this callback is destroyed, when
+        /// the cache is closed.
+        /// </summary>
+        /// <remarks>
+        /// Implementations should clean up any external resources, such as
+        /// database connections. Any runtime exceptions this method throws will be logged.
+        /// <para>
+        /// It is possible for this method to be called multiple times on a single
+        /// callback instance, so implementations must be tolerant of this.
+        /// </para>
+        /// </remarks>
+        /// <seealso cref="Cache.Close" />
+        /// <seealso cref="Region.DestroyRegion" />
+        void Close(IRegion<TKey, TValue>^ region);
+      };
+    }  // namespace Client
+  }  // namespace Geode
+}  // namespace Apache
+