ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [06/16] ignite git commit: IGNITE-2873: .NET: Added support for app configuration from executable. This closes #576.
Date Mon, 28 Mar 2016 06:34:02 GMT
IGNITE-2873: .NET: Added support for app configuration from executable. This closes #576.


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

Branch: refs/heads/ignite-gg-10994
Commit: e3ba037a6a912c54ec378facc9a66d9a6b320752
Parents: 7864826
Author: Pavel Tupitsyn <ptupitsyn@gridgain.com>
Authored: Thu Mar 24 17:18:16 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Thu Mar 24 17:18:16 2016 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests.csproj             |   9 +
 .../Config/Apache.Ignite.exe.config.test2       |  58 +++++++
 .../Config/Apache.Ignite.exe.config.test3       |  34 ++++
 .../Config/ignite-dotnet-cfg.xml                |  52 ++++++
 .../Apache.Ignite.Core.Tests/ExecutableTest.cs  |  89 +++++++---
 .../IgniteConfigurationSerializerTest.cs        |   3 +-
 .../IgniteConfigurationSection.xsd              |   8 +
 .../dotnet/Apache.Ignite/Apache.Ignite.csproj   |   2 +-
 .../Config/AppSettingsConfigurator.cs           |  97 +++--------
 .../Apache.Ignite/Config/ArgsConfigurator.cs    | 145 ++--------------
 .../dotnet/Apache.Ignite/Config/Configurator.cs | 168 +++++++++++++++++++
 .../Apache.Ignite/Config/IConfigurator.cs       |  34 ----
 .../dotnet/Apache.Ignite/IgniteRunner.cs        |  24 +--
 .../Apache.Ignite/Service/IgniteService.cs      |  21 +--
 14 files changed, 448 insertions(+), 296 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index fedbd63..7cc9296 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -265,6 +265,15 @@
     <None Include="Apache.Ignite.Core.Tests.nunit" />
     <None Include="Apache.Ignite.Core.Tests.snk" />
     <None Include="app.config" />
+    <Content Include="Config\ignite-dotnet-cfg.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <None Include="Config\Apache.Ignite.exe.config.test3">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="Config\Apache.Ignite.exe.config.test2">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test2
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test2 b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test2
new file mode 100644
index 0000000..ecfce18
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test2
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<configuration>
+    <configSections>
+        <section name="igniteConfiguration" type="Apache.Ignite.Core.IgniteConfigurationSection, Apache.Ignite.Core" />
+    </configSections>
+
+    <startup>
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
+    </startup>
+
+    <runtime>
+        <gcServer enabled="true" />
+    </runtime>
+
+    <igniteConfiguration xmlns="http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection">
+        <discoverySpi type="TcpDiscoverySpi">
+            <ipFinder type="TcpDiscoveryStaticIpFinder">
+                <endpoints>
+                    <string>127.0.0.1:47500..47501</string>
+                </endpoints>
+            </ipFinder>
+        </discoverySpi>
+
+        <jvmOptions>
+            <string>-Xms1g</string>
+            <string>-Xmx702m</string>
+        </jvmOptions>
+    </igniteConfiguration>
+
+    <appSettings>
+        <add key="Ignite.SpringConfigUrl" value="config\compute\compute-standalone.xml" />
+        <add key="Ignite.Assembly.1" value="test-1.dll" />
+        <add key="Ignite.Assembly.2" value="test-2.dll" />
+        <add key="Ignite.JvmOption.1" value="-DOPT1" />
+        <add key="Ignite.JvmOption.2" value="-DOPT2" />
+        <add key="Ignite.JvmOption.3" value="-Xms601m" />
+        <add key="Ignite.ConfigSectionName" value="igniteConfiguration" />
+    </appSettings>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test3
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test3 b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test3
new file mode 100644
index 0000000..c09f3f4
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test3
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<configuration>
+    <startup>
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
+    </startup>
+
+    <runtime>
+        <gcServer enabled="true" />
+    </runtime>
+
+    <appSettings>
+        <add key="Ignite.ConfigFileName" value="config\ignite-dotnet-cfg.xml" />
+        <add key="Ignite.ConfigSectionName" value="igniteConfiguration" />
+    </appSettings>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/ignite-dotnet-cfg.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/ignite-dotnet-cfg.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/ignite-dotnet-cfg.xml
new file mode 100644
index 0000000..53f2f0f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/ignite-dotnet-cfg.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<configuration>
+    <configSections>
+        <section name="igniteConfiguration" type="Apache.Ignite.Core.IgniteConfigurationSection, Apache.Ignite.Core" />
+    </configSections>
+
+    <igniteConfiguration xmlns="http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection" 
+                         localhost="127.0.0.1">
+        <discoverySpi type="TcpDiscoverySpi">
+            <ipFinder type="TcpDiscoveryStaticIpFinder">
+                <endpoints>
+                    <string>127.0.0.1:47500..47501</string>
+                </endpoints>
+            </ipFinder>
+        </discoverySpi>
+
+        <jvmOptions>
+            <string>-Xms512m</string>
+            <string>-Xmx702m</string>
+            <string>-DOPT25</string>
+        </jvmOptions>
+
+        <cacheConfiguration>
+            <cacheConfiguration name='testCache' cacheMode='Replicated' />
+        </cacheConfiguration>
+
+        <binaryConfiguration>
+            <types>
+                <string>Apache.Ignite.Core.Tests.ExecutableTest+RemoteConfiguration, Apache.Ignite.Core.Tests</string>
+                <string>Apache.Ignite.Core.Tests.ExecutableTest+RemoteConfigurationClosure, Apache.Ignite.Core.Tests</string>
+            </types>
+        </binaryConfiguration>
+    </igniteConfiguration>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
index e34e0ba..9e6de05 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
@@ -17,6 +17,8 @@
 
 // ReSharper disable UnusedVariable
 // ReSharper disable UnusedAutoPropertyAccessor.Global
+// ReSharper disable UnusedAutoPropertyAccessor.Local
+//#pragma warning disable 618
 namespace Apache.Ignite.Core.Tests
 {
     using System;
@@ -27,7 +29,6 @@ namespace Apache.Ignite.Core.Tests
     using Apache.Ignite.Core.Impl;
     using Apache.Ignite.Core.Resource;
     using Apache.Ignite.Core.Tests.Process;
-    using Microsoft.CSharp;
     using NUnit.Framework;
 
     /// <summary>
@@ -77,7 +78,7 @@ namespace Apache.Ignite.Core.Tests
         {
             TestUtils.KillProcesses();
 
-            Assert.IsTrue(_grid.WaitTopology(1, 30000));
+            Assert.IsTrue(_grid.WaitTopology(1));
 
             IgniteProcess.SaveConfigurationBackup();
         }
@@ -106,7 +107,7 @@ namespace Apache.Ignite.Core.Tests
                 "-jvmClasspath=" + TestUtils.CreateTestClasspath()
                 );
 
-            Assert.IsTrue(_grid.WaitTopology(2, 30000));
+            Assert.IsTrue(_grid.WaitTopology(2));
 
             var cfg = RemoteConfig();
 
@@ -133,7 +134,7 @@ namespace Apache.Ignite.Core.Tests
                 "-assembly=test-2.dll"
                 );
 
-            Assert.IsTrue(_grid.WaitTopology(2, 30000));
+            Assert.IsTrue(_grid.WaitTopology(2));
 
             var cfg = RemoteConfig();
 
@@ -153,7 +154,7 @@ namespace Apache.Ignite.Core.Tests
                 "-J-DOPT2"
                 );
 
-            Assert.IsTrue(_grid.WaitTopology(2, 30000));
+            Assert.IsTrue(_grid.WaitTopology(2));
 
             var cfg = RemoteConfig();
 
@@ -173,7 +174,7 @@ namespace Apache.Ignite.Core.Tests
                 "-J-Xmx607m"
                 );
 
-            Assert.IsTrue(_grid.WaitTopology(2, 30000));
+            Assert.IsTrue(_grid.WaitTopology(2));
 
             var minMem = _grid.GetCluster().ForRemotes().GetCompute().ExecuteJavaTask<long>(MinMemTask, null);
             Assert.AreEqual((long) 506*1024*1024, minMem);
@@ -195,7 +196,7 @@ namespace Apache.Ignite.Core.Tests
                 "-JvmMaxMemoryMB=863"
                 );
 
-            Assert.IsTrue(_grid.WaitTopology(2, 30000));
+            Assert.IsTrue(_grid.WaitTopology(2));
 
             var minMem = _grid.GetCluster().ForRemotes().GetCompute().ExecuteJavaTask<long>(MinMemTask, null);
             Assert.AreEqual((long) 615*1024*1024, minMem);
@@ -208,16 +209,17 @@ namespace Apache.Ignite.Core.Tests
         /// Test JVM memory options passing from application configuration.
         /// </summary>
         [Test]
-        public void TestJvmMemoryOptsAppConfig()
+        public void TestJvmMemoryOptsAppConfig(
+            [Values("config\\Apache.Ignite.exe.config.test", "config\\Apache.Ignite.exe.config.test2")] string config)
         {
-            IgniteProcess.ReplaceConfiguration("config\\Apache.Ignite.exe.config.test");
+            IgniteProcess.ReplaceConfiguration(config);
 
             GenerateDll("test-1.dll");
             GenerateDll("test-2.dll");
 
             var proc = new IgniteProcess("-jvmClasspath=" + TestUtils.CreateTestClasspath());
 
-            Assert.IsTrue(_grid.WaitTopology(2, 30000));
+            Assert.IsTrue(_grid.WaitTopology(2));
 
             var minMem = _grid.GetCluster().ForRemotes().GetCompute().ExecuteJavaTask<long>(MinMemTask, null);
             Assert.AreEqual((long) 601*1024*1024, minMem);
@@ -227,14 +229,14 @@ namespace Apache.Ignite.Core.Tests
 
             proc.Kill();
 
-            Assert.IsTrue(_grid.WaitTopology(1, 30000));
+            Assert.IsTrue(_grid.WaitTopology(1));
 
             // Command line options overwrite config file options
             // ReSharper disable once RedundantAssignment
             proc = new IgniteProcess("-jvmClasspath=" + TestUtils.CreateTestClasspath(),
                 "-J-Xms605m", "-J-Xmx706m");
 
-            Assert.IsTrue(_grid.WaitTopology(2, 30000));
+            Assert.IsTrue(_grid.WaitTopology(2));
 
             minMem = _grid.GetCluster().ForRemotes().GetCompute().ExecuteJavaTask<long>(MinMemTask, null);
             Assert.AreEqual((long) 605*1024*1024, minMem);
@@ -258,7 +260,7 @@ namespace Apache.Ignite.Core.Tests
                 "-JvmMaxMemoryMB=256"
                 );
 
-            Assert.IsTrue(_grid.WaitTopology(2, 30000));
+            Assert.IsTrue(_grid.WaitTopology(2));
 
             // Raw JVM options (Xms/Xmx) should override custom options
             var minMem = _grid.GetCluster().ForRemotes().GetCompute().ExecuteJavaTask<long>(MinMemTask, null);
@@ -269,6 +271,45 @@ namespace Apache.Ignite.Core.Tests
         }
 
         /// <summary>
+        /// Tests the .NET XML configuration specified in app.config.
+        /// </summary>
+        [Test]
+        public void TestXmlConfigurationAppConfig()
+        {
+            IgniteProcess.ReplaceConfiguration("config\\Apache.Ignite.exe.config.test3");
+
+            var proc = new IgniteProcess("-jvmClasspath=" + TestUtils.CreateTestClasspath());
+
+            Assert.IsTrue(_grid.WaitTopology(2));
+
+            var remoteCfg = RemoteConfig();
+            Assert.IsTrue(remoteCfg.JvmOptions.Contains("-DOPT25"));
+
+            proc.Kill();
+
+            Assert.IsTrue(_grid.WaitTopology(1));
+        }
+
+        /// <summary>
+        /// Tests the .NET XML configuration specified in command line.
+        /// </summary>
+        [Test]
+        public void TestXmlConfigurationCmd()
+        {
+            var proc = new IgniteProcess("-jvmClasspath=" + TestUtils.CreateTestClasspath(),
+                "-configFileName=config\\ignite-dotnet-cfg.xml");
+
+            Assert.IsTrue(_grid.WaitTopology(2));
+
+            var remoteCfg = RemoteConfig();
+            Assert.IsTrue(remoteCfg.JvmOptions.Contains("-DOPT25"));
+
+            proc.Kill();
+
+            Assert.IsTrue(_grid.WaitTopology(1));
+        }
+
+        /// <summary>
         /// Get remote node configuration.
         /// </summary>
         /// <returns>Configuration.</returns>
@@ -325,21 +366,15 @@ namespace Apache.Ignite.Core.Tests
         /// <param name="outputPath"></param>
         private static void GenerateDll(string outputPath)
         {
-            var codeProvider = new CSharpCodeProvider();
-
-#pragma warning disable 0618
-
-            var icc = codeProvider.CreateCompiler();
-
-#pragma warning restore 0618
-
-            var parameters = new CompilerParameters();
-            parameters.GenerateExecutable = false;
-            parameters.OutputAssembly = outputPath;
+            var parameters = new CompilerParameters
+            {
+                GenerateExecutable = false,
+                OutputAssembly = outputPath
+            };
 
             var src = "namespace Apache.Ignite.Client.Test { public class Foo {}}";
 
-            var results = icc.CompileAssemblyFromSource(parameters, src);
+            var results = CodeDomProvider.CreateProvider("CSharp").CompileAssemblyFromSource(parameters, src);
 
             Assert.False(results.Errors.HasErrors);
         }
@@ -357,7 +392,7 @@ namespace Apache.Ignite.Core.Tests
         /// <summary>
         /// Closure which extracts configuration and passes it back.
         /// </summary>
-        public class RemoteConfigurationClosure : IComputeFunc<RemoteConfiguration>
+        private class RemoteConfigurationClosure : IComputeFunc<RemoteConfiguration>
         {
 
 #pragma warning disable 0649
@@ -396,7 +431,7 @@ namespace Apache.Ignite.Core.Tests
         /// <summary>
         /// Configuration.
         /// </summary>
-        public class RemoteConfiguration
+        private class RemoteConfiguration
         {
             /// <summary>
             /// GG home.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index e221a55..6e9effe 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -307,6 +307,7 @@ namespace Apache.Ignite.Core.Tests
                             Serializer = new TestSerializer()
                         }
                     },
+                    Types = new [] {typeof(string).FullName },
                     DefaultIdMapper = new IdMapper(),
                     DefaultKeepDeserialized = true,
                     DefaultNameMapper = new NameMapper(),
@@ -319,7 +320,7 @@ namespace Apache.Ignite.Core.Tests
                         AtomicWriteOrderMode = CacheAtomicWriteOrderMode.Primary,
                         AtomicityMode = CacheAtomicityMode.Transactional,
                         Backups = 15,
-                        CacheMode = CacheMode.Partitioned,
+                        CacheMode = CacheMode.Replicated,
                         CacheStoreFactory = new TestCacheStoreFactory(),
                         CopyOnRead = true,
                         EagerTtl = true,

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 8902d3a..c7b6cf2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -61,6 +61,13 @@
                                     </xs:sequence>
                                 </xs:complexType>
                             </xs:element>
+                            <xs:element name="types" minOccurs="0">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element maxOccurs="unbounded" name="string" type="xs:string" />
+                                    </xs:sequence>
+                                </xs:complexType>
+                            </xs:element>
                             <xs:element name="defaultNameMapper" minOccurs="0">
                                 <xs:complexType>
                                     <xs:attribute name="type" type="xs:string" use="required" />
@@ -161,6 +168,7 @@
                                         </xs:element>
                                     </xs:all>
                                     <xs:attribute name="name" type="xs:string" />
+                                    <xs:attribute name="cacheMode" type="xs:string" />
                                     <xs:attribute name="writeSynchronizationMode" type="xs:string" />
                                     <xs:attribute name="evictSynchronized" type="xs:boolean" />
                                     <xs:attribute name="evictSynchronizedKeyBufferSize" type="xs:int" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite/Apache.Ignite.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/Apache.Ignite.csproj b/modules/platforms/dotnet/Apache.Ignite/Apache.Ignite.csproj
index e2dae25..ccebbfe 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Apache.Ignite.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite/Apache.Ignite.csproj
@@ -51,8 +51,8 @@
   <ItemGroup>
     <Compile Include="Config\AppSettingsConfigurator.cs" />
     <Compile Include="Config\ArgsConfigurator.cs" />
+    <Compile Include="Config\Configurator.cs" />
     <Compile Include="Config\ConfigValueParser.cs" />
-    <Compile Include="Config\IConfigurator.cs" />
     <Compile Include="IgniteRunner.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Service\IgniteService.cs">

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs b/modules/platforms/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs
index b2e827e..c15f29f 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs
@@ -17,97 +17,50 @@
 
 namespace Apache.Ignite.Config
 {
+    using System;
     using System.Collections.Generic;
     using System.Collections.Specialized;
-    using Apache.Ignite.Core;
+    using System.Linq;
 
     /// <summary>
     /// Configurator which uses application configuration.
     /// </summary>
-    internal class AppSettingsConfigurator : IConfigurator<NameValueCollection>
+    internal static class AppSettingsConfigurator
     {
         /** Common configuration property prefix. */
-        private static readonly string CfgPrefix = "Ignite.".ToLower();
+        private const string CfgPrefix = "Ignite.";
 
         /** Configuration property: Ignite home. */
-        private static readonly string CfgHome = "Home".ToLower();
-
-        /** Configuration property: Spring config URL. */
-        private static readonly string CfgSpringCfgUrl = "SpringConfigUrl".ToLower();
-
-        /** Configuration property: Path to JVM dll. */
-        private static readonly string CfgJvmDll = "JvmDll".ToLower();
-
-        /** Configuration property: JVM classpath. */
-        private static readonly string CfgJvmClasspath = "JvmClasspath".ToLower();
-
-        /** Configuration property: suppress warnings flag. */
-        private static readonly string CfgSuppressWarn = "SuppressWarnings".ToLower();
+        private const string CfgHome = "Home";
 
         /** Configuration property: JVM option prefix. */
-        private static readonly string CfgJvmOptPrefix = "JvmOption".ToLower();
+        private const string CfgJvmOptPrefix = "JvmOption";
 
         /** Configuration property: assembly prefix. */
-        private static readonly string CfgAssemblyPrefix = "Assembly".ToLower();
-
-        /** Configuration property: JVM min memory. */
-        private static readonly string CfgJvmMinMem = "JvmInitialMemoryMB".ToLower();
-
-        /** Configuration property: JVM max memory. */
-        private static readonly string CfgJvmMaxMem = "JvmMaxMemoryMB".ToLower();
+        private const string CfgAssemblyPrefix = "Assembly";
 
-        /** <inheritDoc /> */
-        public void Configure(IgniteConfiguration cfg, NameValueCollection src)
+        /// <summary>
+        /// Gets the arguments in split form.
+        /// </summary>
+        public static IEnumerable<Tuple<string, string>> GetArgs(NameValueCollection args)
         {
-            var jvmOpts = new List<string>();
-            var assemblies = new List<string>();
-
-            foreach (string key in src.Keys)
-            {
-                var key0 = key.ToLower();
-
-                if (key0.StartsWith(CfgPrefix))
-                {
-                    key0 = key0.Substring(CfgPrefix.Length);
-
-                    var val = src[key];
+            return args.AllKeys
+                .Where(x => x.StartsWith(CfgPrefix, StringComparison.OrdinalIgnoreCase))
+                .Select(k => Tuple.Create(Replace(k), args[k]));
+        }
 
-                    if (CfgHome.Equals(key0))
-                        cfg.IgniteHome = val;
-                    else if (CfgSpringCfgUrl.Equals(key0))
-                        cfg.SpringConfigUrl = val;
-                    else if (CfgJvmDll.Equals(key0))
-                        cfg.JvmDllPath = val;
-                    else if (CfgJvmClasspath.Equals(key0))
-                        cfg.JvmClasspath = val;
-                    else if (CfgSuppressWarn.Equals(key0))
-                        cfg.SuppressWarnings = val != null && bool.TrueString.ToLower().Equals(val.ToLower());
-                    else if (key0.StartsWith(CfgJvmOptPrefix))
-                        jvmOpts.Add(val);
-                    else if (key0.StartsWith(CfgAssemblyPrefix))
-                        assemblies.Add(val);
-                    else if (CfgJvmMinMem.Equals(key0))
-                        cfg.JvmInitialMemoryMb = ConfigValueParser.ParseInt(val, key);
-                    else if (CfgJvmMaxMem.Equals(key0))
-                        cfg.JvmMaxMemoryMb = ConfigValueParser.ParseInt(val, key);
-                }
-            }
+        /// <summary>
+        /// Replaces the appsettings-specific keys with common arg name.
+        /// </summary>
+        private static string Replace(string key)
+        {
+            key = key.Substring(CfgPrefix.Length);
 
-            if (jvmOpts.Count > 0)
-            {
-                if (cfg.JvmOptions == null)
-                    cfg.JvmOptions = jvmOpts;
-                else
-                    jvmOpts.ForEach(val => cfg.JvmOptions.Add(val));
-            }
+            key = key.Equals(CfgHome, StringComparison.OrdinalIgnoreCase) ? Configurator.CmdIgniteHome : key;
+            key = key.StartsWith(CfgJvmOptPrefix, StringComparison.OrdinalIgnoreCase) ? Configurator.CmdJvmOpt : key;
+            key = key.StartsWith(CfgAssemblyPrefix, StringComparison.OrdinalIgnoreCase) ? Configurator.CmdAssembly : key;
 
-            if (assemblies.Count > 0)
-            {
-                if (cfg.Assemblies == null)
-                    cfg.Assemblies = assemblies;
-                else
-                    assemblies.ForEach(val => cfg.Assemblies.Add(val));
-            }
+            return key;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs b/modules/platforms/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs
index b0651d7..c7dae66 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs
@@ -17,148 +17,27 @@
 
 namespace Apache.Ignite.Config
 {
+    using System;
     using System.Collections.Generic;
-    using Apache.Ignite.Core;
+    using System.Linq;
 
     /// <summary>
     /// Configurator which uses arguments array.
     /// </summary>
-    internal class ArgsConfigurator : IConfigurator<string[]>
+    internal static class ArgsConfigurator
     {
-        /** Command line argument: Ignite home. */
-        private static readonly string CmdIgniteHome = "-IgniteHome=".ToLower();
-
-        /** Command line argument: Spring config URL. */
-        private static readonly string CmdSpringCfgUrl = "-SpringConfigUrl=".ToLower();
-
-        /** Command line argument: Path to JVM dll. */
-        private static readonly string CmdJvmDll = "-JvmDll=".ToLower();
-
-        /** Command line argument: JVM classpath. */
-        private static readonly string CmdJvmClasspath = "-JvmClasspath=".ToLower();
-
-        /** Command line argument: suppress warnings flag. */
-        private static readonly string CmdSuppressWarn = "-SuppressWarnings=".ToLower();
-
-        /** Command line argument: JVM option prefix. */
-        private static readonly string CmdJvmOpt = "-J".ToLower();
-
-        /** Command line argument: assembly. */
-        private static readonly string CmdAssembly = "-Assembly=".ToLower();
-
-        /** Command line argument: JvmInitialMemoryMB. */
-        private static readonly string CmdJvmMinMem = "-JvmInitialMemoryMB=".ToLower();
-
-        /** Command line argument: JvmMaxMemoryMB. */
-        private static readonly string CmdJvmMaxMem = "-JvmMaxMemoryMB=".ToLower();
-
-        /// <summary>
-        /// Convert configuration to arguments.
-        /// </summary>
-        /// <param name="cfg"></param>
-        /// <returns></returns>
-        internal static string[] ToArgs(IgniteConfiguration cfg)
-        {
-            var args = new List<string>();
-
-            if (cfg.IgniteHome != null)
-                args.Add(CmdIgniteHome + cfg.IgniteHome);
-
-            if (cfg.SpringConfigUrl != null)
-                args.Add(CmdSpringCfgUrl + cfg.SpringConfigUrl);
-
-            if (cfg.JvmDllPath != null)
-                args.Add(CmdJvmDll + cfg.JvmDllPath);
-
-            if (cfg.JvmClasspath != null)
-                args.Add(CmdJvmClasspath + cfg.JvmClasspath);
-            
-            if (cfg.SuppressWarnings)
-                args.Add(CmdSuppressWarn + bool.TrueString);
-
-            if (cfg.JvmOptions != null)
-            {
-                foreach (var jvmOpt in cfg.JvmOptions)
-                    args.Add(CmdJvmOpt + jvmOpt);
-            }
-
-            if (cfg.Assemblies != null)
-            {
-                foreach (var assembly in cfg.Assemblies)
-                    args.Add(CmdAssembly + assembly);
-            }
-
-            args.Add(CmdJvmMinMem + cfg.JvmInitialMemoryMb);
-            args.Add(CmdJvmMaxMem + cfg.JvmMaxMemoryMb);
-
-            return args.ToArray();
-        }
-
         /// <summary>
-        /// Convert arguments to configuration.
+        /// Gets the arguments in split form.
         /// </summary>
-        /// <param name="args">Arguments.</param>
-        /// <returns>Configuration.</returns>
-        internal static IgniteConfiguration FromArgs(string[] args)
-        {
-            var cfg = new IgniteConfiguration();
-
-            new ArgsConfigurator().Configure(cfg, args);
-
-            return cfg;
-        }
-
-        /** <inheritDoc /> */
-        public void Configure(IgniteConfiguration cfg, string[] src)
+        public static IEnumerable<Tuple<string, string>> GetArgs(IEnumerable<string> args)
         {
-            var jvmOpts = new List<string>();
-            var assemblies = new List<string>();
-
-            foreach (var arg in src)
-            {
-                var argLow = arg.ToLower();
-
-                if (argLow.StartsWith(CmdIgniteHome))
-                    cfg.IgniteHome = arg.Substring(CmdIgniteHome.Length);
-                else if (argLow.StartsWith(CmdSpringCfgUrl))
-                    cfg.SpringConfigUrl = arg.Substring(CmdSpringCfgUrl.Length);
-                else if (argLow.StartsWith(CmdJvmDll))
-                    cfg.JvmDllPath = arg.Substring(CmdJvmDll.Length);
-                else if (argLow.StartsWith(CmdJvmClasspath))
-                    cfg.JvmClasspath = arg.Substring(CmdJvmClasspath.Length);
-                else if (argLow.StartsWith(CmdSuppressWarn))
-                {
-                    var val = arg.Substring(CmdSuppressWarn.Length);
-
-                    cfg.SuppressWarnings = bool.TrueString.ToLower().Equals(val.ToLower());
-                }
-                else if (argLow.StartsWith(CmdJvmMinMem))
-                    cfg.JvmInitialMemoryMb = ConfigValueParser.ParseInt(arg.Substring(CmdJvmMinMem.Length),
-                        CmdJvmMinMem);
-                else if (argLow.StartsWith(CmdJvmMaxMem))
-                    cfg.JvmMaxMemoryMb = ConfigValueParser.ParseInt(arg.Substring(CmdJvmMaxMem.Length),
-                        CmdJvmMaxMem);
-                else if (argLow.StartsWith(CmdJvmOpt))
-                    jvmOpts.Add(arg.Substring(CmdJvmOpt.Length));
-                else if (argLow.StartsWith(CmdAssembly))
-                    assemblies.Add(arg.Substring(CmdAssembly.Length));
-            }
-
-            if (jvmOpts.Count > 0)
-            {
-                if (cfg.JvmOptions == null)
-                    cfg.JvmOptions = jvmOpts;
-                else
-                    jvmOpts.ForEach(val => cfg.JvmOptions.Add(val));
-            }
-
-            if (assemblies.Count > 0)
-            {
-                if (cfg.Assemblies == null)
-                    cfg.Assemblies = assemblies;
-                else
-                    assemblies.ForEach(val => cfg.Assemblies.Add(val));
-            }
+            return args
+                .Select(x => x.TrimStart('-'))
+                .Select(x => x.StartsWith(Configurator.CmdJvmOpt + "-")
+                    ? new[] {Configurator.CmdJvmOpt, x.Substring(Configurator.CmdJvmOpt.Length)}
+                    : x.Split('='))
+                .Where(x => x.Length == 2)
+                .Select(x => Tuple.Create(x[0], x[1]));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs b/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs
new file mode 100644
index 0000000..af009e8
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Config
+{
+    using System;
+    using System.Collections.Generic;
+    using System.Configuration;
+    using System.IO;
+    using System.Linq;
+    using Apache.Ignite.Core;
+
+    /// <summary>
+    /// Configurator which uses arguments array.
+    /// </summary>
+    internal static class Configurator
+    {
+        /** Command line argument: Ignite home. */
+        public const string CmdIgniteHome = "IgniteHome";
+
+        /** Command line argument: Spring config URL. */
+        private const string CmdSpringCfgUrl = "SpringConfigUrl";
+
+        /** Command line argument: Path to JVM dll. */
+        private const string CmdJvmDll = "JvmDll";
+
+        /** Command line argument: JVM classpath. */
+        private const string CmdJvmClasspath = "JvmClasspath";
+
+        /** Command line argument: suppress warnings flag. */
+        private const string CmdSuppressWarn = "SuppressWarnings";
+
+        /** Command line argument: JVM option prefix. */
+        public const string CmdJvmOpt = "J";
+
+        /** Command line argument: assembly. */
+        public const string CmdAssembly = "Assembly";
+
+        /** Command line argument: JvmInitialMemoryMB. */
+        private const string CmdJvmMinMem = "JvmInitialMemoryMB";
+
+        /** Command line argument: JvmMaxMemoryMB. */
+        private const string CmdJvmMaxMem = "JvmMaxMemoryMB";
+
+        /** Command line argument: Config section name to read config from. */
+        private const string CmdConfigSection = "ConfigSectionName";
+
+        /** Command line argument: Config file name to read config section from. */
+        private const string CmdConfigFile = "ConfigFileName";
+
+        /** <inheritDoc /> */
+        public static IgniteConfiguration GetConfiguration(Tuple<string, string>[] args)
+        {
+            var jvmOpts = new List<string>();
+            var assemblies = new List<string>();
+
+            var cfg = ReadConfigurationSection(args) ?? new IgniteConfiguration();
+
+            foreach (var arg in args)
+            {
+                Func<string, bool> argIs = x => arg.Item1.Equals(x, StringComparison.OrdinalIgnoreCase);
+
+                if (argIs(CmdIgniteHome))
+                    cfg.IgniteHome = arg.Item2;
+                else if (argIs(CmdSpringCfgUrl))
+                    cfg.SpringConfigUrl = arg.Item2;
+                else if (argIs(CmdJvmDll))
+                    cfg.JvmDllPath = arg.Item2;
+                else if (argIs(CmdJvmClasspath))
+                    cfg.JvmClasspath = arg.Item2;
+                else if (argIs(CmdSuppressWarn))
+                {
+                    cfg.SuppressWarnings = bool.TrueString.Equals(arg.Item2, StringComparison.OrdinalIgnoreCase);
+                }
+                else if (argIs(CmdJvmMinMem))
+                    cfg.JvmInitialMemoryMb = ConfigValueParser.ParseInt(arg.Item2, CmdJvmMinMem);
+                else if (argIs(CmdJvmMaxMem))
+                    cfg.JvmMaxMemoryMb = ConfigValueParser.ParseInt(arg.Item2, CmdJvmMaxMem);
+                else if (argIs(CmdJvmOpt))
+                    jvmOpts.Add(arg.Item2);
+                else if (argIs(CmdAssembly))
+                    assemblies.Add(arg.Item2);
+            }
+
+            if (jvmOpts.Count > 0)
+            {
+                if (cfg.JvmOptions == null)
+                    cfg.JvmOptions = jvmOpts;
+                else
+                    jvmOpts.ForEach(val => cfg.JvmOptions.Add(val));
+            }
+
+            if (assemblies.Count > 0)
+            {
+                if (cfg.Assemblies == null)
+                    cfg.Assemblies = assemblies;
+                else
+                    assemblies.ForEach(val => cfg.Assemblies.Add(val));
+            }
+
+            return cfg;
+        }
+
+        /// <summary>
+        /// Reads the configuration section.
+        /// </summary>
+        private static IgniteConfiguration ReadConfigurationSection(Tuple<string, string>[] args)
+        {
+            var fileName = FindValue(args, CmdConfigFile);
+            var sectionName = FindValue(args, CmdConfigSection);
+
+            if (string.IsNullOrEmpty(fileName) && string.IsNullOrEmpty(sectionName))
+                return null;
+
+            var cfg = string.IsNullOrEmpty(fileName)
+                ? ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
+                : ConfigurationManager.OpenMappedExeConfiguration(GetConfigMap(fileName), ConfigurationUserLevel.None);
+
+            var section = string.IsNullOrEmpty(sectionName)
+                ? cfg.Sections.OfType<IgniteConfigurationSection>().FirstOrDefault()
+                : (IgniteConfigurationSection) cfg.GetSection(sectionName);
+
+            if (section == null)
+                throw new ConfigurationErrorsException(
+                    string.Format("Could not find {0} in current application configuration",
+                        typeof(IgniteConfigurationSection).Name));
+
+            return section.IgniteConfiguration;
+        }
+
+        /// <summary>
+        /// Gets the configuration file map.
+        /// </summary>
+        private static ExeConfigurationFileMap GetConfigMap(string fileName)
+        {
+            fileName = Path.GetFullPath(fileName);
+
+            if (!File.Exists(fileName))
+                throw new InvalidOperationException("Specified config file does not exist: " + fileName);
+
+            return new ExeConfigurationFileMap {ExeConfigFilename = fileName};
+        }
+
+        /// <summary>
+        /// Finds the config value.
+        /// </summary>
+        private static string FindValue(IEnumerable<Tuple<string, string>> args, string name)
+        {
+            return args.Where(x => name.Equals(x.Item1, StringComparison.OrdinalIgnoreCase))
+                    .Select(x => x.Item2)
+                    .FirstOrDefault();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite/Config/IConfigurator.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/Config/IConfigurator.cs b/modules/platforms/dotnet/Apache.Ignite/Config/IConfigurator.cs
deleted file mode 100644
index f5c0acf..0000000
--- a/modules/platforms/dotnet/Apache.Ignite/Config/IConfigurator.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Config
-{
-    using Apache.Ignite.Core;
-
-    /// <summary>
-    /// Configurator which is capable of setting configuration properties taken from somewhere.
-    /// </summary>
-    internal interface IConfigurator<in T>
-    {
-        /// <summary>
-        /// Set configuration.
-        /// </summary>
-        /// <param name="cfg">Configuration.</param>
-        /// <param name="src">Source.</param>
-        void Configure(IgniteConfiguration cfg, T src);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite/IgniteRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/IgniteRunner.cs b/modules/platforms/dotnet/Apache.Ignite/IgniteRunner.cs
index 122994f..68a8445 100644
--- a/modules/platforms/dotnet/Apache.Ignite/IgniteRunner.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/IgniteRunner.cs
@@ -49,8 +49,6 @@ namespace Apache.Ignite
         /// </summary>
         internal static void Main(string[] args)
         {
-            IgniteConfiguration cfg;
-
             bool svc = false;
             bool install = false;
 
@@ -59,7 +57,7 @@ namespace Apache.Ignite
                 // Check for special cases.
                 if (args.Length > 0)
                 {
-                    string first = args[0].ToLower();
+                    string first = args[0].ToLowerInvariant();
 
                     if (Help.Contains(first))
                     {
@@ -91,19 +89,15 @@ namespace Apache.Ignite
 
                 if (!svc)
                 {
-                    // Pick application configuration.
-                    cfg = new IgniteConfiguration();
-
-                    new AppSettingsConfigurator().Configure(cfg, ConfigurationManager.AppSettings);
-
-                    // Pick command line arguments.
-                    new ArgsConfigurator().Configure(cfg, args);
+                    // Pick application configuration first, command line arguments second.
+                    var allArgs = AppSettingsConfigurator.GetArgs(ConfigurationManager.AppSettings)
+                        .Concat(ArgsConfigurator.GetArgs(args)).ToArray();
 
                     if (install)
-                        IgniteService.DoInstall(cfg);
+                        IgniteService.DoInstall(allArgs);
                     else
                     {
-                        Ignition.Start(cfg);
+                        Ignition.Start(Configurator.GetConfiguration(allArgs));
 
                         IgniteManager.DestroyJvm();
                     }
@@ -113,16 +107,14 @@ namespace Apache.Ignite
             }
             catch (Exception e)
             {
-                Console.WriteLine("ERROR: " + e.Message);
+                Console.WriteLine("ERROR: " + e);
 
                 Environment.Exit(-1);
             }
 
             // If we are here, then this is a service call.
-            cfg = new IgniteConfiguration();
-
             // Use only arguments, not app.config.
-            new ArgsConfigurator().Configure(cfg, args);
+            var cfg = Configurator.GetConfiguration(ArgsConfigurator.GetArgs(args).ToArray());
 
             ServiceBase.Run(new IgniteService(cfg));
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ba037a/modules/platforms/dotnet/Apache.Ignite/Service/IgniteService.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/Service/IgniteService.cs b/modules/platforms/dotnet/Apache.Ignite/Service/IgniteService.cs
index 49cce44..c64c7bf 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Service/IgniteService.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Service/IgniteService.cs
@@ -25,7 +25,6 @@ namespace Apache.Ignite.Service
     using System.Runtime.InteropServices;
     using System.ServiceProcess;
     using System.Text;
-    using Apache.Ignite.Config;
     using Apache.Ignite.Core;
     using Apache.Ignite.Core.Common;
 
@@ -35,21 +34,21 @@ namespace Apache.Ignite.Service
     internal class IgniteService : ServiceBase
     {
         /** Service name. */
-        internal static readonly string SvcName = "Apache Ignite.NET";
+        private static readonly string SvcName = "Apache Ignite.NET";
 
         /** Service display name. */
-        internal static readonly string SvcDisplayName = "Apache Ignite.NET " + 
+        private static readonly string SvcDisplayName = "Apache Ignite.NET " + 
             Assembly.GetExecutingAssembly().GetName().Version.ToString(4);
 
         /** Service description. */
-        internal static readonly string SvcDesc = "Apache Ignite.NET Service.";
+        private static readonly string SvcDesc = "Apache Ignite.NET Service.";
 
         /** Current executable name. */
-        internal static readonly string ExeName =
+        private static readonly string ExeName =
             new FileInfo(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath).FullName;
 
         /** Current executable fully qualified name. */
-        internal static readonly string FullExeName = Path.GetFileName(FullExeName);
+        private static readonly string FullExeName = Path.GetFileName(FullExeName);
 
         /** Ignite configuration to start with. */
         private readonly IgniteConfiguration _cfg;
@@ -81,8 +80,8 @@ namespace Apache.Ignite.Service
         /// <summary>
         /// Install service programmatically.
         /// </summary>
-        /// <param name="cfg">Ignite configuration.</param>
-        internal static void DoInstall(IgniteConfiguration cfg)
+        /// <param name="args">The arguments.</param>
+        internal static void DoInstall(Tuple<string, string>[] args)
         {
             // 1. Check if already defined.
             if (ServiceController.GetServices().Any(svc => SvcName.Equals(svc.ServiceName)))
@@ -92,8 +91,6 @@ namespace Apache.Ignite.Service
             }
 
             // 2. Create startup arguments.
-            var args = ArgsConfigurator.ToArgs(cfg);
-
             if (args.Length > 0)
             {
                 Console.WriteLine("Installing \"" + SvcName + "\" service with the following startup " +
@@ -140,13 +137,13 @@ namespace Apache.Ignite.Service
         /// Native service installation.
         /// </summary>
         /// <param name="args">Arguments.</param>
-        private static void Install0(string[] args)
+        private static void Install0(Tuple<string, string>[] args)
         {
             // 1. Prepare arguments.
             var binPath = new StringBuilder(FullExeName).Append(" ").Append(IgniteRunner.Svc);
 
             foreach (var arg in args)
-                binPath.Append(" ").Append(arg);
+                binPath.Append(" ").AppendFormat("-{0}={1}", arg.Item1, arg.Item2);
 
             // 2. Get SC manager.
             var scMgr = OpenServiceControlManager();


Mime
View raw message