You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2017/02/01 12:00:04 UTC
ignite git commit: IGNITE-4444 Extend .NET plugin API to interact
with Java
Repository: ignite
Updated Branches:
refs/heads/ignite-2.0 82aa4730d -> f299d9adb
IGNITE-4444 Extend .NET plugin API to interact with Java
This closes #1480
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f299d9ad
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f299d9ad
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f299d9ad
Branch: refs/heads/ignite-2.0
Commit: f299d9adb61034c06171a7fec9d6fb6dc36577c9
Parents: 82aa473
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Feb 1 14:59:47 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Feb 1 14:59:47 2017 +0300
----------------------------------------------------------------------
.../platform/PlatformNoopProcessor.java | 5 +
.../platform/PlatformPluginExtension.java | 39 ++++++++
.../processors/platform/PlatformProcessor.java | 7 ++
.../platform/PlatformProcessorImpl.java | 62 ++++++++++++-
.../org.apache.ignite.plugin.PluginProvider | 1 +
.../platform/plugin/PlatformTestPlugin.java | 27 ++++++
.../plugin/PlatformTestPluginExtension.java | 51 ++++++++++
.../plugin/PlatformTestPluginProvider.java | 97 ++++++++++++++++++++
.../plugin/PlatformTestPluginTarget.java | 90 ++++++++++++++++++
.../cpp/jni/include/ignite/jni/exports.h | 1 +
.../platforms/cpp/jni/include/ignite/jni/java.h | 2 +
modules/platforms/cpp/jni/project/vs/module.def | 1 +
modules/platforms/cpp/jni/src/exports.cpp | 4 +
modules/platforms/cpp/jni/src/java.cpp | 13 +++
.../Plugin/PluginTest.cs | 42 +++++++++
.../Apache.Ignite.Core.csproj | 1 +
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 70 +++++++++++++-
.../Impl/Plugin/PluginContext.cs | 12 +++
.../Impl/Plugin/PluginProcessor.cs | 2 +-
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 3 +
.../Impl/Unmanaged/UnmanagedUtils.cs | 7 ++
.../Interop/IPlatformTarget.cs | 91 ++++++++++++++++++
.../Apache.Ignite.Core/Plugin/IPluginContext.cs | 12 +++
23 files changed, 636 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
index 2911418..cd170ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
@@ -137,6 +137,11 @@ public class PlatformNoopProcessor extends GridProcessorAdapter implements Platf
}
/** {@inheritDoc} */
+ @Override public PlatformTargetProxy extension(int id) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public void registerStore(PlatformCacheStore store, boolean convertBinary)
throws IgniteCheckedException {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformPluginExtension.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformPluginExtension.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformPluginExtension.java
new file mode 100644
index 0000000..61281c9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformPluginExtension.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+import org.apache.ignite.plugin.Extension;
+
+/**
+ * Platform extension.
+ */
+public interface PlatformPluginExtension extends Extension {
+ /**
+ * Get extension ID. Must be unique among all extensions.
+ *
+ * @return Extension ID.
+ */
+ int id();
+
+ /**
+ * Creates the PlatformTarget for this extension.
+ *
+ * @return PlatformTarget for this extension.
+ */
+ PlatformTarget createTarget();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
index e0d94d1..54f33a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
@@ -188,6 +188,13 @@ public interface PlatformProcessor extends GridProcessor {
public PlatformTargetProxy extensions();
/**
+ * Gets platform extension by id.
+ *
+ * @return Platform extension target.
+ */
+ public PlatformTargetProxy extension(int id);
+
+ /**
* Register cache store.
*
* @param store Store.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
index 8c81ebb..63fdc18 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
@@ -73,6 +73,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* GridGain platform processor.
*/
+@SuppressWarnings({"ConditionalExpressionWithIdenticalBranches", "unchecked"})
public class PlatformProcessorImpl extends GridProcessorAdapter implements PlatformProcessor {
/** Start latch. */
private final CountDownLatch startLatch = new CountDownLatch(1);
@@ -94,6 +95,9 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
/** Interop configuration. */
private final PlatformConfigurationEx interopCfg;
+ /** Extensions. */
+ private final PlatformPluginExtension[] extensions;
+
/** Whether processor is started. */
private boolean started;
@@ -137,6 +141,9 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
if (interopCfg.logger() != null)
interopCfg.logger().setContext(platformCtx);
+
+ // Initialize extensions (if any).
+ extensions = prepareExtensions(ctx.plugins().extensions(PlatformPluginExtension.class));
}
/** {@inheritDoc} */
@@ -336,6 +343,18 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
}
/** {@inheritDoc} */
+ @Override public PlatformTargetProxy extension(int id) {
+ if (extensions != null && id < extensions.length) {
+ PlatformPluginExtension ext = extensions[id];
+
+ if (ext != null)
+ return proxy(ext.createTarget());
+ }
+
+ throw new IgniteException("Platform extension is not registered [id=" + id + ']');
+ }
+
+ /** {@inheritDoc} */
@Override public void registerStore(PlatformCacheStore store, boolean convertBinary)
throws IgniteCheckedException {
storeLock.readLock().lock();
@@ -565,7 +584,7 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
if (oldCacheExt != null)
throw new IgniteException("Platform cache extensions cannot have the same ID [" +
- "id=" + cacheExt.id() + ", first=" + oldCacheExt + ", second=" + cacheExt + ']');
+ "id=" + cacheExt.id() + ", first=" + oldCacheExt + ", second=" + cacheExt + ']');
if (cacheExt.id() > maxExtId)
maxExtId = cacheExt.id();
@@ -584,6 +603,47 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
}
/**
+ * Prepare extensions.
+ *
+ * @param exts Original extensions.
+ * @return Prepared extensions.
+ */
+ private static PlatformPluginExtension[] prepareExtensions(PlatformPluginExtension[] exts) {
+ if (!F.isEmpty(exts)) {
+ int maxExtId = 0;
+
+ Map<Integer, PlatformPluginExtension> idToExt = new HashMap<>();
+
+ for (PlatformPluginExtension ext : exts) {
+ if (ext == null)
+ throw new IgniteException("Platform extension cannot be null.");
+
+ if (ext.id() < 0)
+ throw new IgniteException("Platform extension ID cannot be negative: " + ext);
+
+ PlatformPluginExtension oldCacheExt = idToExt.put(ext.id(), ext);
+
+ if (oldCacheExt != null)
+ throw new IgniteException("Platform extensions cannot have the same ID [" +
+ "id=" + ext.id() + ", first=" + oldCacheExt + ", second=" + ext + ']');
+
+ if (ext.id() > maxExtId)
+ maxExtId = ext.id();
+ }
+
+ PlatformPluginExtension[] res = new PlatformPluginExtension[maxExtId + 1];
+
+ for (PlatformPluginExtension ext : exts)
+ res[ext.id()]= ext;
+
+ return res;
+ }
+ else
+ //noinspection ZeroLengthArrayAllocation
+ return new PlatformPluginExtension[0];
+ }
+
+ /**
* Wraps target in a proxy.
*/
private PlatformTargetProxy proxy(PlatformTarget target) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
new file mode 100644
index 0000000..2601c7d
--- /dev/null
+++ b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
@@ -0,0 +1 @@
+org.apache.ignite.platform.plugin.PlatformTestPluginProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java
new file mode 100644
index 0000000..b5a2ef3
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPlugin.java
@@ -0,0 +1,27 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.plugin.IgnitePlugin;
+
+/**
+ * Test plugin.
+ */
+class PlatformTestPlugin implements IgnitePlugin {
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java
new file mode 100644
index 0000000..18d1595
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginExtension.java
@@ -0,0 +1,51 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.platform.PlatformPluginExtension;
+import org.apache.ignite.internal.processors.platform.PlatformTarget;
+
+/**
+ * Test plugin extension.
+ */
+public class PlatformTestPluginExtension implements PlatformPluginExtension {
+ /** */
+ private final IgniteEx ignite;
+
+ /**
+ * Ctor.
+ *
+ * @param ignite Ignite.
+ */
+ PlatformTestPluginExtension(IgniteEx ignite) {
+ assert ignite != null;
+
+ this.ignite = ignite;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int id() {
+ return 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public PlatformTarget createTarget() {
+ return new PlatformTestPluginTarget(ignite.context().platform().context(), "");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java
new file mode 100644
index 0000000..298fa20
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginProvider.java
@@ -0,0 +1,97 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.platform.PlatformPluginExtension;
+import org.apache.ignite.plugin.*;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+/**
+ * Plugin provider for platform tests.
+ */
+public class PlatformTestPluginProvider implements PluginProvider {
+ /** {@inheritDoc} */
+ @Override public String name() {
+ return "TestPlatformPlugin";
+ }
+
+ /** {@inheritDoc} */
+ @Override public String version() {
+ return "1.0";
+ }
+
+ /** {@inheritDoc} */
+ @Override public String copyright() {
+ return "-";
+ }
+
+ /** {@inheritDoc} */
+ @Override public void initExtensions(PluginContext ctx, ExtensionRegistry registry) {
+ registry.registerExtension(PlatformPluginExtension.class,
+ new PlatformTestPluginExtension((IgniteEx) ctx.grid()));
+ }
+
+ /** {@inheritDoc} */
+ @Override public void start(PluginContext ctx) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stop(boolean cancel) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ @Override public void onIgniteStart() throws IgniteCheckedException {
+ // No-op.
+ }
+
+ @Override public void onIgniteStop(boolean cancel) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Serializable provideDiscoveryData(UUID nodeId) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void receiveDiscoveryData(UUID nodeId, Serializable data) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void validateNewNode(ClusterNode node) throws PluginValidationException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object createComponent(PluginContext ctx, Class cls) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgnitePlugin plugin() {
+ return new PlatformTestPlugin();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
new file mode 100644
index 0000000..42d8739
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
@@ -0,0 +1,90 @@
+/*
+ * 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.platform.plugin;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.binary.BinaryRawWriterEx;
+import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
+import org.apache.ignite.internal.processors.platform.PlatformContext;
+import org.apache.ignite.internal.processors.platform.PlatformTarget;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Test target.
+ */
+class PlatformTestPluginTarget extends PlatformAbstractTarget {
+ /** */
+ private final String name;
+
+ /**
+ * Constructor.
+ *
+ * @param platformCtx Context.
+ */
+ PlatformTestPluginTarget(PlatformContext platformCtx, String name) {
+ super(platformCtx);
+
+ this.name = name;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException {
+ return val + 1;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
+ return reader.readString().length();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void processInStreamOutStream(int type, BinaryRawReaderEx reader, BinaryRawWriterEx writer)
+ throws IgniteCheckedException {
+ String s = reader.readString();
+
+ writer.writeString(s.toUpperCase());
+ }
+
+ /** {@inheritDoc} */
+ @Override public PlatformTarget processInStreamOutObject(int type, BinaryRawReaderEx reader)
+ throws IgniteCheckedException {
+ return new PlatformTestPluginTarget(platformCtx, reader.readString());
+ }
+
+ /** {@inheritDoc} */
+ @Override public PlatformTarget processInObjectStreamOutObjectStream(
+ int type, @Nullable PlatformTarget arg, BinaryRawReaderEx reader, BinaryRawWriterEx writer)
+ throws IgniteCheckedException {
+ PlatformTestPluginTarget t = (PlatformTestPluginTarget)arg;
+
+ writer.writeString(t.name);
+
+ return new PlatformTestPluginTarget(platformCtx, t.name + reader.readString());
+ }
+
+ /** {@inheritDoc} */
+ @Override public void processOutStream(int type, BinaryRawWriterEx writer) throws IgniteCheckedException {
+ writer.writeString(name);
+ }
+
+ /** {@inheritDoc} */
+ @Override public PlatformTarget processOutObject(int type) throws IgniteCheckedException {
+ return new PlatformTestPluginTarget(platformCtx, name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/cpp/jni/include/ignite/jni/exports.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/exports.h b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
index a2e5cbb..a93f580 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/exports.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
@@ -49,6 +49,7 @@ extern "C" {
void* IGNITE_CALL IgniteProcessorEvents(gcj::JniContext* ctx, void* obj, void* prj);
void* IGNITE_CALL IgniteProcessorServices(gcj::JniContext* ctx, void* obj, void* prj);
void* IGNITE_CALL IgniteProcessorExtensions(gcj::JniContext* ctx, void* obj);
+ void* IGNITE_CALL IgniteProcessorExtension(gcj::JniContext* ctx, void* obj, int id);
void* IGNITE_CALL IgniteProcessorAtomicLong(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create);
void* IGNITE_CALL IgniteProcessorAtomicSequence(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create);
void* IGNITE_CALL IgniteProcessorAtomicReference(gcj::JniContext* ctx, void* obj, char* name, long long memPtr, bool create);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/cpp/jni/include/ignite/jni/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h
index 6289d73..b790db5 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/java.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h
@@ -192,6 +192,7 @@ namespace ignite
jmethodID m_PlatformProcessor_events;
jmethodID m_PlatformProcessor_services;
jmethodID m_PlatformProcessor_extensions;
+ jmethodID m_PlatformProcessor_extension;
jmethodID m_PlatformProcessor_atomicLong;
jmethodID m_PlatformProcessor_getIgniteConfiguration;
jmethodID m_PlatformProcessor_getCacheNames;
@@ -369,6 +370,7 @@ namespace ignite
jobject ProcessorEvents(jobject obj, jobject prj);
jobject ProcessorServices(jobject obj, jobject prj);
jobject ProcessorExtensions(jobject obj);
+ jobject ProcessorExtension(jobject obj, int id);
jobject ProcessorAtomicLong(jobject obj, char* name, long long initVal, bool create);
jobject ProcessorAtomicSequence(jobject obj, char* name, long long initVal, bool create);
jobject ProcessorAtomicReference(jobject obj, char* name, long long memPtr, bool create);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/cpp/jni/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/project/vs/module.def b/modules/platforms/cpp/jni/project/vs/module.def
index 9effaf9..45a5bff 100644
--- a/modules/platforms/cpp/jni/project/vs/module.def
+++ b/modules/platforms/cpp/jni/project/vs/module.def
@@ -34,6 +34,7 @@ IgniteCreateContext @84
IgniteDeleteContext @85
IgniteDestroyJvm @86
IgniteTargetOutObject @91
+IgniteProcessorExtension @96
IgniteProcessorExtensions @97
IgniteProcessorAtomicLong @98
IgniteProcessorCreateCacheFromConfig @114
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/cpp/jni/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp
index b842c03..17fed71 100644
--- a/modules/platforms/cpp/jni/src/exports.cpp
+++ b/modules/platforms/cpp/jni/src/exports.cpp
@@ -118,6 +118,10 @@ extern "C" {
return ctx->ProcessorExtensions(static_cast<jobject>(obj));
}
+ void* IGNITE_CALL IgniteProcessorExtension(gcj::JniContext* ctx, void* obj, int id) {
+ return ctx->ProcessorExtension(static_cast<jobject>(obj), id);
+ }
+
void* IGNITE_CALL IgniteProcessorAtomicLong(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create) {
return ctx->ProcessorAtomicLong(static_cast<jobject>(obj), name, initVal, create);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index 2c8c76a..0c2e460 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -212,6 +212,7 @@ namespace ignite
JniMethod M_PLATFORM_PROCESSOR_EVENTS = JniMethod("events", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
JniMethod M_PLATFORM_PROCESSOR_SERVICES = JniMethod("services", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
JniMethod M_PLATFORM_PROCESSOR_EXTENSIONS = JniMethod("extensions", "()Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
+ JniMethod M_PLATFORM_PROCESSOR_EXTENSION = JniMethod("extension", "(I)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
JniMethod M_PLATFORM_PROCESSOR_ATOMIC_LONG = JniMethod("atomicLong", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
JniMethod M_PLATFORM_PROCESSOR_ATOMIC_SEQUENCE = JniMethod("atomicSequence", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
JniMethod M_PLATFORM_PROCESSOR_ATOMIC_REFERENCE = JniMethod("atomicReference", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
@@ -528,6 +529,7 @@ namespace ignite
m_PlatformProcessor_events = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EVENTS);
m_PlatformProcessor_services = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_SERVICES);
m_PlatformProcessor_extensions = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EXTENSIONS);
+ m_PlatformProcessor_extension = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EXTENSION);
m_PlatformProcessor_atomicLong = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_LONG);
m_PlatformProcessor_atomicSequence = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_SEQUENCE);
m_PlatformProcessor_atomicReference = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_REFERENCE);
@@ -1152,6 +1154,17 @@ namespace ignite
return LocalToGlobal(env, res);
}
+ jobject JniContext::ProcessorExtension(jobject obj, int id)
+ {
+ JNIEnv* env = Attach();
+
+ jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_extension, id);
+
+ ExceptionCheck(env);
+
+ return LocalToGlobal(env, res);
+ }
+
jobject JniContext::ProcessorAtomicLong(jobject obj, char* name, long long initVal, bool create)
{
JNIEnv* env = Attach();
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
index 44ba196..25efce0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests.Plugin
using System.Collections.Generic;
using System.IO;
using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Interop;
using Apache.Ignite.Core.Plugin;
using NUnit.Framework;
@@ -67,6 +68,11 @@ namespace Apache.Ignite.Core.Tests.Plugin
var plugin2 = ignite.GetPlugin<TestIgnitePlugin>(TestIgnitePluginProvider.PluginName);
Assert.AreEqual(plugin, plugin2);
+
+ var extension = plugin.Provider.Context.GetExtension(0);
+ Assert.IsNotNull(extension);
+
+ CheckPluginTarget(extension);
}
Assert.AreEqual(true, plugin.Provider.Stopped);
@@ -74,6 +80,42 @@ namespace Apache.Ignite.Core.Tests.Plugin
}
/// <summary>
+ /// Checks the plugin target operations.
+ /// </summary>
+ private static void CheckPluginTarget(IPlatformTarget target)
+ {
+ // Returns name.
+ Assert.AreEqual(string.Empty, target.OutStream(1, r => r.ReadString()));
+
+ // Increments arg by one.
+ Assert.AreEqual(3, target.InLongOutLong(1, 2));
+ Assert.AreEqual(5, target.InLongOutLong(1, 4));
+
+ // Returns string length.
+ Assert.AreEqual(3, target.InStreamOutLong(1, w => w.WriteString("foo")));
+ Assert.AreEqual(6, target.InStreamOutLong(1, w => w.WriteString("foobar")));
+
+ // Returns uppercase string.
+ Assert.AreEqual("FOO", target.InStreamOutStream(1, w => w.WriteString("foo"), r => r.ReadString()));
+ Assert.AreEqual("BAR", target.InStreamOutStream(1, w => w.WriteString("bar"), r => r.ReadString()));
+
+ // Returns target with specified name.
+ var newTarget = target.InStreamOutObject(1, w => w.WriteString("name1"));
+ Assert.AreEqual("name1", newTarget.OutStream(1, r => r.ReadString()));
+
+ // Returns target with specified name appended.
+ var res = target.InObjectStreamOutObjectStream(1, newTarget, w => w.WriteString("_abc"),
+ (reader, t) => Tuple.Create(reader.ReadString(), t));
+
+ Assert.AreEqual("name1", res.Item1); // Old name
+ Assert.AreEqual("name1_abc", res.Item2.OutStream(1, r => r.ReadString()));
+
+ // Returns a copy with same name.
+ var resCopy = res.Item2.OutObject(1);
+ Assert.AreEqual("name1_abc", resCopy.OutStream(1, r => r.ReadString()));
+ }
+
+ /// <summary>
/// Tests invalid plugins.
/// </summary>
[Test]
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/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 93970c0..8770682 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -454,6 +454,7 @@
<Compile Include="Impl\Unmanaged\UnmanagedNonReleaseableTarget.cs" />
<Compile Include="Impl\Unmanaged\UnmanagedTarget.cs" />
<Compile Include="Impl\Unmanaged\UnmanagedUtils.cs" />
+ <Compile Include="Interop\IPlatformTarget.cs" />
<Compile Include="Interop\JavaObject.cs" />
<Compile Include="Interop\Package-Info.cs" />
<Compile Include="Lifecycle\ClientReconnectEventArgs.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
index 9cf2a6c..f115042 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@ -29,6 +29,7 @@ namespace Apache.Ignite.Core.Impl
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Memory;
using Apache.Ignite.Core.Impl.Unmanaged;
+ using Apache.Ignite.Core.Interop;
using BinaryReader = Apache.Ignite.Core.Impl.Binary.BinaryReader;
using BinaryWriter = Apache.Ignite.Core.Impl.Binary.BinaryWriter;
using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
@@ -37,7 +38,7 @@ namespace Apache.Ignite.Core.Impl
/// Base class for interop targets.
/// </summary>
[SuppressMessage("ReSharper", "LocalVariableHidesMember")]
- internal abstract class PlatformTarget
+ internal class PlatformTarget : IPlatformTarget
{
/** */
protected const int False = 0;
@@ -76,7 +77,7 @@ namespace Apache.Ignite.Core.Impl
/// </summary>
/// <param name="target">Target.</param>
/// <param name="marsh">Marshaller.</param>
- protected PlatformTarget(IUnmanagedTarget target, Marshaller marsh)
+ public PlatformTarget(IUnmanagedTarget target, Marshaller marsh)
{
Debug.Assert(target != null);
Debug.Assert(marsh != null);
@@ -913,6 +914,71 @@ namespace Apache.Ignite.Core.Impl
}
#endregion
+
+ #region IPlatformTarget
+
+ /** <inheritdoc /> */
+ public long InLongOutLong(int type, long val)
+ {
+ return DoOutInOp(type, val);
+ }
+
+ /** <inheritdoc /> */
+ public long InStreamOutLong(int type, Action<IBinaryRawWriter> writeAction)
+ {
+ return DoOutOp(type, writer => writeAction(writer));
+ }
+
+ /** <inheritdoc /> */
+ public T InStreamOutStream<T>(int type, Action<IBinaryRawWriter> writeAction,
+ Func<IBinaryRawReader, T> readAction)
+ {
+ return DoOutInOp(type, writeAction, stream => readAction(Marshaller.StartUnmarshal(stream)));
+ }
+
+ /** <inheritdoc /> */
+ public IPlatformTarget InStreamOutObject(int type, Action<IBinaryRawWriter> writeAction)
+ {
+ return GetPlatformTarget(DoOutOpObject(type, writeAction));
+ }
+
+ /** <inheritdoc /> */
+ public unsafe T InObjectStreamOutObjectStream<T>(int type, IPlatformTarget arg, Action<IBinaryRawWriter> writeAction,
+ Func<IBinaryRawReader, IPlatformTarget, T> readAction)
+ {
+ return DoOutInOp(type, writeAction, (stream, obj) => readAction(Marshaller.StartUnmarshal(stream),
+ GetPlatformTarget(obj)), GetTargetPtr(arg));
+ }
+
+ /** <inheritdoc /> */
+ public T OutStream<T>(int type, Func<IBinaryRawReader, T> readAction)
+ {
+ return DoInOp(type, stream => readAction(Marshaller.StartUnmarshal(stream)));
+ }
+
+ /** <inheritdoc /> */
+ public IPlatformTarget OutObject(int type)
+ {
+ return GetPlatformTarget(DoOutOpObject(type));
+ }
+
+ /// <summary>
+ /// Gets the platform target.
+ /// </summary>
+ private IPlatformTarget GetPlatformTarget(IUnmanagedTarget target)
+ {
+ return target == null ? null : new PlatformTarget(target, Marshaller);
+ }
+
+ /// <summary>
+ /// Gets the target pointer.
+ /// </summary>
+ private static unsafe void* GetTargetPtr(IPlatformTarget target)
+ {
+ return target == null ? null : ((PlatformTarget) target).Target.Target;
+ }
+
+ #endregion
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
index 6b3eaca..1aa4fab 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
@@ -17,6 +17,8 @@
namespace Apache.Ignite.Core.Impl.Plugin
{
+ using Apache.Ignite.Core.Impl.Unmanaged;
+ using Apache.Ignite.Core.Interop;
using Apache.Ignite.Core.Plugin;
/// <summary>
@@ -56,5 +58,15 @@ namespace Apache.Ignite.Core.Impl.Plugin
{
get { return _pluginConfiguration; }
}
+
+ /** <inheritdoc /> */
+ public IPlatformTarget GetExtension(int id)
+ {
+ var ignite = _pluginProcessor.Ignite;
+
+ var ext = UnmanagedUtils.ProcessorExtension(ignite.InteropProcessor, id);
+
+ return new PlatformTarget(ext, ignite.Marshaller);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs
index ba2d401..78b750b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs
@@ -54,7 +54,7 @@ namespace Apache.Ignite.Core.Impl.Plugin
/// <summary>
/// Gets the Ignite.
/// </summary>
- public IIgnite Ignite
+ public Ignite Ignite
{
get { return _ignite; }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
index c4f3e19..a6a3a31 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
@@ -95,6 +95,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorExtensions")]
public static extern void* ProcessorExtensions(void* ctx, void* obj);
+ [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorExtension")]
+ public static extern void* ProcessorExtension(void* ctx, void* obj, int id);
+
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorAtomicLong")]
public static extern void* ProcessorAtomicLong(void* ctx, void* obj, sbyte* name, long initVal,
[MarshalAs(UnmanagedType.U1)] bool create);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
index 34baee0..90e5230 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
@@ -317,6 +317,13 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
return target.ChangeTarget(res);
}
+ internal static IUnmanagedTarget ProcessorExtension(IUnmanagedTarget target, int id)
+ {
+ void* res = JNI.ProcessorExtension(target.Context, target.Target, id);
+
+ return target.ChangeTarget(res);
+ }
+
internal static IUnmanagedTarget ProcessorAtomicLong(IUnmanagedTarget target, string name, long initialValue,
bool create)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/dotnet/Apache.Ignite.Core/Interop/IPlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Interop/IPlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Interop/IPlatformTarget.cs
new file mode 100644
index 0000000..8b8963f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Interop/IPlatformTarget.cs
@@ -0,0 +1,91 @@
+\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.Interop
+{
+ using System;
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// Interface to interoperate with
+ /// org.apache.ignite.internal.processors.platform.PlatformTarget on Java side.
+ /// </summary>
+ public interface IPlatformTarget
+ {
+ /// <summary>
+ /// Performs InLongOutLong operation.
+ /// </summary>
+ /// <param name="type">Operation type code.</param>
+ /// <param name="val">Value.</param>
+ /// <returns>Result.</returns>
+ long InLongOutLong(int type, long val);
+
+ /// <summary>
+ /// Performs InStreamOutLong operation.
+ /// </summary>
+ /// <param name="type">Operation type code.</param>
+ /// <param name="writeAction">Write action.</param>
+ /// <returns>Result.</returns>
+ long InStreamOutLong(int type, Action<IBinaryRawWriter> writeAction);
+
+ /// <summary>
+ /// Performs InStreamOutStream operation.
+ /// </summary>
+ /// <typeparam name="T">Result type.</typeparam>
+ /// <param name="type">Operation type code.</param>
+ /// <param name="writeAction">Write action.</param>
+ /// <param name="readAction">Read action.</param>
+ /// <returns>Result.</returns>
+ T InStreamOutStream<T>(int type, Action<IBinaryRawWriter> writeAction, Func<IBinaryRawReader, T> readAction);
+
+ /// <summary>
+ /// Performs InStreamOutObject operation.
+ /// </summary>
+ /// <param name="type">Operation type code.</param>
+ /// <param name="writeAction">Write action.</param>
+ /// <returns>Result.</returns>
+ IPlatformTarget InStreamOutObject(int type, Action<IBinaryRawWriter> writeAction);
+
+ /// <summary>
+ /// Performs InObjectStreamOutObjectStream operation.
+ /// </summary>
+ /// <typeparam name="T">Result type.</typeparam>
+ /// <param name="type">Operation type code.</param>
+ /// <param name="arg">Target argument.</param>
+ /// <param name="writeAction">Write action.</param>
+ /// <param name="readAction">Read action.</param>
+ /// <returns>Result.</returns>
+ T InObjectStreamOutObjectStream<T>(int type, IPlatformTarget arg, Action<IBinaryRawWriter> writeAction,
+ Func<IBinaryRawReader, IPlatformTarget, T> readAction);
+
+ /// <summary>
+ /// Performs OutStream operation.
+ /// </summary>
+ /// <typeparam name="T">Result type.</typeparam>
+ /// <param name="type">Operation type code.</param>
+ /// <param name="readAction">Read action.</param>
+ /// <returns>Result.</returns>
+ T OutStream<T>(int type, Func<IBinaryRawReader, T> readAction);
+
+ /// <summary>
+ /// Performs the OutObject operation.
+ /// </summary>
+ /// <param name="type">Operation type code.</param>
+ /// <returns>Result.</returns>
+ IPlatformTarget OutObject(int type);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f299d9ad/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs
index e91bdbf..edaa7c3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs
@@ -17,6 +17,8 @@
namespace Apache.Ignite.Core.Plugin
{
+ using Apache.Ignite.Core.Interop;
+
/// <summary>
/// Plugin execution context.
/// </summary>
@@ -36,5 +38,15 @@ namespace Apache.Ignite.Core.Plugin
/// Gets the plugin configuration.
/// </summary>
T PluginConfiguration { get; }
+
+ /// <summary>
+ /// Gets a reference to plugin extension on Java side.
+ /// <para />
+ /// Extensions on Java side are configured via PluginProvider.initExtensions().
+ /// Extension should implement PlatformExtension interface to be accessible from this method.
+ /// </summary>
+ /// <param name="id">Extension id. Equal to PlatformExtension.id().</param>
+ /// <returns>Reference to a plugin extension on Java side.</returns>
+ IPlatformTarget GetExtension(int id);
}
}
\ No newline at end of file