You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by ju...@apache.org on 2015/04/07 23:40:19 UTC

[1/2] incubator-reef git commit: [REEF-228] and [REEF-225]: A Client API and Local implementation

Repository: incubator-reef
Updated Branches:
  refs/heads/master 85bf1da4d -> 561e7a0ad


http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloDriver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloDriver.cs b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloDriver.cs
new file mode 100644
index 0000000..8da1cad
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloDriver.cs
@@ -0,0 +1,120 @@
+/**
+ * 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.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Org.Apache.REEF.Common.Files;
+using Org.Apache.REEF.Driver;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Driver.Evaluator;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+
+namespace Org.Apache.REEF.Examples.HelloREEF
+{
+    /// <summary>
+    /// The Driver for HelloREEF: It requests a single Evaluator and then submits the HelloTask to it.
+    /// </summary>
+    public sealed class HelloDriver : IObserver<IAllocatedEvaluator>, IObserver<IEvaluatorRequestor>, IStartHandler
+    {
+        /// <summary>
+        /// Contexts contain configuration data used beyond a single task.
+        /// </summary>
+        private static readonly IConfiguration ContextConfiguration =
+            Driver.Context.ContextConfiguration.ConfigurationModule
+                .Set(Driver.Context.ContextConfiguration.Identifier, "HelloContext")
+                .Build();
+
+        /// <summary>
+        /// The TaskConfiguration contains the type of Task to run as well as the identifier of that task
+        /// </summary>
+        private static readonly IConfiguration TaskConfiguration = Common.Tasks.TaskConfiguration.ConfigurationModule
+            .Set(Common.Tasks.TaskConfiguration.Identifier, "HelloTask")
+            .Set(Common.Tasks.TaskConfiguration.Task, GenericType<HelloTask>.Class)
+            .Build();
+
+        private readonly REEFFileNames _fileNames;
+
+        [Inject]
+        private HelloDriver(REEFFileNames fileNames)
+        {
+            _fileNames = fileNames;
+            ClrHandlerHelper.GenerateClassHierarchy(GetGlobalAssemblies());
+        }
+
+        /// <summary>
+        /// Submits the HelloTask to the Evaluator.
+        /// </summary>
+        /// <param name="allocatedEvaluator"></param>
+        public void OnNext(IAllocatedEvaluator allocatedEvaluator)
+        {
+            allocatedEvaluator.SubmitContextAndTask(ContextConfiguration, TaskConfiguration);
+        }
+
+        public void OnError(Exception error)
+        {
+            throw error;
+        }
+
+        public void OnCompleted()
+        {
+        }
+
+        /// <summary>
+        /// Ask for one Evaluator with 64MB of memory.
+        /// </summary>
+        /// <param name="evaluatorRequestor"></param>
+        public void OnNext(IEvaluatorRequestor evaluatorRequestor)
+        {
+            evaluatorRequestor.Submit(new EvaluatorRequest(number:1, megaBytes:64));
+        }
+
+        public string Identifier { get; set; }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>All DLLs in the global folder</returns>
+        private ISet<string> GetGlobalAssemblies()
+        {
+            return new HashSet<string>(Directory.GetFiles(_fileNames.GetGlobalFolderPath())
+                .Where(e => !(string.IsNullOrWhiteSpace(e)))
+                .Select(Path.GetFullPath)
+                .Where(File.Exists)
+                .Where(IsBinary)
+                .Select(Path.GetFileNameWithoutExtension));
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns>True, if the path refers to an EXE or DLL</returns>
+        private static Boolean IsBinary(string path)
+        {
+            if (string.IsNullOrWhiteSpace(path))
+            {
+                return false;
+            }
+            var extension = Path.GetExtension(path).ToLower();
+            return extension.EndsWith("dll") || extension.EndsWith("exe");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloREEF.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloREEF.cs b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloREEF.cs
new file mode 100644
index 0000000..5962d38
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloREEF.cs
@@ -0,0 +1,87 @@
+/**
+ * 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.
+ */
+
+using System;
+using Org.Apache.REEF.Client.API;
+using Org.Apache.REEF.Client.Local;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+
+namespace Org.Apache.REEF.Examples.HelloREEF
+{
+    /// <summary>
+    /// A Tool that submits HelloREEFDriver for execution.
+    /// </summary>
+    public sealed class HelloREEF
+    {
+        private const string Local = "local";
+        private readonly IREEFClient _reefClient;
+
+        [Inject]
+        private HelloREEF(IREEFClient reefClient)
+        {
+            _reefClient = reefClient;
+        }
+
+        /// <summary>
+        /// Runs HelloREEF using the IREEFClient passed into the constructor.
+        /// </summary>
+        private void Run()
+        {
+            // The driver configuration contains all the needed bindings.
+            var helloDriverConfiguration = DriverBridgeConfiguration.ConfigurationModule
+                .Set(DriverBridgeConfiguration.OnEvaluatorRequested, GenericType<HelloDriver>.Class)
+                .Set(DriverBridgeConfiguration.OnEvaluatorAllocated, GenericType<HelloDriver>.Class)
+                .Set(DriverBridgeConfiguration.OnDriverStarted, GenericType<HelloDriver>.Class)
+                .Build();
+            // The JobSubmission contains the Driver configuration as well as the files needed on the Driver.
+            var helloJobSubmission = new JobSubmission()
+                .AddDriverConfiguration(helloDriverConfiguration)
+                .AddGlobalAssemblyForType(typeof(HelloDriver))
+                .SetJobIdentifier("HelloREEF");
+
+            _reefClient.Submit(helloJobSubmission);
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns></returns>
+        private static IConfiguration GetRuntimeConfiguration(string name)
+        {
+            switch (name)
+            {
+                case Local:
+                    return LocalRuntimeClientConfiguration.ConfigurationModule
+                        .Set(LocalRuntimeClientConfiguration.NumberOfEvaluators, "2")
+                        .Build();
+                default:
+                    throw new Exception("Unknown runtime: " + name);
+            }
+        }
+
+        public static void Main(string[] args)
+        {
+            TangFactory.GetTang().NewInjector(GetRuntimeConfiguration(args[0])).GetInstance<HelloREEF>().Run();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloTask.cs b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloTask.cs
new file mode 100644
index 0000000..bd8d9ac
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloTask.cs
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+using System;
+using Org.Apache.REEF.Common.Tasks;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Examples.HelloREEF
+{
+    /// <summary>
+    /// A Task that merely prints a greeting and exits.
+    /// </summary>
+    public sealed class HelloTask : ITask
+    {
+        [Inject]
+        private HelloTask()
+        {
+        }
+
+        public void Dispose()
+        {
+            Console.WriteLine("Disposed.");
+        }
+
+        public byte[] Call(byte[] memento)
+        {
+            Console.WriteLine("Hello, REEF!");
+            return null;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Org.Apache.REEF.Examples.HelloREEF.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Org.Apache.REEF.Examples.HelloREEF.csproj b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Org.Apache.REEF.Examples.HelloREEF.csproj
new file mode 100644
index 0000000..46330a9
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Org.Apache.REEF.Examples.HelloREEF.csproj
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <ProjectGuid>{0FF8CEE9-B0B6-4A14-9A52-44441BE048FE}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Org.Apache.REEF.Examples.HelloREEF</RootNamespace>
+    <AssemblyName>Org.Apache.REEF.Examples.HelloREEF</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <Import Project="$(SolutionDir)\build.props" />
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="HelloDriver.cs" />
+    <Compile Include="HelloREEF.cs" />
+    <Compile Include="HelloTask.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="Readme.md" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Bridge\Org.Apache.REEF.Bridge.vcxproj">
+      <Project>{4e69d40a-26d6-4d4a-b96d-729946c07fe1}</Project>
+      <Name>Org.Apache.REEF.Bridge</Name>
+    </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Client\Org.Apache.REEF.Client.csproj">
+      <Project>{5094c35b-4fdb-4322-ac05-45d684501cbf}</Project>
+      <Name>Org.Apache.REEF.Client</Name>
+    </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
+      <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
+      <Name>Org.Apache.REEF.Common</Name>
+    </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
+      <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
+      <Name>Org.Apache.REEF.Driver</Name>
+    </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Evaluator\Org.Apache.REEF.Evaluator.csproj">
+      <Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project>
+      <Name>Org.Apache.REEF.Evaluator</Name>
+    </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj">
+      <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
+      <Name>Org.Apache.REEF.Tang</Name>
+    </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj">
+      <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
+      <Name>Org.Apache.REEF.Utilities</Name>
+    </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj">
+      <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
+      <Name>Org.Apache.REEF.Wake</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!--begin jar reference-->
+  <PropertyGroup>
+    <AfterBuildDependsOn>
+      $(AfterBuildDependsOn);
+      CopyJarFiles;
+    </AfterBuildDependsOn>
+  </PropertyGroup>
+  <Target Name="AfterBuild" DependsOnTargets="$(AfterBuildDependsOn);" />
+  <!--end jar reference-->
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7f8fb7c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Properties/AssemblyInfo.cs
@@ -0,0 +1,54 @@
+/**
+ * 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.
+ */
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Org.Apache.REEF.Examples.HelloREEF")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Org.Apache.REEF.Examples.HelloREEF")]
+[assembly: AssemblyCopyright("Copyright ©  2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("1aaf7ad7-445c-49f3-b519-f77cd8cd58d7")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md
new file mode 100644
index 0000000..0ea427e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md
@@ -0,0 +1,9 @@
+# HelloREEF
+This project contains a simple example of a REEF Program. It contains the following classes:
+
+  * `HelloREEF`: This is the program that submits the driver to the local runtime.
+  * `HelloDriver`: The Driver requests a single Evaluator and submits the `HelloTask` to it.
+  * `HelloTask`: This Task prints a greeting to STDOUT of the Evaluator.
+
+## Running it
+Just run the main class, `HelloREEF`, followed by the runtime you want, e.g. `local`.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs
index 3ef579b..03e7e1f 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs
+++ b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs
@@ -85,7 +85,7 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
                 CreateNoWindow = false
             }; 
             
-            LOGGER.Log(Level.Info, "executing\r\n" + startInfo.FileName + "\r\n" + startInfo.Arguments);
+            LOGGER.Log(Level.Info, "Executing '" + startInfo.FileName + " " + startInfo.Arguments +"' in working directory '" + Directory.GetCurrentDirectory() +"'");
             using (Process process = Process.Start(startInfo))
             {
                 process.WaitForExit();

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Tests/app.config
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/app.config b/lang/cs/Org.Apache.REEF.Tests/app.config
new file mode 100644
index 0000000..226a6a8
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Tests/app.config
@@ -0,0 +1,29 @@
+<!--
+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.
+-->
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.sln
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.sln b/lang/cs/Org.Apache.REEF.sln
index cfaace9..e0f89e9 100644
Binary files a/lang/cs/Org.Apache.REEF.sln and b/lang/cs/Org.Apache.REEF.sln differ

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/java/reef-bridge-client/pom.xml
----------------------------------------------------------------------
diff --git a/lang/java/reef-bridge-client/pom.xml b/lang/java/reef-bridge-client/pom.xml
new file mode 100644
index 0000000..7864953
--- /dev/null
+++ b/lang/java/reef-bridge-client/pom.xml
@@ -0,0 +1,136 @@
+<?xml version="1.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.
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>reef-bridge-client</artifactId>
+    <name>REEF Bridge (Client)</name>
+    <description>The Client side of the REEF Bridge</description>
+
+    <parent>
+        <groupId>org.apache.reef</groupId>
+        <artifactId>reef-project</artifactId>
+        <version>0.11.0-incubating-SNAPSHOT</version>
+        <relativePath>../../..</relativePath>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>reef-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>reef-runtime-local</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>reef-runtime-yarn</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>reef-runtime-hdinsight</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>reef-io</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>reef-checkpoint</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>reef-webserver</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.reef</groupId>
+            <artifactId>reef-bridge-java</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.avro</groupId>
+            <artifactId>avro</artifactId>
+        </dependency>
+
+        <!-- Adding Hadoop to make sure we have it in the shaded jar -->
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-yarn-api</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-yarn-client</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-yarn-common</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <outputFile>
+                        ${project.build.directory}/${project.artifactId}-${project.version}-shaded.jar
+                    </outputFile>
+                    <filters>
+                        <filter>
+                            <artifact>*:*</artifact>
+                            <excludes>
+                                <exclude>yarn-default.xml</exclude>
+                                <exclude>yarn-version-info.properties</exclude>
+                                <exclude>core-default.xml</exclude>
+                                <exclude>LICENSE</exclude>
+                                <exclude>META-INF/*</exclude>
+                            </excludes>
+                        </filter>
+                    </filters>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/Constants.java
----------------------------------------------------------------------
diff --git a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/Constants.java b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/Constants.java
new file mode 100644
index 0000000..a931251
--- /dev/null
+++ b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/Constants.java
@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.reef.bridge.client;
+
+import org.apache.reef.client.DriverConfiguration;
+import org.apache.reef.client.DriverServiceConfiguration;
+import org.apache.reef.io.network.naming.NameServerConfiguration;
+import org.apache.reef.javabridge.generic.JobDriver;
+import org.apache.reef.tang.Configuration;
+import org.apache.reef.tang.Configurations;
+import org.apache.reef.webserver.HttpHandlerConfiguration;
+import org.apache.reef.webserver.HttpServerReefEventHandler;
+import org.apache.reef.webserver.ReefEventStateManager;
+
+/**
+ * Constant Configuration instances used by the bridge.
+ */
+public final class Constants {
+
+  /**
+   * Contains all bindings of event handlers to the bridge.
+   */
+  public static final Configuration DRIVER_CONFIGURATION = DriverConfiguration.CONF
+      .set(DriverConfiguration.ON_EVALUATOR_ALLOCATED, JobDriver.AllocatedEvaluatorHandler.class)
+      .set(DriverConfiguration.ON_EVALUATOR_FAILED, JobDriver.FailedEvaluatorHandler.class)
+      .set(DriverConfiguration.ON_CONTEXT_ACTIVE, JobDriver.ActiveContextHandler.class)
+      .set(DriverConfiguration.ON_DRIVER_RESTART_CONTEXT_ACTIVE, JobDriver.DriverRestartActiveContextHandler.class)
+      .set(DriverConfiguration.ON_CONTEXT_CLOSED, JobDriver.ClosedContextHandler.class)
+      .set(DriverConfiguration.ON_CONTEXT_FAILED, JobDriver.FailedContextHandler.class)
+      .set(DriverConfiguration.ON_CONTEXT_MESSAGE, JobDriver.ContextMessageHandler.class)
+      .set(DriverConfiguration.ON_TASK_MESSAGE, JobDriver.TaskMessageHandler.class)
+      .set(DriverConfiguration.ON_TASK_FAILED, JobDriver.FailedTaskHandler.class)
+      .set(DriverConfiguration.ON_TASK_RUNNING, JobDriver.RunningTaskHandler.class)
+      .set(DriverConfiguration.ON_DRIVER_RESTART_TASK_RUNNING, JobDriver.DriverRestartRunningTaskHandler.class)
+      .set(DriverConfiguration.ON_DRIVER_RESTART_COMPLETED, JobDriver.DriverRestartCompletedHandler.class)
+      .set(DriverConfiguration.ON_TASK_COMPLETED, JobDriver.CompletedTaskHandler.class)
+      .set(DriverConfiguration.ON_DRIVER_STARTED, JobDriver.StartHandler.class)
+      .set(DriverConfiguration.ON_DRIVER_RESTARTED, JobDriver.RestartHandler.class)
+      .set(DriverConfiguration.ON_TASK_SUSPENDED, JobDriver.SuspendedTaskHandler.class)
+      .set(DriverConfiguration.ON_EVALUATOR_COMPLETED, JobDriver.CompletedEvaluatorHandler.class)
+      .build();
+
+  /**
+   * The HTTP Server configuration assumed by the bridge.
+   */
+  public static final Configuration HTTP_SERVER_CONFIGURATION = Configurations.merge(
+      HttpHandlerConfiguration.CONF
+          .set(HttpHandlerConfiguration.HTTP_HANDLERS, HttpServerReefEventHandler.class)
+          .build(),
+      DriverServiceConfiguration.CONF
+          .set(DriverServiceConfiguration.ON_EVALUATOR_ALLOCATED, ReefEventStateManager.AllocatedEvaluatorStateHandler.class)
+          .set(DriverServiceConfiguration.ON_CONTEXT_ACTIVE, ReefEventStateManager.ActiveContextStateHandler.class)
+          .set(DriverServiceConfiguration.ON_DRIVER_RESTART_CONTEXT_ACTIVE, ReefEventStateManager.DrivrRestartActiveContextStateHandler.class)
+          .set(DriverServiceConfiguration.ON_TASK_RUNNING, ReefEventStateManager.TaskRunningStateHandler.class)
+          .set(DriverServiceConfiguration.ON_DRIVER_RESTART_TASK_RUNNING, ReefEventStateManager.DriverRestartTaskRunningStateHandler.class)
+          .set(DriverServiceConfiguration.ON_DRIVER_STARTED, ReefEventStateManager.StartStateHandler.class)
+          .set(DriverServiceConfiguration.ON_DRIVER_STOP, ReefEventStateManager.StopStateHandler.class)
+          .build()
+  );
+
+  /**
+   * The name server configuration assumed by the bridge.
+   */
+  public static final Configuration NAME_SERVER_CONFIGURATION = NameServerConfiguration.CONF
+      .set(NameServerConfiguration.NAME_SERVICE_PORT, 0)
+      .build();
+
+  /**
+   * The driver configuration assumed by the the bridge.
+   */
+  public static final Configuration DRIVER_CONFIGURATION_WITH_HTTP_AND_NAMESERVER = Configurations.merge(
+      DRIVER_CONFIGURATION,
+      HTTP_SERVER_CONFIGURATION,
+      NAME_SERVER_CONFIGURATION
+  );
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/LocalClient.java
----------------------------------------------------------------------
diff --git a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/LocalClient.java b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/LocalClient.java
new file mode 100644
index 0000000..e8d4fdf
--- /dev/null
+++ b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/LocalClient.java
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.reef.bridge.client;
+
+import org.apache.reef.runtime.common.driver.api.AbstractDriverRuntimeConfiguration;
+import org.apache.reef.runtime.common.files.REEFFileNames;
+import org.apache.reef.runtime.local.client.DriverConfigurationProvider;
+import org.apache.reef.runtime.local.client.LocalRuntimeConfiguration;
+import org.apache.reef.runtime.local.client.PreparedDriverFolderLauncher;
+import org.apache.reef.tang.Configuration;
+import org.apache.reef.tang.Tang;
+import org.apache.reef.tang.exceptions.InjectionException;
+import org.apache.reef.tang.formats.AvroConfigurationSerializer;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Submits a folder containing a Driver to the local runtime.
+ */
+public class LocalClient {
+
+  private static final String CLIENT_REMOTE_ID = AbstractDriverRuntimeConfiguration.ClientRemoteIdentifier.NONE;
+  private final AvroConfigurationSerializer configurationSerializer;
+  private final PreparedDriverFolderLauncher launcher;
+  private final REEFFileNames fileNames;
+  private final DriverConfigurationProvider driverConfigurationProvider;
+
+  @Inject
+  public LocalClient(final AvroConfigurationSerializer configurationSerializer,
+                     final PreparedDriverFolderLauncher launcher,
+                     final REEFFileNames fileNames,
+                     final DriverConfigurationProvider driverConfigurationProvider) {
+    this.configurationSerializer = configurationSerializer;
+    this.launcher = launcher;
+    this.fileNames = fileNames;
+    this.driverConfigurationProvider = driverConfigurationProvider;
+  }
+
+  public void submit(final File jobFolder, final String jobId) throws IOException {
+    if (!jobFolder.exists()) {
+      throw new IOException("The Job folder" + jobFolder.getAbsolutePath() + "doesn't exist.");
+    }
+
+    final File driverFolder = new File(jobFolder, PreparedDriverFolderLauncher.DRIVER_FOLDER_NAME);
+    if (!driverFolder.exists()) {
+      throw new IOException("The Driver folder " + driverFolder.getAbsolutePath() + " doesn't exist.");
+    }
+
+    final Configuration driverConfiguration = driverConfigurationProvider
+        .getDriverConfiguration(jobFolder, CLIENT_REMOTE_ID, jobId, Constants.DRIVER_CONFIGURATION_WITH_HTTP_AND_NAMESERVER);
+    final File driverConfigurationFile = new File(driverFolder, fileNames.getDriverConfigurationPath());
+    configurationSerializer.toFile(driverConfiguration, driverConfigurationFile);
+    launcher.launch(driverFolder, jobId, CLIENT_REMOTE_ID);
+  }
+
+
+  public static void main(final String[] args) throws InjectionException, IOException {
+    // TODO: Make the parameters of the local runtime command line arguments of this tool.
+
+    // We assume the given path to be the one of the driver. The job folder is one level up from there.
+    final File jobFolder = new File(args[0]).getParentFile();
+    // The job identifier
+    final String jobId = args[1];
+    // The number of evaluators the local runtime can create
+    final int numberOfEvaluators = Integer.valueOf(args[2]);
+
+    final Configuration runtimeConfiguration = LocalRuntimeConfiguration.CONF
+        .set(LocalRuntimeConfiguration.MAX_NUMBER_OF_EVALUATORS, numberOfEvaluators)
+        .set(LocalRuntimeConfiguration.RUNTIME_ROOT_FOLDER, jobFolder.getParentFile().getAbsolutePath())
+        .build();
+
+    final LocalClient client = Tang.Factory.getTang()
+        .newInjector(runtimeConfiguration)
+        .getInstance(LocalClient.class);
+
+    client.submit(jobFolder, jobId);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/package-info.java
----------------------------------------------------------------------
diff --git a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/package-info.java b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/package-info.java
new file mode 100644
index 0000000..e64ad71
--- /dev/null
+++ b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+/**
+ * Contains the client of the bridge.
+ */
+package org.apache.reef.bridge.client;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java
----------------------------------------------------------------------
diff --git a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java b/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java
index 228743b..f7adb53 100644
--- a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java
+++ b/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java
@@ -268,7 +268,7 @@ public final class JobDriver {
   /**
    * Handles AllocatedEvaluator: Submit an empty context
    */
-  final class AllocatedEvaluatorHandler implements EventHandler<AllocatedEvaluator> {
+  public final class AllocatedEvaluatorHandler implements EventHandler<AllocatedEvaluator> {
     @Override
     public void onNext(final AllocatedEvaluator allocatedEvaluator) {
       try (final LoggingScope ls = loggingScopeFactory.evaluatorAllocated(allocatedEvaluator.getId())) {
@@ -283,7 +283,7 @@ public final class JobDriver {
   /**
    * Receive notification that a new Context is available.
    */
-  final class ActiveContextHandler implements EventHandler<ActiveContext> {
+  public final class ActiveContextHandler implements EventHandler<ActiveContext> {
     @Override
     public void onNext(final ActiveContext context) {
       try (final LoggingScope ls = loggingScopeFactory.activeContextReceived(context.getId())) {
@@ -300,7 +300,7 @@ public final class JobDriver {
   /**
    * Receive notification that the Task has completed successfully.
    */
-  final class CompletedTaskHandler implements EventHandler<CompletedTask> {
+  public final class CompletedTaskHandler implements EventHandler<CompletedTask> {
     @Override
     public void onNext(final CompletedTask task) {
       LOG.log(Level.INFO, "Completed task: {0}", task.getId());
@@ -328,7 +328,7 @@ public final class JobDriver {
   /**
    * Receive notification that the entire Evaluator had failed.
    */
-  final class FailedEvaluatorHandler implements EventHandler<FailedEvaluator> {
+  public final class FailedEvaluatorHandler implements EventHandler<FailedEvaluator> {
     @Override
     public void onNext(final FailedEvaluator eval) {
       try (final LoggingScope ls = loggingScopeFactory.evaluatorFailed(eval.getId())) {
@@ -428,7 +428,7 @@ public final class JobDriver {
   /**
    * Handle failed task.
    */
-  final class FailedTaskHandler implements EventHandler<FailedTask> {
+  public final class FailedTaskHandler implements EventHandler<FailedTask> {
     @Override
     public void onNext(final FailedTask task) throws RuntimeException {
       LOG.log(Level.SEVERE, "FailedTask received, will be handle in CLR handler, if set.");
@@ -449,7 +449,7 @@ public final class JobDriver {
   /**
    * Receive notification that the Task is running.
    */
-  final class RunningTaskHandler implements EventHandler<RunningTask> {
+  public final class RunningTaskHandler implements EventHandler<RunningTask> {
     @Override
     public void onNext(final RunningTask task) {
       try (final LoggingScope ls = loggingScopeFactory.taskRunning(task.getId())) {
@@ -472,7 +472,7 @@ public final class JobDriver {
   /**
    * Receive notification that the Task is running when driver restarted.
    */
-  final class DriverRestartRunningTaskHandler implements EventHandler<RunningTask> {
+  public final class DriverRestartRunningTaskHandler implements EventHandler<RunningTask> {
     @Override
     public void onNext(final RunningTask task) {
       try (final LoggingScope ls = loggingScopeFactory.driverRestartRunningTask(task.getId())) {
@@ -499,7 +499,7 @@ public final class JobDriver {
   /**
    * Receive notification that an context is active on Evaluator when the driver restarted
    */
-  final class DriverRestartActiveContextHandler implements EventHandler<ActiveContext> {
+  public final class DriverRestartActiveContextHandler implements EventHandler<ActiveContext> {
     @Override
     public void onNext(final ActiveContext context) {
       try (final LoggingScope ls = loggingScopeFactory.driverRestartActiveContextReceived(context.getId())) {
@@ -528,7 +528,7 @@ public final class JobDriver {
   /**
    * Job Driver is ready and the clock is set up: request the evaluators.
    */
-  final class StartHandler implements EventHandler<StartTime> {
+  public final class StartHandler implements EventHandler<StartTime> {
     @Override
     public void onNext(final StartTime startTime) {
       try (final LoggingScope ls = loggingScopeFactory.driverStart(startTime)) {
@@ -554,7 +554,7 @@ public final class JobDriver {
   /**
    * Job driver is restarted after previous crash
    */
-  final class RestartHandler implements EventHandler<StartTime> {
+  public final class RestartHandler implements EventHandler<StartTime> {
     @Override
     public void onNext(final StartTime startTime) {
       try (final LoggingScope ls = loggingScopeFactory.driverRestart(startTime)) {
@@ -573,7 +573,7 @@ public final class JobDriver {
   /**
    * Receive notification that driver restart has completed.
    */
-  final class DriverRestartCompletedHandler implements EventHandler<DriverRestartCompleted> {
+  public final class DriverRestartCompletedHandler implements EventHandler<DriverRestartCompleted> {
     @Override
     public void onNext(final DriverRestartCompleted driverRestartCompleted) {
       LOG.log(Level.INFO, "Java DriverRestartCompleted event received at time [{0}]. ", driverRestartCompleted.getTimeStamp());
@@ -604,7 +604,7 @@ public final class JobDriver {
     }
   }
 
-  final class TaskMessageHandler implements EventHandler<TaskMessage> {
+  public final class TaskMessageHandler implements EventHandler<TaskMessage> {
     @Override
     public void onNext(final TaskMessage taskMessage) {
       String msg = new String(taskMessage.get());
@@ -622,7 +622,7 @@ public final class JobDriver {
   /**
    * Receive notification that the Task has been suspended.
    */
-  final class SuspendedTaskHandler implements EventHandler<SuspendedTask> {
+  public final class SuspendedTaskHandler implements EventHandler<SuspendedTask> {
     @Override
     public final void onNext(final SuspendedTask task) {
       final String message = "Received notification that task [" + task.getId() + "] has been suspended.";
@@ -642,7 +642,7 @@ public final class JobDriver {
   /**
    * Receive notification that the Evaluator has been shut down.
    */
-  final class CompletedEvaluatorHandler implements EventHandler<CompletedEvaluator> {
+  public final class CompletedEvaluatorHandler implements EventHandler<CompletedEvaluator> {
     @Override
     public void onNext(final CompletedEvaluator evaluator) {
       LOG.log(Level.INFO, " Completed Evaluator {0}", evaluator.getId());
@@ -662,7 +662,7 @@ public final class JobDriver {
    * Receive notification that the Context had completed.
    * Remove context from the list of active context.
    */
-  final class ClosedContextHandler implements EventHandler<ClosedContext> {
+  public final class ClosedContextHandler implements EventHandler<ClosedContext> {
     @Override
     public void onNext(final ClosedContext context) {
       LOG.log(Level.INFO, "Completed Context: {0}", context.getId());
@@ -685,7 +685,7 @@ public final class JobDriver {
    * Receive notification that the Context had failed.
    * Remove context from the list of active context and notify the client.
    */
-  final class FailedContextHandler implements EventHandler<FailedContext> {
+  public final class FailedContextHandler implements EventHandler<FailedContext> {
     @Override
     public void onNext(final FailedContext context) {
       LOG.log(Level.SEVERE, "FailedContext", context);
@@ -710,7 +710,7 @@ public final class JobDriver {
   /**
    * Receive notification that a ContextMessage has been received
    */
-  final class ContextMessageHandler implements EventHandler<ContextMessage> {
+  public final class ContextMessageHandler implements EventHandler<ContextMessage> {
     @Override
     public void onNext(final ContextMessage message) {
       LOG.log(Level.SEVERE, "Received ContextMessage:", message.get());

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/LocalJobSubmissionHandler.java
----------------------------------------------------------------------
diff --git a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/LocalJobSubmissionHandler.java b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/LocalJobSubmissionHandler.java
index 75fc86e..d417fce 100644
--- a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/LocalJobSubmissionHandler.java
+++ b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/LocalJobSubmissionHandler.java
@@ -18,7 +18,6 @@
  */
 package org.apache.reef.runtime.local.client;
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.reef.annotations.audience.ClientSide;
 import org.apache.reef.annotations.audience.Private;
 import org.apache.reef.proto.ClientRuntimeProtocol;
@@ -37,7 +36,6 @@ import org.apache.reef.util.logging.LoggingScopeFactory;
 
 import javax.inject.Inject;
 import java.io.File;
-import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -49,20 +47,14 @@ import java.util.logging.Logger;
 @ClientSide
 final class LocalJobSubmissionHandler implements JobSubmissionHandler {
 
-  /**
-   * The name of the folder for the driver within the Job folder.
-   */
-  public static final String DRIVER_FOLDER_NAME = "driver";
-  /**
-   * The (hard-coded) amount of memory to be used for the driver.
-   */
-  public static final int DRIVER_MEMORY = 512;
+
   private static final Logger LOG = Logger.getLogger(LocalJobSubmissionHandler.class.getName());
   private final ExecutorService executor;
   private final String rootFolderName;
   private final ConfigurationSerializer configurationSerializer;
   private final REEFFileNames fileNames;
   private final ClasspathProvider classpath;
+  private final PreparedDriverFolderLauncher driverLauncher;
   private final LoggingScopeFactory loggingScopeFactory;
   private final DriverConfigurationProvider driverConfigurationProvider;
 
@@ -73,6 +65,8 @@ final class LocalJobSubmissionHandler implements JobSubmissionHandler {
       final ConfigurationSerializer configurationSerializer,
       final REEFFileNames fileNames,
       final ClasspathProvider classpath,
+
+      final PreparedDriverFolderLauncher driverLauncher,
       final LoggingScopeFactory loggingScopeFactory,
       final DriverConfigurationProvider driverConfigurationProvider) {
 
@@ -80,6 +74,8 @@ final class LocalJobSubmissionHandler implements JobSubmissionHandler {
     this.configurationSerializer = configurationSerializer;
     this.fileNames = fileNames;
     this.classpath = classpath;
+
+    this.driverLauncher = driverLauncher;
     this.driverConfigurationProvider = driverConfigurationProvider;
     this.rootFolderName = new File(rootFolderName).getAbsolutePath();
     this.loggingScopeFactory = loggingScopeFactory;
@@ -101,7 +97,7 @@ final class LocalJobSubmissionHandler implements JobSubmissionHandler {
         final File jobFolder = new File(new File(rootFolderName),
             "/" + t.getIdentifier() + "-" + System.currentTimeMillis() + "/");
 
-        final File driverFolder = new File(jobFolder, DRIVER_FOLDER_NAME);
+        final File driverFolder = new File(jobFolder, PreparedDriverFolderLauncher.DRIVER_FOLDER_NAME);
         driverFolder.mkdirs();
 
         final DriverFiles driverFiles = DriverFiles.fromJobSubmission(t, this.fileNames);
@@ -113,28 +109,7 @@ final class LocalJobSubmissionHandler implements JobSubmissionHandler {
 
         this.configurationSerializer.toFile(driverConfiguration,
             new File(driverFolder, this.fileNames.getDriverConfigurationPath()));
-
-        final List<String> command = new JavaLaunchCommandBuilder()
-            .setErrorHandlerRID(t.getRemoteId())
-            .setLaunchID(t.getIdentifier())
-            .setConfigurationFileName(this.fileNames.getDriverConfigurationPath())
-            .setClassPath(this.classpath.getDriverClasspath())
-            .setMemory(DRIVER_MEMORY)
-            .build();
-
-        if (LOG.isLoggable(Level.FINEST)) {
-          LOG.log(Level.FINEST, "REEF app command: {0}", StringUtils.join(command, ' '));
-        }
-
-        final RunnableProcess process = new RunnableProcess(command,
-            "driver",
-            driverFolder,
-            new LoggingRunnableProcessObserver(),
-            this.fileNames.getDriverStdoutFileName(),
-            this.fileNames.getDriverStderrFileName());
-        this.executor.submit(process);
-        this.executor.shutdown();
-
+        this.driverLauncher.launch(driverFolder, t.getIdentifier(), t.getRemoteId());
       } catch (final Exception e) {
         LOG.log(Level.SEVERE, "Unable to setup driver.", e);
         throw new RuntimeException("Unable to setup driver.", e);

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/PreparedDriverFolderLauncher.java
----------------------------------------------------------------------
diff --git a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/PreparedDriverFolderLauncher.java b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/PreparedDriverFolderLauncher.java
new file mode 100644
index 0000000..602c04d
--- /dev/null
+++ b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/PreparedDriverFolderLauncher.java
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.reef.runtime.local.client;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.reef.runtime.common.files.ClasspathProvider;
+import org.apache.reef.runtime.common.files.REEFFileNames;
+import org.apache.reef.runtime.common.launch.JavaLaunchCommandBuilder;
+import org.apache.reef.runtime.local.process.LoggingRunnableProcessObserver;
+import org.apache.reef.runtime.local.process.RunnableProcess;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Launcher for a already prepared driver folder.
+ */
+public class PreparedDriverFolderLauncher {
+
+  /**
+   * The name of the folder for the driver within the Job folder.
+   */
+  public static final String DRIVER_FOLDER_NAME = "driver";
+
+  private final ExecutorService executor;
+  private final REEFFileNames fileNames;
+  private final ClasspathProvider classpath;
+  /**
+   * The (hard-coded) amount of memory to be used for the driver.
+   */
+  public static final int DRIVER_MEMORY = 512;
+
+  private static final Logger LOG = Logger.getLogger(PreparedDriverFolderLauncher.class.getName());
+
+  @Inject
+  PreparedDriverFolderLauncher(final ExecutorService executor, REEFFileNames fileNames, ClasspathProvider classpath) {
+    this.executor = executor;
+    this.fileNames = fileNames;
+    this.classpath = classpath;
+  }
+
+  /**
+   * Launches the driver prepared in driverFolder
+   *
+   * @param driverFolder
+   * @param jobId
+   * @param clientRemoteId
+   */
+  public void launch(final File driverFolder, final String jobId, final String clientRemoteId) {
+    assert (driverFolder.isDirectory());
+
+    final List<String> command = makeLaunchCommand(jobId, clientRemoteId);
+
+    final RunnableProcess process = new RunnableProcess(command,
+        "driver",
+        driverFolder,
+        new LoggingRunnableProcessObserver(),
+        this.fileNames.getDriverStdoutFileName(),
+        this.fileNames.getDriverStderrFileName());
+    this.executor.submit(process);
+    this.executor.shutdown();
+  }
+
+  private List<String> makeLaunchCommand(final String jobId, final String clientRemoteId) {
+
+    final List<String> command = new JavaLaunchCommandBuilder()
+        .setErrorHandlerRID(clientRemoteId)
+        .setLaunchID(jobId)
+        .setConfigurationFileName(this.fileNames.getDriverConfigurationPath())
+        .setClassPath(this.classpath.getDriverClasspath())
+        .setMemory(DRIVER_MEMORY)
+        .build();
+
+    if (LOG.isLoggable(Level.FINEST)) {
+      LOG.log(Level.FINEST, "REEF app command: {0}", StringUtils.join(command, ' '));
+    }
+    return command;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f913080..dc84e3b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -240,7 +240,9 @@ under the License.
                             <exclude>lang/java/.idea/**</exclude>
                             <exclude>**/*.iml</exclude>
                             <exclude>**/target/**</exclude>
+                            <!-- ReadMe files -->
                             <exclude>**/README.*</exclude>
+                            <exclude>**/*.md</exclude>
                             <!-- The below are sometimes created during tests -->
                             <exclude>REEF_LOCAL_RUNTIME/**</exclude>
                             <!-- The Visual Studio build files -->
@@ -625,7 +627,8 @@ under the License.
     <modules>
         <module>lang/cs</module>
         <module>lang/java/reef-annotations</module>
-     	<module>lang/java/reef-bridge-java</module>
+        <module>lang/java/reef-bridge-client</module>
+        <module>lang/java/reef-bridge-java</module>
         <module>lang/java/reef-checkpoint</module>
         <module>lang/java/reef-common</module>
         <module>lang/java/reef-examples</module>


[2/2] incubator-reef git commit: [REEF-228] and [REEF-225]: A Client API and Local implementation

Posted by ju...@apache.org.
[REEF-228] and [REEF-225]: A Client API and Local implementation

This PR contains a client API for REEF.NET in `Org.Apache.REEF.Client`.
It also adds the `Org.Apache.REEF.Client.Local` implementation. That
implementation is backed by a Java Tool
`org.apache.reef.bridge.client.LocalClient` which gets called in
`Org.Apache.REEF.Client.Local.LocalClient.Submit()`. The API can be seen
in action in the new project `Org.Apache.REEF.Examples.HelloREEF`.

JIRA:
  [REEF-228](https://issues.apache.org/jira/browse/REEF-228) and
  [REEF-225](https://issues.apache.org/jira/browse/REEF-225)

Pull Request:
  This closes #134


Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/561e7a0a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/561e7a0a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/561e7a0a

Branch: refs/heads/master
Commit: 561e7a0addfa0d59d7c7ea15f34ff8766a68a176
Parents: 85bf1da
Author: Markus Weimer <we...@apache.org>
Authored: Wed Apr 1 19:14:10 2015 -0700
Committer: Julia Wang <jw...@yahoo.com>
Committed: Tue Apr 7 14:36:52 2015 -0700

----------------------------------------------------------------------
 .../Org.Apache.REEF.Bridge.JAR.csproj           |  17 +-
 .../Org.Apache.REEF.Bridge.JAR.nuspec           |   3 +-
 .../Org.Apache.REEF.Client/API/ClientFactory.cs |  48 ++++
 .../API/Exceptions/ClasspathException.cs        |  37 +++
 .../API/Exceptions/JavaNotFoundException.cs     |  37 +++
 .../Org.Apache.REEF.Client/API/IREEFClient.cs   |  34 +++
 .../Org.Apache.REEF.Client/API/JobSubmission.cs | 190 ++++++++++++++
 .../Common/ClientConstants.cs                   |  37 +++
 .../Common/DriverFolderPreparationHelper.cs     | 143 +++++++++++
 .../Org.Apache.REEF.Client/Common/FileSets.cs   | 166 ++++++++++++
 .../Common/JavaClientLauncher.cs                | 166 ++++++++++++
 .../Org.Apache.REEF.Client/Local/LocalClient.cs | 101 ++++++++
 .../Local/LocalRuntimeClientConfiguration.cs    |  54 ++++
 .../Local/Parameters/LocalRuntimeDirectory.cs   |  27 ++
 .../Local/Parameters/NumberOfEvaluators.cs      |  27 ++
 .../Org.Apache.REEF.Client.csproj               |  23 ++
 lang/cs/Org.Apache.REEF.Client/packages.config  |  24 ++
 lang/cs/Org.Apache.REEF.Common/Constants.cs     |   3 +
 .../Files/REEFFileNames.cs                      | 252 +++++++++++++++++++
 .../Org.Apache.REEF.Common.csproj               |   1 +
 .../Bridge/BridgeConfigurationProvider.cs       | 133 ++++++++++
 .../Bridge/ClrHandlerHelper.cs                  |  25 +-
 .../Bridge/ClrSystemHandlerWrapper.cs           |  51 ++--
 lang/cs/Org.Apache.REEF.Driver/Constants.cs     |   2 +
 .../Org.Apache.REEF.Driver.csproj               |   1 +
 .../App.config                                  |  24 ++
 .../HelloDriver.cs                              | 120 +++++++++
 .../HelloREEF.cs                                |  87 +++++++
 .../HelloTask.cs                                |  47 ++++
 .../Org.Apache.REEF.Examples.HelloREEF.csproj   |  77 ++++++
 .../Properties/AssemblyInfo.cs                  |  54 ++++
 .../Readme.md                                   |   9 +
 .../Functional/Bridge/TestBridgeClient.cs       |   2 +-
 lang/cs/Org.Apache.REEF.Tests/app.config        |  29 +++
 lang/cs/Org.Apache.REEF.sln                     | Bin 40196 -> 40556 bytes
 lang/java/reef-bridge-client/pom.xml            | 136 ++++++++++
 .../apache/reef/bridge/client/Constants.java    |  92 +++++++
 .../apache/reef/bridge/client/LocalClient.java  |  96 +++++++
 .../apache/reef/bridge/client/package-info.java |  22 ++
 .../reef/javabridge/generic/JobDriver.java      |  34 +--
 .../local/client/LocalJobSubmissionHandler.java |  41 +--
 .../client/PreparedDriverFolderLauncher.java    | 100 ++++++++
 pom.xml                                         |   5 +-
 43 files changed, 2476 insertions(+), 101 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj b/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj
index b1f1159..e6f921b 100644
--- a/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj
+++ b/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj
@@ -59,24 +59,33 @@ under the License.
           DependsOnTargets="CheckMavenInstall;CheckJavaInstall;CheckProtocInstall" 
           Outputs="$(OutputPath)">
     <PropertyGroup>
-      <!--The shaded jar of the bridge -->
+      <!--The shaded jar of the bridge (driver side) -->
       <Bridge_JAR_Name>reef-bridge-java-$(REEF_Version)-shaded.jar</Bridge_JAR_Name>
       <Bridge_JAR>$(REEF_Source_Folder)\lang\java\reef-bridge-java\target\$(Bridge_JAR_Name)</Bridge_JAR>
+      <!--The shaded jar of the bridge (client side) -->
+      <Client_JAR_Name>reef-bridge-client-$(REEF_Version)-shaded.jar</Client_JAR_Name>
+      <Client_JAR>$(REEF_Source_Folder)\lang\java\reef-bridge-client\target\$(Client_JAR_Name)</Client_JAR>
     </PropertyGroup>
     <Exec Command="$(M2_HOME)\bin\mvn -TC1 -DskipTests install" Condition="!Exists('$(Bridge_JAR)')" WorkingDirectory="$(REEF_Source_Folder)" />
     <Copy DestinationFolder="$(OutputPath)" SourceFiles="$(Bridge_JAR)" />
+    <Copy DestinationFolder="$(OutputPath)" SourceFiles="$(Client_JAR)" />
   </Target>
   <!--
     Executes 'mvn clean', if the JAR exists.
   -->
   <Target Name="Clean" DependsOnTargets="CheckMavenInstall;CheckJavaInstall;CheckProtocInstall">
     <PropertyGroup>
-      <!--The shaded jar of the bridge -->
+      <!--The shaded jar of the bridge (driver side) -->
       <Bridge_JAR_Name>reef-bridge-java-$(REEF_Version)-shaded.jar</Bridge_JAR_Name>
       <Bridge_JAR>$(REEF_Source_Folder)\lang\java\reef-bridge-java\target\$(Bridge_JAR_Name)</Bridge_JAR>
+      <!--The shaded jar of the bridge (client side) -->
+      <Client_JAR_Name>reef-bridge-client-$(REEF_Version)-shaded.jar</Client_JAR_Name>
+      <Client_JAR>$(REEF_Source_Folder)\lang\java\reef-bridge-client\target\$(Client_JAR_Name)</Client_JAR>
     </PropertyGroup>
     <Exec Command="$(M2_HOME)\bin\mvn -TC1 -DskipTests clean" Condition="Exists('$(Bridge_JAR)')" WorkingDirectory="$(REEF_Source_Folder)" />
     <Delete Files="$(OutputPath)\$(Bridge_JAR_Name)" />
+    <Delete Files="$(OutputPath)\$(Client_JAR_Name)" />
+
   </Target>
   <!--
     Standard Rebuild target: Clean, then build
@@ -93,6 +102,10 @@ under the License.
     <Line Include="line02"><Text>$file1 = $project.ProjectItems.Item("reef-bridge-java-$(ReefVer)-incubating-SNAPSHOT-shaded.jar")</Text></Line>
     <Line Include="line03"><Text>$copyToOutput1 = $file1.Properties.Item("CopyToOutputDirectory")</Text></Line>
     <Line Include="line04"><Text>$copyToOutput1.Value = 2</Text></Line>
+    <!--Copy the client JAR-->
+    <Line Include="line02"><Text>$file1 = $project.ProjectItems.Item("reef-bridge-client-$(ReefVer)-incubating-SNAPSHOT-shaded.jar")</Text></Line>
+    <Line Include="line03"><Text>$copyToOutput1 = $file1.Properties.Item("CopyToOutputDirectory")</Text></Line>
+    <Line Include="line04"><Text>$copyToOutput1.Value = 2</Text></Line>
     <LineText Include="%(Line.Text)" />
   </ItemGroup>
   <WriteLinesToFile

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.nuspec
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.nuspec b/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.nuspec
index c5c5131..9b0d5b9 100644
--- a/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.nuspec
+++ b/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.nuspec
@@ -29,7 +29,8 @@ under the License.
     <copyright>The Apache Software Foundation and the respective owners of the packaged libraries.</copyright>
   </metadata>
   <files>
-      <file src="..\bin\$Platform$\$Configuration$\Org.Apache.REEF.Bridge.JAR\reef-bridge-java-$REEF_Version$-shaded.jar" target="content" />
+    <file src="..\bin\$Platform$\$Configuration$\Org.Apache.REEF.Bridge.JAR\reef-bridge-java-$REEF_Version$-shaded.jar" target="content" />
+    <file src="..\bin\$Platform$\$Configuration$\Org.Apache.REEF.Bridge.JAR\reef-bridge-client-$REEF_Version$-shaded.jar" target="content" />
 	  <file src="..\bin\$Platform$\$Configuration$\Org.Apache.REEF.Bridge.JAR\install.ps1" target="tools" />
   </files>
 </package>

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/API/ClientFactory.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/API/ClientFactory.cs b/lang/cs/Org.Apache.REEF.Client/API/ClientFactory.cs
new file mode 100644
index 0000000..1c35b4a
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/API/ClientFactory.cs
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+using Org.Apache.REEF.Client.Local;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.Client.API
+{
+    /// <summary>
+    /// Instantiates the client based on IConfiguration for the chosen runtime.
+    /// </summary>
+    public static class ClientFactory
+    {
+        /// <summary>
+        /// Creates a new instance of IREEFClient, based on the given Configuration.
+        /// </summary>
+        /// <remarks>
+        /// If the client itself uses Tang, it is a better design to have the IREEFClient injected into it. In order to make
+        /// that happen, mix in the appropriate runtime configuration into the client configuration.
+        /// </remarks>
+        /// <param name="runtimeClientConfiguration">
+        /// The client configuration. Typically, this will be created via e.g.
+        /// <seealso cref="LocalRuntimeClientConfiguration" />
+        /// </param>
+        /// <returns></returns>
+        public static IREEFClient GetClient(IConfiguration runtimeClientConfiguration)
+        {
+            return TangFactory.GetTang().NewInjector(runtimeClientConfiguration).GetInstance<IREEFClient>();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/API/Exceptions/ClasspathException.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/API/Exceptions/ClasspathException.cs b/lang/cs/Org.Apache.REEF.Client/API/Exceptions/ClasspathException.cs
new file mode 100644
index 0000000..2c4e460
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/API/Exceptions/ClasspathException.cs
@@ -0,0 +1,37 @@
+using System;
+
+/**
+ * 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 Org.Apache.REEF.Client.API.Exceptions
+{
+    /// <summary>
+    /// Thrown when the client fails to assemble the classpath for the Java part of the client.
+    /// </summary>
+    public sealed class ClasspathException : Exception
+    {
+        public ClasspathException(string message) : base(message)
+        {
+        }
+
+        public ClasspathException(string message, Exception innerException) : base(message, innerException)
+        {
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/API/Exceptions/JavaNotFoundException.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/API/Exceptions/JavaNotFoundException.cs b/lang/cs/Org.Apache.REEF.Client/API/Exceptions/JavaNotFoundException.cs
new file mode 100644
index 0000000..493c08c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/API/Exceptions/JavaNotFoundException.cs
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System.IO;
+
+namespace Org.Apache.REEF.Client.API.Exceptions
+{
+    /// <summary>
+    /// Thrown when the java installation cannot be found on the client.
+    /// </summary>
+    public sealed class JavaNotFoundException : FileNotFoundException
+    {
+        public JavaNotFoundException(string message) : base(message)
+        {
+        }
+
+        public JavaNotFoundException(string message, string fileName) : base(message, fileName)
+        {
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/API/IREEFClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/API/IREEFClient.cs b/lang/cs/Org.Apache.REEF.Client/API/IREEFClient.cs
new file mode 100644
index 0000000..56b0042
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/API/IREEFClient.cs
@@ -0,0 +1,34 @@
+/**
+ * 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 Org.Apache.REEF.Client.API
+{
+    /// <summary>
+    /// Interface for job submission on a REEF cluster
+    /// </summary>
+    // ReSharper disable once InconsistentNaming
+    public interface IREEFClient
+    {
+        /// <summary>
+        /// Submit the job described in jobSubmission to the cluster.
+        /// </summary>
+        /// <param name="jobSubmission"></param>
+        void Submit(JobSubmission jobSubmission);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/API/JobSubmission.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/API/JobSubmission.cs b/lang/cs/Org.Apache.REEF.Client/API/JobSubmission.cs
new file mode 100644
index 0000000..440755e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/API/JobSubmission.cs
@@ -0,0 +1,190 @@
+/**
+ * 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.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.Client.API
+{
+    /// <summary>
+    /// Captures a submission of a REEF Job to a cluster.
+    /// </summary>
+    public sealed class JobSubmission
+    {
+        private readonly ISet<IConfiguration> _driverConfigurations = new HashSet<IConfiguration>();
+        private readonly ISet<string> _globalAssemblies = new HashSet<string>();
+        private readonly ISet<string> _globalFiles = new HashSet<string>();
+        private readonly ISet<string> _localAssemblies = new HashSet<string>();
+        private readonly ISet<string> _localFiles = new HashSet<string>();
+        private int _driverMemory = 512;
+
+        /// <summary>
+        /// The assemblies to be made available to all containers.
+        /// </summary>
+        internal ISet<string> GlobalAssemblies
+        {
+            get { return _globalAssemblies; }
+        }
+
+        /// <summary>
+        /// The driver configurations
+        /// </summary>
+        internal ISet<IConfiguration> DriverConfigurations
+        {
+            get { return _driverConfigurations; }
+        }
+
+        internal ISet<string> GlobalFiles
+        {
+            get { return _globalFiles; }
+        }
+
+        internal ISet<string> LocalAssemblies
+        {
+            get { return _localAssemblies; }
+        }
+
+        internal ISet<string> LocalFiles
+        {
+            get { return _localFiles; }
+        }
+
+        internal int DriverMemory
+        {
+            get { return _driverMemory; }
+        }
+
+        /// <summary>
+        /// The Job's identifier
+        /// </summary>
+        public string JobIdentifier { get; private set; }
+
+        /// <summary>
+        /// Add a file to be made available in all containers.
+        /// </summary>
+        /// <param name="fileName"></param>
+        /// <returns></returns>
+        public JobSubmission AddGlobalFile(string fileName)
+        {
+            _globalFiles.Add(fileName);
+            return this;
+        }
+
+        /// <summary>
+        /// Add a file to be made available only on the driver.
+        /// </summary>
+        /// <param name="fileName"></param>
+        /// <returns></returns>
+        public JobSubmission AddLocalFile(string fileName)
+        {
+            _localFiles.Add(fileName);
+            return this;
+        }
+
+        /// <summary>
+        /// Add an assembly to be made available on all containers.
+        /// </summary>
+        /// <param name="fileName"></param>
+        /// <returns></returns>
+        public JobSubmission AddGlobalAssembly(string fileName)
+        {
+            _globalAssemblies.Add(fileName);
+            return this;
+        }
+
+        /// <summary>
+        /// Add an assembly to the driver only.
+        /// </summary>
+        /// <param name="fileName"></param>
+        /// <returns></returns>
+        public JobSubmission AddLocalAssembly(string fileName)
+        {
+            _localAssemblies.Add(fileName);
+            return this;
+        }
+
+        /// <summary>
+        /// Add a Configuration to the Driver.
+        /// </summary>
+        /// <param name="configuration"></param>
+        /// <returns></returns>
+        public JobSubmission AddDriverConfiguration(IConfiguration configuration)
+        {
+            _driverConfigurations.Add(configuration);
+            return this;
+        }
+
+        /// <summary>
+        /// Add the assembly needed for the given Type to the driver.
+        /// </summary>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        public JobSubmission AddLocalAssemblyForType(Type type)
+        {
+            AddLocalAssembly(GetAssemblyPathForType(type));
+            return this;
+        }
+
+        /// <summary>
+        /// Add the assembly needed for the given Type to all containers.
+        /// </summary>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        public JobSubmission AddGlobalAssemblyForType(Type type)
+        {
+            AddGlobalAssembly(GetAssemblyPathForType(type));
+            return this;
+        }
+
+        /// <summary>
+        /// Gives the job an identifier.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public JobSubmission SetJobIdentifier(string id)
+        {
+            JobIdentifier = id;
+            return this;
+        }
+
+        /// <summary>
+        /// Sets the amount of memory (in MB) to allocate for the Driver.
+        /// </summary>
+        /// <param name="driverMemoryInMb">The amount of memory (in MB) to allocate for the Driver.</param>
+        /// <returns>this</returns>
+        public JobSubmission SetDriverMemory(int driverMemoryInMb)
+        {
+            _driverMemory = driverMemoryInMb;
+            return this;
+        }
+
+        /// <summary>
+        /// Finds the path to the assembly the given Type was loaded from.
+        /// </summary>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        private static string GetAssemblyPathForType(Type type)
+        {
+            var path = Uri.UnescapeDataString(new UriBuilder(type.Assembly.CodeBase).Path);
+            return Path.GetFullPath(path);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/Common/ClientConstants.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Common/ClientConstants.cs b/lang/cs/Org.Apache.REEF.Client/Common/ClientConstants.cs
new file mode 100644
index 0000000..a5963d3
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/Common/ClientConstants.cs
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace Org.Apache.REEF.Client.Common
+{
+    /// <summary>
+    /// Constants used by the O.A.R.Client project.
+    /// </summary>
+    internal static class ClientConstants
+    {
+        /// <summary>
+        /// The prefix of the JAR file containing the client logic.
+        /// </summary>
+        internal const string ClientJarFilePrefix = "reef-bridge-client-";
+
+        /// <summary>
+        /// The prefix of the JAR file to be copied to the driver.
+        /// </summary>
+        internal const string DriverJarFilePrefix = "reef-bridge-java-";
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/Common/DriverFolderPreparationHelper.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Common/DriverFolderPreparationHelper.cs b/lang/cs/Org.Apache.REEF.Client/Common/DriverFolderPreparationHelper.cs
new file mode 100644
index 0000000..7e155b8
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/Common/DriverFolderPreparationHelper.cs
@@ -0,0 +1,143 @@
+/**
+ * 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.
+ */
+
+
+using System;
+using System.IO;
+using System.Linq;
+using Org.Apache.REEF.Client.API;
+using Org.Apache.REEF.Common;
+using Org.Apache.REEF.Common.Files;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Implementations.Configuration;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Client.Common
+{
+    /// <summary>
+    /// Helps prepare the driver folder.
+    /// </summary>
+    internal sealed class DriverFolderPreparationHelper
+    {
+        private const string DLLFileNameExtension = ".dll";
+        private const string EXEFileNameExtension = ".exe";
+        private static readonly Logger Logger = Logger.GetLogger(typeof(DriverFolderPreparationHelper));
+        private readonly AvroConfigurationSerializer _configurationSerializer;
+        private readonly REEFFileNames _fileNames;
+        private readonly FileSets _fileSets;
+
+        [Inject]
+        internal DriverFolderPreparationHelper(
+            REEFFileNames fileNames,
+            AvroConfigurationSerializer configurationSerializer,
+            FileSets fileSets)
+        {
+            _fileNames = fileNames;
+            _configurationSerializer = configurationSerializer;
+            _fileSets = fileSets;
+        }
+
+        /// <summary>
+        /// Prepares the working directory for a Driver in driverFolderPath.
+        /// </summary>
+        /// <param name="jobSubmission"></param>
+        /// <param name="driverFolderPath"></param>
+        internal void PrepareDriverFolder(JobSubmission jobSubmission, string driverFolderPath)
+        {
+            Logger.Log(Level.Info, "Preparing Driver filesystem layout in " + driverFolderPath);
+
+            // Setup the folder structure
+            CreateDefaultFolderStructure(driverFolderPath);
+
+            // Add the jobSubmission into that folder structure
+            _fileSets.AddJobFiles(jobSubmission);
+
+            // Create the driver configuration
+            CreateDriverConfiguration(jobSubmission, driverFolderPath);
+
+            // Add the REEF assemblies
+            AddAssemblies();
+
+            // Initiate the final copy
+            _fileSets.CopyToDriverFolder(driverFolderPath);
+
+            Logger.Log(Level.Info, "Done preparing Driver filesystem layout in " + driverFolderPath);
+        }
+
+        /// <summary>
+        /// Merges the Configurations in jobSubmission and serializes them into the right place within driverFolderPath,
+        /// assuming
+        /// that points to a Driver's working directory.
+        /// </summary>
+        /// <param name="jobSubmission"></param>
+        /// <param name="driverFolderPath"></param>
+        internal void CreateDriverConfiguration(JobSubmission jobSubmission, string driverFolderPath)
+        {
+            var driverConfiguration = Configurations.Merge(jobSubmission.DriverConfigurations.ToArray());
+
+            _configurationSerializer.ToFile(driverConfiguration,
+                Path.Combine(driverFolderPath, _fileNames.GetClrDriverConfigurationPath()));
+
+            // TODO: Remove once we cleaned up the Evaluator to not expect this [REEF-216]
+            _configurationSerializer.ToFile(driverConfiguration,
+                Path.Combine(driverFolderPath, _fileNames.GetGlobalFolderPath(), Constants.ClrBridgeRuntimeConfiguration));
+        }
+
+        /// <summary>
+        /// Creates the driver folder structure in this given folder as the root
+        /// </summary>
+        /// <param name="driverFolderPath"></param>
+        internal void CreateDefaultFolderStructure(string driverFolderPath)
+        {
+            Directory.CreateDirectory(Path.Combine(driverFolderPath, _fileNames.GetReefFolderName()));
+            Directory.CreateDirectory(Path.Combine(driverFolderPath, _fileNames.GetLocalFolderPath()));
+            Directory.CreateDirectory(Path.Combine(driverFolderPath, _fileNames.GetGlobalFolderPath()));
+        }
+
+        /// <summary>
+        /// Adds all Assemlies to the Global folder in the Driver.
+        /// </summary>
+        private void AddAssemblies()
+        {
+            // TODO: Be more precise, e.g. copy the JAR only to the driver.
+            var assemblies = Directory.GetFiles(@".\").Where(IsAssemblyToCopy);
+            _fileSets.AddToGlobalFiles(assemblies);
+        }
+
+        /// <summary>
+        /// Returns true, if the given file path references a DLL or EXE or JAR.
+        /// </summary>
+        /// <param name="filePath"></param>
+        /// <returns></returns>
+        private static Boolean IsAssemblyToCopy(string filePath)
+
+        {
+            var fileName = Path.GetFileName(filePath);
+            if (string.IsNullOrWhiteSpace(fileName))
+            {
+                return false;
+            }
+            var lowerCasePath = fileName.ToLower();
+            return lowerCasePath.EndsWith(DLLFileNameExtension) ||
+                   lowerCasePath.EndsWith(EXEFileNameExtension) ||
+                   lowerCasePath.StartsWith(ClientConstants.DriverJarFilePrefix);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/Common/FileSets.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Common/FileSets.cs b/lang/cs/Org.Apache.REEF.Client/Common/FileSets.cs
new file mode 100644
index 0000000..e337112
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/Common/FileSets.cs
@@ -0,0 +1,166 @@
+/**
+ * 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.
+ */
+
+using System.Collections.Generic;
+using System.IO;
+using Org.Apache.REEF.Client.API;
+using Org.Apache.REEF.Common.Files;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Client.Common
+{
+    /// <summary>
+    /// Manages the files to be copied to driver folder.
+    /// </summary>
+    internal sealed class FileSets
+    {
+        private static readonly Logger Logger = Logger.GetLogger(typeof (FileSets));
+        private readonly REEFFileNames _fileNames;
+
+        private readonly ISet<string> _globalFileSet =
+            new HashSet<string>(CaseIgnoringStringEqualityComparer.TheInstance);
+
+        private readonly ISet<string> _localFileSet = new HashSet<string>(CaseIgnoringStringEqualityComparer.TheInstance);
+
+        [Inject]
+        internal FileSets(REEFFileNames fileNames)
+        {
+            _fileNames = fileNames;
+        }
+
+        /// <summary>
+        /// Adds a file to be added to the driver's local folder.
+        /// </summary>
+        /// <remarks>Empty strings are quietly ignored.</remarks>
+        /// <param name="path"></param>
+        internal void AddToLocalFiles(string path)
+        {
+            if (string.IsNullOrWhiteSpace(path))
+            {
+                Logger.Log(Level.Warning, "Skipping: " + path);
+            }
+            else
+            {
+                _localFileSet.Add(Path.GetFullPath(path));
+            }
+        }
+
+        /// <summary>
+        /// Adds all the referenced files to the driver's local folder.
+        /// </summary>
+        /// <remarks>Empty strings are quietly ignored.</remarks>
+        /// <param name="paths"></param>
+        internal void AddToLocalFiles(IEnumerable<string> paths)
+        {
+            foreach (var path in paths)
+            {
+                AddToLocalFiles(path);
+            }
+        }
+
+        /// <summary>
+        /// Adds a file to be added to the driver's global folder.
+        /// </summary>
+        /// <remarks>Empty strings are quietly ignored.</remarks>
+        /// <param name="path"></param>
+        internal void AddToGlobalFiles(string path)
+        {
+            if (string.IsNullOrWhiteSpace(path))
+            {
+                Logger.Log(Level.Warning, "Skipping: " + path);
+            }
+            else
+            {
+                _globalFileSet.Add(Path.GetFullPath(path));
+            }
+        }
+
+        /// <summary>
+        /// Adds all the referenced files to the driver's global folder.
+        /// </summary>
+        /// <remarks>Empty strings are quietly ignored.</remarks>
+        /// <param name="paths"></param>
+        internal void AddToGlobalFiles(IEnumerable<string> paths)
+        {
+            foreach (var path in paths)
+            {
+                AddToGlobalFiles(path);
+            }
+        }
+
+        /// <summary>
+        /// Copies the files captured to the right places, given that driverFolderPath points to the root folder of the driver.
+        /// </summary>
+        /// <param name="driverFolderPath"></param>
+        internal void CopyToDriverFolder(string driverFolderPath)
+        {
+            var localFolderPath = Path.Combine(driverFolderPath, _fileNames.GetLocalFolderPath());
+            CopyAllToFolder(_localFileSet, localFolderPath);
+            var globalFolderPath = Path.Combine(driverFolderPath, _fileNames.GetGlobalFolderPath());
+            CopyAllToFolder(_globalFileSet, globalFolderPath);
+        }
+
+        /// <summary>
+        /// Adds all the files referenced in the given JobSubmission
+        /// </summary>
+        /// <param name="submission"></param>
+        internal void AddJobFiles(JobSubmission submission)
+        {
+            AddToGlobalFiles(submission.GlobalFiles);
+            AddToGlobalFiles(submission.GlobalAssemblies);
+            AddToLocalFiles(submission.LocalFiles);
+            AddToLocalFiles(submission.LocalAssemblies);
+        }
+
+        /// <summary>
+        /// Copies all the files referenced in sourcePaths to destinationPath
+        /// </summary>
+        /// <param name="sourcePaths"></param>
+        /// <param name="destinationPath"></param>
+        private static void CopyAllToFolder(IEnumerable<string> sourcePaths, string destinationPath)
+        {
+            foreach (var file in sourcePaths)
+            {
+                var destinationFileName = Path.GetFileName(file);
+                var destination = Path.Combine(destinationPath, destinationFileName);
+                Logger.Log(Level.Verbose, "Copying {0} to {1}", file, destination);
+                File.Copy(file, destination);
+            }
+        }
+    }
+
+    /// <summary>
+    /// An EqualityComparer for strings that ignores the case when comparing.
+    /// </summary>
+    internal sealed class CaseIgnoringStringEqualityComparer : IEqualityComparer<string>
+    {
+        internal static CaseIgnoringStringEqualityComparer TheInstance = new CaseIgnoringStringEqualityComparer();
+
+        public bool Equals(string stringOne, string stringTwo)
+        {
+            return stringOne.ToLower().Equals(stringTwo.ToLower());
+        }
+
+        public int GetHashCode(string s)
+        {
+            return s.ToLower().GetHashCode();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs b/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs
new file mode 100644
index 0000000..2fa83fc
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs
@@ -0,0 +1,166 @@
+/**
+ * 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.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using Org.Apache.REEF.Client.API.Exceptions;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Client.Common
+{
+    /// <summary>
+    /// Helper class to launch the java side of the various clients.
+    /// </summary>
+    internal class JavaClientLauncher
+    {
+        /// <summary>
+        /// The folder in which we search for the client jar.
+        /// </summary>
+        private const string JarFolder = "./";
+
+        private static readonly Logger Logger = Logger.GetLogger(typeof (JavaClientLauncher));
+
+        [Inject]
+        private JavaClientLauncher()
+        {
+        }
+
+        internal void Launch(string javaClassName, params string[] parameters)
+        {
+            var startInfo = new ProcessStartInfo
+            {
+                Arguments = AssembleArguments(javaClassName, parameters),
+                FileName = GetJavaCommand(),
+                UseShellExecute = false,
+                RedirectStandardOutput = true,
+                RedirectStandardError = true
+            };
+            var process = Process.Start(startInfo);
+            if (process != null)
+            {
+                process.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e)
+                {
+                    if (!string.IsNullOrWhiteSpace(e.Data))
+                    {
+                        Logger.Log(Level.Info, e.Data);
+                    }
+                };
+                process.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e)
+                {
+                    if (!string.IsNullOrWhiteSpace(e.Data))
+                    {
+                        Logger.Log(Level.Error, e.Data);
+                    }
+                };
+                process.BeginErrorReadLine();
+                process.BeginOutputReadLine();
+                process.WaitForExit();
+            }
+            else
+            {
+                Exceptions.Throw(new Exception("Java client process didn't start."), Logger);
+            }
+        }
+
+        /// <summary>
+        /// Assembles the command line arguments. Used by Launch()
+        /// </summary>
+        /// <param name="javaClassName"></param>
+        /// <param name="parameters"></param>
+        /// <returns></returns>
+        private string AssembleArguments(string javaClassName, params string[] parameters)
+        {
+            IList<string> arguments = new List<string>();
+            arguments.Add("-cp");
+            arguments.Add(GetClientClasspath());
+            arguments.Add(javaClassName);
+            foreach (var parameter in parameters)
+            {
+                arguments.Add(parameter);
+            }
+            return string.Join(" ", arguments);
+        }
+
+        /// <summary>
+        /// Find the `java` command on this machine and returns its path.
+        /// </summary>
+        /// <exception cref="JavaNotFoundException">If the java binary couldn't be found.</exception>
+        /// <returns>The path of the `java` command on this machine.</returns>
+        private static string GetJavaCommand()
+        {
+            var javaHomePath = Environment.GetEnvironmentVariable("JAVA_HOME");
+            if (string.IsNullOrWhiteSpace(javaHomePath))
+            {
+                // TODO: Attempt to find java via the registry.
+                Exceptions.Throw(
+                    new JavaNotFoundException("JAVA_HOME isn't set. Please install Java and make set JAVA_HOME"), Logger);
+            }
+
+            if (!Directory.Exists(javaHomePath))
+            {
+                Exceptions.Throw(
+                    new JavaNotFoundException("JAVA_HOME references a folder that doesn't exist.", javaHomePath), Logger);
+            }
+
+            var javaBinPath = Path.Combine(javaHomePath, "bin");
+            if (!Directory.Exists(javaBinPath))
+            {
+                throw new JavaNotFoundException(
+                    "JAVA_HOME references a folder that doesn't contain a `bin` folder. Please adjust JAVA_HOME",
+                    javaHomePath);
+            }
+
+            var javaPath = Path.Combine(javaBinPath, "java.exe");
+            if (!File.Exists(javaPath))
+            {
+                Exceptions.Throw(
+                    new JavaNotFoundException(
+                        "Could not find java.exe on this machine. Is Java installed and JAVA_HOME set?", javaPath),
+                    Logger);
+            }
+            return javaPath;
+        }
+
+        /// <summary>
+        /// Assembles the classpath for the side process
+        /// </summary>
+        /// <exception cref="ClasspathException">If the classpath would be empty.</exception>
+        /// <returns></returns>
+        private string GetClientClasspath()
+        {
+            var files = Directory.GetFiles(JarFolder)
+                .Where(x => (!string.IsNullOrWhiteSpace(x)))
+                .Where(e => Path.GetFileName(e).ToLower().StartsWith(ClientConstants.ClientJarFilePrefix))
+                .ToArray();
+
+            if (null == files || files.Length == 0)
+            {
+                Exceptions.Throw(new ClasspathException(
+                    "Unable to assemble classpath. Make sure the REEF JAR is in the current working directory."), Logger);
+            }
+            var classPath = string.Join(";", files);
+            return classPath;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/Local/LocalClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Local/LocalClient.cs b/lang/cs/Org.Apache.REEF.Client/Local/LocalClient.cs
new file mode 100644
index 0000000..f5aa561
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/Local/LocalClient.cs
@@ -0,0 +1,101 @@
+/**
+ * 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.
+ */
+
+using System;
+using System.IO;
+using Org.Apache.REEF.Client.API;
+using Org.Apache.REEF.Client.Common;
+using Org.Apache.REEF.Client.Local.Parameters;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Client.Local
+{
+    /// <summary>
+    /// An implementation of the REEF interface using an external Java program
+    /// </summary>
+    public sealed class LocalClient : IREEFClient
+    {
+        /// <summary>
+        /// The class name that contains the Java counterpart for this client.
+        /// </summary>
+        private const string JavaClassName = "org.apache.reef.bridge.client.LocalClient";
+
+        /// <summary>
+        /// The name of the folder in the job's working directory that houses the driver.
+        /// </summary>
+        private const string DriverFolderName = "driver";
+
+        private static readonly Logger Logger = Logger.GetLogger(typeof (LocalClient));
+        private readonly DriverFolderPreparationHelper _driverFolderPreparationHelper;
+        private readonly JavaClientLauncher _javaClientLauncher;
+        private readonly int _numberOfEvaluators;
+        private readonly string _runtimeFolder;
+
+        [Inject]
+        private LocalClient(DriverFolderPreparationHelper driverFolderPreparationHelper,
+            [Parameter(typeof (LocalRuntimeDirectory))] string runtimeFolder,
+            [Parameter(typeof (NumberOfEvaluators))] int numberOfEvaluators, JavaClientLauncher javaClientLauncher)
+        {
+            _driverFolderPreparationHelper = driverFolderPreparationHelper;
+            _runtimeFolder = runtimeFolder;
+            _numberOfEvaluators = numberOfEvaluators;
+            _javaClientLauncher = javaClientLauncher;
+        }
+
+        /// <summary>
+        /// Uses Path.GetTempPath() as the runtime execution folder.
+        /// </summary>
+        /// <param name="driverFolderPreparationHelper"></param>
+        /// <param name="reefJarPath"></param>
+        /// <param name="numberOfEvaluators"></param>
+        [Inject]
+        private LocalClient(
+            DriverFolderPreparationHelper driverFolderPreparationHelper,
+            [Parameter(typeof (NumberOfEvaluators))] int numberOfEvaluators, JavaClientLauncher javaClientLauncher)
+            : this(driverFolderPreparationHelper, Path.GetTempPath(), numberOfEvaluators, javaClientLauncher)
+        {
+            // Intentionally left blank.
+        }
+
+        public void Submit(JobSubmission jobSubmission)
+        {
+            // Prepare the job submission folder
+            var jobFolder = CreateJobFolder(jobSubmission.JobIdentifier);
+            var driverFolder = Path.Combine(jobFolder, DriverFolderName);
+            Logger.Log(Level.Info, "Preparing driver folder in " + driverFolder);
+
+            _driverFolderPreparationHelper.PrepareDriverFolder(jobSubmission, driverFolder);
+
+            _javaClientLauncher.Launch(JavaClassName, driverFolder, jobSubmission.JobIdentifier,
+                _numberOfEvaluators.ToString());
+            Logger.Log(Level.Info, "Submitted the Driver for execution.");
+        }
+
+        /// <summary>
+        /// Creates the temporary directory to hold the job submission.
+        /// </summary>
+        /// <returns></returns>
+        private string CreateJobFolder(string jobId)
+        {
+            var timestamp = DateTime.Now.ToString("yyyyMMddHHmmssfff");
+            return Path.Combine(_runtimeFolder, string.Join("-", "reef", jobId, timestamp));
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/Local/LocalRuntimeClientConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Local/LocalRuntimeClientConfiguration.cs b/lang/cs/Org.Apache.REEF.Client/Local/LocalRuntimeClientConfiguration.cs
new file mode 100644
index 0000000..20c3c98
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/Local/LocalRuntimeClientConfiguration.cs
@@ -0,0 +1,54 @@
+/**
+ * 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.
+ */
+
+using Org.Apache.REEF.Client.API;
+using Org.Apache.REEF.Client.Local.Parameters;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Util;
+
+namespace Org.Apache.REEF.Client.Local
+{
+    public sealed class LocalRuntimeClientConfiguration : ConfigurationModuleBuilder
+    {
+        /// <summary>
+        /// The number of threads or evaluators available to the resourcemanager.
+        /// </summary>
+        /// <remarks>
+        /// This is the upper limit on the number of
+        /// Evaluators that the local resourcemanager will hand out concurrently. This simulates the size of a physical cluster
+        /// in terms of the number of slots available on it with one important caveat: The Driver is not counted against this
+        /// number.
+        /// </remarks>
+        public static readonly OptionalParameter<int> NumberOfEvaluators = new OptionalParameter<int>();
+
+        /// <summary>
+        /// The folder in which the sub-folders, one per job, will be created.
+        /// </summary>
+        /// <remarks>
+        /// If none is given, the temp directory is used.
+        /// </remarks>
+        public static readonly OptionalParameter<string> RuntimeFolder = new OptionalParameter<string>();
+
+        public static ConfigurationModule ConfigurationModule = new LocalRuntimeClientConfiguration()
+            .BindImplementation(GenericType<IREEFClient>.Class, GenericType<LocalClient>.Class)
+            .BindNamedParameter(GenericType<LocalRuntimeDirectory>.Class, RuntimeFolder)
+            .BindNamedParameter(GenericType<NumberOfEvaluators>.Class, NumberOfEvaluators)
+            .Build();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/Local/Parameters/LocalRuntimeDirectory.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Local/Parameters/LocalRuntimeDirectory.cs b/lang/cs/Org.Apache.REEF.Client/Local/Parameters/LocalRuntimeDirectory.cs
new file mode 100644
index 0000000..7ac8ac5
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/Local/Parameters/LocalRuntimeDirectory.cs
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Client.Local.Parameters
+{
+    [NamedParameter("The directory in which the local runtime will store its execution.")]
+    public class LocalRuntimeDirectory : Name<string>
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/Local/Parameters/NumberOfEvaluators.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Local/Parameters/NumberOfEvaluators.cs b/lang/cs/Org.Apache.REEF.Client/Local/Parameters/NumberOfEvaluators.cs
new file mode 100644
index 0000000..8bf2e62
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/Local/Parameters/NumberOfEvaluators.cs
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Client.Local.Parameters
+{
+    [NamedParameter(defaultValue: "2")]
+    public class NumberOfEvaluators : Name<int>
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
index eb9f995..f86e0dc 100644
--- a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
+++ b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
@@ -35,12 +35,28 @@ under the License.
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.IO.Compression" />
+    <Reference Include="System.IO.Compression.FileSystem" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="API\ClientFactory.cs" />
+    <Compile Include="API\Exceptions\ClasspathException.cs" />
+    <Compile Include="API\Exceptions\JavaNotFoundException.cs" />
+    <Compile Include="API\IREEFClient.cs" />
+    <Compile Include="API\JobSubmission.cs" />
     <Compile Include="CLRBridgeClient.cs" />
+    <Compile Include="Common\ClientConstants.cs" />
+    <Compile Include="Common\DriverFolderPreparationHelper.cs" />
+    <Compile Include="Common\FileSets.cs" />
+    <Compile Include="Common\JavaClientLauncher.cs" />
+    <Compile Include="Local\LocalClient.cs" />
+    <Compile Include="Local\LocalRuntimeClientConfiguration.cs" />
+    <Compile Include="Local\Parameters\LocalRuntimeDirectory.cs" />
+    <Compile Include="Local\Parameters\NumberOfEvaluators.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
+    <None Include="packages.config" />
     <None Include="run.cmd" />
   </ItemGroup>
   <ItemGroup>
@@ -78,6 +94,13 @@ under the License.
     </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
+  </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Client/packages.config
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/packages.config b/lang/cs/Org.Apache.REEF.Client/packages.config
new file mode 100644
index 0000000..933b7e1
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/packages.config
@@ -0,0 +1,24 @@
+<?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.
+-->
+<packages>
+  <package id="Microsoft.Hadoop.Avro" version="1.4.0.0" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
+  <package id="protobuf-net" version="2.0.0.668" targetFramework="net45" />
+</packages>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Common/Constants.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Constants.cs b/lang/cs/Org.Apache.REEF.Common/Constants.cs
index 27e185e..913d810 100644
--- a/lang/cs/Org.Apache.REEF.Common/Constants.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Constants.cs
@@ -17,10 +17,13 @@
  * under the License.
  */
 
+using System;
+
 namespace Org.Apache.REEF.Common
 {
     public class Constants
     {
+        [Obsolete(message:"Use REEFFileNames instead.")]
         public const string ClrBridgeRuntimeConfiguration = "clrBridge.config";
 
         // if 8080 port is not used, then query would fail, 

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Common/Files/REEFFileNames.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Files/REEFFileNames.cs b/lang/cs/Org.Apache.REEF.Common/Files/REEFFileNames.cs
new file mode 100644
index 0000000..4b6d26e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Common/Files/REEFFileNames.cs
@@ -0,0 +1,252 @@
+/**
+ * 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.
+ */
+
+using System.Diagnostics.CodeAnalysis;
+using System.IO;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Common.Files
+{
+    /// <summary>
+    /// Contains all file system constants used by REEF.
+    /// </summary>
+    /// <remarks>
+    /// Whenever editing this, make sure you also edit org.apache.reef.runtime.common.files.REEFFileNames in the java
+    /// code base.
+    /// </remarks>
+    [SuppressMessage("ReSharper", "InconsistentNaming",
+        Justification = "The names are all taken from the Java codebase.")]
+    public sealed class REEFFileNames
+    {
+        private const string JAR_FILE_SUFFIX = ".jar";
+        private const string JOB_FOLDER_PREFIX = "reef-job-";
+        private const string EVALUATOR_FOLDER_PREFIX = "reef-evaluator-";
+        private const string DRIVER_STDERR = "driver.stderr";
+        private const string DRIVER_STDOUT = "driver.stdout";
+        private const string EVALUATOR_STDERR = "evaluator.stderr";
+        private const string EVALUATOR_STDOUT = "evaluator.stdout";
+        private const string CPP_BRIDGE = "JavaClrBridge";
+        private const string REEF_DRIVER_APPDLL_DIR = "/ReefDriverAppDlls/";
+        private const string TMP_LOAD_DIR = "/reef/CLRLoadingDirectory";
+        private const string REEF_BASE_FOLDER = "reef";
+        private const string GLOBAL_FOLDER = "global";
+        private const string LOCAL_FOLDER = "local";
+        private const string DRIVER_CONFIGURATION_NAME = "driver.conf";
+        private const string EVALUATOR_CONFIGURATION_NAME = "evaluator.conf";
+        private const string CLR_DRIVER_CONFIGURATION_NAME = "clrdriver.conf";
+        private const string BRIDGE_DLL_NAME = "Org.Apache.REEF.Bridge.dll";
+
+        [Inject]
+        public REEFFileNames()
+        {
+        }
+
+        /// <summary>
+        /// The name of the REEF folder inside of the working directory of an Evaluator or Driver
+        /// </summary>
+        /// <returns></returns>
+        public string GetReefFolderName()
+        {
+            return REEF_BASE_FOLDER;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>the name of the folder inside of REEF_BASE_FOLDER that houses the global files.</returns>
+        public string GetGlobalFolderName()
+        {
+            return GLOBAL_FOLDER;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>the path to the global folder: REEF_BASE_FOLDER/GLOBAL_FOLDER</returns>
+        public string GetGlobalFolderPath()
+        {
+            return GLOBAL_FOLDER_PATH;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>the name of the folder inside of REEF_BASE_FOLDER that houses the local files.</returns>
+        public string GetLocalFolderName()
+        {
+            return LOCAL_FOLDER;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>the path to the local folder: REEF_BASE_FOLDER/LOCAL_FOLDER</returns>
+        public string GetLocalFolderPath()
+        {
+            return LOCAL_FOLDER_PATH;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>The name under which the driver configuration will be stored in REEF_BASE_FOLDER/LOCAL_FOLDER</returns>
+        public string GetDriverConfigurationName()
+        {
+            return DRIVER_CONFIGURATION_NAME;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>The name under which the driver configuration will be stored in REEF_BASE_FOLDER/LOCAL_FOLDER</returns>
+        public string GetClrDriverConfigurationName()
+        {
+            return CLR_DRIVER_CONFIGURATION_NAME;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>The path to the driver configuration: GLOBAL_FOLDER/LOCAL_FOLDER/DRIVER_CONFIGURATION_NAME</returns>
+        public string GetDriverConfigurationPath()
+        {
+            return DRIVER_CONFIGURATION_PATH;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>The path to the CLR driver configuration: GLOBAL_FOLDER/LOCAL_FOLDER/CLR_DRIVER_CONFIGURATION_NAME</returns>
+        public string GetClrDriverConfigurationPath()
+        {
+            return CLR_DRIVER_CONFIGURATION_PATH;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>REEF_BASE_FOLDER/LOCAL_FOLDER</returns>
+        public string GetEvaluatorConfigurationName()
+        {
+            return EVALUATOR_CONFIGURATION_NAME;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>the path to the evaluator configuration.</returns>
+        public string GetEvaluatorConfigurationPath()
+        {
+            return EVALUATOR_CONFIGURATION_PATH;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns> The suffix used for JAR files, including the "."</returns>
+        public string GetJarFileSuffix()
+        {
+            return JAR_FILE_SUFFIX;
+        }
+
+        /// <summary>
+        /// The prefix used whenever REEF is asked to create a job folder, on (H)DFS or locally. This prefix is also used with
+        /// JAR files created to represent a job.
+        /// </summary>
+        /// <returns></returns>
+        public string GetJobFolderPrefix()
+        {
+            return JOB_FOLDER_PREFIX;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>The name used within the current working directory of the driver to redirect standard error to.</returns>
+        public string GetDriverStderrFileName()
+        {
+            return DRIVER_STDERR;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>The name used within the current working directory of the driver to redirect standard out to.</returns>
+        public string GetDriverStdoutFileName()
+        {
+            return DRIVER_STDOUT;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>The prefix used whenever REEF is asked to create an Evaluator folder, e.g. for staging.</returns>
+        public string GetEvaluatorFolderPrefix()
+        {
+            return EVALUATOR_FOLDER_PREFIX;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>The name used within the current working directory of the driver to redirect standard error to.</returns>
+        public string GetEvaluatorStderrFileName()
+        {
+            return EVALUATOR_STDERR;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>The name used within the current working directory of the driver to redirect standard out to.</returns>
+        public string GetEvaluatorStdoutFileName()
+        {
+            return EVALUATOR_STDOUT;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>the name of cpp bridge file</returns>
+        public string GetCppBridge()
+        {
+            return CPP_BRIDGE;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>reef driver app dll directory</returns>
+        public string GetReefDriverAppDllDir()
+        {
+            return REEF_DRIVER_APPDLL_DIR;
+        }
+
+        /// <summary>
+        /// The name of the Bridge DLL.
+        /// </summary>
+        /// <returns>The name of the Bridge DLL.</returns>
+        public string GetBridgeDLLName()
+        {
+            return BRIDGE_DLL_NAME;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>temp load directory</returns>
+        public string GetLoadDir()
+        {
+            return TMP_LOAD_DIR;
+        }
+
+        private static readonly string GLOBAL_FOLDER_PATH = Path.Combine(REEF_BASE_FOLDER, GLOBAL_FOLDER);
+        private static readonly string LOCAL_FOLDER_PATH = Path.Combine(REEF_BASE_FOLDER, LOCAL_FOLDER);
+
+        private static readonly string DRIVER_CONFIGURATION_PATH = Path.Combine(LOCAL_FOLDER_PATH,
+            DRIVER_CONFIGURATION_NAME);
+
+        private static readonly string CLR_DRIVER_CONFIGURATION_PATH = Path.Combine(LOCAL_FOLDER_PATH,
+            CLR_DRIVER_CONFIGURATION_NAME);
+
+        private static readonly string EVALUATOR_CONFIGURATION_PATH =
+            Path.Combine(LOCAL_FOLDER_PATH, EVALUATOR_CONFIGURATION_NAME);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj b/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj
index 20f2b8f..556b182 100644
--- a/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj
+++ b/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj
@@ -109,6 +109,7 @@ under the License.
     <Compile Include="Protobuf\ReefProtocol\ReefProtocol.pb.cs" />
     <Compile Include="Protobuf\ReefProtocol\ReefService.pb.cs" />
     <Compile Include="Protobuf\ReefProtocol\Serializer.cs" />
+    <Compile Include="Files\REEFFileNames.cs" />
     <Compile Include="Runtime\Evaluator\Constants.cs" />
     <Compile Include="Runtime\Evaluator\Context\ContextClientCodeException.cs" />
     <Compile Include="Runtime\Evaluator\Context\ContextConfiguration.cs" />

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Driver/Bridge/BridgeConfigurationProvider.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/BridgeConfigurationProvider.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/BridgeConfigurationProvider.cs
new file mode 100644
index 0000000..4f15b7c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/BridgeConfigurationProvider.cs
@@ -0,0 +1,133 @@
+/**
+ * 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.
+ */
+using System.IO;
+using Org.Apache.REEF.Common.Files;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Driver.Bridge
+{
+    /// <summary>
+    /// Helper class that provides the Bridge Configuration.
+    /// </summary>
+    /// <remarks>
+    /// The Bridge configuration file moved in the evolution of REEF (see [REEF-228]). This class hides the actual location
+    /// from client code and does the appropriate logging of its location.
+    /// </remarks>
+    internal sealed class BridgeConfigurationProvider
+    {
+        private static readonly Logger Logger = Logger.GetLogger(typeof(BridgeConfigurationProvider));
+        private readonly REEFFileNames _fileNames;
+
+        [Inject]
+        internal BridgeConfigurationProvider(REEFFileNames fileNames)
+        {
+            _fileNames = fileNames;
+        }
+
+        /// <summary>
+        /// Finds the path to the bridge configuration
+        /// </summary>
+        /// <remarks>
+        /// It tries both the new and the legacy locations and gives preference to the new locations. Warnings will be logged
+        /// when both are present as well as when the configuration is only present in the legacy location.
+        /// </remarks>
+        /// <exception cref="FileNotFoundException">When neither the legacy nor the new file exists.</exception>
+        /// <returns>The path to the bridge configuration</returns>
+        internal string GetBridgeConfigurationPath()
+        {
+            var newBridgeConfigurationPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(),
+                _fileNames.GetClrDriverConfigurationPath()));
+            var legacyBridgeConfigurationPath =
+                Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "reef", "global",
+                    "clrBridge.config"));
+
+            var newExists = File.Exists(newBridgeConfigurationPath);
+            var oldExists = File.Exists(legacyBridgeConfigurationPath);
+
+            if (newExists && oldExists)
+            {
+                Logger.Log(Level.Warning, "Found configurations in both the legacy location (" +
+                                          legacyBridgeConfigurationPath + ") and the new location (" +
+                                          newBridgeConfigurationPath +
+                                          "). Loading only the one found in the new location."
+                    );
+            }
+            if (newExists)
+            {
+                return newBridgeConfigurationPath;
+            }
+            if (oldExists)
+            {
+                Logger.Log(Level.Warning, "Only found configuration in the legacy location (" +
+                                          legacyBridgeConfigurationPath + ") and not the new location (" +
+                                          newBridgeConfigurationPath +
+                                          "). Loading only the one found in the legacy location.");
+                return legacyBridgeConfigurationPath;
+            }
+            // If we reached this, we weren't able to find the configuration file.
+            var message = "Unable to find brigde configuration. Paths checked: ['" +
+                          newBridgeConfigurationPath + "', '" +
+                          legacyBridgeConfigurationPath + "']";
+
+            Logger.Log(Level.Error, message);
+            var exception = new FileNotFoundException(message);
+            Exceptions.Throw(exception, Logger);
+            throw exception;
+        }
+
+        /// <summary>
+        /// Loads the bridge configuration from disk.
+        /// </summary>
+        /// <remarks>
+        /// It tries both the new and the legacy locations and gives preference to the new locations. Warnings will be logged
+        /// when both are present as well as when the configuration is read from the legacy location.
+        /// </remarks>
+        /// <exception cref="FileNotFoundException">When neither the legacy nor the new file exists.</exception>
+        /// <returns>The bridge Configuration loaded from disk</returns>
+        internal IConfiguration LoadBridgeConfiguration()
+        {
+            var bridgeConfigurationPath = GetBridgeConfigurationPath();
+            Logger.Log(Level.Info, "Loading configuration '" + bridgeConfigurationPath + "'.");
+            return new AvroConfigurationSerializer().FromFile(bridgeConfigurationPath);
+        }
+
+        /// <summary>
+        /// Same as LoadBridgeConfiguration for use in cases where Tang isn't available.
+        /// </summary>
+        /// <returns></returns>
+        internal static IConfiguration GetBridgeConfiguration()
+        {
+            return new BridgeConfigurationProvider(new REEFFileNames()).LoadBridgeConfiguration();
+        }
+
+        /// <summary>
+        /// Instantiates an IInjector using the bridge configuration.
+        /// </summary>
+        /// <returns></returns>
+        internal static IInjector GetBridgeInjector()
+        {
+            return TangFactory.GetTang().NewInjector(GetBridgeConfiguration());
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrHandlerHelper.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrHandlerHelper.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrHandlerHelper.cs
index 575519c..bce5ce4 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrHandlerHelper.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrHandlerHelper.cs
@@ -24,7 +24,6 @@ using System.IO;
 using System.Linq;
 using System.Runtime.InteropServices;
 using Org.Apache.REEF.Tang.Exceptions;
-using Org.Apache.REEF.Tang.Formats;
 using Org.Apache.REEF.Tang.Implementations.Tang;
 using Org.Apache.REEF.Tang.Interface;
 using Org.Apache.REEF.Tang.Protobuf;
@@ -80,30 +79,16 @@ namespace Org.Apache.REEF.Driver.Bridge
         {
             using (LOGGER.LogFunction("ClrHandlerHelper::GetCommandLineArguments"))
             {
-                string bridgeConfiguration = Path.Combine(Directory.GetCurrentDirectory(), "reef", "global",
-                                                          Constants.DriverBridgeConfiguration);
-
-                if (!File.Exists(bridgeConfiguration))
-                {
-                    string error = "Configuraiton file not found: " + bridgeConfiguration;
-                    LOGGER.Log(Level.Error, error);
-                    Exceptions.Throw(new InvalidOperationException(error), LOGGER);
-                }
                 CommandLineArguments arguments;
-                IInjector injector;
                 try
-                {
-                    IConfiguration driverBridgeConfiguration =
-                        new AvroConfigurationSerializer().FromFile(bridgeConfiguration);
-                    injector = TangFactory.GetTang().NewInjector(driverBridgeConfiguration);
-                    arguments = injector.GetInstance<CommandLineArguments>();
+                {                       
+                    arguments = BridgeConfigurationProvider.GetBridgeInjector().GetInstance<CommandLineArguments>();
                 }
                 catch (InjectionException e)
                 {
                     string error = "Cannot inject command line arguments from driver bridge configuration. ";
-                    Exceptions.Caught(e, Level.Error, error, LOGGER);
-                    // return empty string set
-                    return new HashSet<string>();
+                    Exceptions.CaughtAndThrow(e, Level.Error, error, LOGGER);
+                    throw e;
                 }
                 return arguments.Arguments;
             }
@@ -116,7 +101,7 @@ namespace Org.Apache.REEF.Driver.Bridge
             File.WriteAllText(path, string.Join(",", classPaths));
         }
 
-        public static void GenerateClassHierarchy(HashSet<string> clrDlls)
+        public static void GenerateClassHierarchy(ISet<string> clrDlls)
         {
             using (LOGGER.LogFunction("ClrHandlerHelper::GenerateClassHierarchy"))
             {

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrSystemHandlerWrapper.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrSystemHandlerWrapper.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrSystemHandlerWrapper.cs
index 80d22f5..3a65103 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrSystemHandlerWrapper.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrSystemHandlerWrapper.cs
@@ -18,10 +18,13 @@
  */
 
 using System;
+using System.CodeDom;
 using System.Globalization;
 using System.IO;
 using System.Runtime.InteropServices;
+using Org.Apache.REEF.Common;
 using Org.Apache.REEF.Common.Context;
+using Org.Apache.REEF.Common.Files;
 using Org.Apache.REEF.Driver.Bridge.Clr2java;
 using Org.Apache.REEF.Driver.Bridge.Events;
 using Org.Apache.REEF.Driver.Context;
@@ -167,10 +170,22 @@ namespace Org.Apache.REEF.Driver.Bridge
         {
             using (LOGGER.LogFunction("ClrSystemHandlerWrapper::Call_ClrSystemHttpServer_OnNext"))
             {
-                GCHandle gc = GCHandle.FromIntPtr((IntPtr)handle);
-                ClrSystemHandler<IHttpMessage> obj = (ClrSystemHandler<IHttpMessage>)gc.Target;
-                obj.OnNext(new HttpMessage(clr2Java));
-            }      
+                try
+                {
+                    GCHandle gc = GCHandle.FromIntPtr((IntPtr) handle);
+                    if (!gc.IsAllocated)
+                    {
+                        LOGGER.Log(Level.Warning, "gc is not allocated.");
+                    } 
+                    ClrSystemHandler<IHttpMessage> obj = (ClrSystemHandler<IHttpMessage>) gc.Target;
+                    obj.OnNext(new HttpMessage(clr2Java));
+                }
+                catch (Exception ex)
+                {
+                  
+                    LOGGER.Log(Level.Info, "Caught exception: " + ex.Message + ex.StackTrace );
+                    Exceptions.CaughtAndThrow(ex, Level.Warning,  LOGGER);
+                }}
         }
 
         public static void Call_ClrSystemClosedContext_OnNext(ulong handle, IClosedContextClr2Java clr2Java)
@@ -235,32 +250,16 @@ namespace Org.Apache.REEF.Driver.Bridge
 
         private static ulong[] GetHandlers(string httpServerPortNumber)
         {
-            IStartHandler startHandler;
-            IInjector injector = null;
-            string errorMessage;
-            string bridgeConfiguration = Path.Combine(Directory.GetCurrentDirectory(), "reef", "global", Constants.DriverBridgeConfiguration);
-            if (!File.Exists(bridgeConfiguration))
-            {
-                errorMessage = "Cannot find CLR Driver bridge configuration file " + bridgeConfiguration;
-                Exceptions.Throw(new InvalidOperationException(errorMessage), LOGGER);
-            }
-            try
-            {
-                IConfiguration driverBridgeConfiguration = new AvroConfigurationSerializer().FromFile(bridgeConfiguration);
-                injector = TangFactory.GetTang().NewInjector(driverBridgeConfiguration);
-            }
-            catch (Exception e)
-            {
-                errorMessage = "Failed to get injector from driver bridge configuration.";
-                Exceptions.CaughtAndThrow(new InvalidOperationException(errorMessage, e), Level.Error, errorMessage, LOGGER);
-            }
+            var injector = BridgeConfigurationProvider.GetBridgeInjector();
 
             try
             {
-                HttpServerPort port = injector.GetInstance<HttpServerPort>();
-                port.PortNumber = httpServerPortNumber == null ? 0 : int.Parse(httpServerPortNumber, CultureInfo.InvariantCulture);
+                var port = injector.GetInstance<HttpServerPort>();
+                port.PortNumber = httpServerPortNumber == null
+                    ? 0
+                    : int.Parse(httpServerPortNumber, CultureInfo.InvariantCulture);
 
-                startHandler = injector.GetInstance<IStartHandler>();
+                var startHandler = injector.GetInstance<IStartHandler>();
                 LOGGER.Log(Level.Info, "Start handler set to be " + startHandler.Identifier);
                 _driverBridge = injector.GetInstance<DriverBridge>();
             }

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Driver/Constants.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Constants.cs b/lang/cs/Org.Apache.REEF.Driver/Constants.cs
index 0ec5659..011d4e0 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Constants.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/Constants.cs
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+using System;
 using System.Collections.Generic;
 
 namespace Org.Apache.REEF.Driver
@@ -67,6 +68,7 @@ namespace Org.Apache.REEF.Driver
 
         public const string DriverRestartRunningTaskHandler = "DriverRestartRunningTask";
 
+        [Obsolete(message:"Use REEFFileNames instead.")]
         public const string DriverBridgeConfiguration = Common.Constants.ClrBridgeRuntimeConfiguration;
 
         public const string DriverAppDirectory = "ReefDriverAppDlls";

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj b/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj
index 359b956..9e26254 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj
+++ b/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj
@@ -38,6 +38,7 @@ under the License.
     <Reference Include="System.Runtime.Serialization" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Bridge\BridgeConfigurationProvider.cs" />
     <Compile Include="Bridge\BridgeLogger.cs" />
     <Compile Include="Bridge\Clr2java\IActiveContextClr2Java.cs" />
     <Compile Include="Bridge\Clr2java\IAllocatedEvaluaotrClr2Java.cs" />

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/561e7a0a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/App.config
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/App.config b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/App.config
new file mode 100644
index 0000000..e429816
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/App.config
@@ -0,0 +1,24 @@
+<?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.5" />
+    </startup>
+</configuration>
\ No newline at end of file