http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/FailedTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/FailedTask.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/FailedTask.cs
new file mode 100644
index 0000000..119ec98
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/FailedTask.cs
@@ -0,0 +1,141 @@
+/**
+ * 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.Runtime.Serialization;
+using Org.Apache.REEF.Driver.Bridge.Clr2java;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Driver.Task;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Driver.Bridge.Events
+{
+    public class FailedTask : IFailedTask
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(FailedTask));
+        
+        public FailedTask(IFailedTaskClr2Java failedTaskClr2Java)
+        {
+            InstanceId = Guid.NewGuid().ToString("N");
+            Parse(failedTaskClr2Java);
+            FailedTaskClr2Java = failedTaskClr2Java;
+            ActiveContextClr2Java = failedTaskClr2Java.GetActiveContext();
+        }
+
+        public Optional<string> Reason { get; set; }
+
+        [DataMember]
+        public string InstanceId { get; set; }
+
+        public string Id { get; set; }
+
+        public string Message { get; set; }
+
+        public Optional<string> Description { get; set; }
+
+        public Optional<Exception> Cause { get; set; }
+
+        public Optional<byte[]> Data { get; set; }
+
+        [DataMember]
+        private IFailedTaskClr2Java FailedTaskClr2Java { get; set; }
+
+        [DataMember]
+        private IActiveContextClr2Java ActiveContextClr2Java { get; set; }
+
+        /// <summary>
+        /// Access the context the task ran (and crashed) on, if it could be 
recovered.
+        /// An ActiveContext is given when the task fails but the context 
remains alive.
+        /// On context failure, the context also fails and is surfaced via the 
FailedContext event.
+        /// Note that receiving an ActiveContext here is no guarantee that the 
context (and evaluator)
+        /// are in a consistent state. Application developers need to 
investigate the reason available
+        /// via getCause() to make that call.
+        /// return the context the Task ran on.
+        /// </summary>
+        public Optional<IActiveContext> GetActiveContext()
+        {
+            IActiveContext activeContext = new 
ActiveContext(ActiveContextClr2Java);
+            return ActiveContextClr2Java == null ? 
Optional<IActiveContext>.Empty() : Optional<IActiveContext>.Of(activeContext);
+        }
+
+        public Exception AsError()
+        {
+            throw new NotImplementedException();
+        }
+
+        private void Parse(IFailedTaskClr2Java failedTaskClr2Java)
+        {
+            string serializedInfo = failedTaskClr2Java.GetString();
+            LOGGER.Log(Level.Verbose, "serialized failed task: " + 
serializedInfo);
+            Dictionary<string, string> settings = new Dictionary<string, 
string>();
+            string[] components = serializedInfo.Split(',');
+            foreach (string component in components)
+            {
+                string[] pair = component.Trim().Split('=');
+                if (pair == null || pair.Length != 2)
+                {
+                    Exceptions.Throw(new ArgumentException("invalid component 
to be used as key-value pair:", component), LOGGER);
+                }
+                settings.Add(pair[0], pair[1]);
+            }
+
+            string id;
+            if (!settings.TryGetValue("Identifier", out id))
+            {
+                Exceptions.Throw(new ArgumentException("cannot find Identifier 
entry."), LOGGER);
+            }
+            Id = id;
+
+            string msg;
+            if (!settings.TryGetValue("Message", out msg))
+            {
+                LOGGER.Log(Level.Verbose, "no Message in Failed Task.");
+                msg = string.Empty;
+            }
+            Message = msg;
+
+            string description;
+            if (!settings.TryGetValue("Description", out description))
+            {
+                LOGGER.Log(Level.Verbose, "no Description in Failed Task.");
+                description = string.Empty;
+            }
+            Description = string.IsNullOrWhiteSpace(description) ? 
Optional<string>.Empty() : Optional<string>.Of(description);
+
+            string cause;
+            if (!settings.TryGetValue("Cause", out cause))
+            {
+                LOGGER.Log(Level.Verbose, "no Cause in Failed Task.");
+                cause = string.Empty;
+            }
+            Reason = string.IsNullOrWhiteSpace(cause) ? 
Optional<string>.Empty() : Optional<string>.Of(cause);
+
+            string rawData;
+            if (!settings.TryGetValue("Data", out rawData))
+            {
+                LOGGER.Log(Level.Verbose, "no Data in Failed Task.");
+                rawData = string.Empty;
+            }
+            Data = string.IsNullOrWhiteSpace(rawData) ? 
Optional<byte[]>.Empty() : 
Optional<byte[]>.Of(ByteUtilities.StringToByteArrays(rawData));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/RunningTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/RunningTask.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/RunningTask.cs
new file mode 100644
index 0000000..a38f6d5
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/RunningTask.cs
@@ -0,0 +1,98 @@
+/**
+ * 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.Driver.Bridge.Clr2java;
+using Org.Apache.REEF.Driver.Task;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Driver.Bridge.Events
+{
+    public class RunningTask : IRunningTask
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(RunningTask));
+        private IRunningTaskClr2Java _runningTaskClr2Java;
+        private IActiveContextClr2Java _activeContextClr2Java;
+
+        public RunningTask(IRunningTaskClr2Java runningTaskClr2Java)
+        {
+            using (LOGGER.LogFunction("RunningTask::RunningTask"))
+            {
+                _runningTaskClr2Java = runningTaskClr2Java;
+                _activeContextClr2Java = 
runningTaskClr2Java.GetActiveContext();
+            }
+        }
+
+        public Context.IActiveContext ActiveContext
+        {
+            get
+            {
+                return new ActiveContext(_activeContextClr2Java);
+            }
+            
+            set
+            {
+                ActiveContext = value;
+            }
+        }
+
+        public string Id
+        {
+            get
+            {
+                return _runningTaskClr2Java.GetId();
+            }
+
+            set
+            {
+                Id = value;
+            }
+        }
+
+        public void Send(byte[] message)
+        {
+            _runningTaskClr2Java.Send(message);
+        }
+
+        public void OnNext(byte[] message)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void Suspend(byte[] message)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void Suspend()
+        {
+            throw new NotImplementedException();
+        }
+
+        public void Dispose(byte[] message)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void Dispose()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/SuspendedTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/SuspendedTask.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/SuspendedTask.cs
new file mode 100644
index 0000000..a694289
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/SuspendedTask.cs
@@ -0,0 +1,83 @@
+/**
+ * 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.Runtime.Serialization;
+using Org.Apache.REEF.Driver.Bridge.Clr2java;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Driver.Task;
+
+namespace Org.Apache.REEF.Driver.Bridge.Events
+{
+    [DataContract]
+    internal class SuspendedTask : ISuspendedTask
+    {
+        internal SuspendedTask(ISuspendedTaskClr2Java suspendedTaskClr2Java)
+        {
+            InstanceId = Guid.NewGuid().ToString("N");
+            SuspendedTaskClr2Java = suspendedTaskClr2Java;
+            ActiveContextClr2Java = suspendedTaskClr2Java.GetActiveContext();
+        }
+
+        [DataMember]
+        public string InstanceId { get; set; }
+
+        public byte[] Message
+        {
+            get
+            {
+                return SuspendedTaskClr2Java.Get();
+            }
+
+            set
+            {
+            }
+        }
+
+        public string Id
+        {
+            get
+            {
+                return SuspendedTaskClr2Java.GetId();
+            }
+
+            set
+            {
+            }
+        }
+
+        public IActiveContext ActiveContext
+        {
+            get
+            {
+                return new ActiveContext(ActiveContextClr2Java);
+            }
+
+            set
+            {
+            }
+        }
+
+        [DataMember]
+        private ISuspendedTaskClr2Java SuspendedTaskClr2Java { get; set; }
+
+        [DataMember]
+        private IActiveContextClr2Java ActiveContextClr2Java { get; set; }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/TaskMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/TaskMessage.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/TaskMessage.cs
new file mode 100644
index 0000000..b905a92
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/TaskMessage.cs
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Runtime.Serialization;
+using Org.Apache.REEF.Driver.Bridge.Clr2java;
+using Org.Apache.REEF.Driver.Task;
+
+namespace Org.Apache.REEF.Driver.Bridge.Events
+{
+    /// <summary>
+    /// TaskMessage which wraps ITaskMessageClr2Java
+    /// </summary>
+    [DataContract]
+    internal class TaskMessage : ITaskMessage
+    {
+        private ITaskMessageClr2Java _taskMessageClr2Java;
+        private byte[] _message;
+        private string _instanceId;
+
+        public TaskMessage(ITaskMessageClr2Java clr2Java, byte[] message)
+        {
+            _instanceId = Guid.NewGuid().ToString("N");
+            _taskMessageClr2Java = clr2Java;
+            _message = message;
+        }
+
+        [DataMember]
+        public string InstanceId
+        {
+            get { return _instanceId; }
+            set { _instanceId = value; }
+        }
+
+        [DataMember]
+        public string TaskId
+        {
+            get { return _taskMessageClr2Java.GetId(); }
+            set { }
+        }
+
+        [DataMember]
+        public byte[] Message
+        {
+            get { return _message; }
+            set { _message = value; } 
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpMessage.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpMessage.cs
new file mode 100644
index 0000000..2a64852
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpMessage.cs
@@ -0,0 +1,61 @@
+/**
+ * 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.Runtime.Serialization;
+using Org.Apache.REEF.Driver.Bridge.Clr2java;
+
+namespace Org.Apache.REEF.Driver.Bridge
+{
+    [DataContract]
+    public class HttpMessage : IHttpMessage
+    {
+        public HttpMessage(IHttpServerBridgeClr2Java httpServerBridgeClr2Java)
+        {
+            HttpServerBridgeClr2Java = httpServerBridgeClr2Java;
+        }
+
+        [DataMember]
+        private IHttpServerBridgeClr2Java HttpServerBridgeClr2Java { get; set; 
}
+
+        public string GetRequestString()
+        {
+            return HttpServerBridgeClr2Java.GetQueryString();
+        }
+
+        public void SetQueryResult(string responseString)
+        {
+            HttpServerBridgeClr2Java.SetQueryResult(responseString);
+        }
+
+        public byte[] GetQueryReuestData()
+        {
+            return HttpServerBridgeClr2Java.GetQueryRequestData();            
+        }
+
+        public void SetQueryResponseData(byte[] responseData)
+        {
+            HttpServerBridgeClr2Java.SetQueryResponseData(responseData);
+        }
+
+        public void SetUriSpecification(string uriSpecification)
+        {
+            HttpServerBridgeClr2Java.SetUriSpecification(uriSpecification);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpServerHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpServerHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpServerHandler.cs
new file mode 100644
index 0000000..8dba521
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpServerHandler.cs
@@ -0,0 +1,164 @@
+/**
+ * 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.Common.Avro;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Net;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Driver.Bridge
+{
+    /// <summary>
+    ///  HttpServerHandler, the handler for all CLR http events
+    /// </summary>
+    public class HttpServerHandler : IObserver<IHttpMessage>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(HttpServerHandler));
+
+        private static readonly string SPEC = "SPEC";
+
+        private IDictionary<string, IHttpHandler> eventHandlers = new 
Dictionary<string, IHttpHandler>();
+
+        private HttpServerPort httpServerPort;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="HttpServerHandler" /> 
class.
+        /// </summary>
+        /// <param name="httpEventHandlers">The HTTP event handlers.</param>
+        /// <param name="httpServerPort">The HTTP server port.</param>
+        [Inject]
+        public HttpServerHandler([Parameter(Value = 
typeof(DriverBridgeConfigurationOptions.HttpEventHandlers))] ISet<IHttpHandler> 
httpEventHandlers,
+                                 HttpServerPort httpServerPort)
+        {
+            LOGGER.Log(Level.Info, "Constructing HttpServerHandler");       
+            foreach (var h in httpEventHandlers)
+            {
+                string spec = h.GetSpecification();
+                if (spec.Contains(":"))
+                {
+                    Exceptions.Throw(new ArgumentException("spec cannot 
contain :"), "The http spec given is " + spec, LOGGER);
+                }
+                LOGGER.Log(Level.Info, "HttpHandler spec:" + spec);   
+                eventHandlers.Add(spec.ToLower(CultureInfo.CurrentCulture), h);
+            }
+            this.httpServerPort = httpServerPort;
+        }
+
+        /// <summary>
+        /// Called when receving an http request from Java side
+        /// </summary>
+        /// <param name="httpMessage">The HTTP message.</param>
+        public void OnNext(IHttpMessage httpMessage)
+        {
+            LOGGER.Log(Level.Info, "HttpHandler OnNext is called");
+            string requestString = httpMessage.GetRequestString();
+
+            if (requestString != null && requestString.Equals(SPEC))
+            {
+                LOGGER.Log(Level.Info, "HttpHandler OnNext, requestString:" + 
requestString);
+                LOGGER.Log(Level.Info, "HttpHandler OnNext, port number:" + 
httpServerPort.PortNumber);
+
+                httpMessage.SetUriSpecification(GetAllSpecifications());
+            }
+            else
+            {
+                LOGGER.Log(Level.Info, "HttpHandler OnNext, handling http 
request.");
+                byte[] byteData = httpMessage.GetQueryReuestData();            
        
+                AvroHttpRequest avroHttpRequest = 
AvroHttpSerializer.FromBytes(byteData);
+                LOGGER.Log(Level.Info, "HttpHandler OnNext, requestData:" + 
avroHttpRequest);
+
+                string spec = GetSpecification(avroHttpRequest.PathInfo);
+                if (spec != null)
+                {
+                    LOGGER.Log(Level.Info, "HttpHandler OnNext, target:" + 
spec);
+                    ReefHttpRequest request = ToHttpRequest(avroHttpRequest);
+                    ReefHttpResponse response = new ReefHttpResponse();
+
+                    IHttpHandler handler;
+                    
eventHandlers.TryGetValue(spec.ToLower(CultureInfo.CurrentCulture), out 
handler);
+
+                    byte[] responseData;
+                    if (handler != null)
+                    {
+                        LOGGER.Log(Level.Info, "HttpHandler OnNext, get 
eventHandler:" + handler.GetSpecification());
+                        handler.OnHttpRequest(request, response);
+                        responseData = response.OutputStream;
+                    }
+                    else
+                    {
+                        responseData =
+                            
ByteUtilities.StringToByteArrays(string.Format(CultureInfo.CurrentCulture,
+                                                                           "No 
event handler found at CLR side for {0}.",
+                                                                           
spec));
+                    }
+                    httpMessage.SetQueryResponseData(responseData);
+                }
+            }
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        private string GetAllSpecifications()
+        {
+            return string.Join(":", eventHandlers.Keys.ToArray());
+        }
+
+        private string GetSpecification(string requestUri)
+        {
+            if (requestUri != null)
+            {
+                string[] parts = requestUri.Split('/');
+
+                if (parts.Length > 1)
+                {
+                    return parts[1];
+                }
+            }
+            return null;            
+        }
+
+        private ReefHttpRequest ToHttpRequest(AvroHttpRequest avroRequest)
+        {
+            ReefHttpRequest httpRequest = new ReefHttpRequest();
+            httpRequest.PathInfo = avroRequest.PathInfo;
+            httpRequest.InputStream = avroRequest.InputStream;
+            httpRequest.Url = avroRequest.RequestUrl;
+            httpRequest.Querystring = avroRequest.QueryString;
+
+            HttpMethod m;
+            HttpMethod.TryParse(avroRequest.HttpMethod, true, out m);
+            httpRequest.Method = m;
+            return httpRequest;
+        }    
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpServerPort.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpServerPort.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpServerPort.cs
new file mode 100644
index 0000000..d0067e7
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/HttpServerPort.cs
@@ -0,0 +1,33 @@
+/**
+ * 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.Driver.Bridge
+{
+    public class HttpServerPort
+    {
+        [Inject]
+        public HttpServerPort()
+        {            
+        }
+
+        public int PortNumber { get; set; }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/IHttpHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/IHttpHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/IHttpHandler.cs
new file mode 100644
index 0000000..409c974
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/IHttpHandler.cs
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Org.Apache.REEF.Driver.Bridge;
+
+namespace Org.Apache.REEF.Driver.Bridge
+{
+    public interface IHttpHandler
+    {
+        /// <summary>
+        /// Define the specification of the handler. ":" is not allowed in the 
specification.
+        /// </summary>
+        /// <returns>string specification</returns>
+        string GetSpecification();
+
+        /// <summary>
+        /// Called when Http request is sent
+        /// </summary>
+        /// <param name="requet">The requet.</param>
+        /// <param name="resonse">The resonse.</param>
+        void OnHttpRequest(ReefHttpRequest requet, ReefHttpResponse resonse);  
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/IHttpMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/IHttpMessage.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/IHttpMessage.cs
new file mode 100644
index 0000000..155d7ab
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/IHttpMessage.cs
@@ -0,0 +1,33 @@
+/**
+ * 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.Driver.Bridge
+{
+    public interface IHttpMessage
+    {
+        string GetRequestString();
+        
+        void SetQueryResult(string responseString);
+
+        byte[] GetQueryReuestData();
+
+        void SetQueryResponseData(byte[] responseData);
+        
+        void SetUriSpecification(string uriSpecification);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/ReefHttpRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/ReefHttpRequest.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/ReefHttpRequest.cs
new file mode 100644
index 0000000..97c0465
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/ReefHttpRequest.cs
@@ -0,0 +1,49 @@
+/**
+ * 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.Globalization;
+
+namespace Org.Apache.REEF.Driver.Bridge
+{
+    public enum HttpMethod
+    {
+        Post,
+        Put,
+        Get,
+        Delete
+    }
+
+    public class ReefHttpRequest
+    {
+        public HttpMethod Method { get; set; }
+
+        public string Url { get; set; }
+
+        public string Querystring { get; set; }
+
+        public byte[] InputStream { get; set; }
+
+        public string PathInfo { get; set; }
+
+        public string Tostring()
+        {
+            return string.Format(CultureInfo.InvariantCulture, "Url: {0}, 
query string {1}", Url, Querystring);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Bridge/ReefHttpResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/ReefHttpResponse.cs 
b/lang/cs/Org.Apache.REEF.Driver/Bridge/ReefHttpResponse.cs
new file mode 100644
index 0000000..73b64cc
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/ReefHttpResponse.cs
@@ -0,0 +1,30 @@
+/**
+ * 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.Net;
+
+namespace Org.Apache.REEF.Driver.Bridge
+{
+    public class ReefHttpResponse
+    {
+        public byte[] OutputStream { get; set; }
+
+        public HttpStatusCode Status { get; set; }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/ClientManager.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/ClientManager.cs 
b/lang/cs/Org.Apache.REEF.Driver/ClientManager.cs
index ebb56b5..a00c261 100644
--- a/lang/cs/Org.Apache.REEF.Driver/ClientManager.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/ClientManager.cs
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-using Org.Apache.REEF.Common.ProtoBuf.ClienRuntimeProto;
 using System;
+using Org.Apache.REEF.Common.Protobuf.ReefProtocol;
 
 // TODO
 namespace Org.Apache.REEF.Driver

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/ContextConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Context/ContextConfiguration.cs 
b/lang/cs/Org.Apache.REEF.Driver/Context/ContextConfiguration.cs
new file mode 100644
index 0000000..1bcea1b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Context/ContextConfiguration.cs
@@ -0,0 +1,93 @@
+/**
+ * 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.Common.Context;
+using Org.Apache.REEF.Common.Events;
+using Org.Apache.REEF.Common.Tasks;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Util;
+using System;
+using System.Diagnostics.CodeAnalysis;
+using Org.Apache.REEF.Common.Tasks.Events;
+
+[module: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", 
"SA1401:FieldsMustBePrivate", Justification = "static field, typical usage in 
configurations")]
+
+namespace Org.Apache.REEF.Driver.Context
+{
+    public class ContextConfiguration : ConfigurationModuleBuilder
+    {
+        /// <summary>
+        ///  The identifier of the context.
+        /// </summary>
+        [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read 
only mutable reference types", Justification = "not applicable")]
+        public static readonly RequiredParameter<string> Identifier = new 
RequiredParameter<string>();
+
+        /// <summary>
+        ///  for context start. Defaults to logging if not bound.
+        /// </summary>
+        [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read 
only mutable reference types", Justification = "not applicable")]
+        public static readonly OptionalImpl<IObserver<IContextStart>> 
OnContextStart = new OptionalImpl<IObserver<IContextStart>>();
+
+        /// <summary>
+        /// for context stop. Defaults to logging if not bound.
+        /// </summary>
+        [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read 
only mutable reference types", Justification = "not applicable")]
+        public static readonly OptionalImpl<IObserver<IContextStop>> 
OnContextStop = new OptionalImpl<IObserver<IContextStop>>();
+
+        /// <summary>
+        ///  to be informed right before a Task enters its call() method.
+        /// </summary>
+        [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read 
only mutable reference types", Justification = "not applicable")]
+        public static readonly OptionalImpl<IObserver<ITaskStart>> OnTaskStart 
= new OptionalImpl<IObserver<ITaskStart>>();
+
+        /// <summary>
+        ///  to be informed right after a Task exits its call() method.
+        /// </summary>
+        [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read 
only mutable reference types", Justification = "not applicable")]
+        public static readonly OptionalImpl<IObserver<ITaskStop>> OnTaskStop = 
new OptionalImpl<IObserver<ITaskStop>>();
+
+        /// <summary>
+        ///  Source of messages to be called whenever the evaluator is about 
to make a heartbeat.
+        /// </summary>
+        [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read 
only mutable reference types", Justification = "not applicable")]
+        public static readonly OptionalImpl<IContextMessageSource> 
OnSendMessage = new OptionalImpl<IContextMessageSource>();
+
+        /// <summary>
+        ///   Driver has sent the context a message, and this parameter is 
used to register a handler on the context for processing that message.
+        /// </summary>
+        [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read 
only mutable reference types", Justification = "not applicable")]
+        public static readonly OptionalImpl<IContextMessageHandler> OnMessage 
= new OptionalImpl<IContextMessageHandler>();
+
+        public static ConfigurationModule ConfigurationModule
+        {
+            get
+            {
+                return new ContextConfiguration()
+                    
.BindNamedParameter(GenericType<ContextConfigurationOptions.ContextIdentifier>.Class,
 Identifier)
+                    
.BindSetEntry(GenericType<ContextConfigurationOptions.StartHandlers>.Class, 
OnContextStart)
+                    
.BindSetEntry(GenericType<ContextConfigurationOptions.StopHandlers>.Class, 
OnContextStop)
+                    
.BindSetEntry(GenericType<ContextConfigurationOptions.ContextMessageSources>.Class,
 OnSendMessage)
+                    
.BindSetEntry(GenericType<ContextConfigurationOptions.ContextMessageHandlers>.Class,
 OnMessage)
+                    
.BindSetEntry(GenericType<TaskConfigurationOptions.StartHandlers>.Class, 
OnTaskStart)
+                    
.BindSetEntry(GenericType<TaskConfigurationOptions.StopHandlers>.Class, 
OnTaskStop)
+                    .Build();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/ContextConfigurationOptions.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Context/ContextConfigurationOptions.cs 
b/lang/cs/Org.Apache.REEF.Driver/Context/ContextConfigurationOptions.cs
new file mode 100644
index 0000000..48eba08
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Context/ContextConfigurationOptions.cs
@@ -0,0 +1,61 @@
+/**
+ * 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.Common.Context;
+using Org.Apache.REEF.Common.Events;
+using Org.Apache.REEF.Driver.Defaults;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Formats;
+using System;
+using System.Collections.Generic;
+using Org.Apache.REEF.Driver.Context.Defaults;
+
+namespace Org.Apache.REEF.Driver.Context
+{
+    /// <summary>
+    ///  Configuration parameters for ContextConfiguration module.
+    /// </summary>
+    public class ContextConfigurationOptions : ConfigurationModuleBuilder 
+    {
+        [NamedParameter(documentation: "The identifier for the context.")]
+        public class ContextIdentifier : Name<string>
+        {
+        }
+
+        [NamedParameter(documentation: "The set of event handlers for the 
ContextStart event", defaultClasses: new[] { typeof(DefaultContextStartHandler) 
})]
+        public class StartHandlers : Name<ISet<IObserver<IContextStart>>>
+        {
+        }
+
+        [NamedParameter(documentation: "The set of event handlers for the 
ContextStop event", defaultClasses: new[] { typeof(DefaultContextStopHandler) 
})]
+        public class StopHandlers : Name<ISet<IObserver<IContextStop>>>
+        {
+        }
+
+        [NamedParameter(documentation: "The set of ContextMessageSource 
implementations called during heartbeats.", defaultClasses: new[] { 
typeof(DefaultContextMessageSource) })]
+        public class ContextMessageSources : Name<ISet<IContextMessageSource>>
+        {
+        }
+
+        [NamedParameter(documentation: "The set of Context message handlers.")]
+        public class ContextMessageHandlers : 
Name<ISet<IContextMessageHandler>>
+        {
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextMessageSource.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextMessageSource.cs
 
b/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextMessageSource.cs
new file mode 100644
index 0000000..1c42990
--- /dev/null
+++ 
b/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextMessageSource.cs
@@ -0,0 +1,42 @@
+/**
+ * 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.Common.Context;
+using Org.Apache.REEF.Utilities;
+
+namespace Org.Apache.REEF.Driver.Context.Defaults
+{
+    /// <summary>
+    /// Default ContextMessageSource: return nothing.
+    /// </summary>
+    public class DefaultContextMessageSource : IContextMessageSource
+    {
+        public Optional<Common.Context.ContextMessage> Message
+        {
+            get
+            {
+                return Optional<Common.Context.ContextMessage>.Empty();
+            }
+
+            set
+            {
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextStartHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextStartHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextStartHandler.cs
new file mode 100644
index 0000000..1d5262e
--- /dev/null
+++ 
b/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextStartHandler.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 System;
+using Org.Apache.REEF.Common.Events;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Driver.Context.Defaults
+{
+   /// <summary>
+    /// Default handler for ContextStart
+   /// </summary>
+    public class DefaultContextStartHandler : IObserver<IContextStart>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultContextStartHandler));
+
+        public void OnNext(IContextStart contextStart)
+        {
+            LOGGER.Log(Level.Info, "DefaultContextStartHandler received for 
context: " + contextStart.Id);
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextStopHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextStopHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextStopHandler.cs
new file mode 100644
index 0000000..ccbf28b
--- /dev/null
+++ 
b/lang/cs/Org.Apache.REEF.Driver/Context/Defaults/DefaultContextStopHandler.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 System;
+using Org.Apache.REEF.Common.Events;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Driver.Context.Defaults
+{
+    /// <summary>
+    /// Default event handler for ContextStop
+    /// </summary>
+    public class DefaultContextStopHandler : IObserver<IContextStop>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultContextStopHandler));
+
+        public void OnNext(IContextStop contextStop)
+        {
+            LOGGER.Log(Level.Info, "DefaultContextStopHandler received for 
context: " + contextStop.Id);
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/EvaluatorContext.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Context/EvaluatorContext.cs 
b/lang/cs/Org.Apache.REEF.Driver/Context/EvaluatorContext.cs
new file mode 100644
index 0000000..4538112
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Context/EvaluatorContext.cs
@@ -0,0 +1,147 @@
+/**
+ * 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.Globalization;
+using Org.Apache.REEF.Common.Protobuf.ReefProtocol;
+using Org.Apache.REEF.Driver.Bridge.Events;
+using Org.Apache.REEF.Driver.Evaluator;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Driver.Context
+{
+    public class EvaluatorContext : IActiveContext
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(EvaluatorContext));
+        
+        private string _identifier;
+
+        private Optional<string> _parentId;
+
+        private EvaluatorManager _evaluatorManager;
+
+        private bool _disposed = false;
+
+        public EvaluatorContext(EvaluatorManager evaluatorManager, string id, 
Optional<string> parentId)
+        {
+            _identifier = id;
+            _parentId = parentId;
+            _evaluatorManager = evaluatorManager;
+        }
+
+        public string Id
+        {
+            get
+            {
+                return _identifier;
+            }
+
+            set
+            {
+            }
+        }
+
+        public string EvaluatorId
+        {
+            get
+            {
+                return _evaluatorManager.Id;
+            }
+
+            set
+            {
+            }
+        }
+
+        public Optional<string> ParentId
+        {
+            get
+            {
+                return _parentId;
+            }
+
+            set
+            {
+            }
+        }
+
+        public IEvaluatorDescriptor EvaluatorDescriptor
+        {
+            get
+            {
+                return _evaluatorManager.EvaluatorDescriptor;
+            }
+
+            set
+            {
+            }
+        }
+
+        public void Dispose()
+        {
+            if (_disposed)
+            {
+                var e = new 
InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Active 
context [{0}] already closed", _identifier));
+                Exceptions.Throw(e, LOGGER);
+            }
+            LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, 
"Submit close context: RunningEvaluator id [{0}] for context id [{1}]", 
EvaluatorId, Id));
+            RemoveContextProto removeContextProto = new RemoveContextProto();
+            removeContextProto.context_id = Id;
+            ContextControlProto contextControlProto = new 
ContextControlProto();
+            contextControlProto.remove_context = removeContextProto;
+            _evaluatorManager.Handle(contextControlProto);
+            _disposed = true;
+        }
+
+        public ClosedContext GetClosedContext(IActiveContext parentContext)
+        {
+            //return new ClosedContext(parentContext, EvaluatorId, Id, 
ParentId, EvaluatorDescriptor);
+            throw new NotImplementedException();
+        }
+
+        public FailedContext GetFailedContext(Optional<IActiveContext> 
parentContext, Exception cause)
+        {
+            //return new FailedContext(parentContext, Id, cause, EvaluatorId, 
ParentId, EvaluatorDescriptor);
+            throw new NotImplementedException();
+        }
+
+        public void SubmitTask(IConfiguration taskConf)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void SubmitContext(IConfiguration contextConfiguration)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void SubmitContextAndService(IConfiguration 
contextConfiguration, IConfiguration serviceConfiguration)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void SendMessage(byte[] message)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/IActiveContext.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Context/IActiveContext.cs 
b/lang/cs/Org.Apache.REEF.Driver/Context/IActiveContext.cs
new file mode 100644
index 0000000..87ae9d2
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Context/IActiveContext.cs
@@ -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.
+ */
+
+using Org.Apache.REEF.Common;
+using System;
+
+namespace Org.Apache.REEF.Driver.Context
+{
+    public interface IActiveContext : IDisposable, IContext, ITaskSubmittable, 
IContextSubmittable
+    {
+        void SendMessage(byte[] message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/IClosedContext.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Context/IClosedContext.cs 
b/lang/cs/Org.Apache.REEF.Driver/Context/IClosedContext.cs
new file mode 100644
index 0000000..1fc0213
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Context/IClosedContext.cs
@@ -0,0 +1,26 @@
+/**
+ * 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.Driver.Context
+{
+    public interface IClosedContext : IContext
+    {
+        IActiveContext ParentContext { get; set; }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/IContext.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Context/IContext.cs 
b/lang/cs/Org.Apache.REEF.Driver/Context/IContext.cs
new file mode 100644
index 0000000..fd6006c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Context/IContext.cs
@@ -0,0 +1,45 @@
+/**
+ * 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.Driver.Evaluator;
+using Org.Apache.REEF.Utilities;
+
+namespace Org.Apache.REEF.Driver.Context
+{
+    /// <summary>
+    /// A common base interface for Contexts, available or failed.
+    /// </summary>
+    public interface IContext : IIdentifiable
+    {
+        /// <summary>
+        /// the identifier of the Evaluator this EvaluatorContext is 
instantiated on.
+        /// </summary>
+        string EvaluatorId { get; set; }
+
+        /// <summary>
+        /// ID of the parent context, if there is any.
+        /// </summary>
+        Optional<string> ParentId { get; set; }
+
+        /// <summary>
+        /// descriptor of the Evaluator this Context is on.
+        /// </summary>
+        IEvaluatorDescriptor EvaluatorDescriptor { get; set; }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Context/IFailedContext.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Context/IFailedContext.cs 
b/lang/cs/Org.Apache.REEF.Driver/Context/IFailedContext.cs
new file mode 100644
index 0000000..6e07788
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Context/IFailedContext.cs
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Org.Apache.REEF.Utilities;
+
+namespace Org.Apache.REEF.Driver.Context
+{
+    public interface IFailedContext : IContext
+    {
+         Optional<IActiveContext> ParentContext { get; }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Contract/IBridgeContract.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Contract/IBridgeContract.cs 
b/lang/cs/Org.Apache.REEF.Driver/Contract/IBridgeContract.cs
new file mode 100644
index 0000000..2c08d0b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Contract/IBridgeContract.cs
@@ -0,0 +1,26 @@
+/**
+ * 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.Driver.Contract
+{
+    public interface IBridgeContract
+    {
+        string InstanceId { get; set; }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientCloseHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientCloseHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientCloseHandler.cs
new file mode 100644
index 0000000..a47a2b1
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientCloseHandler.cs
@@ -0,0 +1,53 @@
+/**
+ * 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.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    /// Default handler for close messages from the client: logging it
+    /// </summary>
+    public class DefaultClientCloseHandler : IObserver<byte[]>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultClientCloseHandler));
+
+        [Inject]
+        public DefaultClientCloseHandler()
+        {
+        }
+
+        public void OnNext(byte[] value)
+        {
+            LOGGER.Log(Level.Info, "Closing the Client");
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientCloseWithMessageHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientCloseWithMessageHandler.cs
 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientCloseWithMessageHandler.cs
new file mode 100644
index 0000000..0dbb6f0
--- /dev/null
+++ 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientCloseWithMessageHandler.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.Utilities;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    /// Default handler for close messages from the client: Throw an Exception.
+    /// </summary>
+    public class DefaultClientCloseWithMessageHandler : IObserver<byte[]>
+    {
+        [Inject]
+        public DefaultClientCloseWithMessageHandler()
+        {
+        }
+        
+        public void OnNext(byte[] value)
+        {
+            Exceptions.Throw(new InvalidOperationException("No handler bound 
for client Close With Message event:" + 
ByteUtilities.ByteArrarysToString(value)), 
+                
Logger.GetLogger(typeof(DefaultClientCloseWithMessageHandler)));
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientMessageHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientMessageHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientMessageHandler.cs
new file mode 100644
index 0000000..ca5ac0e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultClientMessageHandler.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.Utilities;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    /// DDefault event handler for Client messages: Logging it.
+    /// </summary>
+    public class DefaultClientMessageHandler : IObserver<byte[]>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultClientMessageHandler));
+        
+        [Inject]
+        public DefaultClientMessageHandler()
+        {
+        }
+
+        public void OnNext(byte[] value)
+        {
+            LOGGER.Log(Level.Info, "Received message: " + 
ByteUtilities.ByteArrarysToString(value));
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextActiveHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextActiveHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextActiveHandler.cs
new file mode 100644
index 0000000..7bb27ad
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextActiveHandler.cs
@@ -0,0 +1,56 @@
+/**
+ * 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.Driver.Context;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+using System.Globalization;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    /// Default handler for ActiveContext: Close it.
+    /// </summary>
+    public class DefaultContextActiveHandler : IObserver<IActiveContext>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultContextActiveHandler));
+        
+        [Inject]
+        public DefaultContextActiveHandler()
+        {
+        }
+
+        public void OnNext(IActiveContext value)
+        {
+            LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, 
"Received ActiveContext :[{0}], closing it", value.Id));
+            value.Dispose();
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextClosureHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextClosureHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextClosureHandler.cs
new file mode 100644
index 0000000..aa957c7
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextClosureHandler.cs
@@ -0,0 +1,55 @@
+/**
+ * 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.Common.Context;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    /// Default event handler for ClosedContext: Logging it.
+    /// </summary>
+    public class DefaultContextClosureHandler : IObserver<IClosedContext>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultContextClosureHandler));
+        
+        [Inject]
+        public DefaultContextClosureHandler()
+        {
+        }
+
+        public void OnNext(IClosedContext value)
+        {
+            LOGGER.Log(Level.Info, "Received ClosedContext :" + value.Id);
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextFailureHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextFailureHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextFailureHandler.cs
new file mode 100644
index 0000000..d8014c6
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextFailureHandler.cs
@@ -0,0 +1,51 @@
+/**
+ * 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.Driver.Context;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    ///  Default event handler used for FailedContext: It crashes the driver.
+    /// </summary>
+    public class DefaultContextFailureHandler : IObserver<IFailedContext>
+    {
+        [Inject]
+        public DefaultContextFailureHandler()
+        {
+        }
+
+        public void OnNext(IFailedContext value)
+        {
+            throw new InvalidOperationException("No handler bound for 
FailedContext: " + value.Id);
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextMessageHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextMessageHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextMessageHandler.cs
new file mode 100644
index 0000000..0e6715c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultContextMessageHandler.cs
@@ -0,0 +1,55 @@
+/**
+ * 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.Common.Context;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    /// efault event handler for ContextMessage: Logging it.
+    /// </summary>
+    public class DefaultContextMessageHandler : IObserver<IContextMessage>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultContextMessageHandler));
+
+        [Inject]
+        public DefaultContextMessageHandler()
+        {
+        }
+
+        public void OnNext(IContextMessage value)
+        {
+            LOGGER.Log(Level.Info, "Received ContextMessage: " + 
ByteUtilities.ByteArrarysToString(value.Message));
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultCustomTraceListener.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultCustomTraceListener.cs 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultCustomTraceListener.cs
new file mode 100644
index 0000000..a1f897b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultCustomTraceListener.cs
@@ -0,0 +1,45 @@
+/**
+ * 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;
+using System.Diagnostics;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    public class DefaultCustomTraceListener : TraceListener
+    {
+        private readonly TraceListener _listener; 
+
+        [Inject]
+        public DefaultCustomTraceListener()
+        {
+            _listener = new ConsoleTraceListener();
+        }
+
+        public override void Write(string message)
+        {
+            _listener.Write(message);
+        }
+
+        public override void WriteLine(string message)
+        {
+            _listener.WriteLine(message);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartContextActiveHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartContextActiveHandler.cs
 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartContextActiveHandler.cs
new file mode 100644
index 0000000..5ceb271
--- /dev/null
+++ 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartContextActiveHandler.cs
@@ -0,0 +1,56 @@
+/**
+ * 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.Driver.Context;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+using System.Globalization;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    /// Default handler for ActiveContext received during driver restart: 
Close it.
+    /// </summary>
+    public class DefaultDriverRestartContextActiveHandler : 
IObserver<IActiveContext>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultDriverRestartContextActiveHandler));
+        
+        [Inject]
+        public DefaultDriverRestartContextActiveHandler()
+        {
+        }
+
+        public void OnNext(IActiveContext value)
+        {
+            LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, 
"Received ActiveContext during driver restart:[{0}], closing it", value.Id));
+            value.Dispose();
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartHandler.cs 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartHandler.cs
new file mode 100644
index 0000000..1500b70
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartHandler.cs
@@ -0,0 +1,55 @@
+/**
+ * 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.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Wake.Time;
+using System;
+using Org.Apache.REEF.Wake.Time.Event;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    ///  Default event handler for driver restart: Logging it.
+    /// </summary>
+    public class DefaultDriverRestartHandler : IObserver<StartTime>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultDriverRestartHandler));
+        
+        [Inject]
+        public DefaultDriverRestartHandler()
+        {
+        }
+
+        public void OnNext(StartTime startTime)
+        {
+            LOGGER.Log(Level.Info, "Driver restarted at" + new 
DateTime(startTime.TimeStamp));
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartTaskRunningHandler.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartTaskRunningHandler.cs
 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartTaskRunningHandler.cs
new file mode 100644
index 0000000..c202933
--- /dev/null
+++ 
b/lang/cs/Org.Apache.REEF.Driver/Defaults/DefaultDriverRestartTaskRunningHandler.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.Driver.Task;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+
+namespace Org.Apache.REEF.Driver.Defaults
+{
+    /// <summary>
+    ///  Default event handler for TaskRuntime received during driver restart: 
Logging it.
+    /// </summary>
+    public class DefaultDriverRestartTaskRunningHandler : 
IObserver<IRunningTask>
+    {
+        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(DefaultDriverRestartTaskRunningHandler));
+        
+        [Inject]
+        public DefaultDriverRestartTaskRunningHandler()
+        {
+        }
+
+        public void OnNext(IRunningTask runningTask)
+        {
+            LOGGER.Log(Level.Info, "Received TaskRuntime during driver 
restart: " + runningTask.Id);
+        }
+
+        public void OnError(Exception error)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnCompleted()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

Reply via email to