ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [42/50] ignite git commit: IGNITE-1283: Creating infrastructure for platforms module.
Date Tue, 25 Aug 2015 08:57:49 GMT
IGNITE-1283: Creating infrastructure for platforms module.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/aaf43758
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/aaf43758
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/aaf43758

Branch: refs/heads/ignite-1093
Commit: aaf43758caa68a80a31b9cce653e18888da04887
Parents: 1327340
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Mon Aug 24 11:20:11 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Aug 24 11:20:11 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteConfiguration.java      |  22 +++
 .../configuration/PlatformConfiguration.java    |  25 +++
 .../internal/GridEventConsumeHandler.java       |  14 +-
 .../interop/InteropAwareEventFilter.java        |  37 ----
 .../internal/interop/InteropBootstrap.java      |  35 ----
 .../interop/InteropBootstrapFactory.java        |  39 ----
 .../internal/interop/InteropException.java      |  71 -------
 .../internal/interop/InteropIgnition.java       | 186 -------------------
 .../interop/InteropLocalEventListener.java      |  28 ---
 .../interop/InteropNoCallbackException.java     |  50 -----
 .../internal/interop/InteropProcessor.java      |  39 ----
 .../eventstorage/GridEventStorageManager.java   |  10 +-
 .../platform/PlatformAwareEventFilter.java      |  37 ++++
 .../platform/PlatformLocalEventListener.java    |  28 +++
 modules/platform/pom.xml                        |  65 +++++++
 .../ignite/internal/platform/Platform.java      |  39 ++++
 .../internal/platform/PlatformBootstrap.java    |  35 ++++
 .../platform/PlatformBootstrapFactory.java      |  37 ++++
 .../internal/platform/PlatformException.java    |  71 +++++++
 .../internal/platform/PlatformIgnition.java     | 186 +++++++++++++++++++
 .../platform/PlatformNoCallbackException.java   |  50 +++++
 pom.xml                                         |   1 +
 22 files changed, 608 insertions(+), 497 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index b670398..1fa1de4 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -416,6 +416,9 @@ public class IgniteConfiguration {
     /** SSL connection factory. */
     private Factory<SSLContext> sslCtxFactory;
 
+    /** Platform configuration. */
+    private PlatformConfiguration platformCfg;
+
     /**
      * Creates valid grid configuration with all default values.
      */
@@ -490,6 +493,7 @@ public class IgniteConfiguration {
         p2pLocClsPathExcl = cfg.getPeerClassLoadingLocalClassPathExclude();
         p2pMissedCacheSize = cfg.getPeerClassLoadingMissedResourcesCacheSize();
         p2pPoolSize = cfg.getPeerClassLoadingThreadPoolSize();
+        platformCfg = cfg.getPlatformConfiguration();
         pluginCfgs = cfg.getPluginConfigurations();
         pubPoolSize = cfg.getPublicThreadPoolSize();
         segChkFreq = cfg.getSegmentCheckFrequency();
@@ -2371,6 +2375,24 @@ public class IgniteConfiguration {
         return this;
     }
 
+    /**
+     * Gets platform configuration.
+     *
+     * @return Platform configuration.
+     */
+    public PlatformConfiguration getPlatformConfiguration() {
+        return platformCfg;
+    }
+
+    /**
+     * Sets platform configuration.
+     *
+     * @param platformCfg Platform configuration.
+     */
+    public void setPlatformConfiguration(PlatformConfiguration platformCfg) {
+        this.platformCfg = platformCfg;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgniteConfiguration.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/configuration/PlatformConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/PlatformConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/PlatformConfiguration.java
new file mode 100644
index 0000000..14d5e1d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/PlatformConfiguration.java
@@ -0,0 +1,25 @@
+/*
+ * 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.configuration;
+
+/**
+ * Platform configuration marker interface.
+ */
+public class PlatformConfiguration {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
index f33fa39..134184a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
@@ -21,9 +21,9 @@ import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.cluster.*;
-import org.apache.ignite.internal.interop.*;
 import org.apache.ignite.internal.managers.deployment.*;
 import org.apache.ignite.internal.managers.eventstorage.*;
+import org.apache.ignite.internal.platform.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.continuous.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -125,8 +125,8 @@ class GridEventConsumeHandler implements GridContinuousHandler {
         if (filter != null)
             ctx.resource().injectGeneric(filter);
 
-        if (filter instanceof InteropAwareEventFilter)
-            ((InteropAwareEventFilter)filter).initialize(ctx);
+        if (filter instanceof PlatformAwareEventFilter)
+            ((PlatformAwareEventFilter)filter).initialize(ctx);
 
         final boolean loc = nodeId.equals(ctx.localNodeId());
 
@@ -246,16 +246,16 @@ class GridEventConsumeHandler implements GridContinuousHandler {
         RuntimeException err = null;
 
         try {
-            if (filter instanceof InteropAwareEventFilter)
-                ((InteropAwareEventFilter)filter).close();
+            if (filter instanceof PlatformAwareEventFilter)
+                ((PlatformAwareEventFilter)filter).close();
         }
         catch(RuntimeException ex) {
             err = ex;
         }
 
         try {
-            if (cb instanceof InteropLocalEventListener)
-                ((InteropLocalEventListener)cb).close();
+            if (cb instanceof PlatformLocalEventListener)
+                ((PlatformLocalEventListener)cb).close();
         }
         catch (RuntimeException ex) {
             if (err == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropAwareEventFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropAwareEventFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropAwareEventFilter.java
deleted file mode 100644
index 8dbc73b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropAwareEventFilter.java
+++ /dev/null
@@ -1,37 +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.interop;
-
-import org.apache.ignite.events.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.lang.*;
-
-/**
- * Special version of predicate for events with initialize/close callbacks.
- */
-public interface InteropAwareEventFilter<E extends Event> extends IgnitePredicate<E> {
-    /**
-     * Initializes the filter.
-     */
-    public void initialize(GridKernalContext ctx);
-
-    /**
-     * Closes the filter.
-     */
-    public void close();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrap.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrap.java
deleted file mode 100644
index df5af6c..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrap.java
+++ /dev/null
@@ -1,35 +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.interop;
-
-import org.apache.ignite.configuration.*;
-
-/**
- * Interop bootstrap. Responsible for starting Ignite node in interop mode.
- */
-public interface InteropBootstrap {
-    /**
-     * Start Ignite node.
-     *
-     * @param cfg Configuration.
-     * @param envPtr Environment pointer.
-     * @param dataPtr Optional pointer to additional data required for startup.
-     * @return Ignite node.
-     */
-    public InteropProcessor start(IgniteConfiguration cfg, long envPtr, long dataPtr);
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrapFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrapFactory.java
deleted file mode 100644
index b61ca89..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrapFactory.java
+++ /dev/null
@@ -1,39 +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.interop;
-
-import java.io.*;
-
-/**
- * Interop bootstrap factory.
- */
-public interface InteropBootstrapFactory extends Serializable {
-    /**
-     * Get bootstrap factory ID.
-     *
-     * @return ID.
-     */
-    public int id();
-
-    /**
-     * Create bootstrap instance.
-     *
-     * @return Bootstrap instance.
-     */
-    public InteropBootstrap create();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropException.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropException.java
deleted file mode 100644
index d74b9d4..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropException.java
+++ /dev/null
@@ -1,71 +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.interop;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-/**
- * Interop checked exception.
- */
-public class InteropException extends IgniteCheckedException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Create empty exception.
-     */
-    public InteropException() {
-        // No-op.
-    }
-
-    /**
-     * Creates new exception with given error message.
-     *
-     * @param msg Error message.
-     */
-    public InteropException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Creates new grid exception with given throwable as a cause and
-     * source of error message.
-     *
-     * @param cause Non-null throwable cause.
-     */
-    public InteropException(Throwable cause) {
-        this(cause.getMessage(), cause);
-    }
-
-    /**
-     * Creates new exception with given error message and optional nested exception.
-     *
-     * @param msg Error message.
-     * @param cause Optional nested exception (can be {@code null}).
-     */
-    public InteropException(String msg, @Nullable Throwable cause) {
-        super(msg, cause);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(InteropException.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
deleted file mode 100644
index 35e9bc9..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
+++ /dev/null
@@ -1,186 +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.interop;
-
-import org.apache.ignite.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.resource.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
-
-import java.net.*;
-import java.security.*;
-import java.util.*;
-
-/**
- * Entry point for interop nodes.
- */
-@SuppressWarnings("UnusedDeclaration")
-public class InteropIgnition {
-    /** Map with active instances. */
-    private static final HashMap<String, InteropProcessor> instances = new HashMap<>();
-
-    /**
-     * Start Ignite node in interop mode.
-     *
-     * @param springCfgPath Spring configuration path.
-     * @param gridName Grid name.
-     * @param factoryId Factory ID.
-     * @param envPtr Environment pointer.
-     * @param dataPtr Optional pointer to additional data required for startup.
-     * @return Ignite instance.
-     */
-    public static synchronized InteropProcessor start(@Nullable String springCfgPath, @Nullable String gridName,
-        int factoryId, long envPtr, long dataPtr) {
-        if (envPtr <= 0)
-            throw new IgniteException("Environment pointer must be positive.");
-
-        ClassLoader oldClsLdr = Thread.currentThread().getContextClassLoader();
-
-        Thread.currentThread().setContextClassLoader(InteropIgnition.class.getClassLoader());
-
-        try {
-            IgniteConfiguration cfg = configuration(springCfgPath);
-
-            if (gridName != null)
-                cfg.setGridName(gridName);
-            else
-                gridName = cfg.getGridName();
-
-            InteropBootstrap bootstrap = bootstrap(factoryId);
-
-            InteropProcessor proc = bootstrap.start(cfg, envPtr, dataPtr);
-
-            InteropProcessor old = instances.put(gridName, proc);
-
-            assert old == null;
-
-            return proc;
-        }
-        finally {
-            Thread.currentThread().setContextClassLoader(oldClsLdr);
-        }
-    }
-
-    /**
-     * Get instance by environment pointer.
-     *
-     * @param gridName Grid name.
-     * @return Instance or {@code null} if it doesn't exist (never started or stopped).
-     */
-    @Nullable public static synchronized InteropProcessor instance(@Nullable String gridName) {
-        return instances.get(gridName);
-    }
-
-    /**
-     * Get environment pointer of the given instance.
-     *
-     * @param gridName Grid name.
-     * @return Environment pointer or {@code 0} in case grid with such name doesn't exist.
-     */
-    public static synchronized long environmentPointer(@Nullable String gridName) {
-        InteropProcessor proc = instance(gridName);
-
-        return proc != null ? proc.environmentPointer() : 0;
-    }
-
-    /**
-     * Stop single instance.
-     *
-     * @param gridName Grid name,
-     * @param cancel Cancel flag.
-     * @return {@code True} if instance was found and stopped.
-     */
-    public static synchronized boolean stop(@Nullable String gridName, boolean cancel) {
-        if (Ignition.stop(gridName, cancel)) {
-            InteropProcessor old = instances.remove(gridName);
-
-            assert old != null;
-
-            return true;
-        }
-        else
-            return false;
-    }
-
-    /**
-     * Stop all instances.
-     *
-     * @param cancel Cancel flag.
-     */
-    public static synchronized void stopAll(boolean cancel) {
-        for (InteropProcessor proc : instances.values())
-            Ignition.stop(proc.ignite().name(), cancel);
-
-        instances.clear();
-    }
-
-    /**
-     * Create configuration.
-     *
-     * @param springCfgPath Path to Spring XML.
-     * @return Configuration.
-     */
-    private static IgniteConfiguration configuration(@Nullable String springCfgPath) {
-        try {
-            URL url = springCfgPath == null ? U.resolveIgniteUrl(IgnitionEx.DFLT_CFG) :
-                U.resolveSpringUrl(springCfgPath);
-
-            IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> t = IgnitionEx.loadConfiguration(url);
-
-            return t.get1();
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException("Failed to instantiate configuration from Spring XML: " + springCfgPath, e);
-        }
-    }
-
-    /**
-     * Create bootstrap for the given factory ID.
-     *
-     * @param factoryId Factory ID.
-     * @return Bootstrap.
-     */
-    private static InteropBootstrap bootstrap(final int factoryId) {
-        InteropBootstrapFactory factory = AccessController.doPrivileged(
-            new PrivilegedAction<InteropBootstrapFactory>() {
-            @Override public InteropBootstrapFactory run() {
-                for (InteropBootstrapFactory factory : ServiceLoader.load(InteropBootstrapFactory.class)) {
-                    if (factory.id() == factoryId)
-                        return factory;
-                }
-
-                return null;
-            }
-        });
-
-        if (factory == null)
-            throw new IgniteException("Interop factory is not found (did you put into the classpath?): " + factoryId);
-
-        return factory.create();
-    }
-
-    /**
-     * Private constructor.
-     */
-    private InteropIgnition() {
-        // No-op.
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropLocalEventListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropLocalEventListener.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropLocalEventListener.java
deleted file mode 100644
index 180863b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropLocalEventListener.java
+++ /dev/null
@@ -1,28 +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.interop;
-
-/**
- * Special version of listener for events with close callbacks.
- */
-public interface InteropLocalEventListener {
-    /**
-     * Closes the listener.
-     */
-    public void close();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropNoCallbackException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropNoCallbackException.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropNoCallbackException.java
deleted file mode 100644
index 6fd614a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropNoCallbackException.java
+++ /dev/null
@@ -1,50 +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.interop;
-
-import org.apache.ignite.internal.util.typedef.internal.*;
-
-/**
- * Exception raised when interop callback is not set in native platform.
- */
-@SuppressWarnings("UnusedDeclaration")
-public class InteropNoCallbackException extends InteropException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Constructor.
-     */
-    public InteropNoCallbackException() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param msg Message.
-     */
-    public InteropNoCallbackException(String msg) {
-        super(msg);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(InteropNoCallbackException.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
deleted file mode 100644
index 2551047..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
+++ /dev/null
@@ -1,39 +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.interop;
-
-import org.apache.ignite.*;
-
-/**
- * Interop processor.
- */
-public interface InteropProcessor {
-    /**
-     * Get owning Ignite instance.
-     *
-     * @return Ignite instance.
-     */
-    public Ignite ignite();
-
-    /**
-     * Get environment pointer associated with this processor.
-     *
-     * @return Environment pointer.
-     */
-    public long environmentPointer();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
index 365076b..d8e6ae1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
@@ -22,10 +22,10 @@ import org.apache.ignite.cluster.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.events.*;
-import org.apache.ignite.internal.interop.*;
 import org.apache.ignite.internal.managers.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.managers.deployment.*;
+import org.apache.ignite.internal.platform.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -655,8 +655,8 @@ public class GridEventStorageManager extends GridManagerAdapter<EventStorageSpi>
         {
             IgnitePredicate p = ((UserListenerWrapper)lsnr).listener();
 
-            if (p instanceof InteropLocalEventListener)
-                ((InteropLocalEventListener)p).close();
+            if (p instanceof PlatformLocalEventListener)
+                ((PlatformLocalEventListener)p).close();
         }
 
         return found;
@@ -761,8 +761,8 @@ public class GridEventStorageManager extends GridManagerAdapter<EventStorageSpi>
     public <T extends Event> Collection<T> localEvents(IgnitePredicate<T> p) {
         assert p != null;
 
-        if (p instanceof InteropAwareEventFilter) {
-            InteropAwareEventFilter p0 = (InteropAwareEventFilter)p;
+        if (p instanceof PlatformAwareEventFilter) {
+            PlatformAwareEventFilter p0 = (PlatformAwareEventFilter)p;
 
             p0.initialize(ctx);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/platform/PlatformAwareEventFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/platform/PlatformAwareEventFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/platform/PlatformAwareEventFilter.java
new file mode 100644
index 0000000..2ae664d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/platform/PlatformAwareEventFilter.java
@@ -0,0 +1,37 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.events.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.lang.*;
+
+/**
+ * Special version of predicate for events with initialize/close callbacks.
+ */
+public interface PlatformAwareEventFilter<E extends Event> extends IgnitePredicate<E> {
+    /**
+     * Initializes the filter.
+     */
+    public void initialize(GridKernalContext ctx);
+
+    /**
+     * Closes the filter.
+     */
+    public void close();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/core/src/main/java/org/apache/ignite/internal/platform/PlatformLocalEventListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/platform/PlatformLocalEventListener.java b/modules/core/src/main/java/org/apache/ignite/internal/platform/PlatformLocalEventListener.java
new file mode 100644
index 0000000..31c585c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/platform/PlatformLocalEventListener.java
@@ -0,0 +1,28 @@
+/*
+ * 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.platform;
+
+/**
+ * Special version of listener for events with close callbacks.
+ */
+public interface PlatformLocalEventListener {
+    /**
+     * Closes the listener.
+     */
+    public void close();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/platform/pom.xml
----------------------------------------------------------------------
diff --git a/modules/platform/pom.xml b/modules/platform/pom.xml
new file mode 100644
index 0000000..e583f6a
--- /dev/null
+++ b/modules/platform/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-platform</artifactId>
+    <version>1.4.1-SNAPSHOT</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-log4j</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-spring</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/platform/src/main/java/org/apache/ignite/internal/platform/Platform.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/platform/Platform.java b/modules/platform/src/main/java/org/apache/ignite/internal/platform/Platform.java
new file mode 100644
index 0000000..6306723
--- /dev/null
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/platform/Platform.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.platform;
+
+import org.apache.ignite.*;
+
+/**
+ * Platform entry point.
+ */
+public interface Platform {
+    /**
+     * Get owning Ignite instance.
+     *
+     * @return Ignite instance.
+     */
+    public Ignite ignite();
+
+    /**
+     * Get environment pointer associated with this processor.
+     *
+     * @return Environment pointer.
+     */
+    public long environmentPointer();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformBootstrap.java b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformBootstrap.java
new file mode 100644
index 0000000..1044445
--- /dev/null
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformBootstrap.java
@@ -0,0 +1,35 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.configuration.*;
+
+/**
+ * Platform bootstrap. Responsible for starting Ignite node with non-Java platform.
+ */
+public interface PlatformBootstrap {
+    /**
+     * Start Ignite node.
+     *
+     * @param cfg Configuration.
+     * @param envPtr Environment pointer.
+     * @param dataPtr Optional pointer to additional data required for startup.
+     * @return Ignite node.
+     */
+    public Platform start(IgniteConfiguration cfg, long envPtr, long dataPtr);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformBootstrapFactory.java b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformBootstrapFactory.java
new file mode 100644
index 0000000..31d1ca5
--- /dev/null
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformBootstrapFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.platform;
+
+/**
+ * Platform bootstrap factory.
+ */
+public interface PlatformBootstrapFactory {
+    /**
+     * Get bootstrap factory ID.
+     *
+     * @return ID.
+     */
+    public int id();
+
+    /**
+     * Create bootstrap instance.
+     *
+     * @return Bootstrap instance.
+     */
+    public PlatformBootstrap create();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformException.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformException.java b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformException.java
new file mode 100644
index 0000000..d0bf565
--- /dev/null
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformException.java
@@ -0,0 +1,71 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Interop checked exception.
+ */
+public class PlatformException extends IgniteCheckedException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Create empty exception.
+     */
+    public PlatformException() {
+        // No-op.
+    }
+
+    /**
+     * Creates new exception with given error message.
+     *
+     * @param msg Error message.
+     */
+    public PlatformException(String msg) {
+        super(msg);
+    }
+
+    /**
+     * Creates new grid exception with given throwable as a cause and
+     * source of error message.
+     *
+     * @param cause Non-null throwable cause.
+     */
+    public PlatformException(Throwable cause) {
+        this(cause.getMessage(), cause);
+    }
+
+    /**
+     * Creates new exception with given error message and optional nested exception.
+     *
+     * @param msg Error message.
+     * @param cause Optional nested exception (can be {@code null}).
+     */
+    public PlatformException(String msg, @Nullable Throwable cause) {
+        super(msg, cause);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(PlatformException.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformIgnition.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformIgnition.java b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformIgnition.java
new file mode 100644
index 0000000..293d79d
--- /dev/null
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformIgnition.java
@@ -0,0 +1,186 @@
+package org.apache.ignite.internal.platform;
+
+/*
+ * 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.
+ */
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.resource.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.jetbrains.annotations.*;
+
+import java.net.*;
+import java.security.*;
+import java.util.*;
+
+/**
+ * Entry point for platform nodes.
+ */
+@SuppressWarnings("UnusedDeclaration")
+public class PlatformIgnition {
+    /** Map with active instances. */
+    private static final HashMap<String, Platform> instances = new HashMap<>();
+
+    /**
+     * Start Ignite node in platform mode.
+     *
+     * @param springCfgPath Spring configuration path.
+     * @param gridName Grid name.
+     * @param factoryId Factory ID.
+     * @param envPtr Environment pointer.
+     * @param dataPtr Optional pointer to additional data required for startup.
+     * @return Ignite instance.
+     */
+    public static synchronized Platform start(@Nullable String springCfgPath, @Nullable String gridName,
+        int factoryId, long envPtr, long dataPtr) {
+        if (envPtr <= 0)
+            throw new IgniteException("Environment pointer must be positive.");
+
+        ClassLoader oldClsLdr = Thread.currentThread().getContextClassLoader();
+
+        Thread.currentThread().setContextClassLoader(Platform.class.getClassLoader());
+
+        try {
+            IgniteConfiguration cfg = configuration(springCfgPath);
+
+            if (gridName != null)
+                cfg.setGridName(gridName);
+            else
+                gridName = cfg.getGridName();
+
+            PlatformBootstrap bootstrap = bootstrap(factoryId);
+
+            Platform proc = bootstrap.start(cfg, envPtr, dataPtr);
+
+            Platform old = instances.put(gridName, proc);
+
+            assert old == null;
+
+            return proc;
+        }
+        finally {
+            Thread.currentThread().setContextClassLoader(oldClsLdr);
+        }
+    }
+
+    /**
+     * Get instance by environment pointer.
+     *
+     * @param gridName Grid name.
+     * @return Instance or {@code null} if it doesn't exist (never started or stopped).
+     */
+    @Nullable public static synchronized Platform instance(@Nullable String gridName) {
+        return instances.get(gridName);
+    }
+
+    /**
+     * Get environment pointer of the given instance.
+     *
+     * @param gridName Grid name.
+     * @return Environment pointer or {@code 0} in case grid with such name doesn't exist.
+     */
+    public static synchronized long environmentPointer(@Nullable String gridName) {
+        Platform proc = instance(gridName);
+
+        return proc != null ? proc.environmentPointer() : 0;
+    }
+
+    /**
+     * Stop single instance.
+     *
+     * @param gridName Grid name,
+     * @param cancel Cancel flag.
+     * @return {@code True} if instance was found and stopped.
+     */
+    public static synchronized boolean stop(@Nullable String gridName, boolean cancel) {
+        if (Ignition.stop(gridName, cancel)) {
+            Platform old = instances.remove(gridName);
+
+            assert old != null;
+
+            return true;
+        }
+        else
+            return false;
+    }
+
+    /**
+     * Stop all instances.
+     *
+     * @param cancel Cancel flag.
+     */
+    public static synchronized void stopAll(boolean cancel) {
+        for (Platform proc : instances.values())
+            Ignition.stop(proc.ignite().name(), cancel);
+
+        instances.clear();
+    }
+
+    /**
+     * Create configuration.
+     *
+     * @param springCfgPath Path to Spring XML.
+     * @return Configuration.
+     */
+    private static IgniteConfiguration configuration(@Nullable String springCfgPath) {
+        try {
+            URL url = springCfgPath == null ? U.resolveIgniteUrl(IgnitionEx.DFLT_CFG) :
+                U.resolveSpringUrl(springCfgPath);
+
+            IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> t = IgnitionEx.loadConfiguration(url);
+
+            return t.get1();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException("Failed to instantiate configuration from Spring XML: " + springCfgPath, e);
+        }
+    }
+
+    /**
+     * Create bootstrap for the given factory ID.
+     *
+     * @param factoryId Factory ID.
+     * @return Bootstrap.
+     */
+    private static PlatformBootstrap bootstrap(final int factoryId) {
+        PlatformBootstrapFactory factory = AccessController.doPrivileged(
+            new PrivilegedAction<PlatformBootstrapFactory>() {
+                @Override public PlatformBootstrapFactory run() {
+                    for (PlatformBootstrapFactory factory : ServiceLoader.load(PlatformBootstrapFactory.class)) {
+                        if (factory.id() == factoryId)
+                            return factory;
+                    }
+
+                    return null;
+                }
+            });
+
+        if (factory == null)
+            throw new IgniteException("Interop factory is not found (did you put into the classpath?): " + factoryId);
+
+        return factory.create();
+    }
+
+    /**
+     * Private constructor.
+     */
+    private PlatformIgnition() {
+        // No-op.
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformNoCallbackException.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformNoCallbackException.java b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformNoCallbackException.java
new file mode 100644
index 0000000..893c332
--- /dev/null
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/platform/PlatformNoCallbackException.java
@@ -0,0 +1,50 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+/**
+ * Exception raised when interop callback is not set in native platform.
+ */
+@SuppressWarnings("UnusedDeclaration")
+public class PlatformNoCallbackException extends PlatformException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Constructor.
+     */
+    public PlatformNoCallbackException() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param msg Message.
+     */
+    public PlatformNoCallbackException(String msg) {
+        super(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(PlatformNoCallbackException.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/aaf43758/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index fa3eaa4..0540361 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,7 @@
         <module>modules/yarn</module>
         <module>modules/jms11</module>
         <module>modules/zookeeper</module>
+        <module>modules/platform</module>
     </modules>
 
     <profiles>


Mime
View raw message