You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/09/03 13:22:53 UTC
[1/2] ignite git commit: IGNITE-1364: GridConfiguration ->
IgniteConfiguration.
Repository: ignite
Updated Branches:
refs/heads/ignite-1364 863189fdd -> 8c86870c0
IGNITE-1364: GridConfiguration -> IgniteConfiguration.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f6dc5cb0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f6dc5cb0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f6dc5cb0
Branch: refs/heads/ignite-1364
Commit: f6dc5cb00359c4ea0d035c30e0c940ce1583ac74
Parents: 863189f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 3 14:16:36 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 3 14:16:36 2015 +0300
----------------------------------------------------------------------
.../main/cpp/core-test/src/cache_query_test.cpp | 2 +-
.../src/main/cpp/core-test/src/cache_test.cpp | 2 +-
.../cpp/core-test/src/grid_factory_test.cpp | 2 +-
.../src/main/cpp/core/include/Makefile.am | 2 +-
.../src/main/cpp/core/include/ignite/grid.h | 2 +-
.../core/include/ignite/grid_configuration.h | 92 --------------------
.../main/cpp/core/include/ignite/grid_factory.h | 10 +--
.../core/include/ignite/ignite_configuration.h | 92 ++++++++++++++++++++
.../src/main/cpp/core/project/vs/core.vcxproj | 2 +-
.../cpp/core/project/vs/core.vcxproj.filters | 2 +-
.../main/cpp/core/project/vs/core.vcxprojrel | 2 +-
.../src/main/cpp/core/src/grid_factory.cpp | 10 +--
12 files changed, 110 insertions(+), 110 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp b/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
index ad3fb15..9d26307 100644
--- a/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
+++ b/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
@@ -186,7 +186,7 @@ struct CacheQueryTestSuiteFixture {
*/
CacheQueryTestSuiteFixture()
{
- GridConfiguration cfg;
+ IgniteConfiguration cfg;
GridJvmOption opts[5];
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/cache_test.cpp b/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
index 7d0cbce..a7c6ebf 100644
--- a/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
+++ b/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
@@ -93,7 +93,7 @@ struct CacheTestSuiteFixture {
*/
CacheTestSuiteFixture()
{
- GridConfiguration cfg;
+ IgniteConfiguration cfg;
GridJvmOption opts[5];
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core-test/src/grid_factory_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/grid_factory_test.cpp b/modules/platform/src/main/cpp/core-test/src/grid_factory_test.cpp
index 61a1a29..4ce221c 100644
--- a/modules/platform/src/main/cpp/core-test/src/grid_factory_test.cpp
+++ b/modules/platform/src/main/cpp/core-test/src/grid_factory_test.cpp
@@ -31,7 +31,7 @@ BOOST_AUTO_TEST_SUITE(GridFactoryTestSuite)
BOOST_AUTO_TEST_CASE(TestGridFactory)
{
- GridConfiguration cfg;
+ IgniteConfiguration cfg;
GridJvmOption opts[5];
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/Makefile.am b/modules/platform/src/main/cpp/core/include/Makefile.am
index f5a067a..ff0a2e3 100644
--- a/modules/platform/src/main/cpp/core/include/Makefile.am
+++ b/modules/platform/src/main/cpp/core/include/Makefile.am
@@ -55,7 +55,7 @@ nobase_include_HEADERS = ignite/cache/cache.h \
ignite/portable/portable_reader.h \
ignite/portable/portable_writer.h \
ignite/grid.h \
- ignite/grid_configuration.h \
+ ignite/ignite_configuration.h \
ignite/ignite_error.h \
ignite/grid_factory.h \
ignite/guid.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core/include/ignite/grid.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/grid.h b/modules/platform/src/main/cpp/core/include/ignite/grid.h
index 4d24832..5ab9c80 100644
--- a/modules/platform/src/main/cpp/core/include/ignite/grid.h
+++ b/modules/platform/src/main/cpp/core/include/ignite/grid.h
@@ -20,7 +20,7 @@
#include "ignite/cache/cache.h"
#include "ignite/impl/grid_impl.h"
-#include "ignite/grid_configuration.h"
+#include "ignite/ignite_configuration.h"
namespace ignite
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core/include/ignite/grid_configuration.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/grid_configuration.h b/modules/platform/src/main/cpp/core/include/ignite/grid_configuration.h
deleted file mode 100644
index fd03cc1..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/grid_configuration.h
+++ /dev/null
@@ -1,92 +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.
- */
-
-#ifndef _IGNITE_GRID_CONFIGURATION
-#define _IGNITE_GRID_CONFIGURATION
-
-#include <stdint.h>
-
-namespace ignite
-{
- /**
- * Single JVM option.
- */
- struct GridJvmOption
- {
- /** Option. */
- char* opt;
-
- /**
- * Default constructor.
- */
- GridJvmOption() : opt(NULL)
- {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param opt Option.
- */
- GridJvmOption(char* opt) : opt(opt)
- {
- // No-op.
- }
- };
-
- /**
- * Grid configuration.
- */
- struct GridConfiguration
- {
- /** Path to Ignite home. */
- char* igniteHome;
-
- /** Path to Spring configuration file. */
- char* springCfgPath;
-
- /** Path ot JVM libbrary. */
- char* jvmLibPath;
-
- /** JVM classpath. */
- char* jvmClassPath;
-
- /** Initial amount of JVM memory. */
- int32_t jvmInitMem;
-
- /** Maximum amount of JVM memory. */
- int32_t jvmMaxMem;
-
- /** Additional JVM options. */
- GridJvmOption* jvmOpts;
-
- /** Additional JVM options count. */
- int32_t jvmOptsLen;
-
- /**
- * Constructor.
- */
- GridConfiguration() : igniteHome(NULL), springCfgPath(NULL), jvmLibPath(NULL), jvmClassPath(NULL),
- jvmInitMem(512), jvmMaxMem(1024), jvmOpts(NULL), jvmOptsLen(0)
- {
- // No-op.
- }
- };
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h b/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
index 0c8fc25..6173299 100644
--- a/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
+++ b/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
@@ -60,7 +60,7 @@
#define _IGNITE_GRID_FACTORY
#include "ignite/grid.h"
-#include "ignite/grid_configuration.h"
+#include "ignite/ignite_configuration.h"
#include "ignite/ignite_error.h"
namespace ignite
@@ -77,7 +77,7 @@ namespace ignite
* @param cfg Configuration.
* @return Grid instance or null in case of error.
*/
- static Grid Start(const GridConfiguration& cfg);
+ static Grid Start(const IgniteConfiguration& cfg);
/*
* Start grid instance.
@@ -86,7 +86,7 @@ namespace ignite
* @param err Error.
* @return Grid instance or null in case of error.
*/
- static Grid Start(const GridConfiguration& cfg, IgniteError* err);
+ static Grid Start(const IgniteConfiguration& cfg, IgniteError* err);
/**
* Start grid instance with specific name.
@@ -95,7 +95,7 @@ namespace ignite
* @param name Grid name.
* @return Grid instance or null in case of error.
*/
- static Grid Start(const GridConfiguration& cfg, const char* name);
+ static Grid Start(const IgniteConfiguration& cfg, const char* name);
/**
* Start grid instance with specific name.
@@ -105,7 +105,7 @@ namespace ignite
* @param err Error.
* @return Grid instance or null in case of error.
*/
- static Grid Start(const GridConfiguration& cfg, const char* name, IgniteError* err);
+ static Grid Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err);
/**
* Get default grid instance.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h b/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h
new file mode 100644
index 0000000..e7dadda
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+#ifndef _IGNITE_CONFIGURATION
+#define _IGNITE_CONFIGURATION
+
+#include <stdint.h>
+
+namespace ignite
+{
+ /**
+ * Single JVM option.
+ */
+ struct GridJvmOption
+ {
+ /** Option. */
+ char* opt;
+
+ /**
+ * Default constructor.
+ */
+ GridJvmOption() : opt(NULL)
+ {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param opt Option.
+ */
+ GridJvmOption(char* opt) : opt(opt)
+ {
+ // No-op.
+ }
+ };
+
+ /**
+ * Grid configuration.
+ */
+ struct IgniteConfiguration
+ {
+ /** Path to Ignite home. */
+ char* igniteHome;
+
+ /** Path to Spring configuration file. */
+ char* springCfgPath;
+
+ /** Path ot JVM libbrary. */
+ char* jvmLibPath;
+
+ /** JVM classpath. */
+ char* jvmClassPath;
+
+ /** Initial amount of JVM memory. */
+ int32_t jvmInitMem;
+
+ /** Maximum amount of JVM memory. */
+ int32_t jvmMaxMem;
+
+ /** Additional JVM options. */
+ GridJvmOption* jvmOpts;
+
+ /** Additional JVM options count. */
+ int32_t jvmOptsLen;
+
+ /**
+ * Constructor.
+ */
+ IgniteConfiguration() : igniteHome(NULL), springCfgPath(NULL), jvmLibPath(NULL), jvmClassPath(NULL),
+ jvmInitMem(512), jvmMaxMem(1024), jvmOpts(NULL), jvmOptsLen(0)
+ {
+ // No-op.
+ }
+ };
+}
+
+#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
index 210c8b5..6972fa2 100644
--- a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
+++ b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
@@ -198,7 +198,7 @@
<ClInclude Include="..\..\include\ignite\cache\query\query_sql.h" />
<ClInclude Include="..\..\include\ignite\cache\query\query_text.h" />
<ClInclude Include="..\..\include\ignite\grid.h" />
- <ClInclude Include="..\..\include\ignite\grid_configuration.h" />
+ <ClInclude Include="..\..\include\ignite\ignite_configuration.h" />
<ClInclude Include="..\..\include\ignite\ignite_error.h" />
<ClInclude Include="..\..\include\ignite\grid_factory.h" />
<ClInclude Include="..\..\include\ignite\guid.h" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
index db21b54..a849744 100644
--- a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
+++ b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
@@ -156,7 +156,7 @@
<ClInclude Include="..\..\include\ignite\grid.h">
<Filter>Code</Filter>
</ClInclude>
- <ClInclude Include="..\..\include\ignite\grid_configuration.h">
+ <ClInclude Include="..\..\include\ignite\ignite_configuration.h">
<Filter>Code</Filter>
</ClInclude>
<ClInclude Include="..\..\include\ignite\ignite_error.h">
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel b/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel
index 210c8b5..6972fa2 100644
--- a/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel
+++ b/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel
@@ -198,7 +198,7 @@
<ClInclude Include="..\..\include\ignite\cache\query\query_sql.h" />
<ClInclude Include="..\..\include\ignite\cache\query\query_text.h" />
<ClInclude Include="..\..\include\ignite\grid.h" />
- <ClInclude Include="..\..\include\ignite\grid_configuration.h" />
+ <ClInclude Include="..\..\include\ignite\ignite_configuration.h" />
<ClInclude Include="..\..\include\ignite\ignite_error.h" />
<ClInclude Include="..\..\include\ignite\grid_factory.h" />
<ClInclude Include="..\..\include\ignite\guid.h" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6dc5cb0/modules/platform/src/main/cpp/core/src/grid_factory.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/grid_factory.cpp b/modules/platform/src/main/cpp/core/src/grid_factory.cpp
index b9dcc71..19e79c2 100644
--- a/modules/platform/src/main/cpp/core/src/grid_factory.cpp
+++ b/modules/platform/src/main/cpp/core/src/grid_factory.cpp
@@ -73,7 +73,7 @@ namespace ignite
* @param optsLen Options length.
* @return Options.
*/
- char** CreateJvmOptions(const GridConfiguration& cfg, const std::string* home, const std::string& cp, int* optsLen)
+ char** CreateJvmOptions(const IgniteConfiguration& cfg, const std::string* home, const std::string& cp, int* optsLen)
{
*optsLen = 3 + (home ? 1 : 0) + cfg.jvmOptsLen;
char** opts = new char*[*optsLen];
@@ -109,17 +109,17 @@ namespace ignite
return opts;
}
- Grid GridFactory::Start(const GridConfiguration& cfg)
+ Grid GridFactory::Start(const IgniteConfiguration& cfg)
{
return Start(cfg, static_cast<const char*>(NULL));
}
- Grid GridFactory::Start(const GridConfiguration& cfg, IgniteError* err)
+ Grid GridFactory::Start(const IgniteConfiguration& cfg, IgniteError* err)
{
return Start(cfg, NULL, err);
}
- Grid GridFactory::Start(const GridConfiguration& cfg, const char* name)
+ Grid GridFactory::Start(const IgniteConfiguration& cfg, const char* name)
{
IgniteError err;
@@ -130,7 +130,7 @@ namespace ignite
return res;
}
- Grid GridFactory::Start(const GridConfiguration& cfg, const char* name, IgniteError* err)
+ Grid GridFactory::Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err)
{
bool failed = false;
[2/2] ignite git commit: IGNITE-1364: GridFactory -> Ignition.
Posted by vo...@apache.org.
IGNITE-1364: GridFactory -> Ignition.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8c86870c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8c86870c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8c86870c
Branch: refs/heads/ignite-1364
Commit: 8c86870c0568e4b412f26a592bb3ffb5ba2060d6
Parents: f6dc5cb
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 3 14:23:33 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 3 14:23:33 2015 +0300
----------------------------------------------------------------------
.../platform/src/main/cpp/core-test/Makefile.am | 2 +-
.../cpp/core-test/project/vs/core-test.vcxproj | 2 +-
.../project/vs/core-test.vcxproj.filters | 2 +-
.../main/cpp/core-test/src/cache_query_test.cpp | 6 +-
.../src/main/cpp/core-test/src/cache_test.cpp | 8 +-
.../cpp/core-test/src/grid_factory_test.cpp | 97 ----
.../main/cpp/core-test/src/ignition_test.cpp | 97 ++++
modules/platform/src/main/cpp/core/Makefile.am | 2 +-
.../src/main/cpp/core/include/Makefile.am | 2 +-
.../main/cpp/core/include/ignite/grid_factory.h | 195 --------
.../src/main/cpp/core/include/ignite/ignition.h | 195 ++++++++
.../src/main/cpp/core/project/vs/core.vcxproj | 4 +-
.../cpp/core/project/vs/core.vcxproj.filters | 4 +-
.../main/cpp/core/project/vs/core.vcxprojrel | 4 +-
.../src/main/cpp/core/src/grid_factory.cpp | 468 -------------------
.../platform/src/main/cpp/core/src/ignition.cpp | 468 +++++++++++++++++++
16 files changed, 778 insertions(+), 778 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/Makefile.am b/modules/platform/src/main/cpp/core-test/Makefile.am
index 8a2f8ae..9ed3111 100644
--- a/modules/platform/src/main/cpp/core-test/Makefile.am
+++ b/modules/platform/src/main/cpp/core-test/Makefile.am
@@ -28,7 +28,7 @@ noinst_PROGRAMS = ignite-tests
ignite_tests_SOURCES = src/cache_test.cpp \
src/cache_query_test.cpp \
src/concurrent_test.cpp \
- src/grid_factory_test.cpp \
+ src/ignition_test.cpp \
src/handle_registry_test.cpp \
src/portable_test_defs.cpp \
src/portable_reader_writer_raw_test.cpp \
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj b/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj
index 1f70a04..aa8cb98 100644
--- a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj
+++ b/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj
@@ -33,7 +33,7 @@
<ItemGroup>
<ClCompile Include="..\..\src\cache_test.cpp" />
<ClCompile Include="..\..\src\concurrent_test.cpp" />
- <ClCompile Include="..\..\src\grid_factory_test.cpp" />
+ <ClCompile Include="..\..\src\ignition_test.cpp" />
<ClCompile Include="..\..\src\handle_registry_test.cpp" />
<ClCompile Include="..\..\src\portable_reader_writer_raw_test.cpp" />
<ClCompile Include="..\..\src\portable_reader_writer_test.cpp" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters b/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters
index 6ecc63b..7e8dd95 100644
--- a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters
+++ b/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters
@@ -7,7 +7,7 @@
<ClCompile Include="..\..\src\concurrent_test.cpp">
<Filter>Code</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\grid_factory_test.cpp">
+ <ClCompile Include="..\..\src\ignition_test.cpp">
<Filter>Code</Filter>
</ClCompile>
<ClCompile Include="..\..\src\handle_registry_test.cpp">
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp b/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
index 9d26307..fb86d4e 100644
--- a/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
+++ b/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
@@ -29,7 +29,7 @@
#include "ignite/cache/query/query_sql.h"
#include "ignite/cache/query/query_text.h"
#include "ignite/grid.h"
-#include "ignite/grid_factory.h"
+#include "ignite/ignition.h"
using namespace boost::unit_test;
@@ -210,7 +210,7 @@ struct CacheQueryTestSuiteFixture {
IgniteError err;
- Grid grid0 = GridFactory::Start(cfg, &err);
+ Grid grid0 = Ignition::Start(cfg, &err);
if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
BOOST_ERROR(err.GetText());
@@ -223,7 +223,7 @@ struct CacheQueryTestSuiteFixture {
*/
~CacheQueryTestSuiteFixture()
{
- GridFactory::Stop(grid.GetName(), true);
+ Ignition::Stop(grid.GetName(), true);
}
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/cache_test.cpp b/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
index a7c6ebf..f63f886 100644
--- a/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
+++ b/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
@@ -23,7 +23,7 @@
#include "ignite/cache/cache_peek_mode.h"
#include "ignite/grid.h"
-#include "ignite/grid_factory.h"
+#include "ignite/ignition.h"
using namespace ignite;
using namespace boost::unit_test;
@@ -123,7 +123,7 @@ struct CacheTestSuiteFixture {
IgniteError err;
- Grid grid = GridFactory::Start(cfg, stream.str().c_str(), &err);
+ Grid grid = Ignition::Start(cfg, stream.str().c_str(), &err);
if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
BOOST_FAIL(err.GetText());
@@ -140,8 +140,8 @@ struct CacheTestSuiteFixture {
*/
~CacheTestSuiteFixture()
{
- GridFactory::Stop(grid0.GetName(), true);
- GridFactory::Stop(grid1.GetName(), true);
+ Ignition::Stop(grid0.GetName(), true);
+ Ignition::Stop(grid1.GetName(), true);
grid0 = Grid();
grid1 = Grid();
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core-test/src/grid_factory_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/grid_factory_test.cpp b/modules/platform/src/main/cpp/core-test/src/grid_factory_test.cpp
deleted file mode 100644
index 4ce221c..0000000
--- a/modules/platform/src/main/cpp/core-test/src/grid_factory_test.cpp
+++ /dev/null
@@ -1,97 +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.
- */
-
-#ifndef _MSC_VER
- #define BOOST_TEST_DYN_LINK
-#endif
-
-#include <boost/test/unit_test.hpp>
-
-#include "ignite/grid.h"
-#include "ignite/grid_factory.h"
-
-using namespace ignite;
-using namespace boost::unit_test;
-
-BOOST_AUTO_TEST_SUITE(GridFactoryTestSuite)
-
-BOOST_AUTO_TEST_CASE(TestGridFactory)
-{
- IgniteConfiguration cfg;
-
- GridJvmOption opts[5];
-
- opts[0] = GridJvmOption("-Xdebug");
- opts[1] = GridJvmOption("-Xnoagent");
- opts[2] = GridJvmOption("-Djava.compiler=NONE");
- opts[3] = GridJvmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
- opts[4] = GridJvmOption("-XX:+HeapDumpOnOutOfMemoryError");
-
- cfg.jvmOptsLen = 5;
- cfg.jvmOpts = opts;
-
- cfg.jvmInitMem = 1024;
- cfg.jvmMaxMem = 4096;
-
- char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
- std::string cfgPathStr = std::string(cfgPath).append("/").append("cache-test.xml");
-
- cfg.springCfgPath = const_cast<char*>(cfgPathStr.c_str());
-
- IgniteError err;
-
- // Start two grids
- Grid grid1 = GridFactory::Start(cfg, "gridFactoryTest-1", &err);
-
- if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
- BOOST_ERROR(err.GetText());
-
- BOOST_REQUIRE(strcmp(grid1.GetName(), "gridFactoryTest-1") == 0);
-
- Grid grid2 = GridFactory::Start(cfg, "gridFactoryTest-2", &err);
-
- if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
- BOOST_ERROR(err.GetText());
-
- BOOST_REQUIRE(strcmp(grid2.GetName(), "gridFactoryTest-2") == 0);
-
- // Test get
- Grid grid0 = GridFactory::Get("gridFactoryTest-1", &err);
-
- if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
- BOOST_ERROR(err.GetText());
-
- BOOST_REQUIRE(strcmp(grid0.GetName(), grid1.GetName()) == 0);
-
- // Stop one grid
- GridFactory::Stop(grid1.GetName(), true);
-
- GridFactory::Get("gridFactoryTest-1", &err);
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
-
- GridFactory::Get("gridFactoryTest-2", &err);
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_SUCCESS);
-
- // Stop all
- GridFactory::StopAll(true);
-
- GridFactory::Get("gridFactoryTest-2", &err);
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core-test/src/ignition_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/ignition_test.cpp b/modules/platform/src/main/cpp/core-test/src/ignition_test.cpp
new file mode 100644
index 0000000..ee6ccad
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/src/ignition_test.cpp
@@ -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.
+ */
+
+#ifndef _MSC_VER
+ #define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include "ignite/grid.h"
+#include "ignite/ignition.h"
+
+using namespace ignite;
+using namespace boost::unit_test;
+
+BOOST_AUTO_TEST_SUITE(IgnitionTestSuite)
+
+BOOST_AUTO_TEST_CASE(TestIgnition)
+{
+ IgniteConfiguration cfg;
+
+ GridJvmOption opts[5];
+
+ opts[0] = GridJvmOption("-Xdebug");
+ opts[1] = GridJvmOption("-Xnoagent");
+ opts[2] = GridJvmOption("-Djava.compiler=NONE");
+ opts[3] = GridJvmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
+ opts[4] = GridJvmOption("-XX:+HeapDumpOnOutOfMemoryError");
+
+ cfg.jvmOptsLen = 5;
+ cfg.jvmOpts = opts;
+
+ cfg.jvmInitMem = 1024;
+ cfg.jvmMaxMem = 4096;
+
+ char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
+
+ std::string cfgPathStr = std::string(cfgPath).append("/").append("cache-test.xml");
+
+ cfg.springCfgPath = const_cast<char*>(cfgPathStr.c_str());
+
+ IgniteError err;
+
+ // Start two grids
+ Grid grid1 = Ignition::Start(cfg, "ignitionTest-1", &err);
+
+ if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+ BOOST_ERROR(err.GetText());
+
+ BOOST_REQUIRE(strcmp(grid1.GetName(), "ignitionTest-1") == 0);
+
+ Grid grid2 = Ignition::Start(cfg, "ignitionTest-2", &err);
+
+ if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+ BOOST_ERROR(err.GetText());
+
+ BOOST_REQUIRE(strcmp(grid2.GetName(), "ignitionTest-2") == 0);
+
+ // Test get
+ Grid grid0 = Ignition::Get("ignitionTest-1", &err);
+
+ if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+ BOOST_ERROR(err.GetText());
+
+ BOOST_REQUIRE(strcmp(grid0.GetName(), grid1.GetName()) == 0);
+
+ // Stop one grid
+ Ignition::Stop(grid1.GetName(), true);
+
+ Ignition::Get("ignitionTest-1", &err);
+ BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
+
+ Ignition::Get("ignitionTest-2", &err);
+ BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_SUCCESS);
+
+ // Stop all
+ Ignition::StopAll(true);
+
+ Ignition::Get("ignitionTest-2", &err);
+ BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/Makefile.am b/modules/platform/src/main/cpp/core/Makefile.am
index 9cca4ea..180c71f 100644
--- a/modules/platform/src/main/cpp/core/Makefile.am
+++ b/modules/platform/src/main/cpp/core/Makefile.am
@@ -50,7 +50,7 @@ COMMON_SRC = os/linux/src/impl/utils.cpp \
src/impl/cache/cache_impl.cpp \
src/impl/grid_impl.cpp \
src/grid.cpp \
- src/grid_factory.cpp
+ src/ignition.cpp
lib_LTLIBRARIES = libignite.la
libignite_la_SOURCES = $(COMMON_SRC)
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/Makefile.am b/modules/platform/src/main/cpp/core/include/Makefile.am
index ff0a2e3..4ee48d2 100644
--- a/modules/platform/src/main/cpp/core/include/Makefile.am
+++ b/modules/platform/src/main/cpp/core/include/Makefile.am
@@ -57,5 +57,5 @@ nobase_include_HEADERS = ignite/cache/cache.h \
ignite/grid.h \
ignite/ignite_configuration.h \
ignite/ignite_error.h \
- ignite/grid_factory.h \
+ ignite/ignition.h \
ignite/guid.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h b/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
deleted file mode 100644
index 6173299..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
+++ /dev/null
@@ -1,195 +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.
- */
-
-/**
- * \mainpage Apache Ignite C++ Library
- *
- * The Apache Ignite is a proven software solution, which delivers unprecedented speed
- * and unlimited scale to accelerate your business and time to insights. It enables high-performance transactions,
- * real-time streaming and fast analytics in a single, comprehensive data access and processing layer. The In-Memory
- * Data Fabric is designed to easily power both existing and new applications in a distributed, massively
- * parallel architecture on affordable, industry-standard hardware.
- * <p>
- * The Apache Ignite provides a unified API that spans all key types of applications
- * (Java, .NET, C++) and connects them with multiple data stores containing structured, semi-structured and
- * unstructured data (SQL, NoSQL, Hadoop). It offers a secure, highly available and manageable data environment
- * that allows companies to process full ACID transactions and generate valuable insights from real-time,
- * interactive and batch queries.
- * <p>
- * The In-Memory Data Fabric offers a strategic approach to in-memory computing that delivers performance,
- * scale and comprehensive capabilities far above and beyond what traditional in-memory databases,
- * data grids or other in-memory-based point solutions can offer by themselves.
- *
- * \section ultimate_speed_and_scale Ultimate Speed and Scale
- *
- * The Apache Ignite accesses and processes data from distributed enterprise and
- * cloud-based data stores orders of magnitudes faster, and shares them with today's most demanding transactional,
- * analytical and hybrid applications. The In-Memory Data Fabric delivers unprecedented throughput
- * and low latency performance in a virtually unlimited, global scale-out architecture for both new and
- * existing applications.
- *
- * \section comprehensive_and_proven Comprehensive and Proven
- *
- * The Apache Ignite is the product of seven years of meticulous research and development,
- * built from the ground up (i.e. no bolt-on's), and run successfully by hundreds of organizations worldwide.
- * It is a comprehensive in-memory solution that includes a clustering and compute grid, a database-agnostic data grid,
- * a real-time streaming engine as well as plug-and-play Hadoop acceleration. The In-Memory Data Fabric
- * connects multiple data sources (relational, NoSQL, Hadoop) with Java, .NET and C++ applications, and offers
- * a secure and highly available architecture; it also provides a fully-featured, graphical management interface.
- * <p>
- * The Apache Ignite is used today by Fortune 500 companies, top government agencies as well as
- * innovative mobile and web companies in a broad range of business scenarios, such as automated trading systems,
- * fraud detection, big data analytics, social networks, online gaming, and bioinformatics.
- */
-
-#ifndef _IGNITE_GRID_FACTORY
-#define _IGNITE_GRID_FACTORY
-
-#include "ignite/grid.h"
-#include "ignite/ignite_configuration.h"
-#include "ignite/ignite_error.h"
-
-namespace ignite
-{
- /**
- * This class defines a factory for the main Ignite API.
- */
- class IGNITE_IMPORT_EXPORT GridFactory
- {
- public:
- /**
- * Start grid instance.
- *
- * @param cfg Configuration.
- * @return Grid instance or null in case of error.
- */
- static Grid Start(const IgniteConfiguration& cfg);
-
- /*
- * Start grid instance.
- *
- * @param cfg Configuration.
- * @param err Error.
- * @return Grid instance or null in case of error.
- */
- static Grid Start(const IgniteConfiguration& cfg, IgniteError* err);
-
- /**
- * Start grid instance with specific name.
- *
- * @param cfg Configuration.
- * @param name Grid name.
- * @return Grid instance or null in case of error.
- */
- static Grid Start(const IgniteConfiguration& cfg, const char* name);
-
- /**
- * Start grid instance with specific name.
- *
- * @param cfg Configuration.
- * @param name Grid name.
- * @param err Error.
- * @return Grid instance or null in case of error.
- */
- static Grid Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err);
-
- /**
- * Get default grid instance.
- *
- * @return Grid instance.
- */
- static Grid Get();
-
- /**
- * Get default grid instance.
- *
- * @param err Error.
- * @return Grid instance.
- */
- static Grid Get(IgniteError* err);
-
- /**
- * Get grid instance with the given name.
- *
- * @param name Grid name.
- * @return Grid instance.
- */
- static Grid Get(const char* name);
-
- /**
- * Get grid instance with the given name.
- *
- * @param name Grid name.
- * @param err Error.
- * @return Grid instance.
- */
- static Grid Get(const char* name, IgniteError* err);
-
- /**
- * Stop default grid instance.
- *
- * @param cancel Cancel flag.
- * @return True if grid instance was stopped by this call.
- */
- static bool Stop(const bool cancel);
-
- /**
- * Stop default grid instance.
- *
- * @param cancel Cancel flag.
- * @param err Error.
- * @return True if grid instance was stopped by this call.
- */
- static bool Stop(const bool cancel, IgniteError* err);
-
- /**
- * Stop grid instance with the given name.
- *
- * @param name Grid name.
- * @param cancel Cancel flag.
- * @return True if grid instance was stopped by this call.
- */
- static bool Stop(const char* name, const bool cancel);
-
- /**
- * Stop grid instance with the given name.
- *
- * @param name Grid name.
- * @param cancel Cancel flag.
- * @param err Error.
- * @return True if grid instance was stopped by this call.
- */
- static bool Stop(const char* name, const bool cancel, IgniteError* err);
-
- /**
- * Stop all running grid instances.
- *
- * @param cancel Cancel flag.
- */
- static void StopAll(const bool cancel);
-
- /**
- * Stop all running grid instances.
- *
- * @param cancel Cancel flag.
- * @param err Error.
- */
- static void StopAll(const bool cancel, IgniteError* err);
- };
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core/include/ignite/ignition.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignition.h b/modules/platform/src/main/cpp/core/include/ignite/ignition.h
new file mode 100644
index 0000000..641277c
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/ignition.h
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+
+/**
+ * \mainpage Apache Ignite C++ Library
+ *
+ * The Apache Ignite is a proven software solution, which delivers unprecedented speed
+ * and unlimited scale to accelerate your business and time to insights. It enables high-performance transactions,
+ * real-time streaming and fast analytics in a single, comprehensive data access and processing layer. The In-Memory
+ * Data Fabric is designed to easily power both existing and new applications in a distributed, massively
+ * parallel architecture on affordable, industry-standard hardware.
+ * <p>
+ * The Apache Ignite provides a unified API that spans all key types of applications
+ * (Java, .NET, C++) and connects them with multiple data stores containing structured, semi-structured and
+ * unstructured data (SQL, NoSQL, Hadoop). It offers a secure, highly available and manageable data environment
+ * that allows companies to process full ACID transactions and generate valuable insights from real-time,
+ * interactive and batch queries.
+ * <p>
+ * The In-Memory Data Fabric offers a strategic approach to in-memory computing that delivers performance,
+ * scale and comprehensive capabilities far above and beyond what traditional in-memory databases,
+ * data grids or other in-memory-based point solutions can offer by themselves.
+ *
+ * \section ultimate_speed_and_scale Ultimate Speed and Scale
+ *
+ * The Apache Ignite accesses and processes data from distributed enterprise and
+ * cloud-based data stores orders of magnitudes faster, and shares them with today's most demanding transactional,
+ * analytical and hybrid applications. The In-Memory Data Fabric delivers unprecedented throughput
+ * and low latency performance in a virtually unlimited, global scale-out architecture for both new and
+ * existing applications.
+ *
+ * \section comprehensive_and_proven Comprehensive and Proven
+ *
+ * The Apache Ignite is the product of seven years of meticulous research and development,
+ * built from the ground up (i.e. no bolt-on's), and run successfully by hundreds of organizations worldwide.
+ * It is a comprehensive in-memory solution that includes a clustering and compute grid, a database-agnostic data grid,
+ * a real-time streaming engine as well as plug-and-play Hadoop acceleration. The In-Memory Data Fabric
+ * connects multiple data sources (relational, NoSQL, Hadoop) with Java, .NET and C++ applications, and offers
+ * a secure and highly available architecture; it also provides a fully-featured, graphical management interface.
+ * <p>
+ * The Apache Ignite is used today by Fortune 500 companies, top government agencies as well as
+ * innovative mobile and web companies in a broad range of business scenarios, such as automated trading systems,
+ * fraud detection, big data analytics, social networks, online gaming, and bioinformatics.
+ */
+
+#ifndef _IGNITE_IGNITION
+#define _IGNITE_IGNITION
+
+#include "ignite/grid.h"
+#include "ignite/ignite_configuration.h"
+#include "ignite/ignite_error.h"
+
+namespace ignite
+{
+ /**
+ * This class defines a factory for the main Ignite API.
+ */
+ class IGNITE_IMPORT_EXPORT Ignition
+ {
+ public:
+ /**
+ * Start grid instance.
+ *
+ * @param cfg Configuration.
+ * @return Grid instance or null in case of error.
+ */
+ static Grid Start(const IgniteConfiguration& cfg);
+
+ /*
+ * Start grid instance.
+ *
+ * @param cfg Configuration.
+ * @param err Error.
+ * @return Grid instance or null in case of error.
+ */
+ static Grid Start(const IgniteConfiguration& cfg, IgniteError* err);
+
+ /**
+ * Start grid instance with specific name.
+ *
+ * @param cfg Configuration.
+ * @param name Grid name.
+ * @return Grid instance or null in case of error.
+ */
+ static Grid Start(const IgniteConfiguration& cfg, const char* name);
+
+ /**
+ * Start grid instance with specific name.
+ *
+ * @param cfg Configuration.
+ * @param name Grid name.
+ * @param err Error.
+ * @return Grid instance or null in case of error.
+ */
+ static Grid Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err);
+
+ /**
+ * Get default grid instance.
+ *
+ * @return Grid instance.
+ */
+ static Grid Get();
+
+ /**
+ * Get default grid instance.
+ *
+ * @param err Error.
+ * @return Grid instance.
+ */
+ static Grid Get(IgniteError* err);
+
+ /**
+ * Get grid instance with the given name.
+ *
+ * @param name Grid name.
+ * @return Grid instance.
+ */
+ static Grid Get(const char* name);
+
+ /**
+ * Get grid instance with the given name.
+ *
+ * @param name Grid name.
+ * @param err Error.
+ * @return Grid instance.
+ */
+ static Grid Get(const char* name, IgniteError* err);
+
+ /**
+ * Stop default grid instance.
+ *
+ * @param cancel Cancel flag.
+ * @return True if grid instance was stopped by this call.
+ */
+ static bool Stop(const bool cancel);
+
+ /**
+ * Stop default grid instance.
+ *
+ * @param cancel Cancel flag.
+ * @param err Error.
+ * @return True if grid instance was stopped by this call.
+ */
+ static bool Stop(const bool cancel, IgniteError* err);
+
+ /**
+ * Stop grid instance with the given name.
+ *
+ * @param name Grid name.
+ * @param cancel Cancel flag.
+ * @return True if grid instance was stopped by this call.
+ */
+ static bool Stop(const char* name, const bool cancel);
+
+ /**
+ * Stop grid instance with the given name.
+ *
+ * @param name Grid name.
+ * @param cancel Cancel flag.
+ * @param err Error.
+ * @return True if grid instance was stopped by this call.
+ */
+ static bool Stop(const char* name, const bool cancel, IgniteError* err);
+
+ /**
+ * Stop all running grid instances.
+ *
+ * @param cancel Cancel flag.
+ */
+ static void StopAll(const bool cancel);
+
+ /**
+ * Stop all running grid instances.
+ *
+ * @param cancel Cancel flag.
+ * @param err Error.
+ */
+ static void StopAll(const bool cancel, IgniteError* err);
+ };
+}
+
+#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
index 6972fa2..c197406 100644
--- a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
+++ b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
@@ -200,7 +200,7 @@
<ClInclude Include="..\..\include\ignite\grid.h" />
<ClInclude Include="..\..\include\ignite\ignite_configuration.h" />
<ClInclude Include="..\..\include\ignite\ignite_error.h" />
- <ClInclude Include="..\..\include\ignite\grid_factory.h" />
+ <ClInclude Include="..\..\include\ignite\ignition.h" />
<ClInclude Include="..\..\include\ignite\guid.h" />
<ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h" />
<ClInclude Include="..\..\include\ignite\impl\cache\query\query_impl.h" />
@@ -236,7 +236,7 @@
<ClCompile Include="..\..\os\win\src\impl\utils.cpp" />
<ClCompile Include="..\..\src\grid.cpp" />
<ClCompile Include="..\..\src\ignite_error.cpp" />
- <ClCompile Include="..\..\src\grid_factory.cpp" />
+ <ClCompile Include="..\..\src\ignition.cpp" />
<ClCompile Include="..\..\src\guid.cpp" />
<ClCompile Include="..\..\src\impl\cache\cache_impl.cpp" />
<ClCompile Include="..\..\src\impl\cache\query\query_impl.cpp" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
index a849744..b0800fb 100644
--- a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
+++ b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
@@ -52,7 +52,7 @@
<ClCompile Include="..\..\src\ignite_error.cpp">
<Filter>Code</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\grid_factory.cpp">
+ <ClCompile Include="..\..\src\ignition.cpp">
<Filter>Code</Filter>
</ClCompile>
<ClCompile Include="..\..\src\guid.cpp">
@@ -162,7 +162,7 @@
<ClInclude Include="..\..\include\ignite\ignite_error.h">
<Filter>Code</Filter>
</ClInclude>
- <ClInclude Include="..\..\include\ignite\grid_factory.h">
+ <ClInclude Include="..\..\include\ignite\ignition.h">
<Filter>Code</Filter>
</ClInclude>
<ClInclude Include="..\..\include\ignite\guid.h">
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel b/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel
index 6972fa2..c197406 100644
--- a/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel
+++ b/modules/platform/src/main/cpp/core/project/vs/core.vcxprojrel
@@ -200,7 +200,7 @@
<ClInclude Include="..\..\include\ignite\grid.h" />
<ClInclude Include="..\..\include\ignite\ignite_configuration.h" />
<ClInclude Include="..\..\include\ignite\ignite_error.h" />
- <ClInclude Include="..\..\include\ignite\grid_factory.h" />
+ <ClInclude Include="..\..\include\ignite\ignition.h" />
<ClInclude Include="..\..\include\ignite\guid.h" />
<ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h" />
<ClInclude Include="..\..\include\ignite\impl\cache\query\query_impl.h" />
@@ -236,7 +236,7 @@
<ClCompile Include="..\..\os\win\src\impl\utils.cpp" />
<ClCompile Include="..\..\src\grid.cpp" />
<ClCompile Include="..\..\src\ignite_error.cpp" />
- <ClCompile Include="..\..\src\grid_factory.cpp" />
+ <ClCompile Include="..\..\src\ignition.cpp" />
<ClCompile Include="..\..\src\guid.cpp" />
<ClCompile Include="..\..\src\impl\cache\cache_impl.cpp" />
<ClCompile Include="..\..\src\impl\cache\query\query_impl.cpp" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core/src/grid_factory.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/grid_factory.cpp b/modules/platform/src/main/cpp/core/src/grid_factory.cpp
deleted file mode 100644
index 19e79c2..0000000
--- a/modules/platform/src/main/cpp/core/src/grid_factory.cpp
+++ /dev/null
@@ -1,468 +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.
- */
-
-#include <sstream>
-
-#include <ignite/common/common.h>
-#include <ignite/common/concurrent.h>
-#include <ignite/common/exports.h>
-#include <ignite/common/java.h>
-
-#include "ignite/impl/grid_environment.h"
-#include "ignite/impl/grid_impl.h"
-#include "ignite/impl/utils.h"
-#include "ignite/grid_factory.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
-using namespace ignite::impl;
-using namespace ignite::impl::utils;
-
-namespace ignite
-{
- /** Default configuration. */
- const char* GRID_DFLT_CFG = "config/default-config.xml";
-
- /** Whether JVM library is loaded to the process. */
- bool JVM_LIB_LOADED;
-
- /** Critical section for factory methods. */
- CriticalSection factoryLock;
-
- /** Flag indicating that at least one grid has started. */
- bool started = false;
-
- /**
- * Convert integer value to string.
- */
- std::string JvmMemoryString(const std::string& prefix, int32_t val)
- {
- std::ostringstream ss;
- ss << val;
-
- std::string valStr = ss.str();
-
- std::string res = std::string(prefix);
- res.append(valStr);
- res.append("m");
-
- return res;
- }
-
- /**
- * Create JVM options.
- *
- * @param cfg Configuration.
- * @param home Optional GG home.
- * @param cp Classpath.
- * @param opts Options.
- * @param optsLen Options length.
- * @return Options.
- */
- char** CreateJvmOptions(const IgniteConfiguration& cfg, const std::string* home, const std::string& cp, int* optsLen)
- {
- *optsLen = 3 + (home ? 1 : 0) + cfg.jvmOptsLen;
- char** opts = new char*[*optsLen];
-
- int idx = 0;
-
- // 1. Set classpath.
- std::string cpFull = std::string("-Djava.class.path=") + cp;
-
- *(opts + idx++) = CopyChars(cpFull.c_str());
-
- // 2. Set home.
- if (home) {
- std::string homeFull = std::string("-DIGNITE_HOME=") + *home;
-
- *(opts + idx++) = CopyChars(homeFull.c_str());
- }
-
- // 3. Set Xms, Xmx.
- std::string xmsStr = JvmMemoryString(std::string("-Xms"), cfg.jvmInitMem);
- std::string xmxStr = JvmMemoryString(std::string("-Xmx"), cfg.jvmMaxMem);
-
- *(opts + idx++) = CopyChars(xmsStr.c_str());
- *(opts + idx++) = CopyChars(xmxStr.c_str());
-
- // 4. Set the rest options.
- for (int i = 0; i < cfg.jvmOptsLen; i++) {
- char* optCopy = CopyChars(cfg.jvmOpts[i].opt);
-
- opts[idx++] = optCopy;
- }
-
- return opts;
- }
-
- Grid GridFactory::Start(const IgniteConfiguration& cfg)
- {
- return Start(cfg, static_cast<const char*>(NULL));
- }
-
- Grid GridFactory::Start(const IgniteConfiguration& cfg, IgniteError* err)
- {
- return Start(cfg, NULL, err);
- }
-
- Grid GridFactory::Start(const IgniteConfiguration& cfg, const char* name)
- {
- IgniteError err;
-
- Grid res = Start(cfg, name, &err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- Grid GridFactory::Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err)
- {
- bool failed = false;
-
- SharedPointer<GridEnvironment> env;
- SharedPointer<GridEnvironment>* envTarget = NULL;
-
- jobject javaRef = NULL;
-
- factoryLock.Enter();
-
- // 1. Load JVM library if needed.
- if (!JVM_LIB_LOADED)
- {
- bool jvmLibFound;
- std::string jvmLib;
-
- if (cfg.jvmLibPath)
- {
- std::string jvmLibPath = std::string(cfg.jvmLibPath);
-
- jvmLib = FindJvmLibrary(&jvmLibPath, &jvmLibFound);
- }
- else
- jvmLib = FindJvmLibrary(NULL, &jvmLibFound);
-
- if (!jvmLibFound)
- {
- *err = IgniteError(IgniteError::IGNITE_ERR_JVM_LIB_NOT_FOUND,
- "JVM library is not found (did you set JAVA_HOME environment variable?)");
-
- failed = true;
- }
-
- if (!failed) {
- if (!LoadJvmLibrary(jvmLib))
- {
- *err = IgniteError(IgniteError::IGNITE_ERR_JVM_LIB_LOAD_FAILED, "Failed to load JVM library.");
-
- failed = true;
- }
- }
-
- JVM_LIB_LOADED = true;
- }
-
- if (!failed)
- {
- // 2. Resolve IGNITE_HOME.
- bool homeFound;
- std::string home;
-
- if (cfg.igniteHome)
- {
- std::string homePath = std::string(cfg.igniteHome);
-
- home = ResolveIgniteHome(&homePath, &homeFound);
- }
- else
- home = ResolveIgniteHome(NULL, &homeFound);
-
- // 3. Create classpath.
- std::string cp;
-
- if (cfg.jvmClassPath)
- {
- std::string usrCp = cfg.jvmClassPath;
-
- cp = CreateIgniteClasspath(&usrCp, homeFound ? &home : NULL);
- }
- else
- cp = CreateIgniteClasspath(NULL, homeFound ? &home : NULL);
-
- if (!cp.empty())
- {
- // 4. Start JVM if needed.
- JniErrorInfo jniErr;
-
- env = SharedPointer<GridEnvironment>(new GridEnvironment());
-
- int optsLen;
- char** opts = CreateJvmOptions(cfg, homeFound ? &home : NULL, cp, &optsLen);
-
- envTarget = new SharedPointer<GridEnvironment>(env);
-
- SharedPointer<JniContext> ctx(
- JniContext::Create(opts, optsLen, env.Get()->GetJniHandlers(envTarget), &jniErr));
-
- for (int i = 0; i < optsLen; i++)
- ReleaseChars(*(opts + i));
-
- delete[] opts;
-
- if (!ctx.Get())
- {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- failed = true;
- }
-
- // 5. Start Ignite.
- if (!failed)
- {
- char* springCfgPath0 = CopyChars(cfg.springCfgPath);
-
- if (!springCfgPath0)
- springCfgPath0 = CopyChars(GRID_DFLT_CFG);
-
- char* name0 = CopyChars(name);
-
- interop::InteropUnpooledMemory mem(16);
- interop::InteropOutputStream stream(&mem);
- stream.WriteBool(false);
- stream.Synchronize();
-
- javaRef = ctx.Get()->IgnitionStart(springCfgPath0, name0, 1002, mem.PointerLong(), &jniErr);
-
- ReleaseChars(springCfgPath0);
- ReleaseChars(name0);
-
- if (!javaRef) {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- failed = true;
- }
- else {
- // 6. Ignite is started at this point.
- env.Get()->Initialize(ctx);
-
- started = true;
- }
- }
- }
- else {
- *err = IgniteError(IgniteError::IGNITE_ERR_JVM_NO_CLASSPATH,
- "Java classpath is empty (did you set IGNITE_HOME environment variable?)");
-
- failed = true;
- }
- }
-
- factoryLock.Leave();
-
- if (failed)
- {
- if (envTarget)
- delete envTarget;
-
- return Grid();
- }
- else
- {
- GridImpl* impl = new GridImpl(env, javaRef);
-
- return Grid(impl);
- }
- }
-
- Grid GridFactory::Get()
- {
- return Get(static_cast<const char*>(NULL));
- }
-
- Grid GridFactory::Get(IgniteError* err)
- {
- return Get(NULL, err);
- }
-
- Grid GridFactory::Get(const char* name)
- {
- IgniteError err;
-
- Grid res = Get(name, &err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- Grid GridFactory::Get(const char* name, IgniteError* err)
- {
- Grid res;
-
- factoryLock.Enter();
-
- if (started)
- {
- char* name0 = CopyChars(name);
-
- // 1. Create context for this operation.
- JniErrorInfo jniErr;
-
- SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- {
- // 2. Get environment pointer.
- long long ptr = ctx.Get()->IgnitionEnvironmentPointer(name0, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- {
- if (ptr != 0)
- {
- // 3. Obtain real environment for this instance.
- JniHandlers* hnds = reinterpret_cast<JniHandlers*>(ptr);
-
- SharedPointer<GridEnvironment>* env =
- static_cast<SharedPointer<GridEnvironment>*>(hnds->target);
-
- // 4. Get fresh node reference.
- jobject ref = ctx.Get()->IgnitionInstance(name0, &jniErr);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS) {
- if (ref)
- {
- GridImpl* impl = new GridImpl(*env, ref);
-
- res = Grid(impl);
- }
- else
- // Error: concurrent node stop.
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Failed to get grid instance because it was stopped concurrently.");
-
- }
- }
- else
- // Error: no node with the given name.
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Failed to get grid instance because it is either not started yet or already stopped.");
- }
- }
-
- ReleaseChars(name0);
- }
- else
- // Error: no node with the given name.
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Failed to get grid instance because it is either not started yet or already stopped.");
-
- factoryLock.Leave();
-
- return res;
- }
-
- bool GridFactory::Stop(const bool cancel)
- {
- return Stop(NULL, cancel);
- }
-
- bool GridFactory::Stop(const bool cancel, IgniteError* err)
- {
- return Stop(NULL, cancel, err);
- }
-
- bool GridFactory::Stop(const char* name, const bool cancel)
- {
- IgniteError err;
-
- bool res = Stop(name, cancel, &err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- bool GridFactory::Stop(const char* name, const bool cancel, IgniteError* err)
- {
- bool res = false;
-
- factoryLock.Enter();
-
- if (started)
- {
- JniErrorInfo jniErr;
-
- SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- {
- char* name0 = CopyChars(name);
-
- bool res0 = ctx.Get()->IgnitionStop(name0, cancel, &jniErr);
-
- ReleaseChars(name0);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- res = res0;
- }
- }
-
- factoryLock.Leave();
-
- return res;
- }
-
- void GridFactory::StopAll(const bool cancel)
- {
- IgniteError err;
-
- StopAll(cancel, &err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- void GridFactory::StopAll(const bool cancel, IgniteError* err)
- {
- factoryLock.Enter();
-
- if (started)
- {
- JniErrorInfo jniErr;
-
- SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- {
- ctx.Get()->IgnitionStopAll(cancel, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
- }
- }
-
- factoryLock.Leave();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c86870c/modules/platform/src/main/cpp/core/src/ignition.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/ignition.cpp b/modules/platform/src/main/cpp/core/src/ignition.cpp
new file mode 100644
index 0000000..ea42210
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/src/ignition.cpp
@@ -0,0 +1,468 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sstream>
+
+#include <ignite/common/common.h>
+#include <ignite/common/concurrent.h>
+#include <ignite/common/exports.h>
+#include <ignite/common/java.h>
+
+#include "ignite/impl/grid_environment.h"
+#include "ignite/impl/grid_impl.h"
+#include "ignite/impl/utils.h"
+#include "ignite/ignition.h"
+
+using namespace ignite::common::concurrent;
+using namespace ignite::common::java;
+using namespace ignite::impl;
+using namespace ignite::impl::utils;
+
+namespace ignite
+{
+ /** Default configuration. */
+ const char* GRID_DFLT_CFG = "config/default-config.xml";
+
+ /** Whether JVM library is loaded to the process. */
+ bool JVM_LIB_LOADED;
+
+ /** Critical section for factory methods. */
+ CriticalSection factoryLock;
+
+ /** Flag indicating that at least one grid has started. */
+ bool started = false;
+
+ /**
+ * Convert integer value to string.
+ */
+ std::string JvmMemoryString(const std::string& prefix, int32_t val)
+ {
+ std::ostringstream ss;
+ ss << val;
+
+ std::string valStr = ss.str();
+
+ std::string res = std::string(prefix);
+ res.append(valStr);
+ res.append("m");
+
+ return res;
+ }
+
+ /**
+ * Create JVM options.
+ *
+ * @param cfg Configuration.
+ * @param home Optional GG home.
+ * @param cp Classpath.
+ * @param opts Options.
+ * @param optsLen Options length.
+ * @return Options.
+ */
+ char** CreateJvmOptions(const IgniteConfiguration& cfg, const std::string* home, const std::string& cp, int* optsLen)
+ {
+ *optsLen = 3 + (home ? 1 : 0) + cfg.jvmOptsLen;
+ char** opts = new char*[*optsLen];
+
+ int idx = 0;
+
+ // 1. Set classpath.
+ std::string cpFull = std::string("-Djava.class.path=") + cp;
+
+ *(opts + idx++) = CopyChars(cpFull.c_str());
+
+ // 2. Set home.
+ if (home) {
+ std::string homeFull = std::string("-DIGNITE_HOME=") + *home;
+
+ *(opts + idx++) = CopyChars(homeFull.c_str());
+ }
+
+ // 3. Set Xms, Xmx.
+ std::string xmsStr = JvmMemoryString(std::string("-Xms"), cfg.jvmInitMem);
+ std::string xmxStr = JvmMemoryString(std::string("-Xmx"), cfg.jvmMaxMem);
+
+ *(opts + idx++) = CopyChars(xmsStr.c_str());
+ *(opts + idx++) = CopyChars(xmxStr.c_str());
+
+ // 4. Set the rest options.
+ for (int i = 0; i < cfg.jvmOptsLen; i++) {
+ char* optCopy = CopyChars(cfg.jvmOpts[i].opt);
+
+ opts[idx++] = optCopy;
+ }
+
+ return opts;
+ }
+
+ Grid Ignition::Start(const IgniteConfiguration& cfg)
+ {
+ return Start(cfg, static_cast<const char*>(NULL));
+ }
+
+ Grid Ignition::Start(const IgniteConfiguration& cfg, IgniteError* err)
+ {
+ return Start(cfg, NULL, err);
+ }
+
+ Grid Ignition::Start(const IgniteConfiguration& cfg, const char* name)
+ {
+ IgniteError err;
+
+ Grid res = Start(cfg, name, &err);
+
+ IgniteError::ThrowIfNeeded(err);
+
+ return res;
+ }
+
+ Grid Ignition::Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err)
+ {
+ bool failed = false;
+
+ SharedPointer<GridEnvironment> env;
+ SharedPointer<GridEnvironment>* envTarget = NULL;
+
+ jobject javaRef = NULL;
+
+ factoryLock.Enter();
+
+ // 1. Load JVM library if needed.
+ if (!JVM_LIB_LOADED)
+ {
+ bool jvmLibFound;
+ std::string jvmLib;
+
+ if (cfg.jvmLibPath)
+ {
+ std::string jvmLibPath = std::string(cfg.jvmLibPath);
+
+ jvmLib = FindJvmLibrary(&jvmLibPath, &jvmLibFound);
+ }
+ else
+ jvmLib = FindJvmLibrary(NULL, &jvmLibFound);
+
+ if (!jvmLibFound)
+ {
+ *err = IgniteError(IgniteError::IGNITE_ERR_JVM_LIB_NOT_FOUND,
+ "JVM library is not found (did you set JAVA_HOME environment variable?)");
+
+ failed = true;
+ }
+
+ if (!failed) {
+ if (!LoadJvmLibrary(jvmLib))
+ {
+ *err = IgniteError(IgniteError::IGNITE_ERR_JVM_LIB_LOAD_FAILED, "Failed to load JVM library.");
+
+ failed = true;
+ }
+ }
+
+ JVM_LIB_LOADED = true;
+ }
+
+ if (!failed)
+ {
+ // 2. Resolve IGNITE_HOME.
+ bool homeFound;
+ std::string home;
+
+ if (cfg.igniteHome)
+ {
+ std::string homePath = std::string(cfg.igniteHome);
+
+ home = ResolveIgniteHome(&homePath, &homeFound);
+ }
+ else
+ home = ResolveIgniteHome(NULL, &homeFound);
+
+ // 3. Create classpath.
+ std::string cp;
+
+ if (cfg.jvmClassPath)
+ {
+ std::string usrCp = cfg.jvmClassPath;
+
+ cp = CreateIgniteClasspath(&usrCp, homeFound ? &home : NULL);
+ }
+ else
+ cp = CreateIgniteClasspath(NULL, homeFound ? &home : NULL);
+
+ if (!cp.empty())
+ {
+ // 4. Start JVM if needed.
+ JniErrorInfo jniErr;
+
+ env = SharedPointer<GridEnvironment>(new GridEnvironment());
+
+ int optsLen;
+ char** opts = CreateJvmOptions(cfg, homeFound ? &home : NULL, cp, &optsLen);
+
+ envTarget = new SharedPointer<GridEnvironment>(env);
+
+ SharedPointer<JniContext> ctx(
+ JniContext::Create(opts, optsLen, env.Get()->GetJniHandlers(envTarget), &jniErr));
+
+ for (int i = 0; i < optsLen; i++)
+ ReleaseChars(*(opts + i));
+
+ delete[] opts;
+
+ if (!ctx.Get())
+ {
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ failed = true;
+ }
+
+ // 5. Start Ignite.
+ if (!failed)
+ {
+ char* springCfgPath0 = CopyChars(cfg.springCfgPath);
+
+ if (!springCfgPath0)
+ springCfgPath0 = CopyChars(GRID_DFLT_CFG);
+
+ char* name0 = CopyChars(name);
+
+ interop::InteropUnpooledMemory mem(16);
+ interop::InteropOutputStream stream(&mem);
+ stream.WriteBool(false);
+ stream.Synchronize();
+
+ javaRef = ctx.Get()->IgnitionStart(springCfgPath0, name0, 1002, mem.PointerLong(), &jniErr);
+
+ ReleaseChars(springCfgPath0);
+ ReleaseChars(name0);
+
+ if (!javaRef) {
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ failed = true;
+ }
+ else {
+ // 6. Ignite is started at this point.
+ env.Get()->Initialize(ctx);
+
+ started = true;
+ }
+ }
+ }
+ else {
+ *err = IgniteError(IgniteError::IGNITE_ERR_JVM_NO_CLASSPATH,
+ "Java classpath is empty (did you set IGNITE_HOME environment variable?)");
+
+ failed = true;
+ }
+ }
+
+ factoryLock.Leave();
+
+ if (failed)
+ {
+ if (envTarget)
+ delete envTarget;
+
+ return Grid();
+ }
+ else
+ {
+ GridImpl* impl = new GridImpl(env, javaRef);
+
+ return Grid(impl);
+ }
+ }
+
+ Grid Ignition::Get()
+ {
+ return Get(static_cast<const char*>(NULL));
+ }
+
+ Grid Ignition::Get(IgniteError* err)
+ {
+ return Get(NULL, err);
+ }
+
+ Grid Ignition::Get(const char* name)
+ {
+ IgniteError err;
+
+ Grid res = Get(name, &err);
+
+ IgniteError::ThrowIfNeeded(err);
+
+ return res;
+ }
+
+ Grid Ignition::Get(const char* name, IgniteError* err)
+ {
+ Grid res;
+
+ factoryLock.Enter();
+
+ if (started)
+ {
+ char* name0 = CopyChars(name);
+
+ // 1. Create context for this operation.
+ JniErrorInfo jniErr;
+
+ SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
+ {
+ // 2. Get environment pointer.
+ long long ptr = ctx.Get()->IgnitionEnvironmentPointer(name0, &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
+ {
+ if (ptr != 0)
+ {
+ // 3. Obtain real environment for this instance.
+ JniHandlers* hnds = reinterpret_cast<JniHandlers*>(ptr);
+
+ SharedPointer<GridEnvironment>* env =
+ static_cast<SharedPointer<GridEnvironment>*>(hnds->target);
+
+ // 4. Get fresh node reference.
+ jobject ref = ctx.Get()->IgnitionInstance(name0, &jniErr);
+
+ if (err->GetCode() == IgniteError::IGNITE_SUCCESS) {
+ if (ref)
+ {
+ GridImpl* impl = new GridImpl(*env, ref);
+
+ res = Grid(impl);
+ }
+ else
+ // Error: concurrent node stop.
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+ "Failed to get grid instance because it was stopped concurrently.");
+
+ }
+ }
+ else
+ // Error: no node with the given name.
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+ "Failed to get grid instance because it is either not started yet or already stopped.");
+ }
+ }
+
+ ReleaseChars(name0);
+ }
+ else
+ // Error: no node with the given name.
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+ "Failed to get grid instance because it is either not started yet or already stopped.");
+
+ factoryLock.Leave();
+
+ return res;
+ }
+
+ bool Ignition::Stop(const bool cancel)
+ {
+ return Stop(NULL, cancel);
+ }
+
+ bool Ignition::Stop(const bool cancel, IgniteError* err)
+ {
+ return Stop(NULL, cancel, err);
+ }
+
+ bool Ignition::Stop(const char* name, const bool cancel)
+ {
+ IgniteError err;
+
+ bool res = Stop(name, cancel, &err);
+
+ IgniteError::ThrowIfNeeded(err);
+
+ return res;
+ }
+
+ bool Ignition::Stop(const char* name, const bool cancel, IgniteError* err)
+ {
+ bool res = false;
+
+ factoryLock.Enter();
+
+ if (started)
+ {
+ JniErrorInfo jniErr;
+
+ SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
+ {
+ char* name0 = CopyChars(name);
+
+ bool res0 = ctx.Get()->IgnitionStop(name0, cancel, &jniErr);
+
+ ReleaseChars(name0);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
+ res = res0;
+ }
+ }
+
+ factoryLock.Leave();
+
+ return res;
+ }
+
+ void Ignition::StopAll(const bool cancel)
+ {
+ IgniteError err;
+
+ StopAll(cancel, &err);
+
+ IgniteError::ThrowIfNeeded(err);
+ }
+
+ void Ignition::StopAll(const bool cancel, IgniteError* err)
+ {
+ factoryLock.Enter();
+
+ if (started)
+ {
+ JniErrorInfo jniErr;
+
+ SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
+ {
+ ctx.Get()->IgnitionStopAll(cancel, &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+ }
+ }
+
+ factoryLock.Leave();
+ }
+}