http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/TransactionId.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/TransactionId.hpp b/src/clicache/src/TransactionId.hpp index bfe1fdf..bc9339f 100644 --- a/src/clicache/src/TransactionId.hpp +++ b/src/clicache/src/TransactionId.hpp @@ -35,11 +35,11 @@ namespace GemStone /// This class encapsulates Id of a transaction. /// </summary> public ref class TransactionId sealed - : public Internal::SBWrap<gemfire::TransactionId> + : public Internal::SBWrap<apache::geode::client::TransactionId> { internal: - inline static TransactionId^ Create( gemfire::TransactionId* nativeptr ) + inline static TransactionId^ Create( apache::geode::client::TransactionId* nativeptr ) { return ( nativeptr != nullptr ? gcnew TransactionId( nativeptr ) : nullptr ); @@ -51,7 +51,7 @@ namespace GemStone /// Private constructor to wrap a native object pointer /// </summary> /// <param name="nativeptr">The native object pointer</param> - inline TransactionId( gemfire::TransactionId* nativeptr ) + inline TransactionId( apache::geode::client::TransactionId* nativeptr ) : SBWrap( nativeptr ) { } }; }
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/UserFunctionExecutionException.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/UserFunctionExecutionException.cpp b/src/clicache/src/UserFunctionExecutionException.cpp index 49217e0..27df568 100644 --- a/src/clicache/src/UserFunctionExecutionException.cpp +++ b/src/clicache/src/UserFunctionExecutionException.cpp @@ -55,7 +55,7 @@ namespace GemStone { _GF_MG_EXCEPTION_TRY2 - gemfire::CacheableStringPtr value = NativePtr->getMessage( ); + apache::geode::client::CacheableStringPtr value = NativePtr->getMessage( ); return CacheableString::GetString( value.ptr( ) ); _GF_MG_EXCEPTION_CATCH_ALL2 @@ -65,7 +65,7 @@ namespace GemStone { _GF_MG_EXCEPTION_TRY2 - gemfire::CacheableStringPtr value = NativePtr->getName( ); + apache::geode::client::CacheableStringPtr value = NativePtr->getName( ); return CacheableString::GetString( value.ptr( ) ); _GF_MG_EXCEPTION_CATCH_ALL2 http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/UserFunctionExecutionException.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/UserFunctionExecutionException.hpp b/src/clicache/src/UserFunctionExecutionException.hpp index 1dfa091..2178eae 100644 --- a/src/clicache/src/UserFunctionExecutionException.hpp +++ b/src/clicache/src/UserFunctionExecutionException.hpp @@ -38,7 +38,7 @@ namespace GemStone /// UserFunctionExecutionException class is used to encapsulate gemfire sendException in case of Function execution. /// </summary> public ref class UserFunctionExecutionException sealed - : public Internal::SBWrap<gemfire::UserFunctionExecutionException>, public IGFSerializable + : public Internal::SBWrap<apache::geode::client::UserFunctionExecutionException>, public IGFSerializable { public: // IGFSerializable members @@ -124,7 +124,7 @@ namespace GemStone /// Private constructor to wrap a native object pointer. /// </summary> /// <param name="nativeptr">The native object pointer</param> - inline UserFunctionExecutionException( gemfire::UserFunctionExecutionException* nativeptr ) + inline UserFunctionExecutionException( apache::geode::client::UserFunctionExecutionException* nativeptr ) : SBWrap( nativeptr ) { } }; http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/Utils.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/Utils.cpp b/src/clicache/src/Utils.cpp index d5b1230..3f8cb33 100644 --- a/src/clicache/src/Utils.cpp +++ b/src/clicache/src/Utils.cpp @@ -70,7 +70,7 @@ namespace GemStone int32_t Utils::LastError::get( ) { - return gemfire::Utils::getLastError( ); + return apache::geode::client::Utils::getLastError( ); } } } http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/AppDomainContext.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/AppDomainContext.cpp b/src/clicache/src/impl/AppDomainContext.cpp index f500e51..d3fd91e 100644 --- a/src/clicache/src/impl/AppDomainContext.cpp +++ b/src/clicache/src/impl/AppDomainContext.cpp @@ -21,7 +21,7 @@ namespace GemStone { namespace GemFire { namespace Cache { namespace Generic { -gemfire::AppDomainContext* createAppDomainContext() { +apache::geode::client::AppDomainContext* createAppDomainContext() { return new AppDomainContext(); } } http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/AppDomainContext.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/AppDomainContext.hpp b/src/clicache/src/impl/AppDomainContext.hpp index a97ad5f..9135e5b 100644 --- a/src/clicache/src/impl/AppDomainContext.hpp +++ b/src/clicache/src/impl/AppDomainContext.hpp @@ -46,7 +46,7 @@ public: * Captures the current thread's AppDomain for later use in associating a native * thread with this instanaces AppDomain. */ -class AppDomainContext : public gemfire::AppDomainContext { +class AppDomainContext : public apache::geode::client::AppDomainContext { public: AppDomainContext() { functionDelegate = gcnew AppDomainContextWrapper::Delegate(gcnew AppDomainContextWrapper(), @@ -64,7 +64,7 @@ private: AppDomainContextWrapper::Function functionPointer; }; -gemfire::AppDomainContext* createAppDomainContext(); +apache::geode::client::AppDomainContext* createAppDomainContext(); } } http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/AuthenticatedCache.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/AuthenticatedCache.cpp b/src/clicache/src/impl/AuthenticatedCache.cpp index b9e6a77..92edaba 100644 --- a/src/clicache/src/impl/AuthenticatedCache.cpp +++ b/src/clicache/src/impl/AuthenticatedCache.cpp @@ -56,7 +56,7 @@ namespace GemStone _GF_MG_EXCEPTION_TRY2 ManagedString mg_path( path ); - gemfire::RegionPtr& nativeptr( + apache::geode::client::RegionPtr& nativeptr( NativePtr->getRegion( mg_path.CharPtr ) ); return Generic::Region<TKey, TValue>::Create( nativeptr.ptr( ) ); @@ -77,14 +77,14 @@ namespace GemStone generic<class TKey, class TValue> array<IRegion<TKey, TValue>^>^ AuthenticatedCache::RootRegions( ) { - gemfire::VectorOfRegion vrr; + apache::geode::client::VectorOfRegion vrr; NativePtr->rootRegions( vrr ); array<IRegion<TKey, TValue>^>^ rootRegions = gcnew array<IRegion<TKey, TValue>^>( vrr.size( ) ); for( int32_t index = 0; index < vrr.size( ); index++ ) { - gemfire::RegionPtr& nativeptr( vrr[ index ] ); + apache::geode::client::RegionPtr& nativeptr( vrr[ index ] ); rootRegions[ index ] = Generic::Region<TKey, TValue>::Create( nativeptr.ptr( ) ); } return rootRegions; http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/AuthenticatedCache.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/AuthenticatedCache.hpp b/src/clicache/src/impl/AuthenticatedCache.hpp index a962e2c..c669106 100644 --- a/src/clicache/src/impl/AuthenticatedCache.hpp +++ b/src/clicache/src/impl/AuthenticatedCache.hpp @@ -61,7 +61,7 @@ namespace GemStone /// </para> /// </remarks> public ref class AuthenticatedCache - : public IRegionService, Internal::SBWrap<gemfire::RegionService> + : public IRegionService, Internal::SBWrap<apache::geode::client::RegionService> { public: @@ -147,7 +147,7 @@ namespace GemStone /// <returns> /// The managed wrapper object; null if the native pointer is null. /// </returns> - inline static AuthenticatedCache^ Create( gemfire::RegionService* nativeptr ) + inline static AuthenticatedCache^ Create( apache::geode::client::RegionService* nativeptr ) { return ( nativeptr != nullptr ? gcnew AuthenticatedCache( nativeptr ) : nullptr ); @@ -159,7 +159,7 @@ namespace GemStone /// Private constructor to wrap a native object pointer /// </summary> /// <param name="nativeptr">The native object pointer</param> - inline AuthenticatedCache( gemfire::RegionService* nativeptr ) + inline AuthenticatedCache( apache::geode::client::RegionService* nativeptr ) : SBWrap( nativeptr ) { } }; } // end namespace Generic http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/CacheListener.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CacheListener.hpp b/src/clicache/src/impl/CacheListener.hpp index d2afdbe..e778672 100644 --- a/src/clicache/src/impl/CacheListener.hpp +++ b/src/clicache/src/impl/CacheListener.hpp @@ -49,61 +49,61 @@ namespace GemStone virtual void AfterUpdate(GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^>^ event) override { - EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::EntryEvent>(event)); + EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::EntryEvent>(event)); m_listener->AfterUpdate(%gevent); } virtual void AfterCreate(GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^>^ event) override { - EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::EntryEvent>(event)); + EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::EntryEvent>(event)); m_listener->AfterCreate(%gevent); } virtual void AfterInvalidate(GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^>^ event) override { - EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::EntryEvent>(event)); + EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::EntryEvent>(event)); m_listener->AfterInvalidate(%gevent); } virtual void AfterDestroy(GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^>^ event) override { - EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::EntryEvent>(event)); + EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::EntryEvent>(event)); m_listener->AfterDestroy(%gevent); } virtual void AfterRegionLive(GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^>^ event) override { - RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::RegionEvent>(event)); + RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::RegionEvent>(event)); m_listener->AfterRegionLive(%gevent); } virtual void AfterRegionClear(GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^>^ event) override { - RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::RegionEvent>(event)); + RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::RegionEvent>(event)); m_listener->AfterRegionClear(%gevent); } virtual void AfterRegionDestroy(GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^>^ event) override { - RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::RegionEvent>(event)); + RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::RegionEvent>(event)); m_listener->AfterRegionDestroy(%gevent); } virtual void AfterRegionInvalidate(GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^>^ event) override { - RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::RegionEvent>(event)); + RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::RegionEvent>(event)); m_listener->AfterRegionInvalidate(%gevent); } virtual void AfterRegionDisconnected(GemStone::GemFire::Cache::Generic::IRegion<Object^, Object^>^ event) override { - GemStone::GemFire::Cache::Generic::IRegion<TKey, TValue>^ gevent = GemStone::GemFire::Cache::Generic::Region<TKey, TValue>::Create(GemStone::GemFire::Cache::Generic::GetNativePtr<gemfire::Region>(reinterpret_cast<GemStone::GemFire::Cache::Generic::Region<Object^, Object^>^>(event))); + GemStone::GemFire::Cache::Generic::IRegion<TKey, TValue>^ gevent = GemStone::GemFire::Cache::Generic::Region<TKey, TValue>::Create(GemStone::GemFire::Cache::Generic::GetNativePtr<apache::geode::client::Region>(reinterpret_cast<GemStone::GemFire::Cache::Generic::Region<Object^, Object^>^>(event))); m_listener->AfterRegionDisconnected(gevent); } virtual void Close(GemStone::GemFire::Cache::Generic::IRegion<Object^, Object^>^ event) override { - GemStone::GemFire::Cache::Generic::IRegion<TKey, TValue>^ gevent = GemStone::GemFire::Cache::Generic::Region<TKey, TValue>::Create(GemStone::GemFire::Cache::Generic::GetNativePtr<gemfire::Region>(reinterpret_cast<GemStone::GemFire::Cache::Generic::Region<Object^, Object^>^>(event))); + GemStone::GemFire::Cache::Generic::IRegion<TKey, TValue>^ gevent = GemStone::GemFire::Cache::Generic::Region<TKey, TValue>::Create(GemStone::GemFire::Cache::Generic::GetNativePtr<apache::geode::client::Region>(reinterpret_cast<GemStone::GemFire::Cache::Generic::Region<Object^, Object^>^>(event))); m_listener->Close(gevent); } }; http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/CacheLoader.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CacheLoader.hpp b/src/clicache/src/impl/CacheLoader.hpp index e1be614..1fe796a 100644 --- a/src/clicache/src/impl/CacheLoader.hpp +++ b/src/clicache/src/impl/CacheLoader.hpp @@ -40,10 +40,10 @@ namespace GemStone public interface class ICacheLoaderProxy { public: - gemfire::CacheablePtr load( const gemfire::RegionPtr& region, - const gemfire::CacheableKeyPtr& key, const gemfire::UserDataPtr& helper ); + apache::geode::client::CacheablePtr load( const apache::geode::client::RegionPtr& region, + const apache::geode::client::CacheableKeyPtr& key, const apache::geode::client::UserDataPtr& helper ); - void close( const gemfire::RegionPtr& region ); + void close( const apache::geode::client::RegionPtr& region ); }; generic<class TKey, class TValue> @@ -60,8 +60,8 @@ namespace GemStone m_loader = loader; } - virtual gemfire::CacheablePtr load( const gemfire::RegionPtr& region, - const gemfire::CacheableKeyPtr& key, const gemfire::UserDataPtr& helper ) + virtual apache::geode::client::CacheablePtr load( const apache::geode::client::RegionPtr& region, + const apache::geode::client::CacheableKeyPtr& key, const apache::geode::client::UserDataPtr& helper ) { IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.ptr()); @@ -73,7 +73,7 @@ namespace GemStone return Serializable::GetUnmanagedValueGeneric<TValue>(m_loader->Load(gregion, gkey, ghelper)); } - virtual void close( const gemfire::RegionPtr& region ) + virtual void close( const apache::geode::client::RegionPtr& region ) { IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.ptr()); m_loader->Close(gregion); http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/CacheWriter.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CacheWriter.hpp b/src/clicache/src/impl/CacheWriter.hpp index 65a5e3f..7c7dc6f 100644 --- a/src/clicache/src/impl/CacheWriter.hpp +++ b/src/clicache/src/impl/CacheWriter.hpp @@ -49,37 +49,37 @@ namespace GemStone virtual bool BeforeUpdate( GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^>^ ev ) override { - EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::EntryEvent>(ev)); + EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::EntryEvent>(ev)); return m_writer->BeforeUpdate(%gevent); } virtual bool BeforeCreate(GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^>^ ev) override { - EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::EntryEvent>(ev)); + EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::EntryEvent>(ev)); return m_writer->BeforeCreate(%gevent); } virtual bool BeforeDestroy(GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^>^ ev) override { - EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::EntryEvent>(ev)); + EntryEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::EntryEvent>(ev)); return m_writer->BeforeDestroy(%gevent); } virtual bool BeforeRegionClear( GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^>^ ev ) override { - RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::RegionEvent>(ev)); + RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::RegionEvent>(ev)); return m_writer->BeforeRegionClear(%gevent); } virtual bool BeforeRegionDestroy(GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^>^ ev) override { - RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<gemfire::RegionEvent>(ev)); + RegionEvent<TKey, TValue> gevent(Generic::GetNativePtr<apache::geode::client::RegionEvent>(ev)); return m_writer->BeforeRegionDestroy(%gevent); } virtual void Close(GemStone::GemFire::Cache::Generic::Region<Object^, Object^>^ region) override { - IRegion<TKey, TValue>^ gregion = GemStone::GemFire::Cache::Generic::Region<TKey, TValue>::Create(Generic::GetNativePtr<gemfire::Region>(region)); + IRegion<TKey, TValue>^ gregion = GemStone::GemFire::Cache::Generic::Region<TKey, TValue>::Create(Generic::GetNativePtr<apache::geode::client::Region>(region)); m_writer->Close(gregion); } }; http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/CqListenerProxy.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CqListenerProxy.hpp b/src/clicache/src/impl/CqListenerProxy.hpp index da3b81f..5ff3793 100644 --- a/src/clicache/src/impl/CqListenerProxy.hpp +++ b/src/clicache/src/impl/CqListenerProxy.hpp @@ -47,14 +47,14 @@ namespace GemStone virtual void OnEvent( GemStone::GemFire::Cache::Generic::CqEvent<Object^, Object^>^ ev) { //TODO:split---Done - CqEvent<TKey, TResult> gevent(GetNativePtr<gemfire::CqEvent>(ev)); + CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev)); m_listener->OnEvent(%gevent); } virtual void OnError(GemStone::GemFire::Cache::Generic::CqEvent<Object^, Object^>^ ev) { //TODO::split--Done - CqEvent<TKey, TResult> gevent(GetNativePtr<gemfire::CqEvent>(ev)); + CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev)); m_listener->OnError(%gevent); } http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/CqStatusListenerProxy.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CqStatusListenerProxy.hpp b/src/clicache/src/impl/CqStatusListenerProxy.hpp index 2b7973b..05f33e4 100644 --- a/src/clicache/src/impl/CqStatusListenerProxy.hpp +++ b/src/clicache/src/impl/CqStatusListenerProxy.hpp @@ -45,14 +45,14 @@ namespace GemStone virtual void OnEvent(GemStone::GemFire::Cache::Generic::CqEvent<Object^, Object^>^ ev) { //TODO:split---Done - CqEvent<TKey, TResult> gevent(GetNativePtr<gemfire::CqEvent>(ev)); + CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev)); m_listener->OnEvent(%gevent); } virtual void OnError( GemStone::GemFire::Cache::Generic::CqEvent<Object^, Object^>^ ev) { //TODO::split--Done - CqEvent<TKey, TResult> gevent(GetNativePtr<gemfire::CqEvent>(ev)); + CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev)); m_listener->OnError(%gevent); } http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/DelegateWrapper.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/DelegateWrapper.hpp b/src/clicache/src/impl/DelegateWrapper.hpp index abc989d..136afd5 100644 --- a/src/clicache/src/impl/DelegateWrapper.hpp +++ b/src/clicache/src/impl/DelegateWrapper.hpp @@ -36,7 +36,7 @@ namespace GemStone /// Template class to wrap a managed <see cref="TypeFactoryMethod" /> /// delegate that returns an <see cref="IGFSerializable" /> object. It contains /// a method that converts the managed object gotten by invoking the - /// delegate to the native <c>gemfire::Serializable</c> object + /// delegate to the native <c>apache::geode::client::Serializable</c> object /// (using the provided wrapper class constructor). /// </summary> /// <remarks> @@ -45,14 +45,14 @@ namespace GemStone /// In the managed world a user would register a managed type by providing /// a factory delegate returning an object of that type. However, the /// native implementation requires a factory function that returns an - /// object implementing <c>gemfire::Serializable</c>. Normally this would not + /// object implementing <c>apache::geode::client::Serializable</c>. Normally this would not /// be possible since we require to dynamically generate a new function /// for a given delegate. /// /// Fortunately in the managed world the delegates contain an implicit /// 'this' pointer. Thus we can have a universal delegate that contains /// the given managed delegate (in the 'this' pointer) and returns the - /// native <c>gemfire::Serializable</c> object. Additionally marshalling + /// native <c>apache::geode::client::Serializable</c> object. Additionally marshalling /// services provide <c>Marshal.GetFunctionPointerForDelegate</c> which gives /// a function pointer for a delegate which completes the conversion. /// </remarks> @@ -67,14 +67,14 @@ namespace GemStone : m_delegate( typeDelegate ) { } /// <summary> - /// Returns the native <c>gemfire::Serializable</c> object by invoking the + /// Returns the native <c>apache::geode::client::Serializable</c> object by invoking the /// managed delegate provided in the constructor. /// </summary> /// <returns> - /// Native <c>gemfire::Serializable</c> object after invoking the managed + /// Native <c>apache::geode::client::Serializable</c> object after invoking the managed /// delegate and wrapping inside a <c>ManagedCacheableKey</c> object. /// </returns> - gemfire::Serializable* NativeDelegateGeneric( ) + apache::geode::client::Serializable* NativeDelegateGeneric( ) { IGFSerializable^ tempObj = m_delegate( ); IGFDelta^ tempDelta = @@ -82,14 +82,14 @@ namespace GemStone if( tempDelta != nullptr ) { if(!SafeConvertClassGeneric::isAppDomainEnabled) - return new gemfire::ManagedCacheableDeltaGeneric( tempDelta ); + return new apache::geode::client::ManagedCacheableDeltaGeneric( tempDelta ); else - return new gemfire::ManagedCacheableDeltaBytesGeneric( tempDelta, false ); + return new apache::geode::client::ManagedCacheableDeltaBytesGeneric( tempDelta, false ); } else if(!SafeConvertClassGeneric::isAppDomainEnabled) - return new gemfire::ManagedCacheableKeyGeneric( tempObj); + return new apache::geode::client::ManagedCacheableKeyGeneric( tempObj); else - return new gemfire::ManagedCacheableKeyBytesGeneric( tempObj, false); + return new apache::geode::client::ManagedCacheableKeyBytesGeneric( tempObj, false); } http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/FixedPartitionResolver.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/FixedPartitionResolver.hpp b/src/clicache/src/impl/FixedPartitionResolver.hpp index 33a1cad..a5e19e3 100644 --- a/src/clicache/src/impl/FixedPartitionResolver.hpp +++ b/src/clicache/src/impl/FixedPartitionResolver.hpp @@ -34,9 +34,9 @@ namespace GemStone public interface class IFixedPartitionResolverProxy { public: - gemfire::CacheableKeyPtr getRoutingObject(const gemfire::EntryEvent& ev); + apache::geode::client::CacheableKeyPtr getRoutingObject(const apache::geode::client::EntryEvent& ev); const char * getName(); - const char* getPartitionName(const gemfire::EntryEvent& opDetails); + const char* getPartitionName(const apache::geode::client::EntryEvent& opDetails); }; generic<class TKey, class TValue> @@ -56,7 +56,7 @@ namespace GemStone m_strList = gcnew Dictionary<String^, ManagedString^>(); } - virtual gemfire::CacheableKeyPtr getRoutingObject(const gemfire::EntryEvent& ev) + virtual apache::geode::client::CacheableKeyPtr getRoutingObject(const apache::geode::client::EntryEvent& ev) { EntryEvent<TKey, TValue> gevent(&ev); Object^ groutingobject = m_resolver->GetRoutingObject(%gevent); @@ -69,11 +69,11 @@ namespace GemStone return mg_name.CharPtr; } - virtual const char* getPartitionName(const gemfire::EntryEvent& opDetails) + virtual const char* getPartitionName(const apache::geode::client::EntryEvent& opDetails) { if (m_fixedResolver == nullptr) { - throw gemfire::IllegalStateException("GetPartitionName() called on non fixed partition resolver."); + throw apache::geode::client::IllegalStateException("GetPartitionName() called on non fixed partition resolver."); } EntryEvent<TKey, TValue> gevent(&opDetails); http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/ManagedAuthInitialize.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/ManagedAuthInitialize.cpp b/src/clicache/src/impl/ManagedAuthInitialize.cpp index ac3cea3..731eec7 100644 --- a/src/clicache/src/impl/ManagedAuthInitialize.cpp +++ b/src/clicache/src/impl/ManagedAuthInitialize.cpp @@ -27,184 +27,190 @@ using namespace System; using namespace System::Text; using namespace System::Reflection; -namespace gemfire +namespace apache { - - AuthInitialize* ManagedAuthInitializeGeneric::create( const char* assemblyPath, - const char* factoryFunctionName ) + namespace geode { - try + namespace client { - String^ mg_assemblyPath = - GemStone::GemFire::Cache::Generic::ManagedString::Get( assemblyPath ); - String^ mg_factoryFunctionName = - GemStone::GemFire::Cache::Generic::ManagedString::Get( factoryFunctionName ); - String^ mg_typeName = nullptr; - int32_t dotIndx = -1; - - if (mg_factoryFunctionName == nullptr || - ( dotIndx = mg_factoryFunctionName->LastIndexOf( '.' ) ) < 0 ) - { - std::string ex_str = "ManagedAuthInitializeGeneric: Factory function name '"; - ex_str += factoryFunctionName; - ex_str += "' does not contain type name"; - throw AuthenticationRequiredException( ex_str.c_str( ) ); - } - - mg_typeName = mg_factoryFunctionName->Substring( 0, dotIndx ); - mg_factoryFunctionName = mg_factoryFunctionName->Substring( dotIndx + 1 ); - - /* - String^ mg_genericKey = GemStone::GemFire::ManagedString::Get("string"); - String^ mg_genericVal = GemStone::GemFire::ManagedString::Get("object"); - - StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName); - - typeBuilder->Append("`2"); - */ - Assembly^ assmb = nullptr; - try + AuthInitialize* ManagedAuthInitializeGeneric::create(const char* assemblyPath, + const char* factoryFunctionName) { - assmb = Assembly::Load( mg_assemblyPath ); - } - catch (System::Exception^) - { - assmb = nullptr; - } - if (assmb == nullptr) - { - std::string ex_str = "ManagedAuthInitializeGeneric: Could not load assembly: "; - ex_str += assemblyPath; - throw AuthenticationRequiredException( ex_str.c_str( ) ); - } - - Object^ typeInst = assmb->CreateInstance( mg_typeName, true ); - - //Type^ typeInst = assmb->GetType(mg_typeName, false, true); + try + { + String^ mg_assemblyPath = + GemStone::GemFire::Cache::Generic::ManagedString::Get(assemblyPath); + String^ mg_factoryFunctionName = + GemStone::GemFire::Cache::Generic::ManagedString::Get(factoryFunctionName); + String^ mg_typeName = nullptr; + int32_t dotIndx = -1; + + if (mg_factoryFunctionName == nullptr || + (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0) + { + std::string ex_str = "ManagedAuthInitializeGeneric: Factory function name '"; + ex_str += factoryFunctionName; + ex_str += "' does not contain type name"; + throw AuthenticationRequiredException(ex_str.c_str()); + } - if (typeInst != nullptr) - { - /* - array<Type^>^ types = gcnew array<Type^>(2); - types[0] = Type::GetType(mg_genericKey, false, true); - types[1] = Type::GetType(mg_genericVal, false, true); + mg_typeName = mg_factoryFunctionName->Substring(0, dotIndx); + mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1); - if (types[0] == nullptr || types[1] == nullptr) - { - std::string ex_str = "ManagedAuthInitializeGeneric: Could not get both generic type argument instances"; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); - } - */ + /* + String^ mg_genericKey = GemStone::GemFire::ManagedString::Get("string"); + String^ mg_genericVal = GemStone::GemFire::ManagedString::Get("object"); - //typeInst = typeInst->GetType()->MakeGenericType(types); - GemStone::GemFire::Cache::Generic::Log::Info("Loading function: [{0}]", mg_factoryFunctionName); + StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName); - /* - MethodInfo^ mInfo = typeInst->GetMethod( mg_factoryFunctionName, - BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase ); + typeBuilder->Append("`2"); */ - MethodInfo^ mInfo = typeInst->GetType( )->GetMethod( mg_factoryFunctionName, - BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase ); - - if (mInfo != nullptr) - { - Object^ userptr = nullptr; + Assembly^ assmb = nullptr; try { - userptr = mInfo->Invoke(typeInst, nullptr); + assmb = Assembly::Load(mg_assemblyPath); } catch (System::Exception^) { - userptr = nullptr; + assmb = nullptr; } - if (userptr == nullptr) + if (assmb == nullptr) { - std::string ex_str = "ManagedAuthInitializeGeneric: Could not create " - "object on invoking factory function ["; - ex_str += factoryFunctionName; + std::string ex_str = "ManagedAuthInitializeGeneric: Could not load assembly: "; + ex_str += assemblyPath; + throw AuthenticationRequiredException(ex_str.c_str()); + } + + Object^ typeInst = assmb->CreateInstance(mg_typeName, true); + + //Type^ typeInst = assmb->GetType(mg_typeName, false, true); + + if (typeInst != nullptr) + { + /* + array<Type^>^ types = gcnew array<Type^>(2); + types[0] = Type::GetType(mg_genericKey, false, true); + types[1] = Type::GetType(mg_genericVal, false, true); + + if (types[0] == nullptr || types[1] == nullptr) + { + std::string ex_str = "ManagedAuthInitializeGeneric: Could not get both generic type argument instances"; + throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + } + */ + + //typeInst = typeInst->GetType()->MakeGenericType(types); + GemStone::GemFire::Cache::Generic::Log::Info("Loading function: [{0}]", mg_factoryFunctionName); + + /* + MethodInfo^ mInfo = typeInst->GetMethod( mg_factoryFunctionName, + BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase ); + */ + + MethodInfo^ mInfo = typeInst->GetType()->GetMethod(mg_factoryFunctionName, + BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase); + + if (mInfo != nullptr) + { + Object^ userptr = nullptr; + try + { + userptr = mInfo->Invoke(typeInst, nullptr); + } + catch (System::Exception^) + { + userptr = nullptr; + } + if (userptr == nullptr) + { + std::string ex_str = "ManagedAuthInitializeGeneric: Could not create " + "object on invoking factory function ["; + ex_str += factoryFunctionName; + ex_str += "] in assembly: "; + ex_str += assemblyPath; + throw AuthenticationRequiredException(ex_str.c_str()); + } + ManagedAuthInitializeGeneric * maig = new ManagedAuthInitializeGeneric(safe_cast<GemStone::GemFire::Cache::Generic::IAuthInitialize^>(userptr)); + return maig; + } + else + { + std::string ex_str = "ManagedAuthInitializeGeneric: Could not load " + "function with name ["; + ex_str += factoryFunctionName; + ex_str += "] in assembly: "; + ex_str += assemblyPath; + throw AuthenticationRequiredException(ex_str.c_str()); + } + } + else + { + GemStone::GemFire::Cache::Generic::ManagedString typeName(mg_typeName); + std::string ex_str = "ManagedAuthInitializeGeneric: Could not load type ["; + ex_str += typeName.CharPtr; ex_str += "] in assembly: "; ex_str += assemblyPath; - throw AuthenticationRequiredException( ex_str.c_str( ) ); + throw AuthenticationRequiredException(ex_str.c_str()); } - ManagedAuthInitializeGeneric * maig = new ManagedAuthInitializeGeneric(safe_cast<GemStone::GemFire::Cache::Generic::IAuthInitialize^>(userptr)); - return maig; } - else + catch (const apache::geode::client::AuthenticationRequiredException&) + { + throw; + } + catch (const apache::geode::client::Exception& ex) { - std::string ex_str = "ManagedAuthInitializeGeneric: Could not load " - "function with name ["; - ex_str += factoryFunctionName; - ex_str += "] in assembly: "; - ex_str += assemblyPath; - throw AuthenticationRequiredException( ex_str.c_str( ) ); + std::string ex_str = "ManagedAuthInitializeGeneric: Got an exception while " + "loading managed library: "; + ex_str += ex.getName(); + ex_str += ": "; + ex_str += ex.getMessage(); + throw AuthenticationRequiredException(ex_str.c_str()); + } + catch (System::Exception^ ex) + { + GemStone::GemFire::Cache::Generic::ManagedString mg_exStr(ex->ToString()); + std::string ex_str = "ManagedAuthInitializeGeneric: Got an exception while " + "loading managed library: "; + ex_str += mg_exStr.CharPtr; + throw AuthenticationRequiredException(ex_str.c_str()); + } + return NULL; + } + + PropertiesPtr ManagedAuthInitializeGeneric::getCredentials(PropertiesPtr& + securityprops, const char* server) + { + try { + GemStone::GemFire::Cache::Generic::Properties<String^, String^>^ mprops = + GemStone::GemFire::Cache::Generic::Properties<String^, String^>::Create<String^, String^>(securityprops.ptr()); + String^ mg_server = GemStone::GemFire::Cache::Generic::ManagedString::Get(server); + + return PropertiesPtr(m_managedptr->GetCredentials(mprops, mg_server)->NativePtr()); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } + return NULLPTR; } - else + + void ManagedAuthInitializeGeneric::close() { - GemStone::GemFire::Cache::Generic::ManagedString typeName( mg_typeName ); - std::string ex_str = "ManagedAuthInitializeGeneric: Could not load type ["; - ex_str += typeName.CharPtr; - ex_str += "] in assembly: "; - ex_str += assemblyPath; - throw AuthenticationRequiredException( ex_str.c_str( ) ); + try { + m_managedptr->Close(); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } } - } - catch (const gemfire::AuthenticationRequiredException&) - { - throw; - } - catch (const gemfire::Exception& ex) - { - std::string ex_str = "ManagedAuthInitializeGeneric: Got an exception while " - "loading managed library: "; - ex_str += ex.getName( ); - ex_str += ": "; - ex_str += ex.getMessage( ); - throw AuthenticationRequiredException( ex_str.c_str( ) ); - } - catch (System::Exception^ ex) - { - GemStone::GemFire::Cache::Generic::ManagedString mg_exStr( ex->ToString( ) ); - std::string ex_str = "ManagedAuthInitializeGeneric: Got an exception while " - "loading managed library: "; - ex_str += mg_exStr.CharPtr; - throw AuthenticationRequiredException( ex_str.c_str( ) ); - } - return NULL; - } - - PropertiesPtr ManagedAuthInitializeGeneric::getCredentials( PropertiesPtr& - securityprops, const char* server ) - { - try { - GemStone::GemFire::Cache::Generic::Properties<String^, String^>^ mprops = - GemStone::GemFire::Cache::Generic::Properties<String^, String^>::Create<String^, String^>(securityprops.ptr()); - String^ mg_server = GemStone::GemFire::Cache::Generic::ManagedString::Get( server ); - - return PropertiesPtr(m_managedptr->GetCredentials(mprops, mg_server)->NativePtr()); - } - catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { - ex->ThrowNative(); - } - catch (System::Exception^ ex) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - return NULLPTR; - } - - void ManagedAuthInitializeGeneric::close( ) - { - try { - m_managedptr->Close( ); - } - catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { - ex->ThrowNative(); - } - catch (System::Exception^ ex) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - -} + + } // namespace client + } // namespace geode +} // namespace apache http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/ManagedAuthInitialize.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/ManagedAuthInitialize.hpp b/src/clicache/src/impl/ManagedAuthInitialize.hpp index b7fcfad..93df540 100644 --- a/src/clicache/src/impl/ManagedAuthInitialize.hpp +++ b/src/clicache/src/impl/ManagedAuthInitialize.hpp @@ -22,98 +22,103 @@ #include <vcclr.h> #include "../IAuthInitialize.hpp" -//using namespace gemfire; +//using namespace apache::geode::client; -namespace gemfire +namespace apache { - - /// <summary> - /// Wraps the managed <see cref="GemStone.GemFire.Cache.Generic.IAuthInitialize" /> - /// object and implements the native <c>gemfire::AuthInitialize</c> interface. - /// </summary> - class ManagedAuthInitializeGeneric - : public gemfire::AuthInitialize + namespace geode { - public: + namespace client + { - /// <summary> - /// Constructor to initialize with the provided managed object. - /// </summary> - /// <param name="managedptr"> - /// The managed object. - /// </param> - inline ManagedAuthInitializeGeneric(GemStone::GemFire::Cache::Generic::IAuthInitialize^ managedptr) - : m_managedptr(managedptr) { } + /// <summary> + /// Wraps the managed <see cref="GemStone.GemFire.Cache.Generic.IAuthInitialize" /> + /// object and implements the native <c>apache::geode::client::AuthInitialize</c> interface. + /// </summary> + class ManagedAuthInitializeGeneric + : public apache::geode::client::AuthInitialize + { + public: - /// <summary> - /// Static function to create a <c>ManagedAuthInitialize</c> using given - /// managed assembly path and given factory function. - /// </summary> - /// <param name="assemblyPath"> - /// The path of the managed assembly that contains the <c>IAuthInitialize</c> - /// factory function. - /// </param> - /// <param name="factoryFunctionName"> - /// The name of the factory function of the managed class for creating - /// an object that implements <c>IAuthInitialize</c>. - /// This should be a static function of the format - /// {Namespace}.{Class Name}.{Method Name}. - /// </param> - /// <exception cref="IllegalArgumentException"> - /// If the managed library cannot be loaded or the factory function fails. - /// </exception> - static AuthInitialize* create( const char* assemblyPath, - const char* factoryFunctionName ); + /// <summary> + /// Constructor to initialize with the provided managed object. + /// </summary> + /// <param name="managedptr"> + /// The managed object. + /// </param> + inline ManagedAuthInitializeGeneric(GemStone::GemFire::Cache::Generic::IAuthInitialize^ managedptr) + : m_managedptr(managedptr) { } - /// <summary> - /// Called when the cache is going down - /// </summary> - /// <remarks> - /// Implementations should clean up any external - /// resources, such as database connections. Any runtime exceptions this method - /// throws will be logged. - /// <para> - /// It is possible for this method to be called multiple times on a single - /// callback instance, so implementations must be tolerant of this. - /// </para> - /// </remarks> - /// <seealso cref="GemStone.GemFire.Cache.Cache.Close" /> - virtual void close( ); + /// <summary> + /// Static function to create a <c>ManagedAuthInitialize</c> using given + /// managed assembly path and given factory function. + /// </summary> + /// <param name="assemblyPath"> + /// The path of the managed assembly that contains the <c>IAuthInitialize</c> + /// factory function. + /// </param> + /// <param name="factoryFunctionName"> + /// The name of the factory function of the managed class for creating + /// an object that implements <c>IAuthInitialize</c>. + /// This should be a static function of the format + /// {Namespace}.{Class Name}.{Method Name}. + /// </param> + /// <exception cref="IllegalArgumentException"> + /// If the managed library cannot be loaded or the factory function fails. + /// </exception> + static AuthInitialize* create(const char* assemblyPath, + const char* factoryFunctionName); - /// <summary> - /// Initialize with the given set of security properties and return the - /// credentials for the given client as properties. - /// </summary> - /// <param name="securityprops">Given set of properties with which - /// to initialize - /// </param> - /// <param name="server">It is the ID of the endpoint - /// </param> - virtual PropertiesPtr getCredentials(PropertiesPtr& securityprops, const char* server); + /// <summary> + /// Called when the cache is going down + /// </summary> + /// <remarks> + /// Implementations should clean up any external + /// resources, such as database connections. Any runtime exceptions this method + /// throws will be logged. + /// <para> + /// It is possible for this method to be called multiple times on a single + /// callback instance, so implementations must be tolerant of this. + /// </para> + /// </remarks> + /// <seealso cref="GemStone.GemFire.Cache.Cache.Close" /> + virtual void close(); - virtual ~ManagedAuthInitializeGeneric( ) { } + /// <summary> + /// Initialize with the given set of security properties and return the + /// credentials for the given client as properties. + /// </summary> + /// <param name="securityprops">Given set of properties with which + /// to initialize + /// </param> + /// <param name="server">It is the ID of the endpoint + /// </param> + virtual PropertiesPtr getCredentials(PropertiesPtr& securityprops, const char* server); - /// <summary> - /// Returns the wrapped managed object reference. - /// </summary> - inline GemStone::GemFire::Cache::Generic::IAuthInitialize^ ptr( ) const - { - return m_managedptr; - } + virtual ~ManagedAuthInitializeGeneric() { } - private: + /// <summary> + /// Returns the wrapped managed object reference. + /// </summary> + inline GemStone::GemFire::Cache::Generic::IAuthInitialize^ ptr() const + { + return m_managedptr; + } - /// <summary> - /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly). - /// Note: not using auto_gcroot since it will result in 'Dispose' of the ICacheLoader - /// to be called which is not what is desired when this object is destroyed. Normally this - /// managed object may be created by the user and will be handled automatically by the GC. - /// </summary> - gcroot<GemStone::GemFire::Cache::Generic::IAuthInitialize^> m_managedptr; + private: - // Disable the copy and assignment constructors - ManagedAuthInitializeGeneric( const ManagedAuthInitializeGeneric& ); - ManagedAuthInitializeGeneric& operator = ( const ManagedAuthInitializeGeneric& ); - }; + /// <summary> + /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly). + /// Note: not using auto_gcroot since it will result in 'Dispose' of the ICacheLoader + /// to be called which is not what is desired when this object is destroyed. Normally this + /// managed object may be created by the user and will be handled automatically by the GC. + /// </summary> + gcroot<GemStone::GemFire::Cache::Generic::IAuthInitialize^> m_managedptr; -} + // Disable the copy and assignment constructors + ManagedAuthInitializeGeneric(const ManagedAuthInitializeGeneric&); + ManagedAuthInitializeGeneric& operator = (const ManagedAuthInitializeGeneric&); + }; + } // namespace client + } // namespace geode +} // namespace apache http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/ManagedCacheListener.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/ManagedCacheListener.cpp b/src/clicache/src/impl/ManagedCacheListener.cpp index 35a1498..fc678fb 100644 --- a/src/clicache/src/impl/ManagedCacheListener.cpp +++ b/src/clicache/src/impl/ManagedCacheListener.cpp @@ -31,326 +31,332 @@ using namespace System; using namespace System::Text; using namespace System::Reflection; -namespace gemfire +namespace apache { - - gemfire::CacheListener* ManagedCacheListenerGeneric::create( const char* assemblyPath, - const char* factoryFunctionName ) + namespace geode { - try + namespace client { - String^ mg_assemblyPath = - GemStone::GemFire::Cache::Generic::ManagedString::Get( assemblyPath ); - String^ mg_factoryFunctionName = - GemStone::GemFire::Cache::Generic::ManagedString::Get(factoryFunctionName); - String^ mg_typeName = nullptr; - - String^ mg_genericKey = nullptr; - String^ mg_genericVal = nullptr; - - int32_t dotIndx = -1; - int32_t genericsOpenIndx = -1; - int32_t genericsCloseIndx = -1; - int32_t commaIndx = -1; - - if (mg_factoryFunctionName == nullptr || - ( dotIndx = mg_factoryFunctionName->LastIndexOf( '.' ) ) < 0 ) + + apache::geode::client::CacheListener* ManagedCacheListenerGeneric::create(const char* assemblyPath, + const char* factoryFunctionName) { - std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '"; - ex_str += factoryFunctionName; - ex_str += "' does not contain type name"; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); + try + { + String^ mg_assemblyPath = + GemStone::GemFire::Cache::Generic::ManagedString::Get(assemblyPath); + String^ mg_factoryFunctionName = + GemStone::GemFire::Cache::Generic::ManagedString::Get(factoryFunctionName); + String^ mg_typeName = nullptr; + + String^ mg_genericKey = nullptr; + String^ mg_genericVal = nullptr; + + int32_t dotIndx = -1; + int32_t genericsOpenIndx = -1; + int32_t genericsCloseIndx = -1; + int32_t commaIndx = -1; + + if (mg_factoryFunctionName == nullptr || + (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0) + { + std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '"; + ex_str += factoryFunctionName; + ex_str += "' does not contain type name"; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + + if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0) + { + std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '"; + ex_str += factoryFunctionName; + ex_str += "' does not contain any generic type parameters"; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + + if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 || + genericsOpenIndx > genericsCloseIndx) + { + std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '"; + ex_str += factoryFunctionName; + ex_str += "' does not contain expected generic type parameters"; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + + if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 || + (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx)) + { + std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '"; + ex_str += factoryFunctionName; + ex_str += "' does not contain expected generic type parameter comma separator"; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + + StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx)); + mg_typeName = typeBuilder->ToString(); + mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1); + mg_genericKey = mg_genericKey->Trim(); + mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1); + mg_genericVal = mg_genericVal->Trim(); + mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1); + + GemStone::GemFire::Cache::Generic::Log::Fine("Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.", + mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName); + + typeBuilder->Append("`2"); + mg_typeName = typeBuilder->ToString(); + + Assembly^ assmb = nullptr; + try + { + assmb = Assembly::Load(mg_assemblyPath); + } + catch (System::Exception^) + { + assmb = nullptr; + } + if (assmb == nullptr) + { + std::string ex_str = "ManagedCacheListenerGeneric: Could not load assembly: "; + ex_str += assemblyPath; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + + GemStone::GemFire::Cache::Generic::Log::Debug("Loading type: [{0}]", mg_typeName); + + Type^ typeInst = assmb->GetType(mg_typeName, false, true); + + if (typeInst != nullptr) + { + array<Type^>^ types = gcnew array<Type^>(2); + types[0] = Type::GetType(mg_genericKey, false, true); + types[1] = Type::GetType(mg_genericVal, false, true); + + if (types[0] == nullptr || types[1] == nullptr) + { + std::string ex_str = "ManagedCacheListenerGeneric: Could not get both generic type argument instances"; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + + typeInst = typeInst->MakeGenericType(types); + GemStone::GemFire::Cache::Generic::Log::Info("Loading function: [{0}]", mg_factoryFunctionName); + + MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName, + BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase); + + if (mInfo != nullptr) + { + Object^ userptr = nullptr; + try + { + userptr = mInfo->Invoke(typeInst, nullptr); + } + catch (System::Exception^ ex) + { + GemStone::GemFire::Cache::Generic::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message); + userptr = nullptr; + } + if (userptr == nullptr) + { + std::string ex_str = "ManagedCacheListenerGeneric: Could not create " + "object on invoking factory function ["; + ex_str += factoryFunctionName; + ex_str += "] in assembly: "; + ex_str += assemblyPath; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + + ManagedCacheListenerGeneric * mgcl = new ManagedCacheListenerGeneric(userptr); + + Type^ clgType = Type::GetType("GemStone.GemFire.Cache.Generic.CacheListenerGeneric`2"); + clgType = clgType->MakeGenericType(types); + Object^ clg = Activator::CreateInstance(clgType); + + mInfo = clgType->GetMethod("SetCacheListener"); + array<Object^>^ params = gcnew array<Object^>(1); + params[0] = userptr; + mInfo->Invoke(clg, params); + + mgcl->setptr((GemStone::GemFire::Cache::Generic::ICacheListener<Object^, Object^>^)clg); + + return mgcl; + } + else + { + std::string ex_str = "ManagedCacheListenerGeneric: Could not load " + "function with name ["; + ex_str += factoryFunctionName; + ex_str += "] in assembly: "; + ex_str += assemblyPath; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + } + else + { + GemStone::GemFire::Cache::Generic::ManagedString typeName(mg_typeName); + std::string ex_str = "ManagedCacheListenerGeneric: Could not load type ["; + ex_str += typeName.CharPtr; + ex_str += "] in assembly: "; + ex_str += assemblyPath; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + } + catch (const apache::geode::client::Exception&) + { + throw; + } + catch (System::Exception^ ex) + { + GemStone::GemFire::Cache::Generic::ManagedString mg_exStr(ex->ToString()); + std::string ex_str = "ManagedCacheListenerGeneric: Got an exception while " + "loading managed library: "; + ex_str += mg_exStr.CharPtr; + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); + } + return NULL; } - if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf( '>' )) < 0 ) + void ManagedCacheListenerGeneric::afterCreate(const apache::geode::client::EntryEvent& ev) { - std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '"; - ex_str += factoryFunctionName; - ex_str += "' does not contain any generic type parameters"; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); + try { + GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^> mevent(&ev); + m_managedptr->AfterCreate(%mevent); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } } - if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf( '<' )) < 0 || - genericsOpenIndx > genericsCloseIndx) + void ManagedCacheListenerGeneric::afterUpdate(const apache::geode::client::EntryEvent& ev) { - std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '"; - ex_str += factoryFunctionName; - ex_str += "' does not contain expected generic type parameters"; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); + try { + GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^> mevent(&ev); + m_managedptr->AfterUpdate(%mevent); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } } - if ((commaIndx = mg_factoryFunctionName->LastIndexOf( ',' )) < 0 || - (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx)) + void ManagedCacheListenerGeneric::afterInvalidate(const apache::geode::client::EntryEvent& ev) { - std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '"; - ex_str += factoryFunctionName; - ex_str += "' does not contain expected generic type parameter comma separator"; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); + try { + GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^> mevent(&ev); + m_managedptr->AfterInvalidate(%mevent); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } } - StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx)); - mg_typeName = typeBuilder->ToString(); - mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1); - mg_genericKey = mg_genericKey->Trim(); - mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1); - mg_genericVal = mg_genericVal->Trim(); - mg_factoryFunctionName = mg_factoryFunctionName->Substring( dotIndx + 1 ); - - GemStone::GemFire::Cache::Generic::Log::Fine("Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.", - mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName); - - typeBuilder->Append("`2"); - mg_typeName = typeBuilder->ToString(); - - Assembly^ assmb = nullptr; - try + void ManagedCacheListenerGeneric::afterDestroy(const apache::geode::client::EntryEvent& ev) { - assmb = Assembly::Load( mg_assemblyPath ); + try { + GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^> mevent(&ev); + m_managedptr->AfterDestroy(%mevent); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } } - catch (System::Exception^) + void ManagedCacheListenerGeneric::afterRegionClear(const apache::geode::client::RegionEvent& ev) { - assmb = nullptr; + try { + GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^> mevent(&ev); + m_managedptr->AfterRegionClear(%mevent); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } } - if (assmb == nullptr) + + void ManagedCacheListenerGeneric::afterRegionInvalidate(const apache::geode::client::RegionEvent& ev) { - std::string ex_str = "ManagedCacheListenerGeneric: Could not load assembly: "; - ex_str += assemblyPath; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); + try { + GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^> mevent(&ev); + m_managedptr->AfterRegionInvalidate(%mevent); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } } - GemStone::GemFire::Cache::Generic::Log::Debug("Loading type: [{0}]", mg_typeName); - - Type^ typeInst = assmb->GetType(mg_typeName, false, true); - - if (typeInst != nullptr) + void ManagedCacheListenerGeneric::afterRegionDestroy(const apache::geode::client::RegionEvent& ev) { - array<Type^>^ types = gcnew array<Type^>(2); - types[0] = Type::GetType(mg_genericKey, false, true); - types[1] = Type::GetType(mg_genericVal, false, true); - - if (types[0] == nullptr || types[1] == nullptr) - { - std::string ex_str = "ManagedCacheListenerGeneric: Could not get both generic type argument instances"; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); + try { + GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^> mevent(&ev); + m_managedptr->AfterRegionDestroy(%mevent); } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } + } - typeInst = typeInst->MakeGenericType(types); - GemStone::GemFire::Cache::Generic::Log::Info("Loading function: [{0}]", mg_factoryFunctionName); - - MethodInfo^ mInfo = typeInst->GetMethod( mg_factoryFunctionName, - BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase ); - - if (mInfo != nullptr) - { - Object^ userptr = nullptr; - try - { - userptr = mInfo->Invoke( typeInst, nullptr ); - } - catch (System::Exception^ ex) - { - GemStone::GemFire::Cache::Generic::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message); - userptr = nullptr; - } - if (userptr == nullptr) - { - std::string ex_str = "ManagedCacheListenerGeneric: Could not create " - "object on invoking factory function ["; - ex_str += factoryFunctionName; - ex_str += "] in assembly: "; - ex_str += assemblyPath; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); - } - - ManagedCacheListenerGeneric * mgcl = new ManagedCacheListenerGeneric(userptr); - - Type^ clgType = Type::GetType("GemStone.GemFire.Cache.Generic.CacheListenerGeneric`2"); - clgType = clgType->MakeGenericType(types); - Object^ clg = Activator::CreateInstance(clgType); - - mInfo = clgType->GetMethod("SetCacheListener"); - array<Object^>^ params = gcnew array<Object^>(1); - params[0] = userptr; - mInfo->Invoke(clg, params); + void ManagedCacheListenerGeneric::afterRegionLive(const apache::geode::client::RegionEvent& ev) + { + try { + GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^> mevent(&ev); + m_managedptr->AfterRegionLive(%mevent); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } + } - mgcl->setptr((GemStone::GemFire::Cache::Generic::ICacheListener<Object^, Object^>^)clg); + void ManagedCacheListenerGeneric::close(const apache::geode::client::RegionPtr& region) + { + try { + GemStone::GemFire::Cache::Generic::IRegion<Object^, Object^>^ mregion = + GemStone::GemFire::Cache::Generic::Region<Object^, Object^>::Create(region.ptr()); - return mgcl; + m_managedptr->Close(mregion); } - else - { - std::string ex_str = "ManagedCacheListenerGeneric: Could not load " - "function with name ["; - ex_str += factoryFunctionName; - ex_str += "] in assembly: "; - ex_str += assemblyPath; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); } } - else + void ManagedCacheListenerGeneric::afterRegionDisconnected(const apache::geode::client::RegionPtr& region) { - GemStone::GemFire::Cache::Generic::ManagedString typeName( mg_typeName ); - std::string ex_str = "ManagedCacheListenerGeneric: Could not load type ["; - ex_str += typeName.CharPtr; - ex_str += "] in assembly: "; - ex_str += assemblyPath; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); + try { + GemStone::GemFire::Cache::Generic::IRegion<Object^, Object^>^ mregion = + GemStone::GemFire::Cache::Generic::Region<Object^, Object^>::Create(region.ptr()); + m_managedptr->AfterRegionDisconnected(mregion); + } + catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { + ex->ThrowNative(); + } + catch (System::Exception^ ex) { + GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); + } } - } - catch (const gemfire::Exception&) - { - throw; - } - catch (System::Exception^ ex) - { - GemStone::GemFire::Cache::Generic::ManagedString mg_exStr( ex->ToString( ) ); - std::string ex_str = "ManagedCacheListenerGeneric: Got an exception while " - "loading managed library: "; - ex_str += mg_exStr.CharPtr; - throw gemfire::IllegalArgumentException( ex_str.c_str( ) ); - } - return NULL; - } - - void ManagedCacheListenerGeneric::afterCreate( const gemfire::EntryEvent& ev ) - { - try { - GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^> mevent( &ev ); - m_managedptr->AfterCreate( %mevent ); - } - catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { - ex->ThrowNative(); - } - catch (System::Exception^ ex) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - - void ManagedCacheListenerGeneric::afterUpdate( const gemfire::EntryEvent& ev ) - { - try { - GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^> mevent( &ev ); - m_managedptr->AfterUpdate( %mevent ); - } - catch ( GemStone::GemFire::Cache::Generic::GemFireException^ ex ) { - ex->ThrowNative( ); - } - catch ( System::Exception^ ex ) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - - void ManagedCacheListenerGeneric::afterInvalidate( const gemfire::EntryEvent& ev ) - { - try { - GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^> mevent( &ev ); - m_managedptr->AfterInvalidate( %mevent ); - } - catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { - ex->ThrowNative(); - } - catch (System::Exception^ ex) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - - void ManagedCacheListenerGeneric::afterDestroy( const gemfire::EntryEvent& ev ) - { - try { - GemStone::GemFire::Cache::Generic::EntryEvent<Object^, Object^> mevent( &ev ); - m_managedptr->AfterDestroy( %mevent ); - } - catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { - ex->ThrowNative(); - } - catch (System::Exception^ ex) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - void ManagedCacheListenerGeneric::afterRegionClear( const gemfire::RegionEvent& ev ) - { - try { - GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^> mevent( &ev ); - m_managedptr->AfterRegionClear( %mevent ); - } - catch ( GemStone::GemFire::Cache::Generic::GemFireException^ ex ) { - ex->ThrowNative( ); - } - catch ( System::Exception^ ex ) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - - void ManagedCacheListenerGeneric::afterRegionInvalidate( const gemfire::RegionEvent& ev ) - { - try { - GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^> mevent( &ev ); - m_managedptr->AfterRegionInvalidate( %mevent ); - } - catch ( GemStone::GemFire::Cache::Generic::GemFireException^ ex ) { - ex->ThrowNative( ); - } - catch ( System::Exception^ ex ) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - - void ManagedCacheListenerGeneric::afterRegionDestroy( const gemfire::RegionEvent& ev ) - { - try { - GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^> mevent( &ev ); - m_managedptr->AfterRegionDestroy( %mevent ); - } - catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { - ex->ThrowNative(); - } - catch (System::Exception^ ex) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - - void ManagedCacheListenerGeneric::afterRegionLive( const gemfire::RegionEvent& ev ) - { - try { - GemStone::GemFire::Cache::Generic::RegionEvent<Object^, Object^> mevent( &ev ); - m_managedptr->AfterRegionLive( %mevent ); - } - catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { - ex->ThrowNative(); - } - catch (System::Exception^ ex) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - - void ManagedCacheListenerGeneric::close( const gemfire::RegionPtr& region ) - { - try { - GemStone::GemFire::Cache::Generic::IRegion<Object^, Object^>^ mregion = - GemStone::GemFire::Cache::Generic::Region<Object^, Object^>::Create( region.ptr( ) ); - - m_managedptr->Close( mregion ); - } - catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { - ex->ThrowNative(); - } - catch (System::Exception^ ex) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - void ManagedCacheListenerGeneric::afterRegionDisconnected( const gemfire::RegionPtr& region ) - { - try { - GemStone::GemFire::Cache::Generic::IRegion<Object^, Object^>^ mregion = - GemStone::GemFire::Cache::Generic::Region<Object^, Object^>::Create( region.ptr( ) ); - m_managedptr->AfterRegionDisconnected( mregion ); - } - catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) { - ex->ThrowNative(); - } - catch (System::Exception^ ex) { - GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex); - } - } - -} + + } // namespace client + } // namespace geode +} // namespace apache