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:13 UTC
[06/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/com/vmware/CacheFactoryMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheFactoryMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheFactoryMN.cpp
new file mode 100644
index 0000000..d184d44
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheFactoryMN.cpp
@@ -0,0 +1,474 @@
+/*=========================================================================
+ * 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_includesN.hpp"
+
+#include "ExceptionTypesMN.hpp"
+
+#include "CacheFactoryMN.hpp"
+#include "CacheMN.hpp"
+#include "CacheAttributesMN.hpp"
+#include "DistributedSystemMN.hpp"
+#include "SystemPropertiesMN.hpp"
+#include "impl/SafeConvertN.hpp"
+#include "impl/PdxTypeRegistry.hpp"
+//#pragma warning(disable:4091)
+//#include <msclr/lock.h>
+//#pragma warning(disable:4091)
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ namespace Generic
+ {
+ CacheFactory^ CacheFactory::CreateCacheFactory()
+ {
+ return CacheFactory::CreateCacheFactory(Properties<String^, String^>::Create<String^, String^>());
+ }
+
+ CacheFactory^ CacheFactory::CreateCacheFactory(Properties<String^, String^>^ dsProps)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ gemfire::PropertiesPtr nativepropsptr(
+ GetNativePtr<gemfire::Properties>(dsProps));
+
+ gemfire::CacheFactoryPtr& nativeptr( gemfire::CacheFactory::createCacheFactory( nativepropsptr) );
+ if (nativeptr.ptr() != nullptr)
+ return gcnew CacheFactory( nativeptr.ptr(), dsProps );
+
+ return nullptr;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ Cache^ CacheFactory::Create()
+ {
+ bool pdxIgnoreUnreadFields = false;
+ bool pdxReadSerialized = false;
+ bool appDomainEnable = false;
+ _GF_MG_EXCEPTION_TRY2
+ //msclr::lock lockInstance(m_singletonSync);
+ DistributedSystem::acquireDisconnectLock();
+
+ if(!m_connected)
+ {
+ gemfire::PropertiesPtr nativepropsptr(
+ GetNativePtr<gemfire::Properties>(m_dsProps));
+ DistributedSystem::AppDomainInstanceInitialization(nativepropsptr);
+ }
+
+ gemfire::CachePtr& nativeptr( NativePtr->create( ) );
+ pdxIgnoreUnreadFields = nativeptr->getPdxIgnoreUnreadFields();
+ pdxReadSerialized = nativeptr->getPdxReadSerialized();
+
+ appDomainEnable = DistributedSystem::SystemProperties->AppDomainEnabled;
+ Log::SetLogLevel(static_cast<LogLevel>(gemfire::Log::logLevel( )));
+ //TODO::split
+ SafeConvertClassGeneric::SetAppDomainEnabled(appDomainEnable);
+
+ Serializable::RegisterTypeGeneric(
+ gemfire::GemfireTypeIds::PdxType,
+ gcnew TypeFactoryMethodGeneric(GemStone::GemFire::Cache::Generic::Internal::PdxType::CreateDeserializable),
+ nullptr);
+
+ if(!m_connected)
+ {
+ //it registers types in unmanage layer, so should be once only
+ DistributedSystem::ManagedPostConnect();
+ DistributedSystem::AppDomainInstancePostInitialization();
+ DistributedSystem::connectInstance();
+ }
+
+ m_connected = true;
+
+ return Cache::Create( nativeptr.ptr( ) );
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ finally {
+ DistributedSystem::registerCliCallback();
+ Serializable::RegisterPDXManagedCacheableKey(appDomainEnable);
+ GemStone::GemFire::Cache::Generic::Internal::PdxTypeRegistry::PdxIgnoreUnreadFields = pdxIgnoreUnreadFields;
+ GemStone::GemFire::Cache::Generic::Internal::PdxTypeRegistry::PdxReadSerialized = pdxReadSerialized;
+ DistributedSystem::releaseDisconnectLock();
+ }
+ }
+
+ Cache^ CacheFactory::Create( String^ name, DistributedSystem^ system )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_name( name );
+ gemfire::DistributedSystemPtr systemptr(
+ GetNativePtr<gemfire::DistributedSystem>( system ) );
+
+ gemfire::CachePtr& nativeptr( gemfire::CacheFactory::create(
+ mg_name.CharPtr, systemptr ) );
+ return Cache::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ Cache^ CacheFactory::Create( String^ name, DistributedSystem^ system,
+ String^ cacheXml )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_name( name );
+ gemfire::DistributedSystemPtr systemptr(
+ GetNativePtr<gemfire::DistributedSystem>( system ) );
+ ManagedString mg_cacheXml( cacheXml );
+
+ gemfire::CachePtr& nativeptr( gemfire::CacheFactory::create(
+ mg_name.CharPtr, systemptr, mg_cacheXml.CharPtr ) );
+ return Cache::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ Cache^ CacheFactory::Create( String^ name, DistributedSystem^ system,
+ CacheAttributes^ attributes )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_name( name );
+ gemfire::DistributedSystemPtr systemptr(
+ GetNativePtr<gemfire::DistributedSystem>( system ) );
+ gemfire::CacheAttributesPtr attrsPtr(
+ GetNativePtr<gemfire::CacheAttributes>(attributes));
+
+ gemfire::CachePtr& nativeptr( gemfire::CacheFactory::create(
+ mg_name.CharPtr, systemptr, attrsPtr ) );
+ return Cache::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ Cache^ CacheFactory::Create( String^ name, DistributedSystem^ system,
+ String^ cacheXml, CacheAttributes^ attributes )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_name( name );
+ gemfire::DistributedSystemPtr systemptr(
+ GetNativePtr<gemfire::DistributedSystem>( system ) );
+ ManagedString mg_cacheXml( cacheXml );
+ gemfire::CacheAttributesPtr attrsPtr(
+ GetNativePtr<gemfire::CacheAttributes>(attributes));
+
+ gemfire::CachePtr& nativeptr( gemfire::CacheFactory::create(
+ mg_name.CharPtr, systemptr, mg_cacheXml.CharPtr, attrsPtr ) );
+ return Cache::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ Cache^ CacheFactory::GetInstance( DistributedSystem^ system )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ gemfire::DistributedSystemPtr p_system(
+ GetNativePtr<gemfire::DistributedSystem>( system ) );
+ gemfire::CachePtr& nativeptr(
+ gemfire::CacheFactory::getInstance( p_system ) );
+
+ return Cache::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ Cache^ CacheFactory::GetInstanceCloseOk( DistributedSystem^ system )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ gemfire::DistributedSystemPtr p_system(
+ GetNativePtr<gemfire::DistributedSystem>( system ) );
+ gemfire::CachePtr& nativeptr(
+ gemfire::CacheFactory::getInstanceCloseOk( p_system ) );
+
+ return Cache::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ Cache^ CacheFactory::GetAnyInstance( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ gemfire::CachePtr& nativeptr(
+ gemfire::CacheFactory::getAnyInstance( ) );
+ return Cache::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ String^ CacheFactory::Version::get( )
+ {
+ return ManagedString::Get( gemfire::CacheFactory::getVersion( ) );
+ }
+
+ String^ CacheFactory::ProductDescription::get( )
+ {
+ return ManagedString::Get(
+ gemfire::CacheFactory::getProductDescription( ) );
+ }
+
+
+ CacheFactory^ CacheFactory::SetFreeConnectionTimeout( Int32 connectionTimeout )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setFreeConnectionTimeout( connectionTimeout );
+
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetLoadConditioningInterval( Int32 loadConditioningInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setLoadConditioningInterval( loadConditioningInterval );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetSocketBufferSize( Int32 bufferSize )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setSocketBufferSize( bufferSize );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetReadTimeout( Int32 timeout )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setReadTimeout( timeout );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetMinConnections( Int32 minConnections )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setMinConnections( minConnections );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetMaxConnections( Int32 maxConnections )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setMaxConnections( maxConnections );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetIdleTimeout( Int32 idleTimeout )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setIdleTimeout( idleTimeout );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetRetryAttempts( Int32 retryAttempts )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setRetryAttempts( retryAttempts );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetPingInterval( Int32 pingInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setPingInterval( pingInterval );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetUpdateLocatorListInterval( Int32 updateLocatorListInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setUpdateLocatorListInterval( updateLocatorListInterval );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetStatisticInterval( Int32 statisticInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setStatisticInterval( statisticInterval );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetServerGroup( String^ group )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_servergroup( group );
+ NativePtr->setServerGroup( mg_servergroup.CharPtr );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::AddLocator( String^ host, Int32 port )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_host( host );
+ NativePtr->addLocator( mg_host.CharPtr, port );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::AddServer( String^ host, Int32 port )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_host( host );
+ NativePtr->addServer( mg_host.CharPtr, port );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetSubscriptionEnabled( Boolean enabled )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setSubscriptionEnabled( enabled );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetPRSingleHopEnabled( Boolean enabled )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setPRSingleHopEnabled(enabled);
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetSubscriptionRedundancy( Int32 redundancy )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setSubscriptionRedundancy( redundancy );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetSubscriptionMessageTrackingTimeout( Int32 messageTrackingTimeout )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setSubscriptionMessageTrackingTimeout( messageTrackingTimeout );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetSubscriptionAckInterval( Int32 ackInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setSubscriptionAckInterval( ackInterval );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetThreadLocalConnections( bool enabled )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setThreadLocalConnections( enabled );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+
+ return this;
+ }
+
+ CacheFactory^ CacheFactory::SetMultiuserAuthentication( bool multiuserAuthentication )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setMultiuserAuthentication( multiuserAuthentication );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetPdxIgnoreUnreadFields(bool ignore)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setPdxIgnoreUnreadFields( ignore );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetPdxReadSerialized(bool pdxReadSerialized)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->setPdxReadSerialized( pdxReadSerialized );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::Set(String^ name, String^ value)
+ {
+ _GF_MG_EXCEPTION_TRY2
+ ManagedString mg_name( name );
+ ManagedString mg_value( value );
+ NativePtr->set( mg_name.CharPtr, mg_value.CharPtr );
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ } // end namespace Generic
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheFactoryMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheFactoryMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheFactoryMN.hpp
new file mode 100644
index 0000000..18225df
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheFactoryMN.hpp
@@ -0,0 +1,731 @@
+/*=========================================================================
+ * 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 "impl/NativeWrapperN.hpp"
+#include <cppcache/CacheFactory.hpp>
+#include "PropertiesMN.hpp"
+
+//using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ namespace Generic
+ {
+ ref class Cache;
+ ref class CacheAttributes;
+ ref class DistributedSystem;
+
+ /// <summary>
+ /// A factory class that must be used to obtain instance of <see cref="Cache" />.
+ /// </summary>
+ /// <remarks>
+ /// To create a new cache instance, use <see cref="CacheFactory.CreateCacheFactory" />.
+ /// <para>
+ /// To get an existing unclosed cache instance, use <see cref="CacheFactory.GetInstance" />.
+ /// </para>
+ /// </remarks>
+ public ref class CacheFactory :public Internal::SBWrap<gemfire::CacheFactory>
+ {
+ public:
+
+ /// <summary>
+ /// A factory class that must be used to obtain instance of <see cref="Cache" />.
+ /// This should be called once. Using this one can set default values of <see cref="Pool" />.
+ /// </summary>
+ /// <param name="dsProps">Properties which are applicable at client level.</param>
+ // static CacheFactory^ CreateCacheFactory(Dictionary<Object^, Object^>^ dsProps);
+ static CacheFactory^ CreateCacheFactory(Properties<String^, String^>^ dsProps);
+
+ /// <summary>
+ /// A factory class that must be used to obtain instance of <see cref="Cache" />.
+ /// This should be called once. Using this one can set default values of <see cref="Pool" />.
+ /// </summary>
+ static CacheFactory^ CreateCacheFactory();
+
+ /// <summary>
+ /// To create the instance of <see cref="Cache" />.
+ /// </summary>
+ Cache^ Create();
+
+ /// <summary>
+ /// Creates a new cache using the specified system.
+ /// </summary>
+ /// <param name="name">the name to associate with the new cache</param>
+ /// <param name="system">
+ /// a DistributedSystem obtained by calling
+ /// <see cref="DistributedSystem.Connect" />
+ /// </param>
+ /// <returns>
+ /// a <c>Cache</c> that uses the specified <c>DistributedSystem</c>
+ /// for distribution.
+ /// </returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If <c>system</c> is not connected
+ /// ( <see cref="DistributedSystem.IsConnected" /> ) or name is null.
+ /// </exception>
+ /// <exception cref="CacheExistsException">
+ /// If an open cache already exists.
+ /// </exception>
+ /// <deprecated>
+ /// as of NativeClient 3.5, use <see cref="CacheFactory.CreateCacheFactory" /> instead.
+ /// </deprecated>
+ static Cache^ Create( String^ name, DistributedSystem^ system );
+
+ /// <summary>
+ /// Creates a new cache using the specified system using parameters
+ /// from the given <a href="cacheXml.html">XML</a> file.
+ /// </summary>
+ /// <param name="name">the name to associate with the new cache</param>
+ /// <param name="system">
+ /// a DistributedSystem obtained by calling
+ /// <see cref="DistributedSystem.Connect" />
+ /// </param>
+ /// <param name="cacheXml">
+ /// name of the cache configuration XML file
+ /// </param>
+ /// <returns>
+ /// a <c>Cache</c> that uses the specified <c>DistributedSystem</c>
+ /// for distribution.
+ /// </returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If <c>system</c> is not <see cref="DistributedSystem.IsConnected"/>
+ /// or name is null
+ /// </exception>
+ /// <exception cref="CacheExistsException">
+ /// ff an open cache already exists
+ /// </exception>
+ /// <exception cref="CacheXmlException">
+ /// if something went wrong while parsing the XML
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// if the XML file is well-formed but not valid (consistent)
+ /// </exception>
+ /// <deprecated>
+ /// as of NativeClient 3.5, use <see cref="CacheFactory.CreateCacheFactory" /> instead.
+ /// </deprecated>
+ static Cache^ Create( String^ name, DistributedSystem^ system,
+ String^ cacheXml );
+
+ /// <summary>
+ /// Creates a new cache using the specified system using the given
+ /// <c>CacheAttributes</c>.
+ /// </summary>
+ /// <param name="name">the name to associate with the new cache</param>
+ /// <param name="system">
+ /// a DistributedSystem obtained by calling
+ /// <see cref="DistributedSystem.Connect" />
+ /// </param>
+ /// <param name="attributes">
+ /// optional <c>CacheAttributes</c> for this cache
+ /// </param>
+ /// <returns>
+ /// a <c>Cache</c> that uses the specified <c>DistributedSystem</c>
+ /// for distribution.
+ /// </returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If <c>system</c> is not <see cref="DistributedSystem.IsConnected"/>
+ /// or name is null
+ /// </exception>
+ /// <exception cref="CacheExistsException">
+ /// ff an open cache already exists
+ /// </exception>
+ /// <deprecated>
+ /// as of NativeClient 3.5, use <see cref="CacheFactory.CreateCacheFactory" /> instead.
+ /// </deprecated>
+ static Cache^ Create( String^ name, DistributedSystem^ system,
+ CacheAttributes^ attributes );
+
+ /// <summary>
+ /// Creates a new cache using the specified system using parameters
+ /// from the given <a href="cacheXml.html">XML</a> file and with
+ /// the given <c>CacheAttributes</c>.
+ /// </summary>
+ /// <param name="name">the name to associate with the new cache</param>
+ /// <param name="system">
+ /// a DistributedSystem obtained by calling
+ /// <see cref="DistributedSystem.Connect" />
+ /// </param>
+ /// <param name="cacheXml">
+ /// name of the cache configuration XML file
+ /// </param>
+ /// <param name="attributes">
+ /// optional <c>CacheAttributes</c> for this cache; these
+ /// override the ones provided in <c>cacheXml</c>.
+ /// </param>
+ /// <returns>
+ /// a <c>Cache</c> that uses the specified <c>DistributedSystem</c>
+ /// for distribution.
+ /// </returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If <c>system</c> is not <see cref="DistributedSystem.IsConnected"/>
+ /// or name is null
+ /// </exception>
+ /// <exception cref="CacheExistsException">
+ /// ff an open cache already exists
+ /// </exception>
+ /// <exception cref="CacheXmlException">
+ /// if something went wrong while parsing the XML
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// if the XML file is well-formed but not valid (consistent)
+ /// </exception>
+ /// <deprecated>
+ /// as of NativeClient 3.5, use <see cref="CacheFactory.CreateCacheFactory" /> instead.
+ /// </deprecated>
+ static Cache^ Create( String^ name, DistributedSystem^ system,
+ String^ cacheXml, CacheAttributes^ attributes );
+
+ /// <summary>
+ /// Gets the instance of <see cref="Cache" /> produced by an
+ /// earlier call to <see cref="CacheFactory.Create" />.
+ /// </summary>
+ /// <param name="system">
+ /// the <see cref="DistributedSystem" /> the cache was created with.
+ /// </param>
+ /// <returns>the <see cref="Cache" /> associated with the specified system.</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if the distributed system argument is null
+ /// </exception>
+ /// <exception cref="CacheClosedException">
+ /// if a cache has not been created or the created one is closed
+ /// ( <see cref="Cache.IsClosed" /> )
+ /// </exception>
+ /// <exception cref="EntryNotFoundException">
+ /// if a cache with specified system not found
+ /// </exception>
+ static Cache^ GetInstance( DistributedSystem^ system );
+
+ /// <summary>
+ /// Gets the instance of <see cref="Cache" /> produced by an
+ /// earlier call to <see cref="CacheFactory.Create" />, even if it has been closed.
+ /// </summary>
+ /// <param name="system">
+ /// the <see cref="DistributedSystem" /> the cache was created with.
+ /// </param>
+ /// <returns>
+ /// the <c>Cache</c> associated with the specified system.
+ /// </returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if the distributed system argument is null
+ /// </exception>
+ /// <exception cref="CacheClosedException">
+ /// if a cache has not been created.
+ /// </exception>
+ /// <exception cref="EntryNotFoundException">
+ /// if a cache with specified system not found
+ /// </exception>
+ static Cache^ GetInstanceCloseOk( DistributedSystem^ system );
+
+ /// <summary>
+ /// Gets an arbitrary open instance of <see cref="Cache" /> produced by an
+ /// earlier call to <see cref="CacheFactory.Create" />.
+ /// </summary>
+ /// <exception cref="CacheClosedException">
+ /// if a cache has not been created or the only created one is
+ /// closed ( <see cref="Cache.IsClosed" /> )
+ /// </exception>
+ /// <exception cref="EntryNotFoundException">
+ /// if a cache with specified system not found
+ /// </exception>
+ static Cache^ GetAnyInstance( );
+
+ /// <summary>
+ /// Set allocators for non default Microsoft CRT versions.
+ /// </summary>
+ static void SetNewAndDelete()
+ {
+ gemfire::setNewAndDelete( & operator new, & operator delete );
+ }
+
+ /// <summary>
+ /// Returns the version of the cache implementation.
+ /// For the 1.0 release of GemFire, the string returned is <c>1.0</c>.
+ /// </summary>
+ /// <returns>the version of the cache implementation as a <c>String</c></returns>
+ static property String^ Version
+ {
+ static String^ get( );
+ }
+
+ /// <summary>
+ /// Returns the product description string including product name and version.
+ /// </summary>
+ static property String^ ProductDescription
+ {
+ static String^ get( );
+ }
+
+ /// <summary>
+ /// Sets the free connection timeout for this pool.
+ /// </summary>
+ /// <remarks>
+ /// If the pool has a max connections setting, operations will block
+ /// if all of the connections are in use. The free connection timeout
+ /// specifies how long those operations will block waiting for
+ /// a free connection before receiving an AllConnectionsInUseException.
+ /// If max connections is not set this setting has no effect.
+ /// </remarks>
+ /// <param>
+ /// connectionTimeout the connection timeout in milliseconds
+ /// </param>
+ /// <exception>
+ /// IllegalArgumentException if connectionTimeout
+ /// is less than or equal to 0.
+ /// </exception>
+ CacheFactory^ SetFreeConnectionTimeout( Int32 connectionTimeout );
+
+ /// <summary>
+ /// Sets the load conditioning interval for this pool.
+ /// </summary>
+ /// <remarks>
+ /// This interval controls how frequently the pool will check to see if
+ /// a connection to a given server should be moved to a different
+ /// server to improve the load balance.
+ /// </remarks>
+ /// <param>
+ /// loadConditioningInterval the connection lifetime in milliseconds
+ /// A value of -1 disables load conditioning.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if connectionLifetime
+ /// is less than -1.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetLoadConditioningInterval( Int32 loadConditioningInterval );
+
+ /// <summary>
+ /// Sets the socket buffer size for each connection made in this pool.
+ /// </summary>
+ /// <remarks>
+ /// Large messages can be received and sent faster when this buffer is larger.
+ /// Larger buffers also optimize the rate at which servers can send events
+ /// for client subscriptions.
+ /// </remarks>
+ /// <param>
+ /// bufferSize the size of the socket buffers used for reading and
+ /// writing on each connection in this pool.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if bufferSize
+ /// is less than or equal to 0.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetSocketBufferSize( Int32 bufferSize );
+
+ /// <summary>
+ /// Sets the number of milliseconds to wait for a response from a server before
+ /// timing out the operation and trying another server (if any are available).
+ /// </summary>
+ /// <param>
+ /// timeout number of milliseconds to wait for a response from a server
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if timeout
+ /// is less than or equal to 0.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetReadTimeout( Int32 timeout );
+
+ /// <summary>
+ /// Set the minimum number of connections to keep available at all times.
+ /// </summary>
+ /// <remarks>
+ /// When the pool is created, it will create this many connections.
+ /// If 0 then connections will not be made until an actual operation
+ /// is done that requires client-to-server communication.
+ /// </remarks>
+ /// <param>
+ /// minConnections the initial number of connections this pool will create.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if minConnections is less than 0.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetMinConnections( Int32 minConnections );
+
+ /// <summary>
+ /// Set the max number of client to server connections that the pool will create.
+ /// </summary>
+ /// <remarks>
+ /// If all of the connections are in use, an operation requiring a client to
+ /// server connection will block until a connection is available.
+ /// see setFreeConnectionTimeout(int)
+ /// </remarks>
+ /// <param>
+ /// maxConnections the maximum number of connections in the pool.
+ /// -1 indicates that there is no maximum number of connections.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if maxConnections is less than minConnections.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetMaxConnections( Int32 maxConnections );
+
+ /// <summary>
+ /// Set the amount of time a connection can be idle before expiring the connection.
+ /// </summary>
+ /// <remarks>
+ /// If the pool size is greater than the minimum specified, connections which have
+ /// been idle for longer than the idleTimeout will be closed.
+ /// </remarks>
+ /// <param>
+ /// idleTimeout The amount of time in milliseconds that an idle connection
+ /// should live before expiring. -1 indicates that connections should never expire.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if idleTimout is less than 0.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetIdleTimeout( Int32 idleTimeout );
+
+ /// <summary>
+ /// Set the number of times to retry a request after timeout/exception.
+ /// </summary>
+ /// <param>
+ /// retryAttempts The number of times to retry a request
+ /// after timeout/exception. -1 indicates that a request should be
+ /// tried against every available server before failing.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if idleTimout is less than 0.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetRetryAttempts( Int32 retryAttempts );
+
+ /// <summary>
+ /// Set how often to ping servers to verify that they are still alive.
+ /// </summary>
+ /// <remarks>
+ /// Each server will be sent a ping every pingInterval if there has not
+ /// been any other communication with the server.
+ /// These pings are used by the server to monitor the health of
+ /// the client. Make sure that the pingInterval is less than the
+ /// maximum time between pings allowed by the bridge server.
+ /// see in CacheServer: setMaximumTimeBetweenPings(int)
+ /// </remarks>
+ /// <param>
+ /// pingInterval The amount of time in milliseconds between pings.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if pingInterval is less than 0.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetPingInterval( Int32 pingInterval );
+
+ /// <summary>
+ /// Set how often to update locator list from locator
+ /// </summary>
+ /// <param>
+ /// updateLocatorListInterval The amount of time in milliseconds between
+ /// updating locator list. If its set to 0 then client will not update
+ /// the locator list.
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetUpdateLocatorListInterval( Int32 updateLocatorListInterval );
+
+
+ /// <summary>
+ /// Set how often to send client statistics to the server.
+ /// </summary>
+ /// <remarks>
+ /// Doing this allows gfmon to monitor clients.
+ /// A value of -1 disables the sending of client statistics
+ /// to the server.
+ /// </remarks>
+ /// <param>
+ /// statisticInterval The amount of time in milliseconds between
+ /// sends of client statistics to the server.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if statisticInterval
+ /// is less than -1.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetStatisticInterval( Int32 statisticInterval);
+
+ /// <summary>
+ /// Configures the group that all servers this pool connects to must belong to.
+ /// </summary>
+ /// <param>
+ /// group the server group that this pool will connect to.
+ /// If null or "" then all servers will be connected to.
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetServerGroup( String^ group );
+
+ /// <summary>
+ /// Add a locator, given its host and port, to this factory.
+ /// </summary>
+ /// <remarks>
+ /// The locator must be a server locator and will be used to discover other running
+ /// bridge servers and locators.
+ /// </remarks>
+ /// <param>
+ /// host the host name or ip address that the locator is listening on.
+ /// </param>
+ /// <param>
+ /// port the port that the locator is listening on
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if host is an unknown host
+ /// or if port is outside the valid range of [1..65535] inclusive.
+ /// </exception>
+ /// <exception>
+ /// throws IllegalStateException if a locator has already been added to this factory.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ AddLocator( String^ host, Int32 port );
+
+ /// <summary>
+ /// Add a server, given its host and port, to this factory.
+ /// </summary>
+ /// <remarks>
+ /// The server must be a bridge server and this client will
+ /// directly connect to without consulting a server locator.
+ /// </remarks>
+ /// <param>
+ /// host the host name or ip address that the server is listening on.
+ /// </param>
+ /// <param>
+ /// port the port that the server is listening on
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if host is an unknown host
+ /// or if port is outside the valid range of [1..65535] inclusive.
+ /// </exception>
+ /// <exception>
+ /// throws IllegalStateException if a server has already been added to this factory.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ AddServer( String^ host, Int32 port );
+
+ /// <summary>
+ /// Enable subscriptions.
+ /// </summary>
+ /// <remarks>
+ /// If set to true then the created pool will have server-to-client
+ /// subscriptions enabled. If set to false then all Subscription*
+ /// attributes are ignored at create time.
+ /// </remarks>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetSubscriptionEnabled( Boolean enabled );
+
+ /// <summary>
+ /// By default SetPRSingleHopEnabled is true.
+ /// </summary>
+ /// <remarks>
+ /// The client is aware of location of partitions on servers hosting
+ /// Using this information, the client routes the client cache operations
+ /// directly to the server which is hosting the required partition for the
+ /// cache operation.
+ /// If SetPRSingleHopEnabled is false the client can do an extra hop on servers
+ /// to go to the required partition for that cache operation.
+ /// The SetPRSingleHopEnabled avoids extra hops only for following cache operations :
+ /// put, get & destroy operations.
+ /// </remarks>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetPRSingleHopEnabled( Boolean enabled );
+
+ /// <summary>
+ /// Sets the redundancy level for this pools server-to-client subscriptions.
+ /// </summary>
+ /// <remarks>
+ /// If 0 then no redundant copies will be kept on the servers.
+ /// Otherwise an effort will be made to maintain the requested number of
+ /// copies of the server-to-client subscriptions. At most one copy per server will
+ /// be made up to the requested level.
+ /// </remarks>
+ /// <param>
+ /// redundancy the number of redundant servers for this client's subscriptions.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if redundancyLevel is less than -1.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetSubscriptionRedundancy( Int32 redundancy );
+
+ /// <summary>
+ /// Sets the messageTrackingTimeout attribute which is the time-to-live period,
+ /// in milliseconds, for subscription events the client has received from the server.
+ /// </summary>
+ /// <remarks>
+ /// It's used to minimize duplicate events. Entries that have not been modified
+ /// for this amount of time are expired from the list.
+ /// </remarks>
+ /// <param>
+ /// messageTrackingTimeout number of milliseconds to set the timeout to.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if messageTrackingTimeout is less than or equal to 0.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetSubscriptionMessageTrackingTimeout( Int32 messageTrackingTimeout );
+
+ /// <summary>
+ /// Sets the is the interval in milliseconds to wait before sending
+ /// acknowledgements to the bridge server for events received from the server subscriptions.
+ /// </summary>
+ /// <param>
+ /// ackInterval number of milliseconds to wait before sending event acknowledgements.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if ackInterval is less than or equal to 0.
+ /// </exception>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetSubscriptionAckInterval( Int32 ackInterval );
+
+ /// <summary>
+ /// Enable thread local connections.
+ /// </summary>
+ /// <remarks>
+ /// Sets the thread local connections policy for the default connection pool.
+ /// If true then any time a thread goes to use a connection
+ /// from this pool it will check a thread local cache and see if it already
+ /// has a connection in it. If so it will use it. If not it will get one from
+ /// this pool and cache it in the thread local. This gets rid of thread contention
+ /// for the connections but increases the number of connections the servers see.
+ /// If false then connections are returned to the pool as soon
+ /// as the operation being done with the connection completes. This allows
+ /// connections to be shared amonst multiple threads keeping the number of
+ /// connections down.
+ /// </remarks>
+ CacheFactory^ SetThreadLocalConnections( bool enabled );
+
+ /// <summary>
+ /// Sets whether pool is in multiuser mode
+ /// </summary>
+ /// <param>
+ /// multiuserAuthentication should be true/false. Default value is false;
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetMultiuserAuthentication( bool multiuserAuthentication );
+
+
+ ///<summary>
+ /// Control whether pdx ignores fields that were unread during deserialization.
+ /// The default is to preserve unread fields be including their data during serialization.
+ /// But if you configure the cache to ignore unread fields then their data will be lost
+ /// during serialization.
+ /// <P>You should only set this attribute to <code>true</code> if you know this member
+ /// will only be reading cache data. In this use case you do not need to pay the cost
+ /// of preserving the unread fields since you will never be reserializing pdx data.
+ ///<summary>
+ /// <param> ignore <code>true</code> if fields not read during pdx deserialization should be ignored;
+ /// <code>false</code>, the default, if they should be preserved.
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetPdxIgnoreUnreadFields(bool ignore);
+
+ ///<summary>
+ /// Sets the object preference to PdxInstance type.
+ /// When a cached object that was serialized as a PDX is read
+ /// from the cache a {@link PdxInstance} will be returned instead of the actual domain class.
+ /// The PdxInstance is an interface that provides run time access to
+ /// the fields of a PDX without deserializing the entire PDX.
+ /// The PdxInstance implementation is a light weight wrapper
+ /// that simply refers to the raw bytes of the PDX that are kept
+ /// in the cache. Using this method applications can choose to
+ /// access PdxInstance instead of Java object.
+ /// Note that a PdxInstance is only returned if a serialized PDX is found in the cache.
+ /// If the cache contains a deserialized PDX, then a domain class instance is returned instead of a PdxInstance.
+ ///</summary>
+ /// <param> pdxReadSerialized <code>true</code> to prefer PdxInstance
+ /// <code>false</code>, the default, if they should be preserved.
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetPdxReadSerialized(bool pdxReadSerialized);
+
+
+ /// <summary>
+ /// Sets a gemfire property that will be used when creating the ClientCache.
+ /// </summary>
+ /// <param>
+ /// name the name of the gemfire property
+ /// </param>
+ /// <param>
+ /// value the value of the gemfire property
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ Set(String^ name, String^ value);
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheFactory( gemfire::CacheFactory* nativeptr, Properties<String^, String^>^ dsProps )
+ : SBWrap( nativeptr )
+ {
+ m_dsProps = dsProps;
+ }
+
+ Properties<String^, String^>^ m_dsProps;
+
+ static System::Object^ m_singletonSync = gcnew System::Object();
+
+ internal:
+ static bool m_connected = false;
+ };
+
+ }
+ }
+}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheListenerAdapterN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheListenerAdapterN.hpp b/geode-client-native/src/clicache/com/vmware/CacheListenerAdapterN.hpp
new file mode 100644
index 0000000..b680eb7
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheListenerAdapterN.hpp
@@ -0,0 +1,75 @@
+/*=========================================================================
+ * 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 "ICacheListenerN.hpp"
+
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+
+ /// <summary>
+ /// Utility class that implements all methods in <c>ICacheListener</c>
+ /// with empty implementations. Applications can subclass this class
+ /// and only override the methods for the events of interest.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class CacheListenerAdapter
+ : public ICacheListener<TKey, TValue>
+ {
+ public:
+ virtual void AfterCreate(EntryEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterUpdate(EntryEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterInvalidate(EntryEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterDestroy(EntryEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterRegionInvalidate(RegionEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterRegionDestroy(RegionEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterRegionLive(RegionEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterRegionClear(RegionEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void Close(IRegion<TKey, TValue>^ region)
+ {
+ }
+ virtual void AfterRegionDisconnected( IRegion<TKey, TValue>^ region )
+ {
+ }
+ };
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheMN.cpp
new file mode 100644
index 0000000..057ff75
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheMN.cpp
@@ -0,0 +1,277 @@
+/*=========================================================================
+ * 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_includesN.hpp"
+#include "CacheMN.hpp"
+#include "ExceptionTypesMN.hpp"
+#include "DistributedSystemMN.hpp"
+#include "RegionMN.hpp"
+#include "RegionAttributesMN.hpp"
+#include "QueryServiceMN.hpp"
+//#include "FunctionServiceMN.hpp"
+//#include "ExecutionMN.hpp"
+#include "CacheFactoryMN.hpp"
+#include "impl/AuthenticatedCacheMN.hpp"
+#include "impl/ManagedStringN.hpp"
+#include "impl/SafeConvertN.hpp"
+#include "impl/PdxTypeRegistry.hpp"
+#include "impl/PdxInstanceFactoryImpl.hpp"
+
+#pragma warning(disable:4091)
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ namespace Generic
+ {
+
+
+ String^ Cache::Name::get( )
+ {
+ return ManagedString::Get( NativePtr->getName( ) );
+ }
+
+ bool Cache::IsClosed::get( )
+ {
+ return NativePtr->isClosed( );
+ }
+
+ DistributedSystem^ Cache::DistributedSystem::get( )
+ {
+ gemfire::DistributedSystemPtr& nativeptr(
+ NativePtr->getDistributedSystem( ) );
+
+ return GemStone::GemFire::Cache::Generic::DistributedSystem::Create(
+ nativeptr.ptr( ) );
+ }
+
+ CacheTransactionManager^ Cache::CacheTransactionManager::get( )
+ {
+ gemfire::InternalCacheTransactionManager2PCPtr& nativeptr = static_cast<InternalCacheTransactionManager2PCPtr>(
+ NativePtr->getCacheTransactionManager( ) );
+
+ return GemStone::GemFire::Cache::Generic::CacheTransactionManager::Create(
+ nativeptr.ptr( ) );
+ }
+
+ void Cache::Close( )
+ {
+ Close( false );
+ }
+
+ void Cache::Close( bool keepalive )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ GemStone::GemFire::Cache::Generic::DistributedSystem::acquireDisconnectLock();
+
+ GemStone::GemFire::Cache::Generic::DistributedSystem::disconnectInstance();
+ CacheFactory::m_connected = false;
+
+ NativePtr->close( keepalive );
+
+ // If DS automatically disconnected due to the new bootstrap API, then cleanup the C++/CLI side
+ //if (!gemfire::DistributedSystem::isConnected())
+ {
+ GemStone::GemFire::Cache::Generic::DistributedSystem::UnregisterBuiltinManagedTypes();
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ finally
+ {
+ GemStone::GemFire::Cache::Generic::Internal::PdxTypeRegistry::clear();
+ Serializable::Clear();
+ GemStone::GemFire::Cache::Generic::DistributedSystem::releaseDisconnectLock();
+ GemStone::GemFire::Cache::Generic::DistributedSystem::unregisterCliCallback();
+ }
+ }
+
+ void Cache::ReadyForEvents( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->readyForEvents( );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic <class TKey, class TValue>
+ Generic::IRegion<TKey, TValue>^ Cache::CreateRegion( String^ name,
+ Generic::RegionAttributes<TKey, TValue>^ attributes )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ ManagedString mg_name( name );
+ gemfire::RegionAttributesPtr regionAttribsPtr(
+ GetNativePtrFromSBWrapGeneric<gemfire::RegionAttributes>( attributes ) );
+
+ gemfire::RegionPtr& nativeptr( NativePtr->createRegion(
+ mg_name.CharPtr, regionAttribsPtr ) );
+ return Generic::Region<TKey, TValue>::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ Generic::IRegion<TKey,TValue>^ Cache::GetRegion( String^ path )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ ManagedString mg_path( path );
+ gemfire::RegionPtr& nativeptr(
+ NativePtr->getRegion( mg_path.CharPtr ) );
+
+ return Generic::Region<TKey,TValue>::Create( nativeptr.ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ array<Generic::IRegion<TKey, TValue>^>^ Cache::RootRegions( )
+ {
+ gemfire::VectorOfRegion vrr;
+ NativePtr->rootRegions( vrr );
+ array<Generic::IRegion<TKey, TValue>^>^ rootRegions =
+ gcnew array<Generic::IRegion<TKey, TValue>^>( vrr.size( ) );
+
+ for( int32_t index = 0; index < vrr.size( ); index++ )
+ {
+ gemfire::RegionPtr& nativeptr( vrr[ index ] );
+ rootRegions[ index ] = Generic::Region<TKey, TValue>::Create( nativeptr.ptr( ) );
+ }
+ return rootRegions;
+ }
+
+ generic<class TKey, class TResult>
+ Generic::QueryService<TKey, TResult>^ Cache::GetQueryService( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return Generic::QueryService<TKey, TResult>::Create( NativePtr->getQueryService( ).ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TKey, class TResult>
+ Generic::QueryService<TKey, TResult>^ Cache::GetQueryService(String^ poolName )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_poolName( poolName );
+ return QueryService<TKey, TResult>::Create( NativePtr->getQueryService(mg_poolName.CharPtr).ptr( ) );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ RegionFactory^ Cache::CreateRegionFactory(RegionShortcut preDefinedRegionAttributes)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ gemfire::RegionShortcut preDefineRegionAttr = gemfire::CACHING_PROXY;
+
+ switch(preDefinedRegionAttributes)
+ {
+ case RegionShortcut::PROXY:
+ preDefineRegionAttr = gemfire::PROXY;
+ break;
+ case RegionShortcut::CACHING_PROXY:
+ preDefineRegionAttr = gemfire::CACHING_PROXY;
+ break;
+ case RegionShortcut::CACHING_PROXY_ENTRY_LRU:
+ preDefineRegionAttr = gemfire::CACHING_PROXY_ENTRY_LRU;
+ break;
+ case RegionShortcut::LOCAL:
+ preDefineRegionAttr = gemfire::LOCAL;
+ break;
+ case RegionShortcut::LOCAL_ENTRY_LRU:
+ preDefineRegionAttr = gemfire::LOCAL_ENTRY_LRU;
+ break;
+ }
+
+ return RegionFactory::Create(NativePtr->createRegionFactory(preDefineRegionAttr).ptr());
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ IRegionService^ Cache::CreateAuthenticatedView(Properties<String^, Object^>^ credentials)
+ {
+ // VJR: TODO:
+ //TODO::split
+ gemfire::Properties* prop = NULL;
+
+ if (credentials != nullptr)
+ prop = GetNativePtr<gemfire::Properties>( credentials );
+
+ gemfire::PropertiesPtr credPtr(prop);
+
+
+ _GF_MG_EXCEPTION_TRY2
+
+ return AuthenticatedCache::Create( (NativePtr->createAuthenticatedView(credPtr)).ptr());
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ bool Cache::GetPdxIgnoreUnreadFields()
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return NativePtr->getPdxIgnoreUnreadFields();
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ bool Cache::GetPdxReadSerialized()
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return NativePtr->getPdxReadSerialized();
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ IRegionService^ Cache::CreateAuthenticatedView(Properties<String^, Object^>^ credentials, String^ poolName)
+ {
+ //VJR: TODO:
+ //TODO::split
+ gemfire::Properties* prop = NULL;
+
+ if (credentials != nullptr)
+ prop = GetNativePtr<gemfire::Properties>( credentials );
+
+ gemfire::PropertiesPtr credPtr(prop);
+
+ ManagedString mg_poolName( poolName );
+
+
+ _GF_MG_EXCEPTION_TRY2
+
+ return AuthenticatedCache::Create( (NativePtr->createAuthenticatedView(credPtr, mg_poolName.CharPtr)).ptr());
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void Cache::InitializeDeclarativeCache( String^ cacheXml )
+ {
+ ManagedString mg_cacheXml( cacheXml );
+ NativePtr->initializeDeclarativeCache( mg_cacheXml.CharPtr );
+ }
+
+ IPdxInstanceFactory^ Cache::CreatePdxInstanceFactory(String^ className)
+ {
+ return gcnew Internal::PdxInstanceFactoryImpl(className);
+ }
+ } // end namespace Generic
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheMN.hpp
new file mode 100644
index 0000000..63800df
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheMN.hpp
@@ -0,0 +1,319 @@
+/*=========================================================================
+ * 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/Cache.hpp>
+//#include "impl/NativeWrapperN.hpp"
+#include "RegionShortcutMN.hpp"
+//#include "RegionFactoryMN.hpp"
+#include "IGemFireCacheN.hpp"
+//#include "IRegionServiceN.hpp"
+#include "IRegionN.hpp"
+//#include "QueryServiceMN.hpp"
+
+
+#include "RegionAttributesMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ namespace Generic
+ {
+
+ generic<class TKey, class TResult>
+ ref class QueryService;
+
+ ref class RegionFactory;
+ enum class ExpirationAction;
+ ref class DistributedSystem;
+ ref class CacheTransactionManager2PC;
+ //ref class FunctionService;
+
+ /// <summary>
+ /// Provides a distributed cache.
+ /// </summary>
+ /// <remarks>
+ /// Caches are obtained from Create methods on the
+ /// <see cref="CacheFactory.Create"/> class.
+ /// <para>
+ /// When a cache will no longer be used, call <see cref="Cache.Close" />.
+ /// Once it <see cref="Cache.IsClosed" /> any attempt to use it
+ /// will cause a <c>CacheClosedException</c> to be thrown.
+ /// </para><para>
+ /// A cache can have multiple root regions, each with a different name.
+ /// </para>
+ /// </remarks>
+ public ref class Cache sealed
+ : public IGemFireCache, Internal::SBWrap<gemfire::Cache>
+ {
+ public:
+
+ /// <summary>
+ /// Initializes the cache from an XML file.
+ /// </summary>
+ /// <param name="cacheXml">pathname of a <c>cache.xml</c> file</param>
+ virtual void InitializeDeclarativeCache( String^ cacheXml );
+
+ /// <summary>
+ /// Returns the name of this cache.
+ /// </summary>
+ /// <remarks>
+ /// This method does not throw
+ /// <c>CacheClosedException</c> if the cache is closed.
+ /// </remarks>
+ /// <returns>the string name of this cache</returns>
+ virtual property String^ Name
+ {
+ String^ get( );
+ }
+
+ /// <summary>
+ /// True if this cache has been closed.
+ /// </summary>
+ /// <remarks>
+ /// After a new cache object is created, this method returns false.
+ /// After <see cref="Close" /> is called on this cache object, this method
+ /// returns true.
+ /// </remarks>
+ /// <returns>true if this cache is closed, otherwise false</returns>
+ virtual property bool IsClosed
+ {
+ bool get( );
+ }
+
+ /// <summary>
+ /// Returns the distributed system used to
+ /// <see cref="CacheFactory.Create" /> this cache.
+ /// </summary>
+ /// <remarks>
+ /// This method does not throw
+ /// <c>CacheClosedException</c> if the cache is closed.
+ /// </remarks>
+ virtual property GemStone::GemFire::Cache::Generic::DistributedSystem^ DistributedSystem
+ {
+ GemStone::GemFire::Cache::Generic::DistributedSystem^ get( );
+ }
+
+ /// <summary>
+ /// Returns the cache transaction manager of
+ /// <see cref="CacheFactory.Create" /> this cache.
+ /// </summary>
+ virtual property GemStone::GemFire::Cache::Generic::CacheTransactionManager^ CacheTransactionManager
+ {
+ GemStone::GemFire::Cache::Generic::CacheTransactionManager^ get( );
+ }
+
+ /// <summary>
+ /// Terminates this object cache and releases all the local resources.
+ /// </summary>
+ /// <remarks>
+ /// After this cache is closed, any further
+ /// method call on this cache or any region object will throw
+ /// <c>CacheClosedException</c>, unless otherwise noted.
+ /// </remarks>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is already closed.
+ /// </exception>
+ virtual void Close( );
+
+ /// <summary>
+ /// Terminates this object cache and releases all the local resources.
+ /// </summary>
+ /// <remarks>
+ /// After this cache is closed, any further
+ /// method call on this cache or any region object will throw
+ /// <c>CacheClosedException</c>, unless otherwise noted.
+ /// </remarks>
+ /// <param name="keepalive">whether to keep a durable client's queue alive</param>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is already closed.
+ /// </exception>
+ virtual void Close( bool keepalive );
+
+ /// <summary>
+ /// Send the client-ready message to the server for a durable client.
+ /// </summary>
+ /// <remarks>
+ /// This method should only be called for durable clients and
+ /// with a cache server version 5.5 onwards.
+ /// </remarks>
+ /// <exception cref="IllegalStateException">
+ /// if there was a problem sending the message to the server.
+ /// </exception>
+ virtual void ReadyForEvents( );
+
+ /// <summary>
+ /// Creates a region with the given name using the specified
+ /// RegionAttributes.
+ /// The region is just created locally. It is not created on the server
+ /// to which this client is connected with.
+ /// </summary>
+ /// <remarks>
+ /// If Pool attached with Region is in multiusersecure mode then don't use return instance of region as no credential are attached with this instance.
+ /// Get instance of region from <see cref="Cache.CreateAuthenticatedView" to do the operation on Cache.
+ /// </remarks>
+ /// <param name="name">the name of the region to create</param>
+ /// <param name="attributes">the attributes of the root region</param>
+ /// <returns>new region</returns>
+ /// <exception cref="RegionExistsException">
+ /// if a region with the same name is already in this cache
+ /// </exception>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if the memory allocation failed
+ /// </exception>
+ /// <exception cref="RegionCreationFailedException">
+ /// if the call fails due to incomplete mirror initialization
+ /// </exception>
+ /// <exception cref="InitFailedException">
+ /// if the optional PersistenceManager fails to initialize
+ /// </exception>
+ /// <exception cref="UnknownException">otherwise</exception>
+ /// <deprecated>
+ /// as of NativeClient 3.5, use <see cref="Cache.CreateRegionFactory /> instead.
+ /// </deprecated>
+ generic <class TKey, class TValue>
+ virtual IRegion<TKey, TValue>^ CreateRegion( String^ name,
+ Generic::RegionAttributes<TKey, TValue>^ attributes );
+
+ /// <summary>
+ /// Returns an existing region given the full path from root, or null
+ /// if no such region exists.
+ /// </summary>
+ /// <remarks>
+ /// If Pool attached with Region is in multiusersecure mode then don't use return instance of region as no credential are attached with this instance.
+ /// Get region from RegionService instance of Cache.<see cref="Cache.CreateAuthenticatedView(PropertiesPtr)" />.
+ /// </remarks>
+ /// <param name="path">the pathname of the region</param>
+ /// <returns>the region</returns>
+ generic<class TKey, class TValue>
+ virtual IRegion<TKey, TValue>^ GetRegion( String^ path );
+
+ /// <summary>
+ /// Returns an array of root regions in the cache. This set is a
+ /// snapshot and is not backed by the cache.
+ /// </summary>
+ /// <remarks>
+ /// It is not supported when Cache is created from Pool.
+ /// </remarks>
+ /// <returns>array of regions</returns>
+ generic<class TKey, class TValue>
+ virtual array<IRegion<TKey, TValue>^>^ RootRegions();
+
+ /// <summary>
+ /// Get a query service object to be able to query the cache.
+ /// Supported only when cache is created from Pool(pool is in multiuserSecure mode)
+ /// </summary>
+ /// <remarks>
+ /// Currently only works against the java server in native mode, and
+ /// at least some endpoints must have been defined in some regions
+ /// before actually firing a query.
+ /// </remarks>
+ generic<class TKey, class TResult>
+ virtual Generic::QueryService<TKey, TResult>^ GetQueryService();
+
+ /// <summary>
+ /// Get a query service object to be able to query the cache.
+ /// Use only when Cache has more than one Pool.
+ /// </summary>
+ /// <remarks>
+ /// Currently only works against the java server in native mode, and
+ /// at least some endpoints must have been defined in some regions
+ /// before actually firing a query.
+ /// </remarks>
+ generic<class TKey, class TResult>
+ virtual Generic::QueryService<TKey, TResult>^ GetQueryService(String^ poolName );
+
+ /// <summary>
+ /// Returns the instance of <see cref="RegionFactory" /> to create the region
+ /// </summary>
+ /// <remarks>
+ /// Pass the <see cref="RegionShortcut" /> to set the deafult region attributes
+ /// </remarks>
+ /// <param name="regionShortcut">the regionShortcut to set the default region attributes</param>
+ /// <returns>Instance of RegionFactory</returns>
+ RegionFactory^ CreateRegionFactory(RegionShortcut regionShortcut);
+
+ /// <summary>
+ /// Returns the instance of <see cref="IRegionService" /> to do the operation on Cache with different Credential.
+ /// </summary>
+ /// <remarks>
+ /// Deafault pool should be in multiuser mode <see cref="CacheFactory.SetMultiuserAuthentication" />
+ /// </remarks>
+ /// <param name="credentials">the user Credentials.</param>
+ /// <returns>Instance of IRegionService</returns>
+ IRegionService^ CreateAuthenticatedView(Properties<String^, Object^>^ credentials);
+
+ /// <summary>
+ /// Returns the instance of <see cref="IRegionService" /> to do the operation on Cache with different Credential.
+ /// </summary>
+ /// <remarks>
+ /// Deafault pool should be in multiuser mode <see cref="CacheFactory.SetMultiuserAuthentication" />
+ /// </remarks>
+ /// <param name="credentials">the user Credentials.</param>
+ /// <param name="poolName">Pool, which is in multiuser mode.</param>
+ /// <returns>Instance of IRegionService</returns>
+ IRegionService^ CreateAuthenticatedView(Properties<String^, Object^>^ credentials, String^ poolName);
+
+ ///<summary>
+ /// Returns whether Cache saves unread fields for Pdx types.
+ ///</summary>
+ virtual bool GetPdxIgnoreUnreadFields();
+
+ ///<summary>
+ /// Returns whether { @link PdxInstance} is preferred for PDX types instead of .NET object.
+ ///</summary>
+ virtual bool GetPdxReadSerialized();
+
+ /// <summary>
+ /// Returns a factory that can create a {@link PdxInstance}.
+ /// @param className the fully qualified class name that the PdxInstance will become
+ /// when it is fully deserialized.
+ /// @return the factory
+ /// </summary>
+ virtual IPdxInstanceFactory^ CreatePdxInstanceFactory(String^ className);
+
+ 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 Cache^ Create( gemfire::Cache* nativeptr )
+ {
+ return ( nativeptr != nullptr ?
+ gcnew Cache( nativeptr ) : nullptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Cache( gemfire::Cache* nativeptr )
+ : SBWrap( nativeptr ) { }
+ };
+ } // end namespace Generic
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheStatisticsMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheStatisticsMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheStatisticsMN.cpp
new file mode 100644
index 0000000..762d21f
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheStatisticsMN.cpp
@@ -0,0 +1,33 @@
+/*=========================================================================
+ * 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_includesN.hpp"
+#include "CacheStatisticsMN.hpp"
+
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+
+ uint32_t CacheStatistics::LastModifiedTime::get( )
+ {
+ return NativePtr->getLastModifiedTime( );
+ }
+
+ uint32_t CacheStatistics::LastAccessedTime::get( )
+ {
+ return NativePtr->getLastAccessedTime( );
+ }
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheStatisticsMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheStatisticsMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheStatisticsMN.hpp
new file mode 100644
index 0000000..f5a8763
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheStatisticsMN.hpp
@@ -0,0 +1,145 @@
+/*=========================================================================
+ * 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/CacheStatistics.hpp>
+#include "impl/NativeWrapperN.hpp"
+
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+
+ /// <summary>
+ /// Defines common statistical information for both the region and its entries.
+ /// </summary>
+ /// <remarks>
+ /// All of these methods may throw a <c>CacheClosedException</c>,
+ /// <c>RegionDestroyedException</c>, or <c>EntryDestroyedException</c>.
+ /// </remarks>
+ /// <seealso cref="Region.Statistics" />
+ /// <seealso cref="RegionEntry.Statistics" />
+ public ref class CacheStatistics sealed
+ : public Internal::SBWrap<gemfire::CacheStatistics>
+ {
+ public:
+
+ /// <summary>
+ /// For an entry, returns the time that the entry's value was last modified.
+ /// For a region, returns the last time any of the region's entries' values or
+ /// the values in subregions' entries were modified.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The modification may have been initiated locally, or it may have been
+ /// an update distributed from another cache. It may also have been a new
+ /// value provided by a loader. The modification time on a region is
+ /// propagated upward to parent regions, transitively, to the root region.
+ /// </para><para>
+ /// The number is expressed as the number of milliseconds since January 1, 1970.
+ /// The granularity may be as coarse as 100ms, so the accuracy may be off by
+ /// up to 50ms.
+ /// </para><para>
+ /// Entry and subregion creation will update the modification time on a
+ /// region, but <c>Region.Destroy</c>, <c>Region.DestroyRegion</c>,
+ /// <c>Region.Invalidate</c>, and <c>Region.InvalidateRegion</c>
+ /// do not update the modification time.
+ /// </para>
+ /// </remarks>
+ /// <returns>
+ /// the last modification time of the region or the entry;
+ /// returns 0 if the entry is invalid or the modification time is uninitialized.
+ /// </returns>
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ /// <seealso cref="Region.Create" />
+ /// <seealso cref="Region.CreateSubRegion" />
+ property uint32_t LastModifiedTime
+ {
+ /// <summary>
+ /// Get the last modified time of an entry or a region.
+ /// </summary>
+ /// <returns>
+ /// the last accessed time expressed as the number of milliseconds since
+ /// January 1, 1970.
+ /// </returns>
+ uint32_t get( );
+ }
+
+ /// <summary>
+ /// For an entry, returns the last time it was accessed via <c>Region.Get</c>.
+ /// For a region, returns the last time any of its entries or the entries of
+ /// its subregions were accessed with <c>Region.Get</c>.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Any modifications will also update the <c>LastAccessedTime</c>,
+ /// so <c>LastAccessedTime</c> is always greater than or equal to
+ /// <c>LastModifiedTime</c>. The <c>LastAccessedTime</c> on a region is
+ /// propagated upward to parent regions, transitively, to the the root region.
+ /// </para><para>
+ /// The number is expressed as the number of milliseconds since
+ /// January 1, 1970. The granularity may be as coarse as 100ms, so
+ /// the accuracy may be off by up to 50ms.
+ /// </para>
+ /// </remarks>
+ /// <returns>
+ /// the last access time of the region or the entry's value;
+ /// returns 0 if entry is invalid or access time is uninitialized.
+ /// </returns>
+ /// <seealso cref="Region.Get" />
+ /// <seealso cref="LastModifiedTime" />
+ property uint32_t LastAccessedTime
+ {
+ /// <summary>
+ /// Get the last accessed time of an entry or a region.
+ /// </summary>
+ /// <returns>
+ /// the last accessed time expressed as the number of milliseconds since
+ /// January 1, 1970.
+ /// </returns>
+ uint32_t get( );
+ }
+
+
+ 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 CacheStatistics^ Create( gemfire::CacheStatistics* nativeptr )
+ {
+ return ( nativeptr != nullptr ?
+ gcnew CacheStatistics( nativeptr ) : nullptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheStatistics( gemfire::CacheStatistics* nativeptr )
+ : SBWrap( nativeptr ) { }
+ };
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheTransactionManagerMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheTransactionManagerMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheTransactionManagerMN.cpp
new file mode 100644
index 0000000..fbe5bdb
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheTransactionManagerMN.cpp
@@ -0,0 +1,206 @@
+/*=========================================================================
+ * 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_includesN.hpp"
+#include "impl/SafeConvertN.hpp"
+#include "impl/ManagedTransactionListenerN.hpp"
+#include "impl/ManagedTransactionWriterN.hpp"
+#include "CacheTransactionManagerMN.hpp"
+#include "TransactionListenerAdapterN.hpp"
+#include "TransactionWriterAdapterN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache {
+ namespace Generic
+ {
+
+ void CacheTransactionManager::Begin( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->begin( );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void CacheTransactionManager::Prepare( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ NativePtr->prepare( );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void CacheTransactionManager::Commit( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+ NativePtr->commit( );
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void CacheTransactionManager::Rollback( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+ NativePtr->rollback( );
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ bool CacheTransactionManager::Exists( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return NativePtr->exists( );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ GemStone::GemFire::Cache::Generic::TransactionId^ CacheTransactionManager::Suspend( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return GemStone::GemFire::Cache::Generic::TransactionId::Create( NativePtr->suspend().ptr() );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ GemStone::GemFire::Cache::Generic::TransactionId^ CacheTransactionManager::TransactionId::get( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return GemStone::GemFire::Cache::Generic::TransactionId::Create( NativePtr->getTransactionId().ptr() );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ void CacheTransactionManager::Resume(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return NativePtr->resume( gemfire::TransactionIdPtr(transactionId->NativePtr()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ bool CacheTransactionManager::IsSuspended(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return NativePtr->isSuspended( gemfire::TransactionIdPtr(transactionId->NativePtr()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ bool CacheTransactionManager::TryResume(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return NativePtr->tryResume( gemfire::TransactionIdPtr(transactionId->NativePtr()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ bool CacheTransactionManager::TryResume(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId, int32_t waitTimeInMilliSec)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return NativePtr->tryResume( gemfire::TransactionIdPtr(transactionId->NativePtr()), waitTimeInMilliSec);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ bool CacheTransactionManager::Exists(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return NativePtr->exists( gemfire::TransactionIdPtr(transactionId->NativePtr()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+#ifdef CSTX_COMMENTED
+ generic<class TKey, class TValue>
+ ITransactionWriter<TKey, TValue>^ CacheTransactionManager::GetWriter( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ // Conver the unmanaged object to managed generic object
+ gemfire::TransactionWriterPtr& writerPtr( NativePtr->getWriter( ) );
+ gemfire::ManagedTransactionWriterGeneric* twg =
+ dynamic_cast<gemfire::ManagedTransactionWriterGeneric*>( writerPtr.ptr( ) );
+
+ if (twg != nullptr)
+ {
+ return (ITransactionWriter<TKey, TValue>^)twg->userptr( );
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+
+ return nullptr;
+ }
+
+ generic<class TKey, class TValue>
+ void CacheTransactionManager::SetWriter(ITransactionWriter<TKey, TValue>^ transactionWriter)
+ {
+ _GF_MG_EXCEPTION_TRY2
+ // Create a unmanaged object using the ManagedTransactionWriterGeneric.
+ // Set the generic object inside the TransactionWriterGeneric that is a non generic object
+ gemfire::TransactionWriterPtr writerPtr;
+ if ( transactionWriter != nullptr )
+ {
+ TransactionWriterGeneric<TKey, TValue>^ twg = gcnew TransactionWriterGeneric<TKey, TValue> ();
+ twg->SetTransactionWriter(transactionWriter);
+ writerPtr = new gemfire::ManagedTransactionWriterGeneric( transactionWriter );
+ ((gemfire::ManagedTransactionWriterGeneric*)writerPtr.ptr())->setptr(twg);
+ }
+ NativePtr->setWriter( writerPtr );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TKey, class TValue>
+ void CacheTransactionManager::AddListener(ITransactionListener<TKey, TValue>^ transactionListener)
+ {
+ _GF_MG_EXCEPTION_TRY2
+ // Create a unmanaged object using the ManagedTransactionListenerGeneric.
+ // Set the generic object inside the TransactionListenerGeneric that is a non generic object
+ gemfire::TransactionListenerPtr listenerPtr;
+ if ( transactionListener != nullptr )
+ {
+ TransactionListenerGeneric<TKey, TValue>^ twg = gcnew TransactionListenerGeneric<TKey, TValue> ();
+ twg->SetTransactionListener(transactionListener);
+ listenerPtr = new gemfire::ManagedTransactionListenerGeneric( transactionListener );
+ ((gemfire::ManagedTransactionListenerGeneric*)listenerPtr.ptr())->setptr(twg);
+ }
+ NativePtr->addListener( listenerPtr );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TKey, class TValue>
+ void CacheTransactionManager::RemoveListener(ITransactionListener<TKey, TValue>^ transactionListener)
+ {
+ _GF_MG_EXCEPTION_TRY2
+ // Create an unmanaged non generic object using the managed generic object
+ // use this to call the remove listener
+ gemfire::TransactionListenerPtr listenerPtr;
+ if ( transactionListener != nullptr )
+ {
+ TransactionListenerGeneric<TKey, TValue>^ twg = gcnew TransactionListenerGeneric<TKey, TValue> ();
+ twg->SetTransactionListener(transactionListener);
+ listenerPtr = new gemfire::ManagedTransactionListenerGeneric( transactionListener );
+ ((gemfire::ManagedTransactionListenerGeneric*)listenerPtr.ptr())->setptr(twg);
+ }
+ NativePtr->removeListener( listenerPtr );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+#endif
+ }
+ }
+}
+ } //namespace