You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/08/11 23:52:27 UTC
[11/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionAttributes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionAttributes.hpp b/clicache/src/RegionAttributes.hpp
new file mode 100644
index 0000000..da47fc3
--- /dev/null
+++ b/clicache/src/RegionAttributes.hpp
@@ -0,0 +1,511 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/RegionAttributes.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+#include "IGeodeSerializable.hpp"
+#include "ExpirationAction.hpp"
+#include "DiskPolicyType.hpp"
+#include "GeodeClassIds.hpp"
+
+#include "ICacheLoader.hpp"
+#include "ICacheWriter.hpp"
+#include "ICacheListener.hpp"
+#include "IPartitionResolver.hpp"
+#include "Properties.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Defines attributes for configuring a region.
+ /// </summary>
+ /// <remarks>
+ /// These are
+ /// <c>ICacheListener</c>, <c>ICacheLoader</c>, <c>ICacheWriter</c>,
+ /// scope, mirroring, and expiration attributes
+ /// for the region itself; expiration attributes for the region entries;
+ /// and whether statistics are enabled for the region and its entries.
+ ///
+ /// To create an instance of this interface, use
+ /// <see cref="AttributesFactory.CreateRegionAttributes" />.
+ ///
+ /// For compatibility rules and default values, see <see cref="AttributesFactory" />.
+ /// <para>
+ /// Note that the <c>RegionAttributes</c> are not distributed with the region.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="AttributesFactory" />
+ /// <seealso cref="AttributesMutator" />
+ /// <seealso cref="Region.Attributes" />
+ generic <class TKey, class TValue>
+ public ref class RegionAttributes sealed
+ : public IGeodeSerializable
+ {
+ public:
+
+ /// <summary>
+ /// Gets the cache loader for the region.
+ /// </summary>
+ /// <returns>
+ /// region's <c>ICacheLoader</c> or null if none
+ /// </returns>
+ property Apache::Geode::Client::ICacheLoader<TKey, TValue>^ CacheLoader
+ {
+ Apache::Geode::Client::ICacheLoader<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Gets the cache writer for the region.
+ /// </summary>
+ /// <returns>
+ /// region's <c>ICacheWriter</c> or null if none
+ /// </returns>
+ property ICacheWriter<TKey, TValue>^ CacheWriter
+ {
+ ICacheWriter<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Gets the cache listener for the region.
+ /// </summary>
+ /// <returns>
+ /// region's <c>ICacheListener</c> or null if none
+ /// </returns>
+ property ICacheListener<TKey, TValue>^ CacheListener
+ {
+ ICacheListener<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Gets the partition resolver for the region.
+ /// </summary>
+ /// <returns>
+ /// region's <c>IPartitionResolver</c> or null if none
+ /// </returns>
+ property IPartitionResolver<TKey, TValue>^ PartitionResolver
+ {
+ IPartitionResolver<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Gets the <c>timeToLive</c> value for the region as a whole.
+ /// </summary>
+ /// <returns>the timeToLive duration for this region, in seconds</returns>
+ property System::Int32 RegionTimeToLive
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Gets the <c>timeToLive</c> expiration action for the region as a whole.
+ /// </summary>
+ /// <returns>the timeToLive action for this region</returns>
+ property ExpirationAction RegionTimeToLiveAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// Gets the <c>idleTimeout</c> value for the region as a whole.
+ /// </summary>
+ /// <returns>the IdleTimeout duration for this region, in seconds</returns>
+ property System::Int32 RegionIdleTimeout
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Gets the <c>idleTimeout</c> expiration action for the region as a whole.
+ /// </summary>
+ /// <returns>the idleTimeout action for this region</returns>
+ property ExpirationAction RegionIdleTimeoutAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// Gets the <c>timeToLive</c> value for entries in this region.
+ /// </summary>
+ /// <returns>the timeToLive duration for entries in this region, in seconds</returns>
+ property System::Int32 EntryTimeToLive
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Gets the <c>timeToLive</c> expiration action for entries in this region.
+ /// </summary>
+ /// <returns>the timeToLive action for entries in this region</returns>
+ property ExpirationAction EntryTimeToLiveAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// Gets the <c>idleTimeout</c> value for entries in this region.
+ /// </summary>
+ /// <returns>the idleTimeout duration for entries in this region, in seconds</returns>
+ property System::Int32 EntryIdleTimeout
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Gets the <c>idleTimeout</c> expiration action for entries in this region.
+ /// </summary>
+ /// <returns>the idleTimeout action for entries in this region</returns>
+ property ExpirationAction EntryIdleTimeoutAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// If true, this region will store data in the current process.
+ /// </summary>
+ /// <returns>true if caching is enabled</returns>
+ property bool CachingEnabled
+ {
+ bool get();
+ }
+
+
+ // MAP ATTRIBUTES
+
+ /// <summary>
+ /// Returns the initial capacity of the entry's local cache.
+ /// </summary>
+ /// <returns>the initial capacity</returns>
+ property System::Int32 InitialCapacity
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the load factor of the entry's local cache.
+ /// </summary>
+ /// <returns>the load factor</returns>
+ property Single LoadFactor
+ {
+ Single get();
+ }
+
+ /// <summary>
+ /// Returns the concurrency level of the entry's local cache.
+ /// </summary>
+ /// <returns>the concurrency level</returns>
+ /// <seealso cref="AttributesFactory" />
+ property System::Int32 ConcurrencyLevel
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the maximum number of entries this cache will hold before
+ /// using LRU eviction.
+ /// </summary>
+ /// <returns>the maximum LRU size, or 0 for no limit</returns>
+ property System::UInt32 LruEntriesLimit
+ {
+ System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the disk policy type of the region.
+ /// </summary>
+ /// <returns>the disk policy type, default is null</returns>
+ property DiskPolicyType DiskPolicy
+ {
+ DiskPolicyType get();
+ }
+
+ /// <summary>
+ /// Returns the ExpirationAction used for LRU Eviction, default is LOCAL_DESTROY.
+ /// </summary>
+ /// <returns>the LRU eviction action</returns>
+ property ExpirationAction LruEvictionAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the CacheLoader library path</returns>
+ property String^ CacheLoaderLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Rreturns the symbol name of the factory function from which
+ /// the loader will be created on a cache server.
+ /// </summary>
+ /// <returns>the CacheLoader factory function name</returns>
+ property String^ CacheLoaderFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the CacheListener library path</returns>
+ property String^ CacheListenerLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the PartitionResolver library path</returns>
+ property String^ PartitionResolverLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the symbol name of the factory function from which
+ /// the loader will be created on a cache server.
+ /// </summary>
+ /// <returns>the CacheListener factory function name</returns>
+ property String^ CacheListenerFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the symbol name of the factory function from which
+ /// the loader will be created on a cache server.
+ /// </summary>
+ /// <returns>the PartitionResolver factory function name</returns>
+ property String^ PartitionResolverFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the CacheWriter library path</returns>
+ property String^ CacheWriterLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the symbol name of the factory function from which
+ /// the loader will be created on a cache server.
+ /// </summary>
+ /// <returns>the CacheWriter factory function name</returns>
+ property String^ CacheWriterFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// True if all the attributes are equal to those of <c>other</c>.
+ /// </summary>
+ /// <param name="other">attribute object to compare</param>
+ /// <returns>true if equal</returns>
+ bool Equals(RegionAttributes<TKey, TValue>^ other);
+
+ /// <summary>
+ /// True if all the attributes are equal to those of <c>other</c>.
+ /// </summary>
+ /// <param name="other">attribute object to compare</param>
+ /// <returns>true if equal</returns>
+ virtual bool Equals(Object^ other) override;
+
+ /// <summary>
+ /// Throws IllegalStateException if the attributes are not suited for serialization
+ /// such as those that have a cache callback (listener, loader, or writer) set
+ /// directly instead of providing the library path and factory function.
+ /// </summary>
+ /// <exception cref="IllegalStateException">if the attributes cannot be serialized</exception>
+ void ValidateSerializableAttributes();
+
+ /// <summary>
+ /// This method returns the list of endpoints (servername:portnumber) separated by commas.
+ /// </summary>
+ /// <returns>list of endpoints</returns>
+ property String^ Endpoints
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// This method returns the name of the attached pool.
+ /// </summary>
+ /// <returns>pool name</returns>
+ property String^ PoolName
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// True if client notification is enabled.
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool ClientNotificationEnabled
+ {
+ bool get();
+ }
+ /// <summary>
+ /// True if cloning is enabled for in case of delta.
+ /// </summary>
+ /// <returns>true if enabled</returns>
+
+ property bool CloningEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the PersistenceManager library path</returns>
+ property String^ PersistenceLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the symbol name of the factory function from which
+ /// the persistence manager will be created on a cache server.
+ /// </summary>
+ /// <returns>the PersistenceManager factory function name</returns>
+ property String^ PersistenceFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the properties set for persistence.
+ /// </summary>
+ /// <returns>properties for the PersistenceManager</returns>
+ property Properties<String^, String^>^ PersistenceProperties
+ {
+ Properties<String^, String^>^ get();
+ }
+
+ /// <summary>
+ /// Returns the concurrency check enabled flag of the region
+ /// </summary>
+ /// <returns>the concurrency check enabled flag</returns>
+ /// <seealso cref="AttributesFactory" />
+ property bool ConcurrencyChecksEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Serializes this Properties object.
+ /// </summary>
+ /// <param name="output">the DataOutput stream to use for serialization</param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserializes this Properties object.
+ /// </summary>
+ /// <param name="input">the DataInput stream to use for reading data</param>
+ /// <returns>the deserialized Properties object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get()
+ {
+ return 0; //don't care
+ }
+ }
+
+ /// <summary>
+ /// Returns the classId of this class for serialization.
+ /// </summary>
+ /// <returns>classId of the Properties class</returns>
+ /// <seealso cref="../../IGeodeSerializable.ClassId" />
+ virtual property System::UInt32 ClassId
+ {
+ inline virtual System::UInt32 get()
+ {
+ return GeodeClassIds::RegionAttributes;
+ }
+ }
+
+
+ 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 RegionAttributes<TKey, TValue>^ Create(native::RegionAttributesPtr nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew RegionAttributes<TKey, TValue>( nativeptr );
+ }
+
+ std::shared_ptr<native::RegionAttributes> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline RegionAttributes<TKey, TValue>(native::RegionAttributesPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionAttributes>(nativeptr);
+ }
+
+ native_shared_ptr<native::RegionAttributes>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionEntry.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionEntry.cpp b/clicache/src/RegionEntry.cpp
new file mode 100644
index 0000000..95b5b57
--- /dev/null
+++ b/clicache/src/RegionEntry.cpp
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#include "geode_includes.hpp"
+#include "RegionEntry.hpp"
+#include "Region.hpp"
+#include "CacheStatistics.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TValue>
+ TKey RegionEntry<TKey, TValue>::Key::get( )
+ {
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TKey>(m_nativeptr->get()->getKey());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ TValue RegionEntry<TKey, TValue>::Value::get( )
+ {
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TValue>(m_nativeptr->get()->getValue());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ RegionEntry<TKey, TValue>::Region::get( )
+ {
+ try
+ {
+ return Apache::Geode::Client::Region<TKey, TValue>::Create(m_nativeptr->get()->getRegion());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ Apache::Geode::Client::CacheStatistics^ RegionEntry<TKey, TValue>::Statistics::get( )
+ {
+ apache::geode::client::CacheStatisticsPtr nativeptr;
+ try
+ {
+ m_nativeptr->get()->getStatistics( nativeptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return Apache::Geode::Client::CacheStatistics::Create( nativeptr);
+ }
+
+ generic<class TKey, class TValue>
+ bool RegionEntry<TKey, TValue>::IsDestroyed::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->isDestroyed( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionEntry.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionEntry.hpp b/clicache/src/RegionEntry.hpp
new file mode 100644
index 0000000..85c933f
--- /dev/null
+++ b/clicache/src/RegionEntry.hpp
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/RegionEntry.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+//#include "ICacheableKey.hpp"
+#include "IRegion.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ //ref class Region;
+ ref class CacheStatistics;
+
+ /// <summary>
+ /// An object in a region that represents an <em>entry</em>, that is, a key-value pair.
+ /// </summary>
+ /// <remarks>
+ /// This object's operations are not distributed, do not acquire any locks, and do not affect
+ /// <c>CacheStatistics</c>.
+ ///
+ /// Unless otherwise noted, all of these methods throw a
+ /// <c>CacheClosedException</c> if the cache is closed at the time of
+ /// invocation, or an <c>EntryDestroyedException</c> if the entry has been
+ /// destroyed.
+ ///
+ /// Call <see cref="IsDestroyed" /> to see if an entry has already been destroyed.
+ /// </remarks>
+ generic<class TKey, class TValue>
+ public ref class RegionEntry sealed
+ {
+ public:
+
+ /// <summary>
+ /// Returns the key for this entry.
+ /// </summary>
+ /// <returns>the key for this entry</returns>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed at the time of invocation
+ /// </exception>
+ /// <exception cref="EntryDestroyedException">
+ /// if the entry has been destroyed
+ /// </exception>
+ property TKey Key
+ {
+ TKey get( );
+ }
+
+ /// <summary>
+ /// Returns the value of this entry in the local cache. Does not invoke
+ /// an <c>ICacheLoader</c>, does not do a netSearch, netLoad, etc.
+ /// </summary>
+ /// <returns>
+ /// the value, or null if this entry is invalid -- see <see cref="IsDestroyed" />
+ /// </returns>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed at the time of invocation
+ /// </exception>
+ /// <exception cref="EntryDestroyedException">
+ /// if the entry has been destroyed
+ /// </exception>
+ property TValue Value
+ {
+ TValue get( );
+ }
+
+ /// <summary>
+ /// Returns the region that contains this entry.
+ /// </summary>
+ /// <returns>the region that contains this entry</returns>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed at the time of invocation
+ /// </exception>
+ /// <exception cref="EntryDestroyedException">
+ /// if the entry has been destroyed
+ /// </exception>
+ property IRegion<TKey, TValue>^ Region
+ {
+ IRegion<TKey, TValue>^ get( );
+ }
+
+ /// <summary>
+ /// Returns the statistics for this entry.
+ /// </summary>
+ /// <returns>the CacheStatistics for this entry</returns>
+ /// <exception cref="StatisticsDisabledException">
+ /// if statistics have been disabled for this region
+ /// </exception>
+ property Apache::Geode::Client::CacheStatistics^ Statistics
+ {
+ Apache::Geode::Client::CacheStatistics^ get( );
+ }
+
+ ///// <summary>
+ ///// Returns the user attribute for this entry in the local cache.
+ ///// </summary>
+ ///// <returns>the user attribute for this entry</returns>
+ ////Object^ GetUserAttribute( );
+
+ ///// <summary>
+ ///// Sets the user attribute for this entry. Does not distribute the user
+ ///// attribute to other caches.
+ ///// </summary>
+ ///// <param name="uptr">a pointer to the user attribute for this entry</param>
+ ///// <returns>
+ ///// the previous user attribute or null if no user attributes have been
+ ///// set for this entry
+ ///// </returns>
+ ////void SetUserAttribute( Object^ uptr );
+
+ /// <summary>
+ /// True if this entry has been destroyed.
+ /// </summary>
+ /// <remarks>
+ /// Does not throw a <c>EntryDestroyedException</c> if this entry
+ /// has been destroyed.
+ /// </remarks>
+ /// <returns>true if this entry has been destroyed</returns>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed at the time of invocation
+ /// </exception>
+ property bool IsDestroyed
+ {
+ bool 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 Client::RegionEntry<TKey, TValue>^ Create( native::RegionEntryPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew RegionEntry<TKey, TValue>( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline RegionEntry( native::RegionEntryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionEntry>(nativeptr);
+ }
+
+ native_shared_ptr<native::RegionEntry>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionEvent.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionEvent.cpp b/clicache/src/RegionEvent.cpp
new file mode 100644
index 0000000..3ee64d2
--- /dev/null
+++ b/clicache/src/RegionEvent.cpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "RegionEvent.hpp"
+#include "Region.hpp"
+#include "IGeodeSerializable.hpp"
+#include "impl/SafeConvert.hpp"
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ RegionEvent<TKey, TValue>::Region::get( )
+ {
+ auto regionptr = m_nativeptr->getRegion( );
+ return Client::Region<TKey, TValue>::Create( regionptr );
+ }
+
+ generic<class TKey, class TValue>
+ Object^ RegionEvent<TKey, TValue>::CallbackArgument::get()
+ {
+ apache::geode::client::UserDataPtr& valptr(m_nativeptr->getCallbackArgument());
+ return Serializable::GetManagedValueGeneric<Object^>( valptr );
+ }
+
+ generic<class TKey, class TValue>
+ bool RegionEvent<TKey, TValue>::RemoteOrigin::get( )
+ {
+ return m_nativeptr->remoteOrigin( );
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionEvent.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionEvent.hpp b/clicache/src/RegionEvent.hpp
new file mode 100644
index 0000000..7554c13
--- /dev/null
+++ b/clicache/src/RegionEvent.hpp
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/RegionEvent.hpp>
+#include "end_native.hpp"
+
+#include "IGeodeSerializable.hpp"
+#include "IRegion.hpp"
+#include "Region.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ //ref class Region;
+
+ /// <summary>
+ /// This class encapsulates events that occur for a region.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class RegionEvent sealed
+ {
+ public:
+
+ /// <summary>
+ /// Return the region this event occurred in.
+ /// </summary>
+ property IRegion<TKey, TValue>^ Region
+ {
+ IRegion<TKey, TValue>^ get( );
+ }
+
+ /// <summary>
+ /// Returns the callbackArgument passed to the method that generated
+ /// this event. See the <see cref="Region" /> interface methods
+ /// that take a callbackArgument parameter.
+ /// </summary>
+ property Object^ CallbackArgument
+ {
+ Object^ get();
+ }
+
+ /// <summary>
+ /// Returns true if the event originated in a remote process.
+ /// </summary>
+ property bool RemoteOrigin
+ {
+ bool get( );
+ }
+
+
+ internal:
+
+ const native::RegionEvent* GetNative()
+ {
+ return m_nativeptr;
+ }
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Apache::Geode::Client::RegionEvent<TKey, TValue>( const native::RegionEvent* nativeptr )
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ private:
+ const native::RegionEvent* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionFactory.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionFactory.cpp b/clicache/src/RegionFactory.cpp
new file mode 100644
index 0000000..f662a7c
--- /dev/null
+++ b/clicache/src/RegionFactory.cpp
@@ -0,0 +1,481 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "RegionFactory.hpp"
+#include "RegionAttributes.hpp"
+#include "impl/SafeConvert.hpp"
+
+#include "impl/ManagedCacheLoader.hpp"
+#include "impl/ManagedCacheWriter.hpp"
+#include "impl/ManagedCacheListener.hpp"
+#include "impl/ManagedPartitionResolver.hpp"
+#include "impl/ManagedFixedPartitionResolver.hpp"
+#include "impl/ManagedFixedPartitionResolver.hpp"
+#include "impl/ManagedPersistenceManager.hpp"
+
+#include "impl/CacheLoader.hpp"
+#include "impl/CacheWriter.hpp"
+#include "impl/CacheListener.hpp"
+#include "impl/PartitionResolver.hpp"
+#include "impl/FixedPartitionResolver.hpp"
+#include "impl/FixedPartitionResolver.hpp"
+#include "impl/PersistenceManagerProxy.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ RegionFactory^ RegionFactory::SetCacheLoader( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetCacheWriter( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetCacheListener( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setCacheListener( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetPartitionResolver( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ // EXPIRATION ATTRIBUTES
+
+ RegionFactory^ RegionFactory::SetEntryIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
+ {
+ try
+ {
+ m_nativeptr->get()->setEntryIdleTimeout( static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetEntryTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
+ {
+ try
+ {
+ m_nativeptr->get()->setEntryTimeToLive(static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetRegionIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
+ {
+ try
+ {
+ m_nativeptr->get()->setRegionIdleTimeout(static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetRegionTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
+ {
+ try
+ {
+ m_nativeptr->get()->setRegionTimeToLive(static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ // PERSISTENCE
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetPersistenceManager( Client::IPersistenceManager<TKey, TValue>^ persistenceManager,
+ Properties<String^, String^>^ config)
+ {
+ native::PersistenceManagerPtr persistenceManagerptr;
+ if ( persistenceManager != nullptr ) {
+ PersistenceManagerGeneric<TKey, TValue>^ clg = gcnew PersistenceManagerGeneric<TKey, TValue>();
+ clg->SetPersistenceManager(persistenceManager);
+ persistenceManagerptr = std::shared_ptr<native::ManagedPersistenceManagerGeneric>(new native::ManagedPersistenceManagerGeneric(persistenceManager));
+ ((native::ManagedPersistenceManagerGeneric*)persistenceManagerptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager( persistenceManagerptr, config->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetPersistenceManager( Client::IPersistenceManager<TKey, TValue>^ persistenceManager )
+ {
+ return SetPersistenceManager(persistenceManager, nullptr);
+ }
+
+ RegionFactory^ RegionFactory::SetPersistenceManager( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ SetPersistenceManager( libPath, factoryFunctionName, nullptr );
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetPersistenceManager( String^ libPath,
+ String^ factoryFunctionName, /*Dictionary<Object^, Object^>*/Properties<String^, String^>^ config )
+ {
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr, config->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetPoolName( String^ poolName )
+ {
+ ManagedString mg_poolName( poolName );
+
+ try
+ {
+ m_nativeptr->get()->setPoolName( mg_poolName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ // MAP ATTRIBUTES
+
+ RegionFactory^ RegionFactory::SetInitialCapacity( System::Int32 initialCapacity )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->setInitialCapacity( initialCapacity );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ RegionFactory^ RegionFactory::SetLoadFactor( Single loadFactor )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->setLoadFactor( loadFactor );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ RegionFactory^ RegionFactory::SetConcurrencyLevel( System::Int32 concurrencyLevel )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->setConcurrencyLevel( concurrencyLevel );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ RegionFactory^ RegionFactory::SetLruEntriesLimit( System::UInt32 entriesLimit )
+ {
+ try
+ {
+ m_nativeptr->get()->setLruEntriesLimit( entriesLimit );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetDiskPolicy( DiskPolicyType diskPolicy )
+ {
+ try
+ {
+ m_nativeptr->get()->setDiskPolicy(static_cast<native::DiskPolicyType::PolicyType>( diskPolicy ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetCachingEnabled( bool cachingEnabled )
+ {
+ try
+ {
+ m_nativeptr->get()->setCachingEnabled( cachingEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetCloningEnabled( bool cloningEnabled )
+ {
+ try
+ {
+ m_nativeptr->get()->setCloningEnabled( cloningEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled )
+ {
+ try
+ {
+ m_nativeptr->get()->setConcurrencyChecksEnabled( concurrencyChecksEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+ // NEW GENERIC APIs:
+
+ generic <class TKey, class TValue>
+ IRegion<TKey,TValue>^ RegionFactory::Create(String^ regionName)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ ManagedString mg_name( regionName );
+ auto nativeptr = m_nativeptr->get()->create( mg_name.CharPtr );
+ return Client::Region<TKey,TValue>::Create( nativeptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetCacheLoader( Client::ICacheLoader<TKey, TValue>^ cacheLoader )
+ {
+ native::CacheLoaderPtr loaderptr;
+ if ( cacheLoader != nullptr ) {
+ CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
+ clg->SetCacheLoader(cacheLoader);
+ loaderptr = std::shared_ptr<native::ManagedCacheLoaderGeneric>(new native::ManagedCacheLoaderGeneric(cacheLoader));
+ ((native::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( loaderptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetCacheWriter( Client::ICacheWriter<TKey, TValue>^ cacheWriter )
+ {
+ native::CacheWriterPtr writerptr;
+ if ( cacheWriter != nullptr ) {
+ CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
+ cwg->SetCacheWriter(cacheWriter);
+ writerptr = std::shared_ptr<native::ManagedCacheWriterGeneric>(new native::ManagedCacheWriterGeneric(cacheWriter));
+ ((native::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( writerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetCacheListener( Client::ICacheListener<TKey, TValue>^ cacheListener )
+ {
+ native::CacheListenerPtr listenerptr;
+ if ( cacheListener != nullptr ) {
+ CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
+ clg->SetCacheListener(cacheListener);
+ listenerptr = std::shared_ptr<native::ManagedCacheListenerGeneric>(new native::ManagedCacheListenerGeneric(cacheListener));
+ ((native::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
+ /*
+ listenerptr = new native::ManagedCacheListenerGeneric(
+ (Client::ICacheListener<Object^, Object^>^)cacheListener);
+ */
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheListener( listenerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetPartitionResolver(Client::IPartitionResolver<TKey, TValue>^ partitionresolver)
+ {
+ native::PartitionResolverPtr resolverptr;
+ if (partitionresolver != nullptr) {
+ Client::IFixedPartitionResolver<TKey, TValue>^ resolver =
+ dynamic_cast<Client::IFixedPartitionResolver<TKey, TValue>^>(partitionresolver);
+ if (resolver != nullptr) {
+ FixedPartitionResolverGeneric<TKey, TValue>^ prg = gcnew FixedPartitionResolverGeneric<TKey, TValue>();
+ prg->SetPartitionResolver(resolver);
+ resolverptr = std::shared_ptr<native::ManagedFixedPartitionResolverGeneric>(new native::ManagedFixedPartitionResolverGeneric(resolver));
+ ((native::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ }
+ else {
+ PartitionResolverGeneric<TKey, TValue>^ prg = gcnew PartitionResolverGeneric<TKey, TValue>();
+ prg->SetPartitionResolver(partitionresolver);
+ resolverptr = std::shared_ptr<native::ManagedPartitionResolverGeneric>(new native::ManagedPartitionResolverGeneric(partitionresolver));
+ ((native::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ }
+ }
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver(resolverptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionFactory.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionFactory.hpp b/clicache/src/RegionFactory.hpp
new file mode 100644
index 0000000..6e781db
--- /dev/null
+++ b/clicache/src/RegionFactory.hpp
@@ -0,0 +1,458 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/AttributesFactory.hpp>
+#include <geode/RegionFactory.hpp>
+#include "end_native.hpp"
+
+#include "ExpirationAction.hpp"
+#include "DiskPolicyType.hpp"
+#include "RegionShortcut.hpp"
+#include "ICacheLoader.hpp"
+#include "ICacheWriter.hpp"
+#include "ICacheListener.hpp"
+#include "IPartitionResolver.hpp"
+#include "IFixedPartitionResolver.hpp"
+#include "IPersistenceManager.hpp"
+#include "IRegion.hpp"
+#include "Properties.hpp"
+#include "Region.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// This interface provides for the configuration and creation of instances of Region.
+ /// </summary>
+ public ref class RegionFactory sealed
+ {
+ public:
+ /// <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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetPartitionResolver( String^ libPath, String^ factoryFunctionName );
+
+ /// <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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetEntryIdleTimeout( ExpirationAction action, System::UInt32 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetEntryTimeToLive( ExpirationAction action, System::UInt32 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetRegionIdleTimeout( ExpirationAction action, System::UInt32 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetRegionTimeToLive( ExpirationAction action, System::UInt32 timeToLive );
+
+
+ // PERSISTENCE
+
+ /// <summary>
+ /// Sets the persistence manager for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="persistenceManager">
+ /// a user-defined persistence manager, or null for no persistence manager
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ SetPersistenceManager( Client::IPersistenceManager<TKey, TValue>^ persistenceManager );
+
+ /// <summary>
+ /// Sets the persistence manager for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="persistenceManager">
+ /// a user-defined persistence manager, or null for no persistence manager
+ /// </param>
+ /// <param name="config">
+ /// The configuration properties to use for the PersistenceManager.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ SetPersistenceManager( Client::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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetPersistenceManager( String^ libPath, String^ factoryFunctionName,
+ /*Dictionary<Object^, Object^>*/Properties<String^, String^>^ config );
+
+ /// <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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetInitialCapacity( System::Int32 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetConcurrencyLevel( System::Int32 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetLruEntriesLimit( System::UInt32 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled );
+ // NEW GENERIC APIs:
+
+ /// <summary>
+ /// Creates a region with the given name.
+ /// 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>
+ /// <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>
+ generic <class TKey, class TValue>
+ IRegion<TKey, TValue>^ Create(String^ regionName);
+
+ /// <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>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ 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>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver );
+
+
+ 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 RegionFactory^ Create(native::RegionFactoryPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew RegionFactory( nativeptr );
+ }
+
+ std::shared_ptr<native::RegionFactory> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline RegionFactory(native::RegionFactoryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionFactory>(nativeptr);
+ }
+
+ native_shared_ptr<native::RegionFactory>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionShortcut.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionShortcut.hpp b/clicache/src/RegionShortcut.hpp
new file mode 100644
index 0000000..1373aaa
--- /dev/null
+++ b/clicache/src/RegionShortcut.hpp
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+
+using namespace System;
+//using namespace System::Runtime::InteropServices;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Each enum represents a predefined <see cref="RegionAttributes" /> in a <see cref="Cache" />.
+ /// These enum values can be used to create regions using a <see cref="RegionFactory" />
+ /// obtained by calling <see cref="Cache.CreateRegionFactory(RegionShortcut) />.
+ /// <p>Another way to use predefined region attributes is in cache.xml by setting
+ /// the refid attribute on a region element or region-attributes element to the
+ /// string of each value.
+ /// </summary>
+ public enum class RegionShortcut {
+
+ /// <summary>
+ /// A PROXY region has no local state and forwards all operations to a server.
+ /// </summary>
+ PROXY,
+
+ /// <summary>
+ /// A CACHING_PROXY region has local state but can also send operations to a server.
+ /// If the local state is not found then the operation is sent to the server
+ /// and the local state is updated to contain the server result.
+ /// </summary>
+ CACHING_PROXY,
+
+ /// <summary>
+ /// A CACHING_PROXY_ENTRY_LRU region has local state but can also send operations to a server.
+ /// If the local state is not found then the operation is sent to the server
+ /// and the local state is updated to contain the server result.
+ /// It will also destroy entries once it detects that the number of enteries crossing default limit of #100000.
+ /// </summary>
+ CACHING_PROXY_ENTRY_LRU,
+
+ /// <summary>
+ /// A LOCAL region only has local state and never sends operations to a server.
+ /// </summary>
+ LOCAL,
+
+ /// <summary>
+ /// A LOCAL_ENTRY_LRU region only has local state and never sends operations to a server.
+ /// It will also destroy entries once it detects once it detects that the number of enteries crossing default limit of #100000.
+ /// </summary>
+ LOCAL_ENTRY_LRU
+ } ;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ResultCollector.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/ResultCollector.cpp b/clicache/src/ResultCollector.cpp
new file mode 100644
index 0000000..595bd9c
--- /dev/null
+++ b/clicache/src/ResultCollector.cpp
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//#include "geode_includes.hpp"
+#include "ResultCollector.hpp"
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ generic<class TResult>
+ void ResultCollector<TResult>::AddResult( TResult rs )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto result = std::shared_ptr<native::Cacheable>(SafeGenericMSerializableConvert((IGeodeSerializable^)rs, nullptr));
+ m_nativeptr->get()->addResult(result);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ System::Collections::Generic::ICollection<TResult>^ ResultCollector<TResult>::GetResult()
+ {
+ return GetResult( DEFAULT_QUERY_RESPONSE_TIMEOUT );
+ }
+
+ generic<class TResult>
+ System::Collections::Generic::ICollection<TResult>^ ResultCollector<TResult>::GetResult(UInt32 timeout)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ auto results = m_nativeptr->get()->getResult(timeout);
+ auto rs = gcnew array<TResult>(results->size());
+ for (System::Int32 index = 0; index < results->size(); index++)
+ {
+ auto nativeptr = results->operator[](index);
+ rs[index] = Serializable::GetManagedValueGeneric<TResult>(nativeptr);
+ }
+ auto collectionlist = (ICollection<TResult>^)rs;
+ return collectionlist;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ void ResultCollector<TResult>::EndResults()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ m_nativeptr->get()->endResults();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ void ResultCollector<TResult>::ClearResults(/*bool*/)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ m_nativeptr->get()->clearResults();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ResultCollector.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ResultCollector.hpp b/clicache/src/ResultCollector.hpp
new file mode 100644
index 0000000..f75ffdc
--- /dev/null
+++ b/clicache/src/ResultCollector.hpp
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IResultCollector.hpp"
+#include "begin_native.hpp"
+#include <geode/ResultCollector.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TResult>
+ interface class IResultCollector;
+
+ /// <summary>
+ /// collect function execution results, default collector
+ /// </summary>
+ generic<class TResult>
+ public ref class ResultCollector
+ : public IResultCollector<TResult>
+ {
+ public:
+
+ /// <summary>
+ /// add result from a single function execution
+ /// </summary>
+ virtual void AddResult( TResult rs );
+
+ /// <summary>
+ /// get result
+ /// </summary>
+ virtual System::Collections::Generic::ICollection<TResult>^ GetResult();
+
+ /// <summary>
+ /// get result
+ /// </summary>
+ virtual System::Collections::Generic::ICollection<TResult>^ GetResult(UInt32 timeout);
+
+ /// <summary>
+ ///Call back provided to caller, which is called after function execution is
+ ///complete and caller can retrieve results using getResult()
+ /// </summary>
+ //generic<class TKey>
+ virtual void EndResults();
+
+ //generic<class TKey>
+ virtual void ClearResults();
+
+ internal:
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline ResultCollector( native::ResultCollectorPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::ResultCollector>(nativeptr);
+ }
+
+ native_shared_ptr<native::ResultCollector>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ResultSet.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/ResultSet.cpp b/clicache/src/ResultSet.cpp
new file mode 100644
index 0000000..8e512cc
--- /dev/null
+++ b/clicache/src/ResultSet.cpp
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#include "geode_includes.hpp"
+#include "ResultSet.hpp"
+#include "SelectResultsIterator.hpp"
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TResult>
+ bool ResultSet<TResult>::IsModifiable::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->isModifiable( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ System::Int32 ResultSet<TResult>::Size::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->size( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ TResult ResultSet<TResult>::default::get( size_t index )
+ {
+ try
+ {
+ return (Serializable::GetManagedValueGeneric<TResult>(m_nativeptr->get()->operator[](static_cast<System::Int32>(index))));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ SelectResultsIterator<TResult>^ ResultSet<TResult>::GetIterator()
+ {
+ try
+ {
+ return SelectResultsIterator<TResult>::Create(std::make_unique<apache::geode::client::SelectResultsIterator>(
+ m_nativeptr->get()->getIterator()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ System::Collections::Generic::IEnumerator<TResult>^ ResultSet<TResult>::GetEnumerator( )
+ {
+ return GetIterator( );
+ }
+
+ generic<class TResult>
+ System::Collections::IEnumerator^ ResultSet<TResult>::GetIEnumerator()
+ {
+ return GetIterator();
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ResultSet.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ResultSet.hpp b/clicache/src/ResultSet.hpp
new file mode 100644
index 0000000..bc64ede
--- /dev/null
+++ b/clicache/src/ResultSet.hpp
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/ResultSet.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+#include "ISelectResults.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ interface class IGeodeSerializable;
+
+ generic<class TResult>
+ ref class SelectResultsIterator;
+ /// <summary>
+ /// Encapsulates a query result set.
+ /// It specifies the interface for the resultset obtained from the
+ /// Geode cache server
+ /// </summary>
+ generic<class TResult>
+ public ref class ResultSet sealed
+ : public ISelectResults<TResult>
+ {
+ public:
+
+ /// <summary>
+ /// True if this <c>ResultSet</c> is modifiable.
+ /// </summary>
+ virtual property bool IsModifiable
+ {
+ virtual bool get();
+ }
+
+ /// <summary>
+ /// The size of the <c>ResultSet</c>.
+ /// </summary>
+ virtual property System::Int32 Size
+ {
+ virtual System::Int32 get();
+ }
+
+ /// <summary>
+ /// Get an object at the given index.
+ /// </summary>
+ virtual property /*IGeodeSerializable^*/TResult GFINDEXER(size_t)
+ {
+ virtual /*IGeodeSerializable^*/TResult get(size_t index);
+ }
+
+ /// <summary>
+ /// Get an iterator for the result set.
+ /// </summary>
+ virtual SelectResultsIterator<TResult>^ GetIterator();
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the collection.
+ /// </summary>
+ /// <returns>
+ /// A <c>System.Collections.Generic.IEnumerator</c> that
+ /// can be used to iterate through the <c>ResultSet</c>.
+ /// </returns>
+ virtual System::Collections::Generic::IEnumerator</*IGeodeSerializable^*/TResult>^
+ GetEnumerator();
+
+
+ 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 ResultSet<TResult>^ Create(native::ResultSetPtr nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew ResultSet<TResult>( nativeptr );
+ }
+
+
+ private:
+
+ virtual System::Collections::IEnumerator^ GetIEnumerator() sealed
+ = System::Collections::IEnumerable::GetEnumerator;
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline ResultSet(native::ResultSetPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::ResultSet>(nativeptr);
+ }
+
+ native_shared_ptr<native::ResultSet>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+