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 2017/01/13 22:45:57 UTC
[13/51] [partial] geode git commit: Software Grant Agreement (SGA)
from Pivotal for Apache Geode
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/valid_overflowAttr.xml
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/valid_overflowAttr.xml b/src/clicache/integration-test/valid_overflowAttr.xml
new file mode 100644
index 0000000..f9d89d2
--- /dev/null
+++ b/src/clicache/integration-test/valid_overflowAttr.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+ <root-region name = "Root1" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35" disk-policy="overflows">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="local-destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="local-invalidate"/>
+ </entry-time-to-live>
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLite"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ <region name="SubRegion11">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="23" load-factor="0.89" concurrency-level="52" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteSubRegion"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ </region>
+
+ <region name="SubRegion12">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="23" load-factor="0.89" concurrency-level="52" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteSubRegion"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ </region>
+
+ </root-region>
+
+
+ <root-region name= "Root2">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="16" load-factor="0.75" concurrency-level="16" lru-entries-limit = "35" disk-policy="overflows" >
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="invalidate"/>
+ </region-idle-time>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-time-to-live>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="invalidate"/>
+ </entry-idle-time>
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteRoot"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ <region name="SubRegion21">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="16" load-factor="0.75" concurrency-level="16">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ </region-attributes>
+ </region>
+
+ <region name="SubRegion22">
+ <region-attributes scope="local" caching-enabled="true">
+ </region-attributes>
+ <region name="SubSubRegion221">
+ <region-attributes scope="local" caching-enabled="true">
+ </region-attributes>
+ </region>
+ </region>
+
+ </root-region>
+
+ <root-region name = "Root3" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35" disk-policy="overflows">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="local-destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="local-invalidate"/>
+ </entry-time-to-live>
+ <persistence-manager library-name="Gemstone.Gemfire.Plugins.SqLite" library-function-name="GemStone.GemFire.Plugins.SqLite.SqLiteImpl<System.Object, System.Object>.Create" >
+
+ <properties>
+ <property name="PersistenceDirectory" value="SqLite"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ <region name="SubRegion31">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="23" load-factor="0.89" concurrency-level="52" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="Gemstone.Gemfire.Plugins.SqLite" library-function-name="GemStone.GemFire.Plugins.SqLite.SqLiteImpl<System.Object, System.Object>.Create" >
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteSubRegion"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ </region>
+
+ <region name="SubRegion32">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="23" load-factor="0.89" concurrency-level="52" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="Gemstone.Gemfire.Plugins.SqLite" library-function-name="GemStone.GemFire.Plugins.SqLite.SqLiteImpl<System.Object, System.Object>.Create" >
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteSubRegion"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ </region>
+
+ </root-region>
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/AttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesFactory.cpp b/src/clicache/src/AttributesFactory.cpp
new file mode 100644
index 0000000..7ccdaea
--- /dev/null
+++ b/src/clicache/src/AttributesFactory.cpp
@@ -0,0 +1,322 @@
+/*=========================================================================
+ * 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 "AttributesFactory.hpp"
+#include "Region.hpp"
+#include "impl/ManagedCacheLoader.hpp"
+#include "impl/ManagedPersistenceManager.hpp"
+#include "impl/ManagedCacheWriter.hpp"
+#include "impl/ManagedCacheListener.hpp"
+#include "impl/ManagedPartitionResolver.hpp"
+#include "impl/ManagedFixedPartitionResolver.hpp"
+#include "impl/CacheLoader.hpp"
+#include "impl/CacheWriter.hpp"
+#include "impl/CacheListener.hpp"
+#include "impl/PartitionResolver.hpp"
+#include "impl/PersistenceManagerProxy.hpp"
+#include "RegionAttributes.hpp"
+#include "ICacheLoader.hpp"
+#include "IPersistenceManager.hpp"
+#include "ICacheWriter.hpp"
+#include "IPartitionResolver.hpp"
+#include "IFixedPartitionResolver.hpp"
+#include "impl/SafeConvert.hpp"
+#include "ExceptionTypes.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ generic<class TKey, class TValue>
+ AttributesFactory<TKey, TValue>::AttributesFactory( GemStone::GemFire::Cache::Generic::RegionAttributes<TKey, TValue>^ regionAttributes )
+ : UMWrap( )
+ {
+ gemfire::RegionAttributesPtr attribptr(
+ GetNativePtrFromSBWrapGeneric<gemfire::RegionAttributes>( regionAttributes ) );
+ SetPtr( new gemfire::AttributesFactory( attribptr ), true );
+ }
+
+ // CALLBACKS
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader )
+ {
+ gemfire::CacheLoaderPtr loaderptr;
+ if ( cacheLoader != nullptr ) {
+ CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
+ clg->SetCacheLoader(cacheLoader);
+ loaderptr = new gemfire::ManagedCacheLoaderGeneric( /*clg,*/ cacheLoader );
+ ((gemfire::ManagedCacheLoaderGeneric*)loaderptr.ptr())->setptr(clg);
+ }
+ NativePtr->setCacheLoader( loaderptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter )
+ {
+ gemfire::CacheWriterPtr writerptr;
+ if ( cacheWriter != nullptr ) {
+ CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
+ cwg->SetCacheWriter(cacheWriter);
+ writerptr = new gemfire::ManagedCacheWriterGeneric( /*cwg,*/ cacheWriter );
+ ((gemfire::ManagedCacheWriterGeneric*)writerptr.ptr())->setptr(cwg);
+ }
+ NativePtr->setCacheWriter( writerptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener )
+ {
+ gemfire::CacheListenerPtr listenerptr;
+ if ( cacheListener != nullptr ) {
+ CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
+ clg->SetCacheListener(cacheListener);
+ //listenerptr = new gemfire::ManagedCacheListenerGeneric( (ICacheListener<Object^, Object^>^)cacheListener );
+ listenerptr = new gemfire::ManagedCacheListenerGeneric( /*clg,*/ cacheListener );
+ ((gemfire::ManagedCacheListenerGeneric*)listenerptr.ptr())->setptr(clg);
+ }
+ NativePtr->setCacheListener( listenerptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver )
+ {
+ gemfire::PartitionResolverPtr resolverptr;
+ if ( partitionresolver != nullptr ) {
+ Generic::IFixedPartitionResolver<TKey, TValue>^ resolver =
+ dynamic_cast<Generic::IFixedPartitionResolver<TKey, TValue>^>(partitionresolver);
+ if (resolver != nullptr) {
+ FixedPartitionResolverGeneric<TKey, TValue>^ prg = gcnew FixedPartitionResolverGeneric<TKey, TValue>();
+ prg->SetPartitionResolver(partitionresolver);
+ resolverptr = new gemfire::ManagedFixedPartitionResolverGeneric( partitionresolver );
+ ((gemfire::ManagedFixedPartitionResolverGeneric*)resolverptr.ptr())->setptr(prg);
+ }
+ else {
+ PartitionResolverGeneric<TKey, TValue>^ prg = gcnew PartitionResolverGeneric<TKey, TValue>();
+ prg->SetPartitionResolver(partitionresolver);
+ resolverptr = new gemfire::ManagedPartitionResolverGeneric( partitionresolver );
+ ((gemfire::ManagedPartitionResolverGeneric*)resolverptr.ptr())->setptr(prg);
+ }
+ }
+ NativePtr->setPartitionResolver( resolverptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheLoader( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ NativePtr->setCacheLoader( mg_libpath.CharPtr,
+ mg_factoryFunctionName.CharPtr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheWriter( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ NativePtr->setCacheWriter( mg_libpath.CharPtr,
+ mg_factoryFunctionName.CharPtr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheListener( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ NativePtr->setCacheListener( mg_libpath.CharPtr,
+ mg_factoryFunctionName.CharPtr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPartitionResolver( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ NativePtr->setPartitionResolver( mg_libpath.CharPtr,
+ mg_factoryFunctionName.CharPtr );
+ }
+
+ // EXPIRATION ATTRIBUTES
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetEntryIdleTimeout( ExpirationAction action, uint32_t idleTimeout )
+ {
+ NativePtr->setEntryIdleTimeout(
+ static_cast<gemfire::ExpirationAction::Action>( action ), idleTimeout );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetEntryTimeToLive( ExpirationAction action, uint32_t timeToLive )
+ {
+ NativePtr->setEntryTimeToLive(
+ static_cast<gemfire::ExpirationAction::Action>( action ), timeToLive );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetRegionIdleTimeout( ExpirationAction action, uint32_t idleTimeout )
+ {
+ NativePtr->setRegionIdleTimeout(
+ static_cast<gemfire::ExpirationAction::Action>( action ), idleTimeout );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetRegionTimeToLive( ExpirationAction action, uint32_t timeToLive )
+ {
+ NativePtr->setRegionTimeToLive(
+ static_cast<gemfire::ExpirationAction::Action>( action ), timeToLive );
+ }
+
+ // PERSISTENCE
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager, Properties<String^, String^>^ config )
+ {
+ gemfire::PersistenceManagerPtr persistenceManagerptr;
+ if ( persistenceManager != nullptr ) {
+ PersistenceManagerGeneric<TKey, TValue>^ clg = gcnew PersistenceManagerGeneric<TKey, TValue>();
+ clg->SetPersistenceManager(persistenceManager);
+ persistenceManagerptr = new gemfire::ManagedPersistenceManagerGeneric( /*clg,*/ persistenceManager );
+ ((gemfire::ManagedPersistenceManagerGeneric*)persistenceManagerptr.ptr())->setptr(clg);
+ }
+ gemfire::PropertiesPtr configptr(GetNativePtr<gemfire::Properties>( config ) );
+ NativePtr->setPersistenceManager( persistenceManagerptr, configptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager )
+ {
+ SetPersistenceManager(persistenceManager, nullptr);
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPersistenceManager( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ SetPersistenceManager( libPath, factoryFunctionName, nullptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPersistenceManager( String^ libPath,
+ String^ factoryFunctionName, Properties<String^, String^>^ config )
+ {
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+ // TODO:
+ //TODO::split
+ gemfire::PropertiesPtr configptr(
+ GetNativePtr<gemfire::Properties>( config ) );
+
+ NativePtr->setPersistenceManager( mg_libpath.CharPtr,
+ mg_factoryFunctionName.CharPtr, configptr );
+
+ }
+
+ // STORAGE ATTRIBUTES
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPoolName( String^ poolName )
+ {
+ ManagedString mg_poolName( poolName );
+
+ NativePtr->setPoolName( mg_poolName.CharPtr );
+ }
+
+ // MAP ATTRIBUTES
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetInitialCapacity( int32_t initialCapacity )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ NativePtr->setInitialCapacity( initialCapacity );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetLoadFactor( Single loadFactor )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ NativePtr->setLoadFactor( loadFactor );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetConcurrencyLevel( int32_t concurrencyLevel )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ NativePtr->setConcurrencyLevel( concurrencyLevel );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetLruEntriesLimit( uint32_t entriesLimit )
+ {
+ NativePtr->setLruEntriesLimit( entriesLimit );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetDiskPolicy( DiskPolicyType diskPolicy )
+ {
+ NativePtr->setDiskPolicy(
+ static_cast<gemfire::DiskPolicyType::PolicyType>( diskPolicy ) );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCachingEnabled( bool cachingEnabled )
+ {
+ NativePtr->setCachingEnabled( cachingEnabled );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCloningEnabled( bool cloningEnabled )
+ {
+ NativePtr->setCloningEnabled( cloningEnabled );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled )
+ {
+ NativePtr->setConcurrencyChecksEnabled( concurrencyChecksEnabled );
+ }
+ // FACTORY METHOD
+
+ generic<class TKey, class TValue>
+ GemStone::GemFire::Cache::Generic::RegionAttributes<TKey, TValue>^ AttributesFactory<TKey, TValue>::CreateRegionAttributes()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ gemfire::RegionAttributesPtr& nativeptr (
+ NativePtr->createRegionAttributes( ) );
+ return GemStone::GemFire::Cache::Generic::RegionAttributes<TKey, TValue>::Create(nativeptr.ptr());
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ }
+ }
+}
+} //namespace
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/AttributesFactory.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesFactory.hpp b/src/clicache/src/AttributesFactory.hpp
new file mode 100644
index 0000000..23c35b9
--- /dev/null
+++ b/src/clicache/src/AttributesFactory.hpp
@@ -0,0 +1,507 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "gf_defs.hpp"
+#include <gfcpp/AttributesFactory.hpp>
+//#include "impl/NativeWrapper.hpp"
+#include "ExpirationAction.hpp"
+#include "DiskPolicyType.hpp"
+
+#include "ICacheLoader.hpp"
+#include "ICacheWriter.hpp"
+#include "ICacheListener.hpp"
+#include "IPartitionResolver.hpp"
+#include "IFixedPartitionResolver.hpp"
+#include "IPersistenceManager.hpp"
+#include "RegionAttributes.hpp"
+#include "RegionAttributes.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache {
+
+ namespace Generic
+ {
+
+ //ref class RegionAttributes;
+ //interface class ICacheLoader;
+ //interface class ICacheWriter;
+ //interface class ICacheListener;
+ //interface class IPartitionResolver;
+ //interface class IFixedPartitionResolver;
+
+
+ /// <summary>
+ /// Factory class to create instances of <see cref="RegionAttributes" />.
+ /// </summary>
+ /// <remarks>
+ /// An <see cref="AttributesFactory" />
+ /// instance maintains state for creating <see cref="RegionAttributes" /> instances.
+ /// The setter methods are used to change the settings that will be used for
+ /// creating the next attributes instance with the <see cref="CreateRegionAttributes" />
+ /// method. If you create a factory with the default constructor, then the
+ /// factory is set up to create attributes with all default settings. You can
+ /// also create a factory by providing a preset <see cref="RegionAttributes" />.
+ /// <para>
+ /// Once a <see cref="RegionAttributes" /> is created, it can only be modified
+ /// after it has been used to create a <see cref="Region" />, and then only by
+ /// using an <see cref="AttributesMutator" /> obtained from the region.
+ /// </para><para>
+ /// <h3>Attributes</h3>
+ /// <h4>Callbacks</h4>
+ /// <dl>
+ /// <dt><see cref="ICacheLoader" /> [<em>default:</em> null]</dt>
+ /// <dd>User-implemented plug-in for loading data on cache misses.<br />
+ /// see <see cref="SetCacheLoader" />,
+ /// <see cref="RegionAttributes.CacheLoader" /></dd>
+ ///
+ /// <dt><see cref="ICacheWriter" /> [<em>default:</em> null]</dt>
+ /// <dd>User-implemented plug-in for intercepting cache modifications, e.g.
+ /// for writing to an external data source.<br />
+ /// see <see cref="SetCacheWriter" />,
+ /// <see cref="RegionAttributes.CacheWriter" /></dd>
+ ///
+ /// <dt><see cref="ICacheListener" /> [<em>default:</em> null]</dt>
+ /// <dd>User-implemented plug-in for receiving and handling cache-related events.<br />
+ /// see <see cref="SetCacheListener" />,
+ /// <see cref="RegionAttributes.CacheListener" /></dd>
+ ///
+ /// <dt><see cref="IPartitionResolver" /> [<em>default:</em> null]</dt>
+ /// <dd>User-implemented plug-in for custom partitioning.<br />
+ /// see <see cref="SetPartitionResolver" />,
+ /// <see cref="RegionAttributes.PartitionResolver" /></dd>
+ /// </dl>
+ /// <h4>Expiration</h4>
+ /// <dl>
+ /// <dt>RegionTimeToLive [<em>default:</em> no expiration]</dt>
+ /// <dd>Expiration configuration for the entire region based on the
+ /// lastModifiedTime ( <see cref="CacheStatistics.LastModifiedTime" /> ).<br />
+ /// see <see cref="SetRegionTimeToLive" />,
+ /// <see cref="RegionAttributes.RegionTimeToLive" />,
+ /// <see cref="AttributesMutator.SetRegionTimeToLive" /></dd>
+ ///
+ /// <dt>RegionIdleTimeout [<em>default:</em> no expiration]</dt>
+ /// <dd>Expiration configuration for the entire region based on the
+ /// lastAccessedTime ( <see cref="CacheStatistics.LastAccessedTime" /> ).<br />
+ /// see <see cref="SetRegionIdleTimeout" />,
+ /// <see cref="RegionAttributes.RegionIdleTimeout" />,
+ /// <see cref="AttributesMutator.SetRegionIdleTimeout" /></dd>
+ ///
+ /// <dt>EntryTimeToLive [<em>default:</em> no expiration]</dt>
+ /// <dd>Expiration configuration for individual entries based on the
+ /// lastModifiedTime ( <see cref="CacheStatistics.LastModifiedTime" /> ).<br />
+ /// see <see cref="SetEntryTimeToLive" />,
+ /// <see cref="RegionAttributes.EntryTimeToLive" />,
+ /// <see cref="AttributesMutator.SetEntryTimeToLive" /></dd>
+ ///
+ /// <dt>EntryIdleTimeout [<em>default:</em> no expiration]</dt>
+ /// <dd>Expiration configuration for individual entries based on the
+ /// lastAccessedTime ( <see cref="CacheStatistics.LastAccessedTime" /> ).<br />
+ /// see <see cref="SetEntryIdleTimeout" />,
+ /// <see cref="RegionAttributes.EntryIdleTimeout" />,
+ /// <see cref="AttributesMutator.SetEntryIdleTimeout" /></dd>
+ /// </dl>
+ /// <h4>Storage</h4>
+ /// <dl>
+ /// <dt>InitialCapacity [<em>default:</em> <tt>16</tt>]</dt>
+ /// <dd>The initial capacity of the map used for storing the entries.<br />
+ /// see <see cref="SetInitialCapacity" />,
+ /// <see cref="RegionAttributes.InitialCapacity" /></dd>
+ ///
+ /// <dt>LoadFactor [<em>default:</em> <tt>0.75</tt>]</dt>
+ /// <dd>The load factor of the map used for storing the entries.<br />
+ /// see <see cref="SetLoadFactor" />,
+ /// <see cref="RegionAttributes.LoadFactor" /></dd>
+ ///
+ /// <dt>ConcurrencyLevel [<em>default:</em> <tt>16</tt>]</dt>
+ /// <dd>The allowed concurrency among updates to values in the region
+ /// is guided by the <tt>concurrencyLevel</tt>, which is used as a hint
+ /// for internal sizing. The actual concurrency will vary.
+ /// Ideally, you should choose a value to accommodate as many
+ /// threads as will ever concurrently modify values in the region. Using a
+ /// significantly higher value than you need can waste space and time,
+ /// and a significantly lower value can lead to thread contention. But
+ /// overestimates and underestimates within an order of magnitude do
+ /// not usually have much noticeable impact. A value of one is
+ /// appropriate when it is known that only one thread will modify
+ /// and all others will only read.<br />
+ /// see <see cref="SetConcurrencyLevel" />,
+ /// <see cref="RegionAttributes.ConcurrencyLevel" /></dd>
+ ///
+ /// </dl>
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="RegionAttributes" />
+ /// <seealso cref="AttributesMutator" />
+ /// <seealso cref="Region.CreateSubRegion" />
+ generic<class TKey, class TValue>
+ public ref class AttributesFactory sealed
+ : public Internal::UMWrap<gemfire::AttributesFactory>
+ {
+ public:
+
+ /// <summary>
+ /// Creates a new <c>AttributesFactory</c> ready to create
+ /// a <c>RegionAttributes</c> with default settings.
+ /// </summary>
+ inline AttributesFactory<TKey, TValue>( )
+ : UMWrap( new gemfire::AttributesFactory( ), true ) { }
+
+ /// <summary>
+ /// Creates a new instance of <c>AttributesFactory</c> ready to create
+ /// a <c>RegionAttributes</c> with the same settings as those in the
+ /// specified <c>RegionAttributes</c>.
+ /// </summary>
+ /// <param name="regionAttributes">
+ /// attributes used to initialize this AttributesFactory
+ /// </param>
+ AttributesFactory<TKey, TValue>(RegionAttributes<TKey, TValue>^ regionAttributes);
+
+ // CALLBACKS
+
+ /// <summary>
+ /// Sets the cache loader for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="cacheLoader">
+ /// a user-defined cache loader, or null for no cache loader
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader );
+
+ /// <summary>
+ /// Sets the cache writer for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="cacheWriter">
+ /// user-defined cache writer, or null for no cache writer
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter );
+
+ /// <summary>
+ /// Sets the CacheListener for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="cacheListener">
+ /// user-defined cache listener, or null for no cache listener
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener );
+
+ /// <summary>
+ /// Sets the PartitionResolver for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="partitionresolver">
+ /// user-defined partition resolver, or null for no partition resolver
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the loader of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheLoader</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheLoader</c> for a managed library.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheLoader( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the writer of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheWriter</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheWriter</c> for a managed library.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheWriter( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the listener of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheListener</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheListener</c> for a managed library.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheListener( String^ libPath, String^ factoryFunctionName );
+
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the partition resolver of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>PartitionResolver</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>IPartitionResolver</c> for a managed library.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetPartitionResolver( String^ libPath, String^ factoryFunctionName );
+
+
+ // EXPIRATION ATTRIBUTES
+
+ /// <summary>
+ /// Sets the idleTimeout expiration attributes for region entries for the next
+ /// <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="idleTimeout">
+ /// the idleTimeout in seconds for entries in this region.
+ /// </param>
+ void SetEntryIdleTimeout( ExpirationAction action, uint32_t idleTimeout );
+
+ /// <summary>
+ /// Sets the timeToLive expiration attributes for region entries for the next
+ /// <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="timeToLive">
+ /// the timeToLive in seconds for entries in this region.
+ /// </param>
+ void SetEntryTimeToLive( ExpirationAction action, uint32_t timeToLive );
+
+ /// <summary>
+ /// Sets the idleTimeout expiration attributes for the region itself for the
+ /// next <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="idleTimeout">
+ /// the idleTimeout in seconds for the region as a whole.
+ /// </param>
+ void SetRegionIdleTimeout( ExpirationAction action, uint32_t idleTimeout );
+
+ /// <summary>
+ /// Sets the timeToLive expiration attributes for the region itself for the
+ /// next <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="timeToLive">
+ /// the timeToLive in seconds for the region as a whole.
+ /// </param>
+ void SetRegionTimeToLive( ExpirationAction action, uint32_t timeToLive );
+
+
+ // PERSISTENCE
+
+ /// <summary>
+ /// Sets the PersistenceManager object that will be invoked for the persistence of the region.
+ /// </summary>
+ /// <param name="persistenceManager">
+ /// Persistence Manager object
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager);
+
+ /// <summary>
+ /// Sets the PersistenceManager object that will be invoked for the persistence of the region.
+ /// </summary>
+ /// <param name="persistenceManager">
+ /// Persistence Manager object
+ /// </param>
+ /// <param name="config">
+ /// The configuration properties to use for the PersistenceManager.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager, Properties<String^, String^>^ config);
+
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the persistence of the region.
+ /// If the region is being created from a client on a server, or on a server directly, then
+ /// This must be used to set the PersistenceManager.
+ /// </summary>
+ /// <param name="libPath">The path of the PersistenceManager shared library.</param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function to create an instance of PersistenceManager object.
+ /// </param>
+ void SetPersistenceManager( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the persistence of the region.
+ /// If the region is being created from a client on a server, or on a server directly, then
+ /// This must be used to set the PersistenceManager.
+ /// </summary>
+ /// <param name="libPath">The path of the PersistenceManager shared library.</param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function to create an instance of PersistenceManager object.
+ /// </param>
+ /// <param name="config">
+ /// The configuration properties to use for the PersistenceManager.
+ /// </param>
+ void SetPersistenceManager( String^ libPath, String^ factoryFunctionName,
+ /*Dictionary<Object^, Object^>*/Properties<String^, String^>^ config );
+
+
+ // STORAGE ATTRIBUTES
+
+ /// <summary>
+ /// Set the pool name for a Thin Client region.
+ /// </summary>
+ /// <remarks>
+ /// The pool with the name specified must be already created.
+ /// </remarks>
+ /// <param name="poolName">
+ /// The name of the pool to attach to this region.
+ /// </param>
+ void SetPoolName( String^ poolName );
+
+ // MAP ATTRIBUTES
+
+ /// <summary>
+ /// Sets the entry initial capacity for the <c>RegionAttributes</c>
+ /// being created. This value is used in initializing the map that
+ /// holds the entries.
+ /// </summary>
+ /// <param name="initialCapacity">the initial capacity of the entry map</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if initialCapacity is nonpositive
+ /// </exception>
+ void SetInitialCapacity( int32_t initialCapacity );
+
+ /// <summary>
+ /// Sets the entry load factor for the next <c>RegionAttributes</c>
+ /// created. This value is
+ /// used in initializing the map that holds the entries.
+ /// </summary>
+ /// <param name="loadFactor">the load factor of the entry map</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if loadFactor is nonpositive
+ /// </exception>
+ void SetLoadFactor( Single loadFactor );
+
+ /// <summary>
+ /// Sets the concurrency level of the next <c>RegionAttributes</c>
+ /// created. This value is used in initializing the map that holds the entries.
+ /// </summary>
+ /// <param name="concurrencyLevel">
+ /// the concurrency level of the entry map
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if concurrencyLevel is nonpositive
+ /// </exception>
+ void SetConcurrencyLevel( int32_t concurrencyLevel );
+
+ /// <summary>
+ /// Sets a limit on the number of entries that will be held in the cache.
+ /// If a new entry is added while at the limit, the cache will evict the
+ /// least recently used entry.
+ /// </summary>
+ /// <param name="entriesLimit">
+ /// The limit of the number of entries before eviction starts.
+ /// Defaults to 0, meaning no LRU actions will used.
+ /// </param>
+ void SetLruEntriesLimit( uint32_t entriesLimit );
+
+ /// <summary>
+ /// Sets the disk policy type for the next <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="diskPolicy">
+ /// the disk policy to use for the region
+ /// </param>
+ void SetDiskPolicy( DiskPolicyType diskPolicy );
+
+ /// <summary>
+ /// Set caching enabled flag for this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If set to false, then no data is stored in the local process,
+ /// but events and distributions will still occur, and the region
+ /// can still be used to put and remove, etc...
+ /// </para><para>
+ /// The default if not set is 'true', 'false' is illegal for regions
+ /// of <c>ScopeType.Local</c> scope.
+ /// </para>
+ /// </remarks>
+ /// <param name="cachingEnabled">
+ /// if true, cache data for this region in this process.
+ /// </param>
+ void SetCachingEnabled( bool cachingEnabled );
+ /// <summary>
+ /// Set cloning enabled flag for this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If set to false, then there is no cloning will take place in case of delta.
+ /// Delta will be applied on the old value which will change old value in-place.
+ /// </para><para>
+ /// The default if not set is 'false'
+ /// of <c>ScopeType.Local</c> scope.
+ /// </para>
+ /// </remarks>
+ /// <param name="cloningEnabled">
+ /// if true, clone old value before applying delta so that in-place change would not occour..
+ /// </param>
+ void SetCloningEnabled( bool cloningEnabled );
+
+ /// <summary>
+ /// Sets concurrency checks enabled flag for this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If set to false, then the version checks will not occur.
+ /// </para><para>
+ /// The default if not set is 'true'
+ /// </para>
+ /// </remarks>
+ /// <param name="concurrencyChecksEnabled">
+ /// if true, version checks for region entries will occur.
+ /// </param>
+ void SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled );
+ // FACTORY METHOD
+
+ /// <summary>
+ /// Creates a <c>RegionAttributes</c> with the current settings.
+ /// </summary>
+ /// <returns>the newly created <c>RegionAttributes</c></returns>
+ /// <exception cref="IllegalStateException">
+ /// if the current settings violate the
+ /// compatibility rules.
+ /// </exception>
+ RegionAttributes<TKey, TValue>^ CreateRegionAttributes( );
+ };
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/AttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesMutator.cpp b/src/clicache/src/AttributesMutator.cpp
new file mode 100644
index 0000000..78643bc
--- /dev/null
+++ b/src/clicache/src/AttributesMutator.cpp
@@ -0,0 +1,175 @@
+/*=========================================================================
+ * 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 "AttributesMutator.hpp"
+//#include "Region.hpp"
+#include "impl/ManagedCacheListener.hpp"
+#include "impl/ManagedCacheLoader.hpp"
+#include "impl/ManagedCacheWriter.hpp"
+#include "impl/CacheLoader.hpp"
+#include "impl/CacheWriter.hpp"
+#include "impl/CacheListener.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+
+ generic<class TKey, class TValue>
+ int32_t AttributesMutator<TKey, TValue>::SetEntryIdleTimeout( int32_t idleTimeout )
+ {
+ return NativePtr->setEntryIdleTimeout( idleTimeout );
+ }
+
+ generic<class TKey, class TValue>
+ ExpirationAction AttributesMutator<TKey, TValue>::SetEntryIdleTimeoutAction(
+ ExpirationAction action )
+ {
+ return static_cast<ExpirationAction>(
+ NativePtr->setEntryIdleTimeoutAction(
+ static_cast<gemfire::ExpirationAction::Action>( action ) ) );
+ }
+
+ generic<class TKey, class TValue>
+ int32_t AttributesMutator<TKey, TValue>::SetEntryTimeToLive( int32_t timeToLive )
+ {
+ return NativePtr->setEntryTimeToLive( timeToLive );
+ }
+
+ generic<class TKey, class TValue>
+ ExpirationAction AttributesMutator<TKey, TValue>::SetEntryTimeToLiveAction(
+ ExpirationAction action )
+ {
+ return static_cast<ExpirationAction>(
+ NativePtr->setEntryTimeToLiveAction(
+ static_cast<gemfire::ExpirationAction::Action>( action ) ) );
+ }
+
+ generic<class TKey, class TValue>
+ int32_t AttributesMutator<TKey, TValue>::SetRegionIdleTimeout( int32_t idleTimeout )
+ {
+ return NativePtr->setRegionIdleTimeout( idleTimeout );
+ }
+
+ generic<class TKey, class TValue>
+ ExpirationAction AttributesMutator<TKey, TValue>::SetRegionIdleTimeoutAction(
+ ExpirationAction action )
+ {
+ return static_cast<ExpirationAction>(
+ NativePtr->setRegionIdleTimeoutAction(
+ static_cast<gemfire::ExpirationAction::Action>( action ) ) );
+ }
+
+ generic<class TKey, class TValue>
+ int32_t AttributesMutator<TKey, TValue>::SetRegionTimeToLive( int32_t timeToLive )
+ {
+ return NativePtr->setRegionTimeToLive( timeToLive );
+ }
+
+ generic<class TKey, class TValue>
+ ExpirationAction AttributesMutator<TKey, TValue>::SetRegionTimeToLiveAction(
+ ExpirationAction action )
+ {
+ return static_cast<ExpirationAction>(
+ NativePtr->setRegionTimeToLiveAction(
+ static_cast<gemfire::ExpirationAction::Action>( action ) ) );
+ }
+
+ generic<class TKey, class TValue>
+ uint32_t AttributesMutator<TKey, TValue>::SetLruEntriesLimit( uint32_t entriesLimit )
+ {
+ return NativePtr->setLruEntriesLimit( entriesLimit );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener )
+ {
+ gemfire::CacheListenerPtr listenerptr;
+ if (cacheListener != nullptr)
+ {
+ CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
+ clg->SetCacheListener(cacheListener);
+ listenerptr = new gemfire::ManagedCacheListenerGeneric( /*clg,*/ cacheListener );
+ ((gemfire::ManagedCacheListenerGeneric*)listenerptr.ptr())->setptr(clg);
+ }
+ NativePtr->setCacheListener( listenerptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheListener( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ NativePtr->setCacheListener( mg_libpath.CharPtr,
+ mg_factoryFunctionName.CharPtr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader )
+ {
+ gemfire::CacheLoaderPtr loaderptr;
+ if (cacheLoader != nullptr)
+ {
+ CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
+ clg->SetCacheLoader(cacheLoader);
+ loaderptr = new gemfire::ManagedCacheLoaderGeneric( /*clg,*/ cacheLoader );
+ ((gemfire::ManagedCacheLoaderGeneric*)loaderptr.ptr())->setptr(clg);
+ }
+ NativePtr->setCacheLoader( loaderptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheLoader( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ NativePtr->setCacheLoader( mg_libpath.CharPtr,
+ mg_factoryFunctionName.CharPtr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter )
+ {
+ gemfire::CacheWriterPtr writerptr;
+ if (cacheWriter != nullptr)
+ {
+ CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
+ cwg->SetCacheWriter(cacheWriter);
+ writerptr = new gemfire::ManagedCacheWriterGeneric( /*cwg,*/ cacheWriter );
+ ((gemfire::ManagedCacheWriterGeneric*)writerptr.ptr())->setptr(cwg);
+ }
+ NativePtr->setCacheWriter( writerptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheWriter( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ NativePtr->setCacheWriter( mg_libpath.CharPtr,
+ mg_factoryFunctionName.CharPtr );
+ }
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/AttributesMutator.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesMutator.hpp b/src/clicache/src/AttributesMutator.hpp
new file mode 100644
index 0000000..eeb72fb
--- /dev/null
+++ b/src/clicache/src/AttributesMutator.hpp
@@ -0,0 +1,256 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "gf_defs.hpp"
+#include <gfcpp/AttributesMutator.hpp>
+//#include "impl/NativeWrapper.hpp"
+#include "ExpirationAction.hpp"
+#include "ICacheListener.hpp"
+#include "ICacheLoader.hpp"
+#include "ICacheWriter.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+
+ /// <summary>
+ /// Supports modification of certain region attributes after the region
+ /// has been created.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// It is required that the attributes be completely initialized using an
+ /// <see cref="AttributesFactory" /> before creating the region.
+ /// AttributesMutator can be applied to adjusting and tuning a subset of
+ /// attributes that are modifiable at runtime.
+ /// </para><para>
+ /// The setter methods all return the previous value of the attribute.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Region.AttributesMutator" />
+ /// <seealso cref="RegionAttributes" />
+ /// <seealso cref="AttributesFactory" />
+ generic<class TKey, class TValue>
+ public ref class AttributesMutator sealed
+ : public Internal::SBWrap<gemfire::AttributesMutator>
+ {
+ public:
+
+ /// <summary>
+ /// Sets the idleTimeout duration for region entries.
+ /// </summary>
+ /// <param name="idleTimeout">
+ /// the idleTimeout in seconds for entries in this region, or 0 for no idle timeout
+ /// </param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new idleTimeout changes entry expiration from
+ /// disabled to enabled or enabled to disabled.
+ /// </exception>
+ int32_t SetEntryIdleTimeout( int32_t idleTimeout );
+
+ /// <summary>
+ /// Sets the idleTimeout action for region entries.
+ /// </summary>
+ /// <param name="action">
+ /// the idleTimeout action for entries in this region
+ /// </param>
+ /// <returns>the previous action</returns>
+ ExpirationAction SetEntryIdleTimeoutAction( ExpirationAction action );
+
+ /// <summary>
+ /// Sets the timeToLive duration for region entries.
+ /// </summary>
+ /// <param name="timeToLive">
+ /// the timeToLive in seconds for entries in this region, or 0 to disable time-to-live
+ /// </param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new timeToLive changes entry expiration from
+ /// disabled to enabled or enabled to disabled
+ /// </exception>
+ int32_t SetEntryTimeToLive( int32_t timeToLive );
+
+ /// <summary>
+ /// Set the timeToLive action for region entries.
+ /// </summary>
+ /// <param name="action">
+ /// the timeToLive action for entries in this region
+ /// </param>
+ /// <returns>the previous action</returns>
+ ExpirationAction SetEntryTimeToLiveAction( ExpirationAction action );
+
+ /// <summary>
+ /// Sets the idleTimeout duration for the region itself.
+ /// </summary>
+ /// <param name="idleTimeout">
+ /// the idleTimeout for this region, in seconds, or 0 to disable idle timeout
+ /// </param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new idleTimeout changes region expiration from
+ /// disabled to enabled or enabled to disabled.
+ /// </exception>
+ int32_t SetRegionIdleTimeout( int32_t idleTimeout );
+
+ /// <summary>
+ /// Sets the idleTimeout action for the region itself.
+ /// </summary>
+ /// <param name="action">
+ /// the idleTimeout action for this region
+ /// </param>
+ /// <returns>the previous action</returns>
+ ExpirationAction SetRegionIdleTimeoutAction( ExpirationAction action );
+
+ /// <summary>
+ /// Sets the timeToLive duration for the region itself.
+ /// </summary>
+ /// <param name="timeToLive">
+ /// the timeToLive for this region, in seconds, or 0 to disable time-to-live
+ /// </param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new timeToLive changes region expiration from
+ /// disabled to enabled or enabled to disabled.
+ /// </exception>
+ int32_t SetRegionTimeToLive( int32_t timeToLive );
+
+ /// <summary>
+ /// Sets the timeToLive action for the region itself.
+ /// </summary>
+ /// <param name="action">
+ /// the timeToLiv eaction for this region
+ /// </param>
+ /// <returns>the previous action</returns>
+ ExpirationAction SetRegionTimeToLiveAction( ExpirationAction action );
+
+ /// <summary>
+ /// Sets the maximum entry count in the region before LRU eviction.
+ /// </summary>
+ /// <param name="entriesLimit">the number of entries to allow, or 0 to disable LRU</param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new entriesLimit changes LRU from
+ /// disabled to enabled or enabled to disabled.
+ /// </exception>
+ uint32_t SetLruEntriesLimit( uint32_t entriesLimit );
+
+ /// <summary>
+ /// Sets the CacheListener for the region.
+ /// The previous cache listener (if any) will be replaced with the given <c>cacheListener</c>.
+ /// </summary>
+ /// <param name="cacheListener">
+ /// user-defined cache listener, or null for no cache listener
+ /// </param>
+ void SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the listener of the region.
+ /// The previous cache listener will be replaced with a listener created
+ /// using the factory function provided in the given library.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheListener</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheListener</c> for a managed library.
+ /// </param>
+ void SetCacheListener( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the CacheLoader for the region.
+ /// The previous cache loader (if any) will be replaced with the given <c>cacheLoader</c>.
+ /// </summary>
+ /// <param name="cacheLoader">
+ /// user-defined cache loader, or null for no cache loader
+ /// </param>
+ void SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the loader of the region.
+ /// The previous cache loader will be replaced with a loader created
+ /// using the factory function provided in the given library.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheLoader</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheLoader</c> for a managed library.
+ /// </param>
+ void SetCacheLoader( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the CacheListener for the region.
+ /// The previous cache writer (if any) will be replaced with the given <c>cacheWriter</c>.
+ /// </summary>
+ /// <param name="cacheWriter">
+ /// user-defined cache writer, or null for no cache writer
+ /// </param>
+ void SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the writer of the region.
+ /// The previous cache writer will be replaced with a writer created
+ /// using the factory function provided in the given library.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheWriter</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheWriter</c> for a managed library.
+ /// </param>
+ void SetCacheWriter( String^ libPath, String^ factoryFunctionName );
+
+
+ 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 AttributesMutator<TKey, TValue>^ Create( gemfire::AttributesMutator* nativeptr )
+ {
+ return ( nativeptr != nullptr ?
+ gcnew AttributesMutator<TKey, TValue>( nativeptr ) : nullptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline AttributesMutator<TKey, TValue>( gemfire::AttributesMutator* nativeptr )
+ : SBWrap( nativeptr ) { }
+ };
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/clicache/src/CMakeLists.txt b/src/clicache/src/CMakeLists.txt
new file mode 100644
index 0000000..eef44a2
--- /dev/null
+++ b/src/clicache/src/CMakeLists.txt
@@ -0,0 +1,60 @@
+cmake_minimum_required(VERSION 3.4)
+project(clicache)
+
+file(GLOB_RECURSE SOURCES "*.cpp")
+
+file(GLOB_RECURSE PRIVATE_HEADERS "*.hpp")
+set_source_files_properties(${PRIVATE_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE)
+
+set(RESOURCES gfclicache.rc)
+
+if(NOT "${STRONG_NAME_PUBLIC_KEY}" STREQUAL "")
+ set(STRONG_NAME_PUBLIC_KEY_ATTRIBUTE ", PublicKey=${STRONG_NAME_PUBLIC_KEY}")
+endif()
+list(APPEND CONFIGURE_IN_FILES ${CMAKE_CURRENT_SOURCE_DIR}/impl/AssemblyInfo.cpp.in)
+list(APPEND CONFIGURE_OUT_FILES ${CMAKE_CURRENT_BINARY_DIR}/impl/AssemblyInfo.cpp)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/impl/AssemblyInfo.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/impl/AssemblyInfo.cpp)
+
+#set_source_files_properties(${CONFIGURE_IN_FILES} PROPERTIES LANGUAGE NONE)
+set_source_files_properties(${CONFIGURE_OUT_FILES} PROPERTIES GENERATED TRUE)
+
+add_library(gfclicache SHARED
+ ${SOURCES}
+ ${PRIVATE_HEADERS} ${CONFIGURE_IN_FILES} ${CONFIGURE_OUT_FILES} ${RESOURCES})
+add_dependencies(client-libraries gfclicache)
+
+#TODO get external project library names
+target_link_libraries(gfclicache
+ PRIVATE
+ gfcppcache-static
+ psapi
+ PUBLIC
+ c++11
+)
+
+string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clr /wd4947 /doc")
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SHARED_LINKER_FLAGS_STRONG_KEY}")
+
+include_directories(${CMAKE_SOURCE_DIR}/clicache/src/legacy)
+include_directories(${CMAKE_SOURCE_DIR}/clicache/include)
+include_directories(${CMAKE_SOURCE_DIR}/clicache/src)
+include_directories(${CMAKE_SOURCE_DIR}/cppcache/src)
+
+set_target_properties(gfclicache PROPERTIES
+ OUTPUT_NAME Gemstone.Gemfire.Cache
+ VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
+ VS_DOTNET_REFERENCES "System;System.Xml")
+
+add_subdirectory(templates)
+
+install(TARGETS gfclicache
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+)
+
+# For Visual Studio organization
+source_group("Header Files" REGULAR_EXPRESSION "\.(hpp|inl)$")
+source_group("Configure In Files" FILES ${CONFIGURE_IN_FILES})
+source_group("Configure Out Files" FILES ${CONFIGURE_OUT_FILES})
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/src/Cache.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Cache.cpp b/src/clicache/src/Cache.cpp
new file mode 100644
index 0000000..0a6f7d3
--- /dev/null
+++ b/src/clicache/src/Cache.cpp
@@ -0,0 +1,260 @@
+/*=========================================================================
+ * 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 "Cache.hpp"
+#include "ExceptionTypes.hpp"
+#include "DistributedSystem.hpp"
+#include "Region.hpp"
+#include "RegionAttributes.hpp"
+#include "QueryService.hpp"
+//#include "FunctionService.hpp"
+//#include "Execution.hpp"
+#include "CacheFactory.hpp"
+#include "impl/AuthenticatedCache.hpp"
+#include "impl/ManagedString.hpp"
+#include "impl/SafeConvert.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::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)
+ {
+ // 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)
+ {
+ // 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/geode/blob/2d4a7ecd/src/clicache/src/Cache.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Cache.hpp b/src/clicache/src/Cache.hpp
new file mode 100644
index 0000000..2311650
--- /dev/null
+++ b/src/clicache/src/Cache.hpp
@@ -0,0 +1,283 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "gf_defs.hpp"
+//#include <gfcpp/Cache.hpp>
+//#include "impl/NativeWrapper.hpp"
+#include "RegionShortcut.hpp"
+//#include "RegionFactory.hpp"
+#include "IGemFireCache.hpp"
+//#include "IRegionService.hpp"
+#include "IRegion.hpp"
+//#include "QueryService.hpp"
+
+
+#include "RegionAttributes.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>
+ /// 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
+ }
+ }
+}