You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/04/14 15:27:40 UTC
[15/44] ignite git commit: IGNITE-4983 .NET: Remove .NET-only cache
plugins
IGNITE-4983 .NET: Remove .NET-only cache plugins
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/44a8f938
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/44a8f938
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/44a8f938
Branch: refs/heads/ignite-4986
Commit: 44a8f93892fd44aef934e6cbb7bf5e9f616df42c
Parents: 4e6de2a
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Apr 14 14:44:08 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Apr 14 14:44:08 2017 +0300
----------------------------------------------------------------------
.../callback/PlatformCallbackGateway.java | 68 ------
.../cache/PlatformCachePluginProvider.java | 121 ----------
.../Apache.Ignite.Core.Tests.csproj | 3 -
.../Cache/CacheConfigurationTest.cs | 2 +-
.../IgniteConfigurationSerializerTest.cs | 8 +-
.../Plugin/Cache/CachePlugin.cs | 127 -----------
.../Plugin/Cache/CachePluginConfiguration.cs | 64 ------
.../Plugin/Cache/CachePluginTest.cs | 218 -------------------
.../Apache.Ignite.Core.csproj | 7 -
.../Impl/Plugin/Cache/CachePluginContext.cs | 82 -------
.../Impl/Plugin/Cache/CachePluginProcessor.cs | 77 -------
.../Plugin/Cache/CachePluginProviderProxy.cs | 75 -------
.../Plugin/Cache/ICachePluginProviderProxy.cs | 52 -----
.../Impl/Unmanaged/UnmanagedCallbackOp.cs | 4 -
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 56 +----
.../Cache/CachePluginProviderTypeAttribute.cs | 52 -----
.../Plugin/Cache/ICachePluginConfiguration.cs | 21 --
.../Plugin/Cache/ICachePluginContext.cs | 47 ----
.../Plugin/Cache/ICachePluginProvider.cs | 52 -----
19 files changed, 6 insertions(+), 1130 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
index f195c02..7a5c0a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
@@ -1156,74 +1156,6 @@ public class PlatformCallbackGateway {
}
/**
- * Create cache plugin.
- *
- * @param memPtr Memory pointer.
- * @return Pointer.
- */
- public long cachePluginCreate(long memPtr) {
- enter();
-
- try {
- return PlatformCallbackUtils.inLongOutLong(envPtr, PlatformCallbackOp.CachePluginCreate, memPtr);
- }
- finally {
- leave();
- }
- }
-
- /**
- * Notify cache plugin on ignite start.
- *
- * @param objPtr Object pointer.
- */
- public void cachePluginIgniteStart(long objPtr) {
- enter();
-
- try {
- PlatformCallbackUtils.inLongOutLong(envPtr, PlatformCallbackOp.CachePluginIgniteStart, objPtr);
- }
- finally {
- leave();
- }
- }
-
- /**
- * Notify cache plugin on ignite start.
- *
- * @param objPtr Object pointer.
- */
- public void cachePluginIgniteStop(long objPtr, boolean cancel) {
- enter();
-
- try {
- PlatformCallbackUtils.inLongLongLongObjectOutLong(envPtr, PlatformCallbackOp.CachePluginIgniteStop, objPtr,
- cancel ? 1 : 0, 0, null);
- }
- finally {
- leave();
- }
- }
-
- /**
- * Destroy cache plugin.
- *
- * @param objPtr Object pointer.
- */
- public void cachePluginDestroy(long objPtr, boolean cancel) {
- if (!lock.enterBusy())
- return; // no need to destroy plugins on grid stop
-
- try {
- PlatformCallbackUtils.inLongLongLongObjectOutLong(envPtr, PlatformCallbackOp.CachePluginDestroy,
- objPtr, cancel ? 1 : 0, 0, null);
- }
- finally {
- leave();
- }
- }
-
- /**
* Invoke plugin callback by id.
*
* @param callbackId Id of a callback registered in Platform.
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/plugin/cache/PlatformCachePluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/plugin/cache/PlatformCachePluginProvider.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/plugin/cache/PlatformCachePluginProvider.java
deleted file mode 100644
index 3e3b223..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/plugin/cache/PlatformCachePluginProvider.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.plugin.cache;
-
-import javax.cache.Cache;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.binary.BinaryRawWriterEx;
-import org.apache.ignite.internal.processors.platform.PlatformContext;
-import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
-import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
-import org.apache.ignite.internal.processors.platform.utils.PlatformConfigurationUtils;
-import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
-import org.apache.ignite.plugin.CachePluginContext;
-import org.apache.ignite.plugin.CachePluginProvider;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Platform cache plugin provider.
- */
-class PlatformCachePluginProvider implements CachePluginProvider {
- /** Context. */
- private final CachePluginContext ctx;
-
- /** Native config. */
- private final Object nativeCfg;
-
- /** Pointer to native plugin. */
- protected long ptr;
-
- /**
- * Ctor.
- *
- * @param ctx Context.
- */
- PlatformCachePluginProvider(CachePluginContext ctx, Object nativeCfg) {
- assert ctx != null;
- assert nativeCfg != null;
-
- this.ctx = ctx;
- this.nativeCfg = nativeCfg;
- }
-
- /** {@inheritDoc} */
- @Override public void start() throws IgniteCheckedException {
- PlatformContext platformCtx = PlatformUtils.platformContext(ctx.grid());
-
- try (PlatformMemory mem = platformCtx.memory().allocate()) {
- PlatformOutputStream out = mem.output();
-
- BinaryRawWriterEx writer = platformCtx.writer(out);
-
- writer.writeObjectDetached(nativeCfg);
-
- PlatformConfigurationUtils.writeIgniteConfiguration(writer, ctx.igniteConfiguration());
- PlatformConfigurationUtils.writeCacheConfiguration(writer, ctx.igniteCacheConfiguration());
-
- out.synchronize();
-
- ptr = platformCtx.gateway().cachePluginCreate(mem.pointer());
- }
- }
-
- /** {@inheritDoc} */
- @Override public void stop(boolean cancel) {
- PlatformContext platformCtx = PlatformUtils.platformContext(ctx.grid());
-
- platformCtx.gateway().cachePluginDestroy(ptr, cancel);
- }
-
- /** {@inheritDoc} */
- @Override public void onIgniteStart() throws IgniteCheckedException {
- PlatformContext platformCtx = PlatformUtils.platformContext(ctx.grid());
-
- platformCtx.gateway().cachePluginIgniteStart(ptr);
- }
-
- /** {@inheritDoc} */
- @Override public void onIgniteStop(boolean cancel) {
- PlatformContext platformCtx = PlatformUtils.platformContext(ctx.grid());
-
- platformCtx.gateway().cachePluginIgniteStop(ptr, cancel);
- }
-
- /** {@inheritDoc} */
- @Override public void validate() throws IgniteCheckedException {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void validateRemote(CacheConfiguration locCfg, CacheConfiguration rmtCfg, ClusterNode rmtNode)
- throws IgniteCheckedException {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Object unwrapCacheEntry(Cache.Entry entry, Class cls) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Object createComponent(Class cls) {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 2e81781..838a1e0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -104,9 +104,6 @@
<Compile Include="Plugin\TestIgnitePluginConfiguration.cs" />
<Compile Include="Plugin\TestIgnitePluginException.cs" />
<Compile Include="Plugin\TestIgnitePluginProvider.cs" />
- <Compile Include="Plugin\Cache\CachePlugin.cs" />
- <Compile Include="Plugin\Cache\CachePluginConfiguration.cs" />
- <Compile Include="Plugin\Cache\CachePluginTest.cs" />
<Compile Include="TestAppConfig.cs" />
<Compile Include="Binary\BinaryBuilderSelfTestFullFooter.cs" />
<Compile Include="Binary\BinaryCompactFooterInteropTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index e63e203..1fd7d05 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -547,7 +547,7 @@ namespace Apache.Ignite.Core.Tests.Cache
},
ExpiryPolicyFactory = new ExpiryFactory(),
EnableStatistics = true,
- PluginConfigurations = new[] { new CachePluginConfiguration() }
+ PluginConfigurations = new[] { new CacheJavaPluginConfiguration() }
};
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 96858f7..b22b78d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -114,7 +114,7 @@ namespace Apache.Ignite.Core.Tests
</nearConfiguration>
<affinityFunction type='RendezvousAffinityFunction' partitions='99' excludeNeighbors='true' />
<expiryPolicyFactory type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+MyPolicyFactory, Apache.Ignite.Core.Tests' />
- <pluginConfigurations><iCachePluginConfiguration type='Apache.Ignite.Core.Tests.Plugin.Cache.CachePluginConfiguration, Apache.Ignite.Core.Tests' testProperty='baz' /></pluginConfigurations>
+ <pluginConfigurations><iCachePluginConfiguration type='Apache.Ignite.Core.Tests.Plugin.Cache.CacheJavaPluginConfiguration, Apache.Ignite.Core.Tests' foo='baz' /></pluginConfigurations>
</cacheConfiguration>
<cacheConfiguration name='secondCache' />
</cacheConfiguration>
@@ -241,8 +241,8 @@ namespace Apache.Ignite.Core.Tests
Assert.IsNotNull(plugins);
Assert.IsNotNull(plugins.Cast<TestIgnitePluginConfiguration>().SingleOrDefault());
- var cachePlugCfg = cacheCfg.PluginConfigurations.Cast<CachePluginConfiguration>().Single();
- Assert.AreEqual("baz", cachePlugCfg.TestProperty);
+ var cachePlugCfg = cacheCfg.PluginConfigurations.Cast<CacheJavaPluginConfiguration>().Single();
+ Assert.AreEqual("baz", cachePlugCfg.Foo);
var eventStorage = cfg.EventStorageSpi as MemoryEventStorageSpi;
Assert.IsNotNull(eventStorage);
@@ -678,7 +678,7 @@ namespace Apache.Ignite.Core.Tests
EnableStatistics = true,
PluginConfigurations = new[]
{
- new CachePluginConfiguration()
+ new CacheJavaPluginConfiguration()
}
}
},
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePlugin.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePlugin.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePlugin.cs
deleted file mode 100644
index dcc53ca..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePlugin.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Plugin.Cache
-{
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.IO;
- using Apache.Ignite.Core.Plugin.Cache;
- using NUnit.Framework;
-
- /// <summary>
- /// Test cache plugin.
- /// </summary>
- public class CachePlugin : ICachePluginProvider<CachePluginConfiguration>
- {
- /** */
- private static readonly ConcurrentDictionary<CachePlugin, object> Instances =
- new ConcurrentDictionary<CachePlugin, object>();
-
- /// <summary>
- /// Gets the instances.
- /// </summary>
- public static IEnumerable<CachePlugin> GetInstances()
- {
- return Instances.Keys;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CachePlugin"/> class.
- /// </summary>
- public CachePlugin()
- {
- Assert.IsTrue(Instances.TryAdd(this, null));
- }
-
- /** <inheritdoc /> */
- public void Start(ICachePluginContext<CachePluginConfiguration> cachePluginContext)
- {
- Context = cachePluginContext;
- Started = true;
-
- Assert.IsNotNull(Context);
- Assert.IsNotNull(Context.IgniteConfiguration);
- Assert.IsNotNull(Context.CachePluginConfiguration);
- Assert.IsNotNull(Context.CacheConfiguration);
- Assert.IsNotNull(Context.Ignite);
-
- // Check that Ignite is operational.
- Assert.GreaterOrEqual(2, Context.Ignite.GetCluster().GetNodes().Count);
-
- Throw();
- }
-
- /** <inheritdoc /> */
- public void Stop(bool cancel)
- {
- Stopped = cancel;
-
- object unused;
- Assert.IsTrue(Instances.TryRemove(this, out unused));
- }
-
- /** <inheritdoc /> */
- public void OnIgniteStart()
- {
- // Check that Ignite is operational.
- Assert.GreaterOrEqual(2, Context.Ignite.GetCluster().GetNodes().Count);
-
- IgniteStarted = true;
- }
-
- /** <inheritdoc /> */
- public void OnIgniteStop(bool cancel)
- {
- IgniteStopped = cancel;
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether this <see cref="CachePlugin"/> is started.
- /// </summary>
- public bool Started { get; private set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this <see cref="CachePlugin"/> is started.
- /// </summary>
- public bool IgniteStarted { get; private set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this <see cref="CachePlugin"/> is stopped.
- /// </summary>
- public bool? Stopped { get; private set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this <see cref="CachePlugin"/> is stopped.
- /// </summary>
- public bool? IgniteStopped { get; private set; }
-
- /// <summary>
- /// Gets the context.
- /// </summary>
- public ICachePluginContext<CachePluginConfiguration> Context { get; private set; }
-
- /// <summary>
- /// Throws an error when configured.
- /// </summary>
- private void Throw()
- {
- if (Context.CachePluginConfiguration.ThrowError)
- throw new IOException("Failure in cache plugin provider");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePluginConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePluginConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePluginConfiguration.cs
deleted file mode 100644
index 72220ff..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePluginConfiguration.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Plugin.Cache
-{
- using System;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Plugin.Cache;
- using NUnit.Framework;
-
- /// <summary>
- /// Cache plugin config.
- /// </summary>
- [Serializable]
- [CachePluginProviderType(typeof(CachePlugin))]
- public class CachePluginConfiguration : ICachePluginConfiguration
- {
- /// <summary>
- /// Gets or sets the test property.
- /// </summary>
- public string TestProperty { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether the plugin should throw an error.
- /// </summary>
- // ReSharper disable once UnusedAutoPropertyAccessor.Global
- public bool ThrowError { get; set; }
-
- /// <summary>
- /// Gets the id to locate PlatformCachePluginConfigurationClosureFactory on Java side
- /// and read the data written by
- /// <see cref="WriteBinary(IBinaryRawWriter)" /> method.
- /// </summary>
- public int? CachePluginConfigurationClosureFactoryId
- {
- get { return null; }
- }
-
- /// <summary>
- /// Writes this instance to a raw writer.
- /// This method will be called when <see cref="CachePluginConfigurationClosureFactoryId" />
- /// is not null to propagate configuration to the Java side.
- /// </summary>
- /// <param name="writer">The writer.</param>
- public void WriteBinary(IBinaryRawWriter writer)
- {
- Assert.Fail("Should not be called");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePluginTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePluginTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePluginTest.cs
deleted file mode 100644
index 2ef8bb2..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/Cache/CachePluginTest.cs
+++ /dev/null
@@ -1,218 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Plugin.Cache
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cache.Configuration;
- using Apache.Ignite.Core.Plugin.Cache;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests for cache plugins.
- /// </summary>
- public class CachePluginTest
- {
- /** */
- private const string CacheName = "staticCache";
-
- /** */
- private const string DynCacheName = "dynamicCache";
-
- /** */
- private IIgnite _grid1;
-
- /** */
- private IIgnite _grid2;
-
- /** */
- private readonly List<CachePlugin> _plugins = new List<CachePlugin>();
-
- /// <summary>
- /// Fixture set up.
- /// </summary>
- [TestFixtureSetUp]
- public void FixtureSetUp()
- {
- _plugins.Clear();
-
- _grid1 = Ignition.Start(GetConfig("grid1"));
- _grid2 = Ignition.Start(GetConfig("grid2"));
- }
-
- /// <summary>
- /// Fixture tear down.
- /// </summary>
- [TestFixtureTearDown]
- public void FixtureTearDown()
- {
- // One plugin is expected in registry.
- TestUtils.AssertHandleRegistryHasItems(10, 1, _grid1, _grid2);
-
- Ignition.StopAll(true);
-
- // Check IgniteStop callbacks.
- foreach (var plugin in _plugins)
- {
- Assert.AreEqual(true, plugin.IgniteStopped);
- }
- }
-
- /// <summary>
- /// Tests with static cache.
- /// </summary>
- [Test]
- public void TestStaticCache()
- {
- foreach (var ignite in new[] {_grid1, _grid2})
- {
- var plugin = CheckCachePlugin(ignite, CacheName, "foo");
-
- _plugins.Add(plugin);
- }
- }
-
- /// <summary>
- /// Tests with dynamic cache.
- /// </summary>
- [Test]
- public void TestDynamicCache()
- {
- var cacheConfig = new CacheConfiguration(DynCacheName)
- {
- PluginConfigurations = new[] {new CachePluginConfiguration {TestProperty = "bar"}}
- };
-
- _grid1.CreateCache<int, int>(cacheConfig);
-
- var plugins = new List<CachePlugin>();
-
- foreach (var ignite in new[] { _grid1, _grid2 })
- {
- var plugin = CheckCachePlugin(ignite, DynCacheName, "bar");
-
- plugins.Add(plugin);
- }
-
- // Destroy cache to remove plugin from handle registry.
- _grid1.DestroyCache(DynCacheName);
-
- foreach (var plugin in plugins)
- {
- Assert.AreEqual(true, plugin.Stopped);
- Assert.AreEqual(true, plugin.IgniteStopped); // This is weird, but correct from Java logic POV.
- }
- }
-
- /// <summary>
- /// Non-serializable plugin config results in a meaningful exception.
- /// </summary>
- [Test]
- public void TestNonSerializablePlugin()
- {
- var ex = Assert.Throws<InvalidOperationException>(() => _grid1.CreateCache<int, int>(new CacheConfiguration
- {
- PluginConfigurations = new[] {new NonSerializableCachePluginConfig()}
- }));
-
- Assert.AreEqual("Invalid cache configuration: ICachePluginConfiguration should be Serializable.",
- ex.Message);
- }
-
- /// <summary>
- /// Errors in plugin configuration result in meaningful exception.
- /// </summary>
- [Test]
- [Ignore("IGNITE-4474 Ignite.createCache hangs on exception in CachePluginConfiguration.createProvider")]
- public void TestErrorInPlugin()
- {
- // Throws exception.
- var cacheEx = Assert.Throws<CacheException>(() => _grid1.CreateCache<int, int>(new CacheConfiguration
- {
- PluginConfigurations = new[] { new ThrowCachePluginConfig() }
- }));
-
- Assert.AreEqual("hi!", cacheEx.Message);
- }
-
- /// <summary>
- /// Checks the cache plugin.
- /// </summary>
- private static CachePlugin CheckCachePlugin(IIgnite ignite, string cacheName, string propValue)
- {
- // Check config.
- var plugCfg = ignite.GetCache<int, int>(cacheName).GetConfiguration()
- .PluginConfigurations.Cast<CachePluginConfiguration>().Single();
- Assert.AreEqual(propValue, plugCfg.TestProperty);
-
- // Check started plugin.
- var plugin = CachePlugin.GetInstances().Single(x => x.Context.Ignite == ignite &&
- x.Context.CacheConfiguration.Name == cacheName);
- Assert.IsTrue(plugin.Started);
- Assert.IsTrue(plugin.IgniteStarted);
- Assert.IsNull(plugin.Stopped);
- Assert.IsNull(plugin.IgniteStopped);
-
- var ctx = plugin.Context;
- Assert.AreEqual(ignite.Name, ctx.IgniteConfiguration.IgniteInstanceName);
- Assert.AreEqual(cacheName, ctx.CacheConfiguration.Name);
- Assert.AreEqual(propValue, ctx.CachePluginConfiguration.TestProperty);
-
- return plugin;
- }
-
- /// <summary>
- /// Gets the configuration.
- /// </summary>
- private static IgniteConfiguration GetConfig(string name)
- {
- return new IgniteConfiguration(TestUtils.GetTestConfiguration())
- {
- IgniteInstanceName = name,
- CacheConfiguration = new[]
- {
- new CacheConfiguration(CacheName)
- {
- PluginConfigurations = new[]
- {
- new CachePluginConfiguration {TestProperty = "foo"}
- }
- }
- }
- };
- }
-
- [CachePluginProviderType(typeof(CachePlugin))]
- private class NonSerializableCachePluginConfig : ICachePluginConfiguration
- {
- public int? CachePluginConfigurationClosureFactoryId { get { return null; } }
- public void WriteBinary(IBinaryRawWriter writer) { /* No-op. */ }
- }
-
- [Serializable]
- [CachePluginProviderType(typeof(string))]
- private class ThrowCachePluginConfig : ICachePluginConfiguration
- {
- public int? CachePluginConfigurationClosureFactoryId { get { return null; } }
- public void WriteBinary(IBinaryRawWriter writer) { /* No-op. */ }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 908a192..e8e9329 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -420,14 +420,10 @@
<Compile Include="Impl\Binary\Structure\BinaryStructureJumpTable.cs" />
<Compile Include="Impl\Binary\Structure\BinaryStructureUpdate.cs" />
<Compile Include="Impl\Binary\TypeResolver.cs" />
- <Compile Include="Impl\Plugin\Cache\CachePluginProcessor.cs" />
- <Compile Include="Impl\Plugin\Cache\CachePluginProviderProxy.cs" />
- <Compile Include="Impl\Plugin\Cache\ICachePluginProviderProxy.cs" />
<Compile Include="Impl\Plugin\IPluginProviderProxy.cs" />
<Compile Include="Impl\Plugin\PluginContext.cs" />
<Compile Include="Impl\Plugin\PluginProcessor.cs" />
<Compile Include="Impl\Plugin\PluginProviderProxy.cs" />
- <Compile Include="Impl\Plugin\Cache\CachePluginContext.cs" />
<Compile Include="Impl\Resource\IResourceInjector.cs" />
<Compile Include="Impl\Resource\ResourceFieldInjector.cs" />
<Compile Include="Impl\Resource\ResourceMethodInjector.cs" />
@@ -484,7 +480,6 @@
<Compile Include="Binary\BinaryObjectException.cs" />
<Compile Include="Binary\BinaryTypeConfiguration.cs" />
<Compile Include="Binary\BinaryTypeNames.cs" />
- <Compile Include="Plugin\Cache\CachePluginProviderTypeAttribute.cs" />
<Compile Include="Plugin\IPluginConfiguration.cs" />
<Compile Include="Plugin\IPluginContext.cs" />
<Compile Include="Plugin\IPluginProvider.cs" />
@@ -492,8 +487,6 @@
<Compile Include="Plugin\PluginNotFoundException.cs" />
<Compile Include="Plugin\PluginProviderTypeAttribute.cs" />
<Compile Include="Plugin\Cache\ICachePluginConfiguration.cs" />
- <Compile Include="Plugin\Cache\ICachePluginContext.cs" />
- <Compile Include="Plugin\Cache\ICachePluginProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resource\InstanceResourceAttribute.cs" />
<Compile Include="Resource\Package-Info.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginContext.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginContext.cs
deleted file mode 100644
index ffc74c0..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginContext.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Plugin.Cache
-{
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache.Configuration;
- using Apache.Ignite.Core.Plugin.Cache;
-
- /// <summary>
- /// Cache plugin context.
- /// </summary>
- internal class CachePluginContext<T> : ICachePluginContext<T> where T : ICachePluginConfiguration
- {
- /** */
- private readonly IgniteConfiguration _igniteConfiguration;
-
- /** */
- private readonly CacheConfiguration _cacheConfiguration;
-
- /** */
- private readonly T _cachePluginConfiguration;
-
- /** */
- private readonly IIgnite _ignite;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CachePluginContext{T}"/> class.
- /// </summary>
- public CachePluginContext(IgniteConfiguration igniteConfiguration, CacheConfiguration cacheConfiguration,
- T cachePluginConfiguration, IIgnite ignite)
- {
- Debug.Assert(igniteConfiguration != null);
- Debug.Assert(cacheConfiguration != null);
- Debug.Assert(cachePluginConfiguration != null);
- Debug.Assert(ignite != null);
-
- _igniteConfiguration = igniteConfiguration;
- _cacheConfiguration = cacheConfiguration;
- _cachePluginConfiguration = cachePluginConfiguration;
- _ignite = ignite;
- }
-
- /** <inheritdoc /> */
- public IgniteConfiguration IgniteConfiguration
- {
- get { return _igniteConfiguration; }
- }
-
- /** <inheritdoc /> */
- public CacheConfiguration CacheConfiguration
- {
- get { return _cacheConfiguration; }
- }
-
- /** <inheritdoc /> */
- public T CachePluginConfiguration
- {
- get { return _cachePluginConfiguration; }
- }
-
- /** <inheritdoc /> */
- public IIgnite Ignite
- {
- get { return _ignite; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginProcessor.cs
deleted file mode 100644
index 2d88d73..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginProcessor.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Plugin.Cache
-{
- using System;
- using System.Diagnostics;
- using System.Linq;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Plugin;
- using Apache.Ignite.Core.Plugin.Cache;
-
- /// <summary>
- /// Cache plugin processor.
- /// </summary>
- internal static class CachePluginProcessor
- {
- /// <summary>
- /// Creates the provider proxy.
- /// </summary>
- public static ICachePluginProviderProxy CreateProviderProxy(ICachePluginConfiguration pluginConfiguration)
- {
- Debug.Assert(pluginConfiguration != null);
-
- var cfgType = pluginConfiguration.GetType();
-
- var attributes = cfgType.GetCustomAttributes(true).OfType<CachePluginProviderTypeAttribute>().ToArray();
-
- if (attributes.Length == 0)
- {
- throw new IgniteException(string.Format("{0} of type {1} has no {2}",
- typeof(IPluginConfiguration), cfgType, typeof(CachePluginProviderTypeAttribute)));
-
- }
-
- if (attributes.Length > 1)
- {
- throw new IgniteException(string.Format("{0} of type {1} has more than one {2}",
- typeof(IPluginConfiguration), cfgType, typeof(CachePluginProviderTypeAttribute)));
- }
-
- var providerType = attributes[0].CachePluginProviderType;
-
- var iface = providerType.GetInterfaces()
- .SingleOrDefault(i => i.IsGenericType &&
- i.GetGenericTypeDefinition() == typeof(ICachePluginProvider<>) &&
- i.GetGenericArguments()[0] == cfgType);
-
- if (iface == null)
- {
- throw new IgniteException(string.Format("{0} does not implement {1}",
- providerType, typeof(ICachePluginProvider<>).MakeGenericType(cfgType)));
- }
-
- var pluginProvider = Activator.CreateInstance(providerType);
-
- var providerProxyType = typeof(CachePluginProviderProxy<>).MakeGenericType(cfgType);
-
- return (ICachePluginProviderProxy)Activator.CreateInstance(
- providerProxyType, pluginConfiguration, pluginProvider);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginProviderProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginProviderProxy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginProviderProxy.cs
deleted file mode 100644
index 5dc7366..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/CachePluginProviderProxy.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Plugin.Cache
-{
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache.Configuration;
- using Apache.Ignite.Core.Plugin.Cache;
-
- /// <summary>
- /// Wraps user-defined generic <see cref="ICachePluginProvider{TConfig}"/>.
- /// </summary>
- internal class CachePluginProviderProxy<T> : ICachePluginProviderProxy where T : ICachePluginConfiguration
- {
- /** */
- private readonly T _cachePluginConfiguration;
-
- /** */
- private readonly ICachePluginProvider<T> _pluginProvider;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CachePluginProviderProxy{T}" /> class.
- /// </summary>
- /// <param name="cachePluginConfiguration">The cache plugin configuration.</param>
- /// <param name="pluginProvider">The plugin provider.</param>
- public CachePluginProviderProxy(T cachePluginConfiguration, ICachePluginProvider<T> pluginProvider)
- {
- Debug.Assert(cachePluginConfiguration != null);
- Debug.Assert(pluginProvider != null);
-
- _cachePluginConfiguration = cachePluginConfiguration;
- _pluginProvider = pluginProvider;
- }
-
- /** <inheritdoc /> */
- public void Start(IgniteConfiguration igniteConfiguration, CacheConfiguration cacheConfiguration,
- IIgnite ignite)
- {
- _pluginProvider.Start(new CachePluginContext<T>(igniteConfiguration,
- cacheConfiguration, _cachePluginConfiguration, ignite));
- }
-
- /** <inheritdoc /> */
- public void Stop(bool cancel)
- {
- _pluginProvider.Stop(cancel);
- }
-
- /** <inheritdoc /> */
- public void OnIgniteStart()
- {
- _pluginProvider.OnIgniteStart();
- }
-
- /** <inheritdoc /> */
- public void OnIgniteStop(bool cancel)
- {
- _pluginProvider.OnIgniteStop(cancel);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/ICachePluginProviderProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/ICachePluginProviderProxy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/ICachePluginProviderProxy.cs
deleted file mode 100644
index e2bffde..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/Cache/ICachePluginProviderProxy.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Plugin.Cache
-{
- using Apache.Ignite.Core.Cache.Configuration;
- using Apache.Ignite.Core.Plugin.Cache;
-
- /// <summary>
- /// Wraps user-defined generic <see cref="ICachePluginProvider{TConfig}"/>.
- /// </summary>
- internal interface ICachePluginProviderProxy
- {
- /// <summary>
- /// Starts the plugin provider.
- /// </summary>
- void Start(IgniteConfiguration igniteConfiguration, CacheConfiguration cacheConfiguration, IIgnite ignite);
-
- /// <summary>
- /// Stops the plugin provider.
- /// </summary>
- /// <param name="cancel">if set to <c>true</c>, all ongoing operations should be canceled.</param>
- void Stop(bool cancel);
-
- /// <summary>
- /// Called when Ignite has been started and is fully functional.
- /// <para />
- /// Use <see cref="IIgnite.Stopping"/> and <see cref="IIgnite.Stopped"/> to track shutdown process.
- /// </summary>
- void OnIgniteStart();
-
- /// <summary>
- /// Callback to notify that Ignite is about to stop.
- /// </summary>
- /// <param name="cancel">if set to <c>true</c>, all ongoing operations should be canceled.</param>
- void OnIgniteStop(bool cancel);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackOp.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackOp.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackOp.cs
index 91df822..e16c3c1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackOp.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackOp.cs
@@ -84,10 +84,6 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
ComputeJobExecuteLocal = 61,
PluginProcessorStop = 62,
PluginProcessorIgniteStop = 63,
- CachePluginCreate = 64,
- CachePluginDestroy = 65,
- CachePluginIgniteStart = 66,
- CachePluginIgniteStop = 67,
PluginCallbackInLongLongOutLong = 68
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
index 3028f08..fe0f9e6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@ -26,7 +26,6 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
using System.Runtime.InteropServices;
using System.Threading;
using Apache.Ignite.Core.Cache.Affinity;
- using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Binary;
@@ -43,12 +42,10 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
using Apache.Ignite.Core.Impl.Log;
using Apache.Ignite.Core.Impl.Memory;
using Apache.Ignite.Core.Impl.Messaging;
- using Apache.Ignite.Core.Impl.Plugin.Cache;
using Apache.Ignite.Core.Impl.Resource;
using Apache.Ignite.Core.Impl.Services;
using Apache.Ignite.Core.Lifecycle;
using Apache.Ignite.Core.Log;
- using Apache.Ignite.Core.Plugin.Cache;
using Apache.Ignite.Core.Services;
using UU = UnmanagedUtils;
@@ -242,10 +239,6 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
AddHandler(UnmanagedCallbackOp.ComputeJobExecuteLocal, ComputeJobExecuteLocal);
AddHandler(UnmanagedCallbackOp.PluginProcessorStop, PluginProcessorStop);
AddHandler(UnmanagedCallbackOp.PluginProcessorIgniteStop, PluginProcessorIgniteStop);
- AddHandler(UnmanagedCallbackOp.CachePluginCreate, CachePluginCreate);
- AddHandler(UnmanagedCallbackOp.CachePluginDestroy, CachePluginDestroy);
- AddHandler(UnmanagedCallbackOp.CachePluginIgniteStart, CachePluginIgniteStart);
- AddHandler(UnmanagedCallbackOp.CachePluginIgniteStop, CachePluginIgniteStop);
AddHandler(UnmanagedCallbackOp.PluginCallbackInLongLongOutLong, PluginCallbackInLongLongOutLong);
}
@@ -1242,54 +1235,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
#endregion
#region PLUGINS
-
- private long CachePluginCreate(long objPtr)
- {
- using (var stream = IgniteManager.Memory.Get(objPtr).GetStream())
- {
- var reader = BinaryUtils.Marshaller.StartUnmarshal(stream);
-
- var cachePluginCfg = reader.ReadObject<ICachePluginConfiguration>();
- var providerProxy = CachePluginProcessor.CreateProviderProxy(cachePluginCfg);
-
- var igniteCfg = new IgniteConfiguration(reader, _ignite.Configuration);
- var cacheCfg = new CacheConfiguration(reader);
-
- providerProxy.Start(igniteCfg, cacheCfg, _ignite);
-
- return _handleRegistry.Allocate(providerProxy);
- }
- }
-
- private long CachePluginDestroy(long objPtr, long cancel, long unused, void* arg)
- {
- var pluginProvider = _handleRegistry.Get<ICachePluginProviderProxy>(objPtr, true);
-
- pluginProvider.Stop(cancel != 0);
-
- _ignite.HandleRegistry.Release(objPtr);
-
- return 0;
- }
-
- private long CachePluginIgniteStart(long objPtr)
- {
- var pluginProvider = _handleRegistry.Get<ICachePluginProviderProxy>(objPtr, true);
-
- pluginProvider.OnIgniteStart();
-
- return 0;
- }
-
- private long CachePluginIgniteStop(long objPtr, long cancel, long unused, void* arg)
- {
- var pluginProvider = _handleRegistry.Get<ICachePluginProviderProxy>(objPtr, true);
-
- pluginProvider.OnIgniteStop(cancel != 0);
-
- return 0;
- }
-
+
private long PluginCallbackInLongLongOutLong(long callbackId, long inPtr, long outPtr, void* arg)
{
return _ignite.PluginProcessor.InvokeCallback(callbackId, inPtr, outPtr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/CachePluginProviderTypeAttribute.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/CachePluginProviderTypeAttribute.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/CachePluginProviderTypeAttribute.cs
deleted file mode 100644
index 63b4185..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/CachePluginProviderTypeAttribute.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Plugin.Cache
-{
- using System;
- using Apache.Ignite.Core.Impl.Common;
-
- /// <summary>
- /// When applied to <see cref="ICachePluginConfiguration"/>, defines the type of
- /// <see cref="ICachePluginProvider{T}"/> to instantiate.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
- public sealed class CachePluginProviderTypeAttribute : Attribute
- {
- /** */
- private readonly Type _cachePluginProviderType;
-
- /// <summary>
- /// Initializes new instance of <see cref="CachePluginProviderTypeAttribute"/> class.
- /// </summary>
- /// <param name="cachePluginProviderType">Type of the plugin provider.</param>
- public CachePluginProviderTypeAttribute(Type cachePluginProviderType)
- {
- IgniteArgumentCheck.NotNull(cachePluginProviderType, "pluginProviderType");
-
- _cachePluginProviderType = cachePluginProviderType;
- }
-
- /// <summary>
- /// Gets the plugin provider type.
- /// </summary>
- public Type CachePluginProviderType
- {
- get { return _cachePluginProviderType; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginConfiguration.cs
index 1790357..c58cba2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginConfiguration.cs
@@ -24,24 +24,6 @@ namespace Apache.Ignite.Core.Plugin.Cache
/// <summary>
/// Cache plugin configuration marker interface. Starting point to extend <see cref="CacheConfiguration"/>
/// and extend existing cache functionality.
- /// <para />
- /// Implementations should be linked to corresponding <see cref="ICachePluginProvider{TConfig}"/>
- /// via <see cref="CachePluginProviderTypeAttribute"/>.
- /// <example>
- /// Example plugin implementation:
- /// <code>
- /// [CachePluginProviderType(typeof(MyCachePluginProvider))]
- /// class MyCachePluginConfig : ICachePluginConfiguration
- /// {
- /// int CustomProperty { get; set; }
- /// }
- ///
- /// class MyCachePluginProvider : ICachePluginProvider<MyCachePluginConfig>
- /// {
- /// ...
- /// }
- /// </code>
- /// </example>
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")]
public interface ICachePluginConfiguration
@@ -49,9 +31,6 @@ namespace Apache.Ignite.Core.Plugin.Cache
/// <summary>
/// Gets the id to locate PlatformCachePluginConfigurationClosureFactory on Java side
/// and read the data written by <see cref="WriteBinary"/> method.
- /// <para />
- /// When this property is not null, all cache plugin functionality is delegated to Java part.
- /// <see cref="ICachePluginProvider{TConfig}"/> won't be invoked.
/// </summary>
int? CachePluginConfigurationClosureFactoryId { get; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginContext.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginContext.cs
deleted file mode 100644
index 399db1e..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginContext.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Plugin.Cache
-{
- using Apache.Ignite.Core.Cache.Configuration;
-
- /// <summary>
- /// Cache plugin context.
- /// </summary>
- public interface ICachePluginContext<out T> where T : ICachePluginConfiguration
- {
- /// <summary>
- /// Gets the Ignite configuration.
- /// </summary>
- IgniteConfiguration IgniteConfiguration { get; }
-
- /// <summary>
- /// Gets the Ignite cache configuration.
- /// </summary>
- CacheConfiguration CacheConfiguration { get; }
-
- /// <summary>
- /// Gets the cache plugin configuration.
- /// </summary>
- T CachePluginConfiguration { get; }
-
- /// <summary>
- /// Gets the Ignite.
- /// </summary>
- IIgnite Ignite { get; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/44a8f938/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginProvider.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginProvider.cs
deleted file mode 100644
index 73439cd..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/Cache/ICachePluginProvider.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Plugin.Cache
-{
- using System;
-
- /// <summary>
- /// Cache plugin provider.
- /// <para />
- /// Implementations will be passed to remote nodes and should be marked with <see cref="SerializableAttribute"/>.
- /// </summary>
- public interface ICachePluginProvider<in TConfig> where TConfig : ICachePluginConfiguration
- {
- /// <summary>
- /// Starts the plugin provider.
- /// </summary>
- void Start(ICachePluginContext<TConfig> cachePluginContext);
-
- /// <summary>
- /// Stops the plugin provider.
- /// </summary>
- /// <param name="cancel">if set to <c>true</c>, all ongoing operations should be canceled.</param>
- void Stop(bool cancel);
-
- /// <summary>
- /// Called when Ignite has been started and is fully functional.
- /// <para />
- /// </summary>
- void OnIgniteStart();
-
- /// <summary>
- /// Callback to notify that Ignite is about to stop.
- /// </summary>
- /// <param name="cancel">if set to <c>true</c>, all ongoing operations should be canceled.</param>
- void OnIgniteStop(bool cancel);
- }
-}
\ No newline at end of file