You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by rv...@apache.org on 2016/05/19 15:14:22 UTC
[15/51] [partial] incubator-geode git commit: Add source for geode
c++ and .net clients
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/ExceptionTypesM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/ExceptionTypesM.hpp b/geode-client-native/src/clicache/ExceptionTypesM.hpp
new file mode 100644
index 0000000..ab0749b
--- /dev/null
+++ b/geode-client-native/src/clicache/ExceptionTypesM.hpp
@@ -0,0 +1,700 @@
+/*=========================================================================
+ * 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 <cppcache/ExceptionTypes.hpp>
+#include <cppcache/SignalHandler.hpp>
+#include "impl/ManagedString.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+using namespace System::Runtime::Serialization;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ 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^ CreateException(
+ const gemfire::Exception& nativeEx, System::Exception^ innerException);
+
+ /// <summary>
+ /// The base exception class of all managed GemFire exceptions.
+ /// </summary>
+ [Serializable]
+ //[Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ 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^, CreateException^>^ 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>
+ CreateException^ 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^, CreateException^>^ 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_ADD in ExceptionTypesM.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 GemStone::GemFire::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);
+ }
+ GemStone::GemFire::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;
+ GemStone::GemFire::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);
+ }
+ GemStone::GemFire::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 ) { }
+
+ /// <summary>
+ /// Generate a minidump of the current process in the directory
+ /// specified for log files using "log-file" property.
+ /// This is equivalent to the ".dump /ma" command of windbg.
+ /// </summary>
+ static String^ GenerateMiniDump();
+
+ /// <summary>
+ /// Generate a minidump of the current process in the directory
+ /// specified for log files using "log-file" property.
+ /// This is equivalent to the ".dump /ma" command of windbg.
+ /// </summary>
+ static String^ GenerateMiniDump(int32_t exceptionCode,
+ IntPtr exceptionPointers);
+
+ 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. Also handle fatal exceptions to generate mini dumps if
+/// stack trace dumping is enabled
+#define _GF_MG_EXCEPTION_TRY \
+ try {
+#define _GF_MG_EXCEPTION_CATCH_ALL \
+ } \
+ catch (const gemfire::Exception& ex) { \
+ throw GemStone::GemFire::Cache::GemFireException::Get(ex); \
+ } \
+ catch (System::AccessViolationException^ ex) { \
+ GemStone::GemFire::Cache::GemFireException::GenerateMiniDump(); \
+ throw ex; \
+ }
+
+
+/// Creates a class <c>x</c> named for each exception <c>y</c>.
+#define _GF_MG_EXCEPTION_DEF2(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_DEF(x) _GF_MG_EXCEPTION_DEF2(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 ExceptionTypesM.cpp using _GF_MG_EXCEPTION_ADD( x )
+
+ /// <summary>
+ /// A gemfire assertion exception.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( AssertionException );
+
+ /// <summary>
+ /// Thrown when an argument to a method is illegal.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( IllegalArgumentException );
+
+ /// <summary>
+ /// Thrown when the state of cache is manipulated to be illegal.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( IllegalStateException );
+
+ /// <summary>
+ /// Thrown when an attempt is made to create an existing cache.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CacheExistsException );
+
+ /// <summary>
+ /// Thrown when the cache xml is incorrect.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CacheXmlException );
+
+ /// <summary>
+ /// Thrown when a timout occurs.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( TimeoutException );
+
+ /// <summary>
+ /// Thrown when the cache writer aborts the operation.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CacheWriterException );
+
+ /// <summary>
+ /// Thrown when the cache listener throws an exception.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CacheListenerException );
+
+ /// <summary>
+ /// Thrown when an attempt is made to create an existing region.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( RegionExistsException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted on a closed cache.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CacheClosedException );
+
+ /// <summary>
+ /// Thrown when lease of cache proxy has expired.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( LeaseExpiredException );
+
+ /// <summary>
+ /// Thrown when the cache loader aborts the operation.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CacheLoaderException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted on a destroyed region.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( RegionDestroyedException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted on a destroyed entry.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( EntryDestroyedException );
+
+ /// <summary>
+ /// Thrown when the connecting target is not running.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( NoSystemException );
+
+ /// <summary>
+ /// Thrown when an attempt is made to connect to
+ /// DistributedSystem second time.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( AlreadyConnectedException );
+
+ /// <summary>
+ /// Thrown when a non-existing file is accessed.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( FileNotFoundException );
+
+ /// <summary>
+ /// Thrown when an operation is interrupted.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( InterruptedException );
+
+ /// <summary>
+ /// Thrown when an operation unsupported by the
+ /// current configuration is attempted.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( UnsupportedOperationException );
+
+ /// <summary>
+ /// Thrown when statistics are invoked for a region where
+ /// they are disabled.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( StatisticsDisabledException );
+
+ /// <summary>
+ /// Thrown when a concurrent operation fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( ConcurrentModificationException );
+
+ /// <summary>
+ /// An unknown exception occurred.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( UnknownException );
+
+ /// <summary>
+ /// Thrown when a cast operation fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( ClassCastException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted on a non-existent entry.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( EntryNotFoundException );
+
+ /// <summary>
+ /// Thrown when there is an input/output error.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF2( GemFireIOException, GemfireIOException );
+
+ /// <summary>
+ /// Thrown when gemfire configuration file is incorrect.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF2( 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_DEF( NullPointerException );
+
+ /// <summary>
+ /// Thrown when attempt is made to create an existing entry.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( EntryExistsException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted before connecting
+ /// to the distributed system.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( NotConnectedException );
+
+ /// <summary>
+ /// Thrown when there is an error in the cache proxy.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CacheProxyException );
+
+ /// <summary>
+ /// Thrown when the system cannot allocate any more memory.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( OutOfMemoryException );
+
+ /// <summary>
+ /// Thrown when an attempt is made to release a lock not
+ /// owned by the thread.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( NotOwnerException );
+
+ /// <summary>
+ /// Thrown when a region is created in an incorrect scope.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( WrongRegionScopeException );
+
+ /// <summary>
+ /// Thrown when the internal buffer size is exceeded.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( BufferSizeExceededException );
+
+ /// <summary>
+ /// Thrown when a region creation operation fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( RegionCreationFailedException );
+
+ /// <summary>
+ /// Thrown when there is a fatal internal exception in GemFire.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( FatalInternalException );
+
+ /// <summary>
+ /// Thrown by the persistence manager when a write
+ /// fails due to disk failure.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( DiskFailureException );
+
+ /// <summary>
+ /// Thrown by the persistence manager when the data
+ /// to be read from disk is corrupt.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( DiskCorruptException );
+
+ /// <summary>
+ /// Thrown when persistence manager fails to initialize.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( InitFailedException );
+
+ /// <summary>
+ /// Thrown when persistence manager fails to close properly.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( ShutdownFailedException );
+
+ /// <summary>
+ /// Thrown when an exception occurs on the cache server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CacheServerException );
+
+ /// <summary>
+ /// Thrown when bound of array/vector etc. is exceeded.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( OutOfRangeException );
+
+ /// <summary>
+ /// Thrown when query exception occurs at the server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( QueryException );
+
+ /// <summary>
+ /// Thrown when an unknown message is received from the server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( MessageException );
+
+ /// <summary>
+ /// Thrown when a client operation is not authorized on the server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( NotAuthorizedException );
+
+ /// <summary>
+ /// Thrown when authentication to the server fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( AuthenticationFailedException );
+
+ /// <summary>
+ /// Thrown when credentials are not provided to a server which expects them.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( AuthenticationRequiredException );
+
+ /// <summary>
+ /// Thrown when a duplicate durable client id is provided to the server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( DuplicateDurableClientException );
+
+ /// <summary>
+ /// Thrown when a client is unable to contact any locators.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( NoAvailableLocatorsException );
+
+ /// <summary>
+ /// Thrown when all connections in a pool are in use..
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( AllConnectionsInUseException );
+
+ /// <summary>
+ /// Thrown when cq is invalid
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CqInvalidException );
+
+ /// <summary>
+ /// Thrown when function execution failed
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( FunctionExecutionException );
+
+ /// <summary>
+ /// Thrown during continuous query execution time.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CqException );
+
+ /// <summary>
+ /// Thrown if the Cq on which the operaion performed is closed
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CqClosedException );
+
+ /// <summary>
+ /// Thrown if the Cq Query failed
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CqQueryException );
+
+ /// <summary>
+ /// Thrown if a Cq by this name already exists on this client
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CqExistsException );
+
+ _GF_MG_EXCEPTION_DEF( InvalidDeltaException );
+
+ /// <summary>
+ /// Thrown if a Key is not present in the region.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( KeyNotFoundException );
+
+ /// <summary>
+ /// Thrown if commit fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( CommitConflictException );
+
+
+ /// <summary>
+ /// Thrown if transaction delegate went down.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( TransactionDataNodeHasDepartedException );
+
+ /// <summary>
+ /// Thrown if commit rebalance happens during a transaction.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( TransactionDataRebalancedException );
+ #ifdef CSTX_COMMENTED
+ /// <summary>
+ /// Thrown if transaction writer fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF( TransactionWriterException );
+ #endif
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/ExecutionM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/ExecutionM.cpp b/geode-client-native/src/clicache/ExecutionM.cpp
new file mode 100644
index 0000000..e76899a
--- /dev/null
+++ b/geode-client-native/src/clicache/ExecutionM.cpp
@@ -0,0 +1,84 @@
+/*=========================================================================
+ * 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 "ExecutionM.hpp"
+#include "cppcache/Execution.hpp"
+#include "ResultCollectorM.hpp"
+#include "impl/ManagedResultCollector.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ Execution^ Execution::WithFilter(array<IGFSerializable^>^ routingObj)
+ {
+ _GF_MG_EXCEPTION_TRY
+ gemfire::CacheableVectorPtr rsptr = gemfire::CacheableVector::create();
+ for( int index = 0; index < routingObj->Length; index++ )
+ {
+ rsptr->push_back(gemfire::CacheablePtr(SafeMSerializableConvert( routingObj[ index])));
+ }
+ return Execution::Create(NativePtr->withFilter(rsptr).ptr());
+ _GF_MG_EXCEPTION_CATCH_ALL
+ }
+
+ Execution^ Execution::WithArgs(IGFSerializable^ args)
+ {
+ _GF_MG_EXCEPTION_TRY
+ gemfire::CacheablePtr argsptr( SafeMSerializableConvert( args ) );
+ return Execution::Create(NativePtr->withArgs(argsptr).ptr());
+ _GF_MG_EXCEPTION_CATCH_ALL
+ }
+
+ Execution^ Execution::WithCollector(IResultCollector^ rc)
+ {
+ _GF_MG_EXCEPTION_TRY
+ gemfire::ResultCollectorPtr rcptr;
+ if ( rc != nullptr ) {
+ rcptr = new gemfire::ManagedResultCollector( rc );
+ }
+ return Execution::Create( NativePtr->withCollector(rcptr).ptr());
+ _GF_MG_EXCEPTION_CATCH_ALL
+ }
+ IResultCollector^ Execution::Execute(String^ func)
+ {
+ return Execute(func, false);
+ }
+ IResultCollector^ Execution::Execute(String^ func, Boolean getResult)
+ {
+ return Execute(func, getResult, DEFAULT_QUERY_RESPONSE_TIMEOUT);
+ }
+ IResultCollector^ Execution::Execute(String^ func, Boolean getResult, UInt32 timeout)
+ {
+ return Execute(func, getResult, timeout, true);
+ }
+
+ IResultCollector^ Execution::Execute(String^ func, Boolean getResult, UInt32 timeout, Boolean isHA, Boolean optimizeForWrite)
+ {
+ _GF_MG_EXCEPTION_TRY
+ ManagedString mg_function( func );
+ gemfire::ResultCollectorPtr rc = NativePtr->execute(mg_function.CharPtr, getResult, timeout, isHA, optimizeForWrite);
+ return gcnew ResultCollector(rc.ptr());
+ _GF_MG_EXCEPTION_CATCH_ALL
+ }
+
+ IResultCollector^ Execution::Execute(String^ func, Boolean getResult, UInt32 timeout, Boolean isHA)
+ {
+ return Execute(func, getResult, timeout, isHA, false);;
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/ExecutionM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/ExecutionM.hpp b/geode-client-native/src/clicache/ExecutionM.hpp
new file mode 100644
index 0000000..65bfcc8
--- /dev/null
+++ b/geode-client-native/src/clicache/ExecutionM.hpp
@@ -0,0 +1,126 @@
+/*=========================================================================
+ * 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 "cppcache/Execution.hpp"
+#include "impl/NativeWrapper.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ interface class IGFSerializable;
+ interface class IResultCollector;
+ ref class ResultCollector;
+
+ /// <summary>
+ /// This class encapsulates events that occur for cq.
+ /// </summary>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public ref class Execution sealed
+ : public Internal::SBWrap<gemfire::Execution>
+ {
+ public:
+ /// <summary>
+ /// Add a routing object,
+ /// Return self.
+ /// </summary>
+ Execution^ WithFilter(array<IGFSerializable^>^ routingObj);
+
+ /// <summary>
+ /// Add an argument,
+ /// Return self.
+ /// </summary>
+ Execution^ WithArgs(IGFSerializable^ args);
+
+ /// <summary>
+ /// Add a result collector,
+ /// Return self.
+ /// </summary>
+ Execution^ WithCollector(IResultCollector^ rc);
+
+ /// <summary>
+ /// Execute a function,
+ /// Return resultCollector.
+ /// </summary>
+ /// <param name="func"> The name of the function to be executed. </param>
+ /// <param name="getResult"> Indicating if results are expected. </param>
+ /// <param name="timeout"> Value to wait for the operation to finish before timing out.</param>
+ /// <param name="isHA"> Whether the given function is HA. </param>
+ /// <param name="optimizeForWrite"> Whether the function should be optmized for write operation. </param>
+ /// <deprecated>
+ /// parameters hasResult, isHA and optimizeForWrite are deprecated as of NativeClient 3.6, use of these parameters is ignored.
+ /// </deprecated>
+ IResultCollector^ Execute(String^ func, Boolean getResult, UInt32 timeout, Boolean isHA, Boolean optimizeForWrite);
+
+ /// <summary>
+ /// Execute a function,
+ /// Return resultCollector.
+ /// </summary>
+ /// <param name="func"> The name of the function to be executed. </param>
+ /// <param name="getResult"> Indicating if results are expected. </param>
+ /// <param name="timeout"> Value to wait for the operation to finish before timing out.</param>
+ /// <param name="isHA"> Whether the given function is HA. </param>
+ IResultCollector^ Execute(String^ func, Boolean getResult, UInt32 timeout, Boolean isHA);
+
+ /// <summary>
+ /// Execute a function,
+ /// Return resultCollector.
+ /// </summary>
+ /// <param name="getResult"> Indicating if results are expected. </param>
+ /// <param name="timeout"> Value to wait for the operation to finish before timing out.</param>
+ IResultCollector^ Execute(String^ func, Boolean getResult, UInt32 timeout);
+
+ /// <summary>
+ /// Execute a function,
+ /// Return resultCollector.
+ /// </summary>
+ /// <param name="getResult"> Indicating if results are expected. </param>
+
+ IResultCollector^ Execute(String^ func, Boolean getResult);
+
+ /// <summary>
+ /// Execute a function,
+ /// Return resultCollector.
+ /// </summary>
+ IResultCollector^ 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^ Create( gemfire::Execution* nativeptr )
+ {
+ return ( nativeptr != nullptr ?
+ gcnew Execution( nativeptr ) : nullptr );
+ }
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Execution( gemfire::Execution* nativeptr )
+ : SBWrap( nativeptr ) { }
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/ExpirationActionM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/ExpirationActionM.hpp b/geode-client-native/src/clicache/ExpirationActionM.hpp
new file mode 100644
index 0000000..4188258
--- /dev/null
+++ b/geode-client-native/src/clicache/ExpirationActionM.hpp
@@ -0,0 +1,124 @@
+/*=========================================================================
+ * 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 "cppcache/ExpirationAction.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ /// <summary>
+ /// Enumerated type for expiration (LRU) actions.
+ /// Contains values for setting an action type.
+ /// </summary>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ 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);
+ }
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/FunctionServiceM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/FunctionServiceM.cpp b/geode-client-native/src/clicache/FunctionServiceM.cpp
new file mode 100644
index 0000000..a0b7cd3
--- /dev/null
+++ b/geode-client-native/src/clicache/FunctionServiceM.cpp
@@ -0,0 +1,121 @@
+/*=========================================================================
+ * 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 "FunctionServiceM.hpp"
+#include "cppcache/FunctionService.hpp"
+#include "PoolM.hpp"
+#include "RegionM.hpp"
+#include "ExecutionM.hpp"
+#include "cppcache/RegionService.hpp"
+#include "impl/AuthenticatedCacheM.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ Execution^ FunctionService::OnRegion( Region^ rg )
+ {
+ _GF_MG_EXCEPTION_TRY
+
+ gemfire::RegionPtr regionptr(
+ GetNativePtr<gemfire::Region>( rg ) );
+
+ gemfire::ExecutionPtr& nativeptr( gemfire::FunctionService::onRegion(
+ regionptr ) );
+ return Execution::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL
+ }
+ Execution^ FunctionService::OnServer( Pool^ pl )
+ {
+ _GF_MG_EXCEPTION_TRY
+
+ gemfire::PoolPtr poolptr(GetNativePtr<gemfire::Pool>( pl ) );
+
+ gemfire::ExecutionPtr& nativeptr( gemfire::FunctionService::onServer(
+ poolptr ) );
+ return Execution::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL
+ }
+
+ Execution^ FunctionService::OnServers( Pool^ pl )
+ {
+ _GF_MG_EXCEPTION_TRY
+
+ gemfire::PoolPtr poolptr(GetNativePtr<gemfire::Pool>( pl ) );
+ gemfire::ExecutionPtr& nativeptr( gemfire::FunctionService::onServers(
+ poolptr ) );
+ return Execution::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL
+ }
+
+ Execution^ FunctionService::OnServer( IRegionService^ cache )
+ {
+ _GF_MG_EXCEPTION_TRY
+
+ Cache^ realCache = dynamic_cast<Cache^>(cache);
+
+ if(realCache != nullptr)
+ {
+ gemfire::RegionServicePtr cacheptr(GetNativePtr<gemfire::RegionService>( realCache ) );
+
+ gemfire::ExecutionPtr& nativeptr( gemfire::FunctionService::onServer(
+ cacheptr ) );
+ return Execution::Create( nativeptr.ptr( ) );
+ }
+ else
+ {
+ AuthenticatedCache^ authCache = dynamic_cast<AuthenticatedCache^>(cache);
+ gemfire::RegionServicePtr cacheptr(GetNativePtr<gemfire::RegionService>( authCache ) );
+
+ gemfire::ExecutionPtr& nativeptr( gemfire::FunctionService::onServer(
+ cacheptr ) );
+ return Execution::Create( nativeptr.ptr( ) );
+ }
+
+
+ _GF_MG_EXCEPTION_CATCH_ALL
+ }
+
+ Execution^ FunctionService::OnServers( IRegionService^ cache )
+ {
+ _GF_MG_EXCEPTION_TRY
+
+ Cache^ realCache = dynamic_cast<Cache^>(cache);
+
+ if(realCache != nullptr)
+ {
+ gemfire::RegionServicePtr cacheptr(GetNativePtr<gemfire::RegionService>( realCache ) );
+
+ gemfire::ExecutionPtr& nativeptr( gemfire::FunctionService::onServers(
+ cacheptr ) );
+ return Execution::Create( nativeptr.ptr( ) );
+ }
+ else
+ {
+ AuthenticatedCache^ authCache = dynamic_cast<AuthenticatedCache^>(cache);
+ gemfire::RegionServicePtr cacheptr(GetNativePtr<gemfire::RegionService>( authCache ) );
+
+ gemfire::ExecutionPtr& nativeptr( gemfire::FunctionService::onServers(
+ cacheptr ) );
+ return Execution::Create( nativeptr.ptr( ) );
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/FunctionServiceM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/FunctionServiceM.hpp b/geode-client-native/src/clicache/FunctionServiceM.hpp
new file mode 100644
index 0000000..437bb08
--- /dev/null
+++ b/geode-client-native/src/clicache/FunctionServiceM.hpp
@@ -0,0 +1,93 @@
+/*=========================================================================
+ * 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 "cppcache/FunctionService.hpp"
+#include "CacheM.hpp"
+#include "impl/NativeWrapper.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ ref class Region;
+ ref class Pool;
+ ref class Execution;
+
+ /// <summary>
+ /// A factory class used to create Execute object for function execution
+ /// </summary>
+ /// <remarks>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public ref class FunctionService
+ : public Internal::SBWrap<gemfire::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>
+ static Execution^ OnRegion( Region^ 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^ 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^ 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^ 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^ OnServers( IRegionService^ cache );
+
+ internal:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline FunctionService( gemfire::FunctionService* nativeptr )
+ : SBWrap( nativeptr ) { }
+
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/GemFireClassIdsM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/GemFireClassIdsM.hpp b/geode-client-native/src/clicache/GemFireClassIdsM.hpp
new file mode 100644
index 0000000..f2e9099
--- /dev/null
+++ b/geode-client-native/src/clicache/GemFireClassIdsM.hpp
@@ -0,0 +1,276 @@
+/*=========================================================================
+ * 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 <cppcache/GemfireTypeIds.hpp>
+
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ /// <summary>
+ /// Static class containing the classIds of the built-in cacheable types.
+ /// </summary>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public ref class GemFireClassIds
+ {
+ public:
+
+ /// <summary>
+ /// ClassId of <c>Properties</c> class
+ /// </summary>
+ literal uint32_t Properties =
+ gemfire::GemfireTypeIds::Properties + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CharArray</c> class
+ /// </summary>
+ literal uint32_t CharArray =
+ gemfire::GemfireTypeIds::CharArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>BooleanArray</c> class
+ /// </summary>
+ literal uint32_t BooleanArray =
+ gemfire::GemfireTypeIds::BooleanArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>RegionAttributes</c> class
+ /// </summary>
+ literal uint32_t RegionAttributes =
+ gemfire::GemfireTypeIds::RegionAttributes + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableUndefined</c> class
+ /// Implementation note: this has DSFID of FixedIDByte hence a
+ /// different increment.
+ /// </summary>
+ literal uint32_t CacheableUndefined =
+ gemfire::GemfireTypeIds::CacheableUndefined + 0xa0000000;
+
+ /// <summary>
+ /// ClassId of <c>Struct</c> class
+ /// </summary>
+ literal uint32_t Struct =
+ gemfire::GemfireTypeIds::Struct + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class
+ /// </summary>
+ literal uint32_t CacheableString =
+ gemfire::GemfireTypeIds::CacheableString + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class for huge strings
+ /// </summary>
+ literal uint32_t CacheableStringHuge =
+ gemfire::GemfireTypeIds::CacheableStringHuge + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableBytes</c> class
+ /// </summary>
+ literal uint32_t CacheableBytes =
+ gemfire::GemfireTypeIds::CacheableBytes + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt16Array</c> class
+ /// </summary>
+ literal uint32_t CacheableInt16Array =
+ gemfire::GemfireTypeIds::CacheableInt16Array + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt32Array</c> class
+ /// </summary>
+ literal uint32_t CacheableInt32Array =
+ gemfire::GemfireTypeIds::CacheableInt32Array + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt64Array</c> class
+ /// </summary>
+ literal uint32_t CacheableInt64Array =
+ gemfire::GemfireTypeIds::CacheableInt64Array + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableFloatArray</c> class
+ /// </summary>
+ literal uint32_t CacheableFloatArray =
+ gemfire::GemfireTypeIds::CacheableFloatArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableDoubleArray</c> class
+ /// </summary>
+ literal uint32_t CacheableDoubleArray =
+ gemfire::GemfireTypeIds::CacheableDoubleArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableVector</c> class for object arrays
+ /// </summary>
+ literal uint32_t CacheableObjectArray =
+ gemfire::GemfireTypeIds::CacheableObjectArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableBoolean</c> class
+ /// </summary>
+ literal uint32_t CacheableBoolean =
+ gemfire::GemfireTypeIds::CacheableBoolean + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt16</c> class for wide-characters
+ /// </summary>
+ literal uint32_t CacheableCharacter =
+ gemfire::GemfireTypeIds::CacheableWideChar + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableByte</c> class
+ /// </summary>
+ literal uint32_t CacheableByte =
+ gemfire::GemfireTypeIds::CacheableByte + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt16</c> class
+ /// </summary>
+ literal uint32_t CacheableInt16 =
+ gemfire::GemfireTypeIds::CacheableInt16 + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt32</c> class
+ /// </summary>
+ literal uint32_t CacheableInt32 =
+ gemfire::GemfireTypeIds::CacheableInt32 + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt64</c> class
+ /// </summary>
+ literal uint32_t CacheableInt64 =
+ gemfire::GemfireTypeIds::CacheableInt64 + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableFloat</c> class
+ /// </summary>
+ literal uint32_t CacheableFloat =
+ gemfire::GemfireTypeIds::CacheableFloat + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableDouble</c> class
+ /// </summary>
+ literal uint32_t CacheableDouble =
+ gemfire::GemfireTypeIds::CacheableDouble + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableDate</c> class
+ /// </summary>
+ literal uint32_t CacheableDate =
+ gemfire::GemfireTypeIds::CacheableDate + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableFileName</c> class
+ /// </summary>
+ literal uint32_t CacheableFileName =
+ gemfire::GemfireTypeIds::CacheableFileName + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableStringArray</c> class
+ /// </summary>
+ literal uint32_t CacheableStringArray =
+ gemfire::GemfireTypeIds::CacheableStringArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableVector</c> class
+ /// </summary>
+ literal uint32_t CacheableVector =
+ gemfire::GemfireTypeIds::CacheableVector + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableStack</c> class
+ /// </summary>
+ literal uint32_t CacheableStack =
+ gemfire::GemfireTypeIds::CacheableStack + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableArrayList</c> class
+ /// </summary>
+ literal uint32_t CacheableArrayList =
+ gemfire::GemfireTypeIds::CacheableArrayList + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableHashSet</c> class
+ /// </summary>
+ literal uint32_t CacheableHashSet =
+ gemfire::GemfireTypeIds::CacheableHashSet + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableLinkedHashSet</c> class
+ /// </summary>
+ literal uint32_t CacheableLinkedHashSet =
+ gemfire::GemfireTypeIds::CacheableLinkedHashSet + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableHashMap</c> class
+ /// </summary>
+ literal uint32_t CacheableHashMap =
+ gemfire::GemfireTypeIds::CacheableHashMap + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableHashTable</c> class
+ /// </summary>
+ literal uint32_t CacheableHashTable =
+ gemfire::GemfireTypeIds::CacheableHashTable + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableIdentityHashMap</c> class
+ /// </summary>
+ literal uint32_t CacheableIdentityHashMap =
+ gemfire::GemfireTypeIds::CacheableIdentityHashMap + 0x80000000;
+
+ /// <summary>
+ /// Not used.
+ /// </summary>
+ literal uint32_t CacheableTimeUnit =
+ gemfire::GemfireTypeIds::CacheableTimeUnit + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class for null strings
+ /// </summary>
+ literal uint32_t CacheableNullString =
+ gemfire::GemfireTypeIds::CacheableNullString + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class for ASCII strings
+ /// </summary>
+ literal uint32_t CacheableASCIIString =
+ gemfire::GemfireTypeIds::CacheableASCIIString + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class for huge ASCII strings
+ /// </summary>
+ literal uint32_t CacheableASCIIStringHuge =
+ gemfire::GemfireTypeIds::CacheableASCIIStringHuge + 0x80000000;
+
+
+ // Built-in managed types.
+
+ /// <summary>
+ /// ClassId of <c>CacheableObject</c> class
+ /// </summary>
+ literal uint32_t CacheableManagedObject = 7 + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableObjectXml</c> class
+ /// </summary>
+ literal uint32_t CacheableManagedObjectXml = 8 + 0x80000000;
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/IAuthInitialize.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/IAuthInitialize.hpp b/geode-client-native/src/clicache/IAuthInitialize.hpp
new file mode 100644
index 0000000..15cebed
--- /dev/null
+++ b/geode-client-native/src/clicache/IAuthInitialize.hpp
@@ -0,0 +1,71 @@
+/*=========================================================================
+ * 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"
+
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ ref class Properties;
+
+ /// <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>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ 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>
+ Properties^ GetCredentials(Properties^ props, String^ server);
+
+ /// <summary>
+ /// Invoked before the cache goes down.
+ /// </summary>
+ void Close();
+
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/ICacheListener.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/ICacheListener.hpp b/geode-client-native/src/clicache/ICacheListener.hpp
new file mode 100644
index 0000000..04cb341
--- /dev/null
+++ b/geode-client-native/src/clicache/ICacheListener.hpp
@@ -0,0 +1,199 @@
+/*=========================================================================
+ * 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 "RegionM.hpp"
+#include "EntryEventM.hpp"
+#include "RegionEventM.hpp"
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ /// <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 GemFire 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 Gemfire 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" />
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ 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^ 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^ 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^ 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^ ev );
+
+ /// <summary>
+ /// Handles the event of a region being cleared.
+ /// </summary>
+ void AfterRegionClear( RegionEvent^ 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^ 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^ 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^ 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( Region^ 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(Region^ region );
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/ICacheLoader.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/ICacheLoader.hpp b/geode-client-native/src/clicache/ICacheLoader.hpp
new file mode 100644
index 0000000..668d2ef
--- /dev/null
+++ b/geode-client-native/src/clicache/ICacheLoader.hpp
@@ -0,0 +1,108 @@
+/*=========================================================================
+ * 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 "cppcache/CacheLoader.hpp"
+
+#include "ICacheableKey.hpp"
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ ref class Region;
+ interface class IGFSerializable;
+ //interface class ICacheableKey;
+
+ /// <summary>
+ /// CacheLoader
+ /// </summary>
+ /// <remarks>
+ /// CacheLoader
+ /// </remarks>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ 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, GemFire 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" />
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ 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="helper">
+ /// </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" />
+ IGFSerializable^ Load(Region^ region, ICacheableKey^ key,
+ IGFSerializable^ helper);
+
+ /// <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( Region^ region );
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/ICacheWriter.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/ICacheWriter.hpp b/geode-client-native/src/clicache/ICacheWriter.hpp
new file mode 100644
index 0000000..be47c1d
--- /dev/null
+++ b/geode-client-native/src/clicache/ICacheWriter.hpp
@@ -0,0 +1,161 @@
+/*=========================================================================
+ * 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 "RegionM.hpp"
+#include "EntryEventM.hpp"
+#include "RegionEventM.hpp"
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ /// <summary>
+ /// An application plug-in that can be installed on a region.
+ /// Defines methods that are called <b>before</b> entry modification,
+ /// such as writing the value to a database.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// A distributed region will typically have a single cache writer.
+ /// If the application is designed such that all or most updates to
+ /// a region occur on a node, the cache writer for the region should
+ /// be installed at that node.
+ /// </para><para>
+ /// A cache writer is defined in the <see cref="RegionAttributes" />.
+ /// </para><para>
+ /// Cache writer invocations are initiated by the node where the entry or
+ /// region modification occurs.
+ /// </para><para>
+ /// Before a region is updated via a put, create, or destroy operation,
+ /// GemFire will call an <c>ICacheWriter</c> that is installed anywhere in any
+ /// participating cache for that region, preferring a local <c>ICacheWriter</c>
+ /// if there is one. Usually there will be only one <c>ICacheWriter</c> in
+ /// the distributed system. If there are multiple <c>ICacheWriter</c>s
+ /// available in the distributed system, the GemFire
+ /// implementation always prefers one that is stored locally, or else picks one
+ /// arbitrarily. In any case, only one <c>ICacheWriter</c> will be invoked.
+ /// </para><para>
+ /// The typical use for a <c>ICacheWriter</c> is to update a database.
+ /// Application writers should implement these methods to execute
+ /// application-specific behavior before the cache is modified.
+ /// </para>
+ /// <para>
+ /// Note that cache writer callbacks are synchronous callbacks and have the ability
+ /// to veto the cache update. Since cache writer invocations require communications
+ /// over the network, (especially if they are not co-located on the nodes where the
+ /// change occurs) the use of cache writers presents a performance penalty.
+ /// </para><para>
+ /// The <c>ICacheWriter</c> is capable of aborting the update to the cache by throwing
+ /// a <c>CacheWriterException</c>. This exception or any runtime exception
+ /// thrown by the <c>ICacheWriter</c> will abort the operation, and the
+ /// exception will be propagated to the initiator of the operation, regardless
+ /// of whether the initiator is in the same process as the <c>ICacheWriter</c>.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetCacheWriter" />
+ /// <seealso cref="RegionAttributes.CacheWriter" />
+ /// <seealso cref="ICacheLoader" />
+ /// <seealso cref="ICacheListener" />
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public interface class ICacheWriter
+ {
+ public:
+
+ /// <summary>
+ /// Called before an entry is updated. The entry update is initiated by a
+ /// <c>Put</c> or a <c>Get</c> that causes the loader to update an existing entry.
+ /// </summary>
+ /// <remarks>
+ /// The entry previously existed in the cache where the operation was
+ /// initiated, although the old value may have been null. The entry being
+ /// updated may or may not exist in the local cache where the CacheWriter is
+ /// installed.
+ /// </remarks>
+ /// <param name="ev">
+ /// event object associated with updating the entry
+ /// </param>
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ bool BeforeUpdate( EntryEvent^ ev );
+
+ /// <summary>
+ /// Called before an entry is created. Entry creation is initiated by a
+ /// <c>Create</c>, a <c>Put</c>, or a <c>Get</c>.
+ /// </summary>
+ /// <remarks>
+ /// The <c>CacheWriter</c> can determine whether this value comes from a
+ /// <c>Get</c> or not from <c>Load</c>. The entry being
+ /// created may already exist in the local cache where this <c>CacheWriter</c>
+ /// is installed, but it does not yet exist in the cache where the operation was initiated.
+ /// </remarks>
+ /// <param name="ev">
+ /// event object associated with creating the entry
+ /// </param>
+ /// <seealso cref="Region.Create" />
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ bool BeforeCreate( EntryEvent^ ev );
+
+ /// <summary>
+ /// Called before an entry is destroyed.
+ /// </summary>
+ /// <remarks>
+ /// The entry being destroyed may or may
+ /// not exist in the local cache where the CacheWriter is installed. This method
+ /// is <em>not</em> called as a result of expiration or
+ /// <see cref="Region.LocalDestroyRegion" />.
+ /// </remarks>
+ /// <param name="ev">
+ /// event object associated with destroying the entry
+ /// </param>
+ /// <seealso cref="Region.Destroy" />
+ bool BeforeDestroy( EntryEvent^ ev );
+
+ /// <summary>
+ /// Called before this region is cleared.
+ /// </summary>
+ bool BeforeRegionClear( RegionEvent^ ev );
+
+ /// <summary>
+ /// Called before this region is destroyed.
+ /// </summary>
+ /// <param name="ev">
+ /// event object associated with destroying the region
+ /// </param>
+ /// <seealso cref="Region.DestroyRegion" />
+ bool BeforeRegionDestroy( RegionEvent^ ev );
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Implementations should clean up any external
+ /// resources, such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// </para><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>
+ /// <param name="region">region to close</param>
+ /// <seealso cref="Cache.Close" />
+ /// <seealso cref="Region.DestroyRegion" />
+ void Close( Region^ region );
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/ICacheableKey.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/ICacheableKey.hpp b/geode-client-native/src/clicache/ICacheableKey.hpp
new file mode 100644
index 0000000..923e4d7
--- /dev/null
+++ b/geode-client-native/src/clicache/ICacheableKey.hpp
@@ -0,0 +1,60 @@
+/*=========================================================================
+ * 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 "IGFSerializable.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ /// <summary>
+ /// This interface class is the superclass of all user objects
+ /// in the cache that can be used as a key.
+ /// </summary>
+ /// <remarks>
+ /// If an implementation is required to act as a key in the cache, then
+ /// it must implement this interface and preferably override
+ /// <c>System.Object.ToString</c> to obtain proper string representation.
+ /// Note that this interface requires that the class overrides
+ /// <c>Object.GetHashCode</c>. Though this is not enforced, the default
+ /// implementation in <c>System.Object</c> is almost certainly incorrect
+ /// and will not work correctly.
+ /// </remarks>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public interface class ICacheableKey
+ : public GemStone::GemFire::Cache::IGFSerializable
+ {
+ public:
+
+ /// <summary>
+ /// Get the hash code for this object. This is used in the internal
+ /// hash tables and so must have a nice distribution pattern.
+ /// </summary>
+ /// <returns>
+ /// The hashcode for this object.
+ /// </returns>
+ int32_t GetHashCode( );
+
+ /// <summary>
+ /// Returns true if this <c>ICacheableKey</c> matches the other.
+ /// </summary>
+ bool Equals( GemStone::GemFire::Cache::ICacheableKey^ other );
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/ICqAttributes.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/ICqAttributes.hpp b/geode-client-native/src/clicache/ICqAttributes.hpp
new file mode 100644
index 0000000..20eee1d
--- /dev/null
+++ b/geode-client-native/src/clicache/ICqAttributes.hpp
@@ -0,0 +1,108 @@
+/*=========================================================================
+ * 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"
+
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ interface class CqListener;
+
+ /// <summary>
+ /// An application plug-in that can be installed on a region.
+ /// Listener change notifications are invoked <c>after</c>
+ /// the change has occured.
+ /// </summary>
+ /// <remarks>
+ /// Listeners receive notifications when entries in a region change or changes occur to the
+ /// region attributes themselves.
+ /// <para>
+ /// A cache listener is defined in the <see cref="RegionAttributes" />.
+ /// </para>
+ /// The methods on a <c>ICacheListener</c>
+ /// are invoked asynchronously. 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 GemFire and logged.
+ ///
+ /// Listeners are user callbacks that
+ /// are invoked by GemFire. It is important to ensure that minimal work is done in the
+ /// listener before returning control back to GemFire. 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
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetCacheListener" />
+ /// <seealso cref="RegionAttributes.CacheListener" />
+ /// <seealso cref="ICacheLoader" />
+ /// <seealso cref="ICacheWriter" />
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public interface class ICqListener
+ {
+ 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 OnEvent( CqEvent^ 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 OnError( CqEvent^ 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.
+ /// <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();
+ };
+
+ }
+ }
+}