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/22 08:40:03 UTC
[17/28] ignite git commit: IGNITE-1513: Moved CPP.
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/project/vs/core.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/project/vs/core.vcxproj b/modules/platform/cpp/core/project/vs/core.vcxproj
new file mode 100644
index 0000000..58fa283
--- /dev/null
+++ b/modules/platform/cpp/core/project/vs/core.vcxproj
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{E2DEA693-F2EA-43C2-A813-053378F6E4DB}</ProjectGuid>
+ <RootNamespace>core</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <TargetName>ignite.core</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetName>ignite.core</TargetName>
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <TargetName>ignite.core</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetName>ignite.core</TargetName>
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>false</SDLCheck>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
+ <OmitFramePointers>false</OmitFramePointers>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OptimizeReferences>false</OptimizeReferences>
+ <EnableCOMDATFolding>false</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>false</SDLCheck>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
+ <OmitFramePointers>false</OmitFramePointers>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OptimizeReferences>false</OptimizeReferences>
+ <EnableCOMDATFolding>false</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>false</SDLCheck>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>false</SDLCheck>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ignite\cache\cache.h" />
+ <ClInclude Include="..\..\include\ignite\cache\cache_entry.h" />
+ <ClInclude Include="..\..\include\ignite\cache\cache_peek_mode.h" />
+ <ClInclude Include="..\..\include\ignite\cache\query\query.h" />
+ <ClInclude Include="..\..\include\ignite\cache\query\query_argument.h" />
+ <ClInclude Include="..\..\include\ignite\cache\query\query_cursor.h" />
+ <ClInclude Include="..\..\include\ignite\cache\query\query_scan.h" />
+ <ClInclude Include="..\..\include\ignite\cache\query\query_sql.h" />
+ <ClInclude Include="..\..\include\ignite\cache\query\query_text.h" />
+ <ClInclude Include="..\..\include\ignite\ignite.h" />
+ <ClInclude Include="..\..\include\ignite\ignite_configuration.h" />
+ <ClInclude Include="..\..\include\ignite\ignite_error.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" />
+ <ClInclude Include="..\..\include\ignite\impl\ignite_environment.h" />
+ <ClInclude Include="..\..\include\ignite\impl\ignite_impl.h" />
+ <ClInclude Include="..\..\include\ignite\impl\handle_registry.h" />
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop.h" />
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_input_stream.h" />
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_memory.h" />
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_output_stream.h" />
+ <ClInclude Include="..\..\include\ignite\impl\operations.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_common.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_id_resolver.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_handler.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_manager.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_snapshot.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_updater.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_updater_impl.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_reader_impl.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_utils.h" />
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_writer_impl.h" />
+ <ClInclude Include="..\..\include\ignite\portable\portable.h" />
+ <ClInclude Include="..\..\include\ignite\portable\portable_consts.h" />
+ <ClInclude Include="..\..\include\ignite\portable\portable_containers.h" />
+ <ClInclude Include="..\..\include\ignite\portable\portable_type.h" />
+ <ClInclude Include="..\..\include\ignite\portable\portable_raw_reader.h" />
+ <ClInclude Include="..\..\include\ignite\portable\portable_raw_writer.h" />
+ <ClInclude Include="..\..\include\ignite\portable\portable_reader.h" />
+ <ClInclude Include="..\..\include\ignite\portable\portable_writer.h" />
+ <ClInclude Include="..\..\os\win\include\ignite\impl\utils.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\os\win\src\impl\utils.cpp" />
+ <ClCompile Include="..\..\src\ignite.cpp" />
+ <ClCompile Include="..\..\src\ignite_error.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" />
+ <ClCompile Include="..\..\src\impl\ignite_environment.cpp" />
+ <ClCompile Include="..\..\src\impl\ignite_impl.cpp" />
+ <ClCompile Include="..\..\src\impl\handle_registry.cpp" />
+ <ClCompile Include="..\..\src\impl\interop\interop_input_stream.cpp" />
+ <ClCompile Include="..\..\src\impl\interop\interop_memory.cpp" />
+ <ClCompile Include="..\..\src\impl\interop\interop_output_stream.cpp" />
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_handler.cpp" />
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_manager.cpp" />
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_snapshot.cpp" />
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_updater.cpp" />
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_updater_impl.cpp" />
+ <ClCompile Include="..\..\src\impl\portable\portable_reader_impl.cpp" />
+ <ClCompile Include="..\..\src\impl\portable\portable_utils.cpp" />
+ <ClCompile Include="..\..\src\impl\portable\portable_writer_impl.cpp" />
+ <ClCompile Include="..\..\src\portable\portable_containers.cpp" />
+ <ClCompile Include="..\..\src\portable\portable_type.cpp" />
+ <ClCompile Include="..\..\src\portable\portable_raw_reader.cpp" />
+ <ClCompile Include="..\..\src\portable\portable_raw_writer.cpp" />
+ <ClCompile Include="..\..\src\portable\portable_reader.cpp" />
+ <ClCompile Include="..\..\src\portable\portable_writer.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\common\project\vs\common.vcxproj">
+ <Project>{4f7e4917-4612-4b96-9838-025711ade391}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/project/vs/core.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/project/vs/core.vcxproj.filters b/modules/platform/cpp/core/project/vs/core.vcxproj.filters
new file mode 100644
index 0000000..d18599d
--- /dev/null
+++ b/modules/platform/cpp/core/project/vs/core.vcxproj.filters
@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClCompile Include="..\..\src\impl\cache\cache_impl.cpp">
+ <Filter>Code\impl\cache</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\interop\interop_input_stream.cpp">
+ <Filter>Code\impl\interop</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\interop\interop_memory.cpp">
+ <Filter>Code\impl\interop</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\interop\interop_output_stream.cpp">
+ <Filter>Code\impl\interop</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\ignite_environment.cpp">
+ <Filter>Code\impl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\ignite_impl.cpp">
+ <Filter>Code\impl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable\portable_containers.cpp">
+ <Filter>Code\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable\portable_raw_reader.cpp">
+ <Filter>Code\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable\portable_raw_writer.cpp">
+ <Filter>Code\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable\portable_reader.cpp">
+ <Filter>Code\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable\portable_writer.cpp">
+ <Filter>Code\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\portable\portable_reader_impl.cpp">
+ <Filter>Code\impl\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\portable\portable_utils.cpp">
+ <Filter>Code\impl\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\portable\portable_writer_impl.cpp">
+ <Filter>Code\impl\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\os\win\src\impl\utils.cpp">
+ <Filter>Code\impl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ignite.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ignite_error.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ignition.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\guid.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\handle_registry.cpp">
+ <Filter>Code\impl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\cache\query\query_impl.cpp">
+ <Filter>Code\impl\cache\query</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_snapshot.cpp">
+ <Filter>Code\impl\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_handler.cpp">
+ <Filter>Code\impl\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable\portable_type.cpp">
+ <Filter>Code\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_manager.cpp">
+ <Filter>Code\impl\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_updater.cpp">
+ <Filter>Code\impl\portable</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\portable\portable_metadata_updater_impl.cpp">
+ <Filter>Code\impl\portable</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h">
+ <Filter>Code\impl\cache</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\cache\cache.h">
+ <Filter>Code\cache</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\cache\cache_peek_mode.h">
+ <Filter>Code\cache</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop.h">
+ <Filter>Code\impl\interop</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_input_stream.h">
+ <Filter>Code\impl\interop</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_memory.h">
+ <Filter>Code\impl\interop</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_output_stream.h">
+ <Filter>Code\impl\interop</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\ignite_environment.h">
+ <Filter>Code\impl</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\ignite_impl.h">
+ <Filter>Code\impl</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\operations.h">
+ <Filter>Code\impl</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_common.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\portable\portable_consts.h">
+ <Filter>Code\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\portable\portable.h">
+ <Filter>Code\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\portable\portable_containers.h">
+ <Filter>Code\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_id_resolver.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\portable\portable_raw_reader.h">
+ <Filter>Code\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\portable\portable_raw_writer.h">
+ <Filter>Code\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\portable\portable_reader.h">
+ <Filter>Code\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\portable\portable_writer.h">
+ <Filter>Code\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_reader_impl.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_utils.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_writer_impl.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\os\win\include\ignite\impl\utils.h">
+ <Filter>Code\impl</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\ignite.h">
+ <Filter>Code</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\ignite_configuration.h">
+ <Filter>Code</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\ignite_error.h">
+ <Filter>Code</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\ignition.h">
+ <Filter>Code</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\guid.h">
+ <Filter>Code</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\handle_registry.h">
+ <Filter>Code\impl</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\cache\cache_entry.h">
+ <Filter>Code\cache</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\cache\query\query_impl.h">
+ <Filter>Code\impl\cache\query</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_snapshot.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_handler.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_manager.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\portable\portable_type.h">
+ <Filter>Code\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_updater.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_updater_impl.h">
+ <Filter>Code\impl\portable</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\cache\query\query_argument.h">
+ <Filter>Code\cache\query</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\cache\query\query_cursor.h">
+ <Filter>Code\cache\query</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\cache\query\query_sql.h">
+ <Filter>Code\cache\query</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\cache\query\query.h">
+ <Filter>Code\cache\query</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\cache\query\query_text.h">
+ <Filter>Code\cache\query</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\cache\query\query_scan.h">
+ <Filter>Code\cache\query</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="Code">
+ <UniqueIdentifier>{91873c79-a64f-4786-ab25-d03ef2db9dc8}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\impl">
+ <UniqueIdentifier>{9bede404-e1b1-44d6-b54d-e9b2441c5f13}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\impl\cache">
+ <UniqueIdentifier>{b013b0f6-c4b8-4b88-89bc-8b394971788e}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\impl\portable">
+ <UniqueIdentifier>{883773bd-085d-4eb5-81ee-f11188134faf}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\impl\interop">
+ <UniqueIdentifier>{d4cc8aeb-6e7b-47e6-9b83-cba925844d96}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\cache">
+ <UniqueIdentifier>{8b7e32c0-e222-4f3a-af31-19df380c369f}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\portable">
+ <UniqueIdentifier>{24b7134c-9335-44e1-9604-4093d0e3bbf5}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\cache\query">
+ <UniqueIdentifier>{4658a0ff-0d2d-45a6-b8de-93eeec0cc081}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\impl\cache\query">
+ <UniqueIdentifier>{b6e57294-120a-46f2-b0ad-c3595e2cf789}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/guid.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/guid.cpp b/modules/platform/cpp/core/src/guid.cpp
new file mode 100644
index 0000000..77997e4
--- /dev/null
+++ b/modules/platform/cpp/core/src/guid.cpp
@@ -0,0 +1,65 @@
+/*
+ * 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 "ignite/guid.h"
+
+namespace ignite
+{
+ Guid::Guid() : most(0), least(0)
+ {
+ // No-op.
+ }
+
+ Guid::Guid(int64_t most, int64_t least) : most(most), least(least)
+ {
+ // No-op.
+ }
+
+ int64_t Guid::GetMostSignificantBits() const
+ {
+ return most;
+ }
+
+ int64_t Guid::GetLeastSignificantBits() const
+ {
+ return least;
+ }
+
+ int32_t Guid::GetVersion() const
+ {
+ return static_cast<int32_t>((most >> 12) & 0x0f);
+ }
+
+ int32_t Guid::GetVariant() const
+ {
+ uint64_t least0 = static_cast<uint64_t>(least);
+
+ return static_cast<int32_t>((least0 >> (64 - (least0 >> 62))) & (least >> 63));
+ }
+
+ int32_t Guid::GetHashCode() const
+ {
+ int64_t hilo = most ^ least;
+
+ return static_cast<int32_t>(hilo >> 32) ^ static_cast<int32_t>(hilo);
+ }
+
+ bool operator==(Guid& val1, Guid& val2)
+ {
+ return val1.least == val2.least && val1.most == val2.most;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/ignite.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/ignite.cpp b/modules/platform/cpp/core/src/ignite.cpp
new file mode 100644
index 0000000..665383b
--- /dev/null
+++ b/modules/platform/cpp/core/src/ignite.cpp
@@ -0,0 +1,43 @@
+/*
+ * 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 <ignite/common/java.h>
+
+#include "ignite/impl/ignite_impl.h"
+#include "ignite/ignite.h"
+
+using namespace ignite::common::concurrent;
+using namespace ignite::impl;
+
+namespace ignite
+{
+ Ignite::Ignite() : impl(SharedPointer<IgniteImpl>())
+ {
+ // No-op.
+ }
+
+ Ignite::Ignite(IgniteImpl* impl) : impl(SharedPointer<IgniteImpl>(impl))
+ {
+ // No-op.
+ }
+
+ char* Ignite::GetName()
+ {
+ return impl.Get()->GetName();
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/ignite_error.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/ignite_error.cpp b/modules/platform/cpp/core/src/ignite_error.cpp
new file mode 100644
index 0000000..65cd291
--- /dev/null
+++ b/modules/platform/cpp/core/src/ignite_error.cpp
@@ -0,0 +1,222 @@
+/*
+ * 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 <ignite/common/java.h>
+
+#include "ignite/impl/utils.h"
+#include "ignite/ignite_error.h"
+
+using namespace ignite::common::java;
+using namespace ignite::impl::utils;
+
+namespace ignite
+{
+ void IgniteError::ThrowIfNeeded(IgniteError& err)
+ {
+ if (err.code != IGNITE_SUCCESS)
+ throw err;
+ }
+
+ IgniteError::IgniteError() : code(IGNITE_SUCCESS), msg(NULL)
+ {
+ // No-op.
+ }
+
+ IgniteError::IgniteError(int32_t code) : code(code), msg(NULL)
+ {
+ // No-op.
+ }
+
+ IgniteError::IgniteError(int32_t code, const char* msg)
+ {
+ this->code = code;
+ this->msg = CopyChars(msg);
+ }
+
+ IgniteError::IgniteError(const IgniteError& other)
+ {
+ this->code = other.code;
+ this->msg = CopyChars(other.msg);
+ }
+
+ IgniteError& IgniteError::operator=(const IgniteError& other)
+ {
+ if (this != &other)
+ {
+ IgniteError tmp(other);
+
+ int tmpCode = code;
+ char* tmpMsg = msg;
+
+ code = tmp.code;
+ msg = tmp.msg;
+
+ tmp.code = tmpCode;
+ tmp.msg = tmpMsg;
+ }
+
+ return *this;
+ }
+
+ IgniteError::~IgniteError()
+ {
+ ReleaseChars(msg);
+ }
+
+ int32_t IgniteError::GetCode()
+ {
+ return code;
+ }
+
+ const char* IgniteError::GetText()
+ {
+ if (code == IGNITE_SUCCESS)
+ return "Operation completed successfully.";
+ else if (msg)
+ return msg;
+ else
+ return "No additional information available.";
+ }
+
+ void IgniteError::SetError(const int jniCode, const char* jniCls, const char* jniMsg, IgniteError* err)
+ {
+ if (jniCode == IGNITE_JNI_ERR_SUCCESS)
+ *err = IgniteError();
+ else if (jniCode == IGNITE_JNI_ERR_GENERIC)
+ {
+ // The most common case when we have Java exception "in hands" and must map it to respective code.
+ if (jniCls)
+ {
+ std::string jniCls0 = jniCls;
+
+ if (jniCls0.compare("java.lang.NoClassDefFoundError") == 0)
+ {
+ std::stringstream stream;
+
+ stream << "Java class is not found (did you set IGNITE_HOME environment variable?)";
+
+ if (jniMsg)
+ stream << ": " << jniMsg;
+
+ *err = IgniteError(IGNITE_ERR_JVM_NO_CLASS_DEF_FOUND, stream.str().c_str());
+ }
+ else if (jniCls0.compare("java.lang.NoSuchMethodError") == 0)
+ {
+ std::stringstream stream;
+
+ stream << "Java method is not found (did you set IGNITE_HOME environment variable?)";
+
+ if (jniMsg)
+ stream << ": " << jniMsg;
+
+ *err = IgniteError(IGNITE_ERR_JVM_NO_SUCH_METHOD, stream.str().c_str());
+ }
+ else if (jniCls0.compare("java.lang.IllegalArgumentException") == 0)
+ *err = IgniteError(IGNITE_ERR_ILLEGAL_ARGUMENT, jniMsg);
+ else if (jniCls0.compare("java.lang.IllegalStateException") == 0)
+ *err = IgniteError(IGNITE_ERR_ILLEGAL_STATE, jniMsg);
+ else if (jniCls0.compare("java.lang.UnsupportedOperationException") == 0)
+ *err = IgniteError(IGNITE_ERR_UNSUPPORTED_OPERATION, jniMsg);
+ else if (jniCls0.compare("java.lang.InterruptedException") == 0)
+ *err = IgniteError(IGNITE_ERR_INTERRUPTED, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.cluster.ClusterGroupEmptyException") == 0)
+ *err = IgniteError(IGNITE_ERR_CLUSTER_GROUP_EMPTY, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.cluster.ClusterTopologyException") == 0)
+ *err = IgniteError(IGNITE_ERR_CLUSTER_TOPOLOGY, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.compute.ComputeExecutionRejectedException") == 0)
+ *err = IgniteError(IGNITE_ERR_COMPUTE_EXECUTION_REJECTED, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.compute.ComputeJobFailoverException") == 0)
+ *err = IgniteError(IGNITE_ERR_COMPUTE_JOB_FAILOVER, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.compute.ComputeTaskCancelledException") == 0)
+ *err = IgniteError(IGNITE_ERR_COMPUTE_TASK_CANCELLED, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.compute.ComputeTaskTimeoutException") == 0)
+ *err = IgniteError(IGNITE_ERR_COMPUTE_TASK_TIMEOUT, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.compute.ComputeUserUndeclaredException") == 0)
+ *err = IgniteError(IGNITE_ERR_COMPUTE_USER_UNDECLARED_EXCEPTION, jniMsg);
+ else if (jniCls0.compare("javax.cache.CacheException") == 0)
+ *err = IgniteError(IGNITE_ERR_CACHE, jniMsg);
+ else if (jniCls0.compare("javax.cache.integration.CacheLoaderException") == 0)
+ *err = IgniteError(IGNITE_ERR_CACHE_LOADER, jniMsg);
+ else if (jniCls0.compare("javax.cache.integration.CacheWriterException") == 0)
+ *err = IgniteError(IGNITE_ERR_CACHE_WRITER, jniMsg);
+ else if (jniCls0.compare("javax.cache.processor.EntryProcessorException") == 0)
+ *err = IgniteError(IGNITE_ERR_ENTRY_PROCESSOR, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.cache.CacheAtomicUpdateTimeoutException") == 0)
+ *err = IgniteError(IGNITE_ERR_CACHE_ATOMIC_UPDATE_TIMEOUT, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.cache.CachePartialUpdateException") == 0)
+ *err = IgniteError(IGNITE_ERR_CACHE_PARTIAL_UPDATE, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.transactions.TransactionOptimisticException") == 0)
+ *err = IgniteError(IGNITE_ERR_TX_OPTIMISTIC, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.transactions.TransactionTimeoutException") == 0)
+ *err = IgniteError(IGNITE_ERR_TX_TIMEOUT, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.transactions.TransactionRollbackException") == 0)
+ *err = IgniteError(IGNITE_ERR_TX_ROLLBACK, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.transactions.TransactionHeuristicException") == 0)
+ *err = IgniteError(IGNITE_ERR_TX_HEURISTIC, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.IgniteAuthenticationException") == 0)
+ *err = IgniteError(IGNITE_ERR_AUTHENTICATION, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.plugin.security.GridSecurityException") == 0)
+ *err = IgniteError(IGNITE_ERR_SECURITY, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.IgniteException") == 0)
+ *err = IgniteError(IGNITE_ERR_GENERIC, jniMsg);
+ else if (jniCls0.compare("org.apache.ignite.IgniteCheckedException") == 0)
+ *err = IgniteError(IGNITE_ERR_GENERIC, jniMsg);
+ else
+ {
+ std::stringstream stream;
+
+ stream << "Java exception occurred [cls=" << jniCls0;
+
+ if (jniMsg)
+ stream << ", msg=" << jniMsg;
+
+ stream << "]";
+
+ *err = IgniteError(IGNITE_ERR_UNKNOWN, stream.str().c_str());
+ }
+ }
+ else
+ {
+ // JNI class name is not available. Something really weird.
+ *err = IgniteError(IGNITE_ERR_UNKNOWN);
+ }
+ }
+ else if (jniCode == IGNITE_JNI_ERR_JVM_INIT)
+ {
+ std::stringstream stream;
+
+ stream << "Failed to initialize JVM [errCls=";
+
+ if (jniCls)
+ stream << jniCls;
+ else
+ stream << "N/A";
+
+ stream << ", errMsg=";
+
+ if (jniMsg)
+ stream << jniMsg;
+ else
+ stream << "N/A";
+
+ stream << "]";
+
+ *err = IgniteError(IGNITE_ERR_JVM_INIT, stream.str().c_str());
+ }
+ else if (jniCode == IGNITE_JNI_ERR_JVM_ATTACH)
+ *err = IgniteError(IGNITE_ERR_JVM_ATTACH, "Failed to attach to JVM.");
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/ignition.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/ignition.cpp b/modules/platform/cpp/core/src/ignition.cpp
new file mode 100644
index 0000000..a0e3367
--- /dev/null
+++ b/modules/platform/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/ignite_environment.h"
+#include "ignite/impl/ignite_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* 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 Ignite instance 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;
+ }
+
+ Ignite Ignition::Start(const IgniteConfiguration& cfg)
+ {
+ return Start(cfg, static_cast<const char*>(NULL));
+ }
+
+ Ignite Ignition::Start(const IgniteConfiguration& cfg, IgniteError* err)
+ {
+ return Start(cfg, NULL, err);
+ }
+
+ Ignite Ignition::Start(const IgniteConfiguration& cfg, const char* name)
+ {
+ IgniteError err;
+
+ Ignite res = Start(cfg, name, &err);
+
+ IgniteError::ThrowIfNeeded(err);
+
+ return res;
+ }
+
+ Ignite Ignition::Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err)
+ {
+ bool failed = false;
+
+ SharedPointer<IgniteEnvironment> env;
+ SharedPointer<IgniteEnvironment>* 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<IgniteEnvironment>(new IgniteEnvironment());
+
+ int optsLen;
+ char** opts = CreateJvmOptions(cfg, homeFound ? &home : NULL, cp, &optsLen);
+
+ envTarget = new SharedPointer<IgniteEnvironment>(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(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, 2, 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 Ignite();
+ }
+ else
+ {
+ IgniteImpl* impl = new IgniteImpl(env, javaRef);
+
+ return Ignite(impl);
+ }
+ }
+
+ Ignite Ignition::Get()
+ {
+ return Get(static_cast<const char*>(NULL));
+ }
+
+ Ignite Ignition::Get(IgniteError* err)
+ {
+ return Get(NULL, err);
+ }
+
+ Ignite Ignition::Get(const char* name)
+ {
+ IgniteError err;
+
+ Ignite res = Get(name, &err);
+
+ IgniteError::ThrowIfNeeded(err);
+
+ return res;
+ }
+
+ Ignite Ignition::Get(const char* name, IgniteError* err)
+ {
+ Ignite 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<IgniteEnvironment>* env =
+ static_cast<SharedPointer<IgniteEnvironment>*>(hnds->target);
+
+ // 4. Get fresh node reference.
+ jobject ref = ctx.Get()->IgnitionInstance(name0, &jniErr);
+
+ if (err->GetCode() == IgniteError::IGNITE_SUCCESS) {
+ if (ref)
+ {
+ IgniteImpl* impl = new IgniteImpl(*env, ref);
+
+ res = Ignite(impl);
+ }
+ else
+ // Error: concurrent node stop.
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+ "Failed to get Ignite instance because it was stopped concurrently.");
+
+ }
+ }
+ else
+ // Error: no node with the given name.
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+ "Failed to get Ignite 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 Ignite 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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/impl/cache/cache_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/impl/cache/cache_impl.cpp b/modules/platform/cpp/core/src/impl/cache/cache_impl.cpp
new file mode 100644
index 0000000..2f211e7
--- /dev/null
+++ b/modules/platform/cpp/core/src/impl/cache/cache_impl.cpp
@@ -0,0 +1,388 @@
+/*
+ * 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 "ignite/cache/cache_peek_mode.h"
+#include "ignite/impl/cache/cache_impl.h"
+#include "ignite/impl/interop/interop.h"
+#include "ignite/impl/portable/portable_reader_impl.h"
+#include "ignite/impl/utils.h"
+#include "ignite/impl/portable/portable_metadata_updater_impl.h"
+#include "ignite/portable/portable.h"
+
+using namespace ignite::common::concurrent;
+using namespace ignite::common::java;
+using namespace ignite::cache;
+using namespace ignite::cache::query;
+using namespace ignite::impl;
+using namespace ignite::impl::cache::query;
+using namespace ignite::impl::interop;
+using namespace ignite::impl::portable;
+using namespace ignite::impl::utils;
+using namespace ignite::portable;
+
+namespace ignite
+{
+ namespace impl
+ {
+ namespace cache
+ {
+ /** Operation: Clear. */
+ const int32_t OP_CLEAR = 1;
+
+ /** Operation: ClearAll. */
+ const int32_t OP_CLEAR_ALL = 2;
+
+ /** Operation: ContainsKey. */
+ const int32_t OP_CONTAINS_KEY = 3;
+
+ /** Operation: ContainsKeys. */
+ const int32_t OP_CONTAINS_KEYS = 4;
+
+ /** Operation: Get. */
+ const int32_t OP_GET = 5;
+
+ /** Operation: GetAll. */
+ const int32_t OP_GET_ALL = 6;
+
+ /** Operation: GetAndPut. */
+ const int32_t OP_GET_AND_PUT = 7;
+
+ /** Operation: GetAndPutIfAbsent. */
+ const int32_t OP_GET_AND_PUT_IF_ABSENT = 8;
+
+ /** Operation: GetAndRemove. */
+ const int32_t OP_GET_AND_REMOVE = 9;
+
+ /** Operation: GetAndReplace. */
+ const int32_t OP_GET_AND_REPLACE = 10;
+
+ /** Operation: LocalEvict. */
+ const int32_t OP_LOCAL_EVICT = 16;
+
+ /** Operation: LocalClear. */
+ const int32_t OP_LOCAL_CLEAR = 20;
+
+ /** Operation: LocalClearAll. */
+ const int32_t OP_LOCAL_CLEAR_ALL = 21;
+
+ /** Operation: LocalPeek. */
+ const int32_t OP_LOCAL_PEEK = 25;
+
+ /** Operation: Put. */
+ const int32_t OP_PUT = 26;
+
+ /** Operation: PutAll. */
+ const int32_t OP_PUT_ALL = 27;
+
+ /** Operation: PutIfAbsent. */
+ const int32_t OP_PUT_IF_ABSENT = 28;
+
+ /** Operation: SCAN query. */
+ const int32_t OP_QRY_SCAN = 30;
+
+ /** Operation: SQL query. */
+ const int32_t OP_QRY_SQL = 31;
+
+ /** Operation: SQL fields query. */
+ const int32_t OP_QRY_SQL_FIELDS = 32;
+
+ /** Operation: TEXT query. */
+ const int32_t OP_QRY_TEXT = 33;
+
+ /** Operation: RemoveAll. */
+ const int32_t OP_REMOVE_ALL = 34;
+
+ /** Operation: Remove(K, V). */
+ const int32_t OP_REMOVE_2 = 35;
+
+ /** Operation: Remove(K). */
+ const int32_t OP_REMOVE_1 = 36;
+
+ /** Operation: Replace(K, V). */
+ const int32_t OP_REPLACE_2 = 37;
+
+ /** Operation: Replace(K, V, V). */
+ const int32_t OP_REPLACE_3 = 38;
+
+ CacheImpl::CacheImpl(char* name, SharedPointer<IgniteEnvironment> env, jobject javaRef) :
+ name(name), env(env), javaRef(javaRef)
+ {
+ // No-op.
+ }
+
+ CacheImpl::~CacheImpl()
+ {
+ ReleaseChars(name);
+
+ JniContext::Release(javaRef);
+ }
+
+ char* CacheImpl::GetName()
+ {
+ return name;
+ }
+
+ bool CacheImpl::IsEmpty(IgniteError* err)
+ {
+ return Size(IGNITE_PEEK_MODE_ALL, err) == 0;
+ }
+
+ bool CacheImpl::ContainsKey(InputOperation& inOp, IgniteError* err)
+ {
+ return OutOpInternal(OP_CONTAINS_KEY, inOp, err);
+ }
+
+ bool CacheImpl::ContainsKeys(InputOperation& inOp, IgniteError* err)
+ {
+ return OutOpInternal(OP_CONTAINS_KEYS, inOp, err);
+ }
+
+ void CacheImpl::LocalPeek(InputOperation& inOp, OutputOperation& outOp, int32_t peekModes, IgniteError* err)
+ {
+ OutInOpInternal(OP_LOCAL_PEEK, inOp, outOp, err);
+ }
+
+ void CacheImpl::Get(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
+ {
+ OutInOpInternal(OP_GET, inOp, outOp, err);
+ }
+
+ void CacheImpl::GetAll(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
+ {
+ OutInOpInternal(OP_GET_ALL, inOp, outOp, err);
+ }
+
+ void CacheImpl::Put(InputOperation& inOp, IgniteError* err)
+ {
+ OutOpInternal(OP_PUT, inOp, err);
+ }
+
+ void CacheImpl::PutAll(ignite::impl::InputOperation& inOp, IgniteError* err)
+ {
+ OutOpInternal(OP_PUT_ALL, inOp, err);
+ }
+
+ void CacheImpl::GetAndPut(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
+ {
+ OutInOpInternal(OP_GET_AND_PUT, inOp, outOp, err);
+ }
+
+ void CacheImpl::GetAndReplace(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
+ {
+ OutInOpInternal(OP_GET_AND_REPLACE, inOp, outOp, err);
+ }
+
+ void CacheImpl::GetAndRemove(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
+ {
+ OutInOpInternal(OP_GET_AND_REMOVE, inOp, outOp, err);
+ }
+
+ bool CacheImpl::PutIfAbsent(InputOperation& inOp, IgniteError* err)
+ {
+ return OutOpInternal(OP_PUT_IF_ABSENT, inOp, err);
+ }
+
+ void CacheImpl::GetAndPutIfAbsent(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
+ {
+ OutInOpInternal(OP_GET_AND_PUT_IF_ABSENT, inOp, outOp, err);
+ }
+
+ bool CacheImpl::Replace(InputOperation& inOp, IgniteError* err)
+ {
+ return OutOpInternal(OP_REPLACE_2, inOp, err);
+ }
+
+ bool CacheImpl::ReplaceIfEqual(InputOperation& inOp, IgniteError* err)
+ {
+ return OutOpInternal(OP_REPLACE_3, inOp, err);
+ }
+
+ void CacheImpl::LocalEvict(InputOperation& inOp, IgniteError* err)
+ {
+ OutOpInternal(OP_LOCAL_EVICT, inOp, err);
+ }
+
+ void CacheImpl::Clear(IgniteError* err)
+ {
+ JniErrorInfo jniErr;
+
+ env.Get()->Context()->CacheClear(javaRef, &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+ }
+
+ void CacheImpl::Clear(InputOperation& inOp, IgniteError* err)
+ {
+ OutOpInternal(OP_CLEAR, inOp, err);
+ }
+
+ void CacheImpl::ClearAll(InputOperation& inOp, IgniteError* err)
+ {
+ OutOpInternal(OP_CLEAR_ALL, inOp, err);
+ }
+
+ void CacheImpl::LocalClear(InputOperation& inOp, IgniteError* err)
+ {
+ OutOpInternal(OP_LOCAL_CLEAR, inOp, err);
+ }
+
+ void CacheImpl::LocalClearAll(InputOperation& inOp, IgniteError* err)
+ {
+ OutOpInternal(OP_LOCAL_CLEAR_ALL, inOp, err);
+ }
+
+ bool CacheImpl::Remove(InputOperation& inOp, IgniteError* err)
+ {
+ return OutOpInternal(OP_REMOVE_1, inOp, err);
+ }
+
+ bool CacheImpl::RemoveIfEqual(InputOperation& inOp, IgniteError* err)
+ {
+ return OutOpInternal(OP_REMOVE_2, inOp, err);
+ }
+
+ void CacheImpl::RemoveAll(InputOperation& inOp, IgniteError* err)
+ {
+ OutOpInternal(OP_REMOVE_ALL, inOp, err);
+ }
+
+ void CacheImpl::RemoveAll(IgniteError* err)
+ {
+ JniErrorInfo jniErr;
+
+ env.Get()->Context()->CacheRemoveAll(javaRef, &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+ }
+
+ int32_t CacheImpl::Size(const int32_t peekModes, IgniteError* err)
+ {
+ return SizeInternal(peekModes, false, err);
+ }
+
+ int32_t CacheImpl::LocalSize(const int32_t peekModes, IgniteError* err)
+ {
+ return SizeInternal(peekModes, true, err);
+ }
+
+ QueryCursorImpl* CacheImpl::QuerySql(const SqlQuery& qry, IgniteError* err)
+ {
+ return QueryInternal(qry, OP_QRY_SQL, err);
+ }
+
+ QueryCursorImpl* CacheImpl::QueryText(const TextQuery& qry, IgniteError* err)
+ {
+ return QueryInternal(qry, OP_QRY_TEXT, err);
+ }
+
+ QueryCursorImpl* CacheImpl::QueryScan(const ScanQuery& qry, IgniteError* err)
+ {
+ return QueryInternal(qry, OP_QRY_SCAN, err);
+ }
+
+ int64_t CacheImpl::WriteTo(InteropMemory* mem, InputOperation& inOp, IgniteError* err)
+ {
+ PortableMetadataManager* metaMgr = env.Get()->GetMetadataManager();
+
+ int32_t metaVer = metaMgr->GetVersion();
+
+ InteropOutputStream out(mem);
+ PortableWriterImpl writer(&out, metaMgr);
+
+ inOp.ProcessInput(writer);
+
+ out.Synchronize();
+
+ if (metaMgr->IsUpdatedSince(metaVer))
+ {
+ PortableMetadataUpdaterImpl metaUpdater(env, javaRef);
+
+ if (!metaMgr->ProcessPendingUpdates(&metaUpdater, err))
+ return 0;
+ }
+
+ return mem->PointerLong();
+ }
+
+ void CacheImpl::ReadFrom(InteropMemory* mem, OutputOperation& outOp)
+ {
+ InteropInputStream in(mem);
+
+ PortableReaderImpl reader(&in);
+
+ outOp.ProcessOutput(reader);
+ }
+
+ int CacheImpl::SizeInternal(const int32_t peekModes, const bool loc, IgniteError* err)
+ {
+ JniErrorInfo jniErr;
+
+ int res = env.Get()->Context()->CacheSize(javaRef, peekModes, loc, &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+ return res;
+ else
+ return -1;
+ }
+
+ bool CacheImpl::OutOpInternal(const int32_t opType, InputOperation& inOp, IgniteError* err)
+ {
+ JniErrorInfo jniErr;
+
+ SharedPointer<InteropMemory> mem = env.Get()->AllocateMemory();
+
+ int64_t outPtr = WriteTo(mem.Get(), inOp, err);
+
+ if (outPtr)
+ {
+ long long res = env.Get()->Context()->TargetInStreamOutLong(javaRef, opType, outPtr, &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+ return res == 1;
+ }
+
+ return false;
+ }
+
+ void CacheImpl::OutInOpInternal(const int32_t opType, InputOperation& inOp, OutputOperation& outOp,
+ IgniteError* err)
+ {
+ JniErrorInfo jniErr;
+
+ SharedPointer<InteropMemory> outMem = env.Get()->AllocateMemory();
+ SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory();
+
+ int64_t outPtr = WriteTo(outMem.Get(), inOp, err);
+
+ if (outPtr)
+ {
+ env.Get()->Context()->TargetInStreamOutStream(javaRef, opType, WriteTo(outMem.Get(), inOp, err),
+ inMem.Get()->PointerLong(), &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+ ReadFrom(inMem.Get(), outOp);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/impl/cache/query/query_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/impl/cache/query/query_impl.cpp b/modules/platform/cpp/core/src/impl/cache/query/query_impl.cpp
new file mode 100644
index 0000000..7d89321
--- /dev/null
+++ b/modules/platform/cpp/core/src/impl/cache/query/query_impl.cpp
@@ -0,0 +1,193 @@
+/*
+ * 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 "ignite/impl/cache/query/query_impl.h"
+
+using namespace ignite::common::concurrent;
+using namespace ignite::common::java;
+using namespace ignite::impl::interop;
+using namespace ignite::impl::portable;
+
+namespace ignite
+{
+ namespace impl
+ {
+ namespace cache
+ {
+ namespace query
+ {
+ /** Operation: get all entries. */
+ const int32_t OP_GET_ALL = 1;
+
+ /** Operation: get single entry. */
+ const int32_t OP_GET_SINGLE = 3;
+
+ QueryCursorImpl::QueryCursorImpl(SharedPointer<IgniteEnvironment> env, jobject javaRef) :
+ env(env), javaRef(javaRef), iterCalled(false), getAllCalled(false), hasNext(false)
+ {
+ // No-op.
+ }
+
+ QueryCursorImpl::~QueryCursorImpl()
+ {
+ // 1. Close the cursor.
+ env.Get()->Context()->QueryCursorClose(javaRef);
+
+ // 2. Release Java reference.
+ JniContext::Release(javaRef);
+ }
+
+ bool QueryCursorImpl::HasNext(IgniteError* err)
+ {
+ // Check whether GetAll() was called earlier.
+ if (getAllCalled)
+ {
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+ "Cannot use HasNext() method because GetAll() was called.");
+
+ return false;
+ }
+
+ // Create iterator in Java if needed.
+ if (!CreateIteratorIfNeeded(err))
+ return false;
+
+ return hasNext;
+ }
+
+ void QueryCursorImpl::GetNext(OutputOperation& op, IgniteError* err)
+ {
+ // Check whether GetAll() was called earlier.
+ if (getAllCalled)
+ {
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+ "Cannot use GetNext() method because GetAll() was called.");
+
+ return;
+ }
+
+ // Create iterator in Java if needed.
+ if (!CreateIteratorIfNeeded(err))
+ return;
+
+ if (hasNext)
+ {
+ JniErrorInfo jniErr;
+
+ SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory();
+
+ env.Get()->Context()->TargetOutStream(javaRef, OP_GET_SINGLE, inMem.Get()->PointerLong(), &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+ {
+ InteropInputStream in(inMem.Get());
+
+ portable::PortableReaderImpl reader(&in);
+
+ op.ProcessOutput(reader);
+
+ hasNext = IteratorHasNext(err);
+ }
+ }
+ else
+ {
+ // Ensure we do not overwrite possible previous error.
+ if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, "No more elements available.");
+ }
+ }
+
+ void QueryCursorImpl::GetAll(OutputOperation& op, IgniteError* err)
+ {
+ // Check whether any of iterator methods were called.
+ if (iterCalled)
+ {
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+ "Cannot use GetAll() method because an iteration method was called.");
+
+ return;
+ }
+
+ // Check whether GetAll was called before.
+ if (getAllCalled)
+ {
+ *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+ "Cannot use GetNext() method because GetAll() was called.");
+
+ return;
+ }
+
+ // Get data.
+ JniErrorInfo jniErr;
+
+ SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory();
+
+ env.Get()->Context()->TargetOutStream(javaRef, OP_GET_ALL, inMem.Get()->PointerLong(), &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+ {
+ getAllCalled = true;
+
+ InteropInputStream in(inMem.Get());
+
+ portable::PortableReaderImpl reader(&in);
+
+ op.ProcessOutput(reader);
+ }
+ }
+
+ bool QueryCursorImpl::CreateIteratorIfNeeded(IgniteError* err)
+ {
+ if (!iterCalled)
+ {
+ JniErrorInfo jniErr;
+
+ env.Get()->Context()->QueryCursorIterator(javaRef, &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+ {
+ iterCalled = true;
+
+ hasNext = IteratorHasNext(err);
+ }
+ else
+ return false;
+ }
+
+ return true;
+ }
+
+ bool QueryCursorImpl::IteratorHasNext(IgniteError* err)
+ {
+ JniErrorInfo jniErr;
+
+ bool res = env.Get()->Context()->QueryCursorIteratorHasNext(javaRef, &jniErr);
+
+ IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+ return jniErr.code == IGNITE_JNI_ERR_SUCCESS && res;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/impl/handle_registry.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/impl/handle_registry.cpp b/modules/platform/cpp/core/src/impl/handle_registry.cpp
new file mode 100644
index 0000000..c447faa
--- /dev/null
+++ b/modules/platform/cpp/core/src/impl/handle_registry.cpp
@@ -0,0 +1,234 @@
+/*
+ * 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 "ignite/impl/handle_registry.h"
+
+using namespace ignite::common::concurrent;
+
+namespace ignite
+{
+ namespace impl
+ {
+ HandleRegistryEntry::~HandleRegistryEntry()
+ {
+ // No-op.
+ }
+
+ HandleRegistrySegment::HandleRegistrySegment() :
+ map(new std::map<int64_t, SharedPointer<HandleRegistryEntry>>()), mux(new CriticalSection())
+ {
+ // No-op.
+ }
+
+ HandleRegistrySegment::~HandleRegistrySegment()
+ {
+ delete map;
+ delete mux;
+ }
+
+ SharedPointer<HandleRegistryEntry> HandleRegistrySegment::Get(int64_t hnd)
+ {
+ mux->Enter();
+
+ SharedPointer<HandleRegistryEntry> res = (*map)[hnd];
+
+ mux->Leave();
+
+ return res;
+ }
+
+ void HandleRegistrySegment::Put(int64_t hnd, const SharedPointer<HandleRegistryEntry>& entry)
+ {
+ mux->Enter();
+
+ (*map)[hnd] = entry;
+
+ mux->Leave();
+ }
+
+ void HandleRegistrySegment::Remove(int64_t hnd)
+ {
+ mux->Enter();
+
+ map->erase(hnd);
+
+ mux->Leave();
+ }
+
+ void HandleRegistrySegment::Clear()
+ {
+ mux->Enter();
+
+ map->erase(map->begin(), map->end());
+
+ mux->Leave();
+ }
+
+ HandleRegistry::HandleRegistry(int32_t fastCap, int32_t slowSegmentCnt)
+ {
+ this->fastCap = fastCap;
+
+ fastCtr = 0;
+
+ fast = new SharedPointer<HandleRegistryEntry>[fastCap];
+
+ for (int i = 0; i < fastCap; i++)
+ fast[i] = SharedPointer<HandleRegistryEntry>();
+
+ this->slowSegmentCnt = slowSegmentCnt;
+
+ slowCtr = fastCap;
+
+ slow = new HandleRegistrySegment*[slowSegmentCnt];
+
+ for (int i = 0; i < slowSegmentCnt; i++)
+ slow[i] = new HandleRegistrySegment();
+
+ closed = 0;
+
+ Memory::Fence();
+ }
+
+ HandleRegistry::~HandleRegistry()
+ {
+ Close();
+
+ delete[] fast;
+
+ for (int i = 0; i < slowSegmentCnt; i++)
+ delete slow[i];
+
+ delete[] slow;
+ }
+
+ int64_t HandleRegistry::Allocate(const SharedPointer<HandleRegistryEntry>& target)
+ {
+ return Allocate0(target, false, false);
+ }
+
+ int64_t HandleRegistry::AllocateCritical(const SharedPointer<HandleRegistryEntry>& target)
+ {
+ return Allocate0(target, true, false);
+ }
+
+ int64_t HandleRegistry::AllocateSafe(const SharedPointer<HandleRegistryEntry>& target)
+ {
+ return Allocate0(target, false, true);
+ }
+
+ int64_t HandleRegistry::AllocateCriticalSafe(const SharedPointer<HandleRegistryEntry>& target)
+ {
+ return Allocate0(target, true, true);
+ }
+
+ void HandleRegistry::Release(int64_t hnd)
+ {
+ if (hnd < fastCap)
+ fast[static_cast<int32_t>(hnd)] = SharedPointer<HandleRegistryEntry>();
+ else
+ {
+ HandleRegistrySegment* segment = *(slow + hnd % slowSegmentCnt);
+
+ segment->Remove(hnd);
+ }
+
+ Memory::Fence();
+ }
+
+ SharedPointer<HandleRegistryEntry> HandleRegistry::Get(int64_t hnd)
+ {
+ Memory::Fence();
+
+ if (hnd < fastCap)
+ return fast[static_cast<int32_t>(hnd)];
+ else
+ {
+ HandleRegistrySegment* segment = *(slow + hnd % slowSegmentCnt);
+
+ return segment->Get(hnd);
+ }
+ }
+
+ void HandleRegistry::Close()
+ {
+ if (Atomics::CompareAndSet32(&closed, 0, 1))
+ {
+ // Cleanup fast-path handles.
+ for (int i = 0; i < fastCap; i++)
+ fast[i] = SharedPointer<HandleRegistryEntry>();
+
+ // Cleanup slow-path handles.
+ for (int i = 0; i < slowSegmentCnt; i++)
+ (*(slow + i))->Clear();
+ }
+ }
+
+ int64_t HandleRegistry::Allocate0(const SharedPointer<HandleRegistryEntry>& target, bool critical, bool safe)
+ {
+ // Check closed state.
+ Memory::Fence();
+
+ if (closed == 1)
+ return -1;
+
+ // Try allocating entry on critical path.
+ if (critical)
+ {
+ if (fastCtr < fastCap)
+ {
+ int32_t fastIdx = Atomics::IncrementAndGet32(&fastCtr) - 1;
+
+ if (fastIdx < fastCap)
+ {
+ fast[fastIdx] = target;
+
+ // Double-check for closed state if safe mode is on.
+ Memory::Fence();
+
+ if (safe && closed == 1)
+ {
+ fast[fastIdx] = SharedPointer<HandleRegistryEntry>();
+
+ return -1;
+ }
+ else
+ return fastIdx;
+ }
+ }
+ }
+
+ // Either allocating on slow-path, or fast-path can no longer accomodate more entries.
+ int64_t slowIdx = Atomics::IncrementAndGet64(&slowCtr) - 1;
+
+ HandleRegistrySegment* segment = *(slow + slowIdx % slowSegmentCnt);
+
+ segment->Put(slowIdx, target);
+
+ // Double-check for closed state if safe mode is on.
+ Memory::Fence();
+
+ if (safe && closed == 1)
+ {
+ segment->Remove(slowIdx);
+
+ return -1;
+ }
+
+ return slowIdx;
+ }
+ }
+}
\ No newline at end of file