You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by we...@apache.org on 2017/07/10 20:16:47 UTC
reef git commit: [REEF-1812] Avro bridge C# code generation
Repository: reef
Updated Branches:
refs/heads/master 70ca4d92c -> b0efd4428
[REEF-1812] Avro bridge C# code generation
- Adds a new project Org.Apache.REEF.Bridge.CLR that will be
become Org.Apache.REEF.Bridge when the Java/C# interop bridge is removed.
- Adds Avro avsc to C# code generation task to the msbuild project file.
- Adds a number of Avro messages for Java/C# Avro bridge.
JIRA:
[REEF-1812](https://issues.apache.org/jira/browse/REEF-1812)
Pull request:
This closes #1320
Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/b0efd442
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/b0efd442
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/b0efd442
Branch: refs/heads/master
Commit: b0efd4428b6b0af68809d8073e41aec311cc2e48
Parents: 70ca4d9
Author: Doug Service <do...@apache.org>
Authored: Tue Jun 13 02:42:33 2017 +0000
Committer: Markus Weimer <we...@apache.org>
Committed: Mon Jul 10 13:15:09 2017 -0700
----------------------------------------------------------------------
lang/common/bridge/avro/Acknowledgement.avsc | 36 +++++
lang/common/bridge/avro/Header.avsc | 41 ++++++
lang/common/bridge/avro/Protocol.avsc | 36 +++++
lang/common/bridge/avro/SystemOnStart.avsc | 36 +++++
lang/cs/AvroCodeGeneration.targets | 144 +++++++++++++++++++
.../Message/Acknowledgement.cs | 66 +++++++++
.../Message/Header.cs | 74 ++++++++++
.../Message/Protocol.cs | 66 +++++++++
.../Message/README.md | 10 ++
.../Message/SystemOnStart.cs | 66 +++++++++
.../Org.Apache.REEF.Bridge.CLR.csproj | 92 ++++++++++++
.../Org.Apache.REEF.Bridge.CLR/packages.config | 27 ++++
lang/cs/Org.Apache.REEF.sln | Bin 36118 -> 37118 bytes
13 files changed, 694 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/common/bridge/avro/Acknowledgement.avsc
----------------------------------------------------------------------
diff --git a/lang/common/bridge/avro/Acknowledgement.avsc b/lang/common/bridge/avro/Acknowledgement.avsc
new file mode 100644
index 0000000..31c9e53
--- /dev/null
+++ b/lang/common/bridge/avro/Acknowledgement.avsc
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+[
+ /*
+ * Acknowledgement that a specific message was received and processed.
+ */
+ {
+ "namespace":"org.apache.reef.bridge.message",
+ "type":"record",
+ "name":"Acknowledgement",
+ "doc":"The Acknowledgement message is sent to the Java bridge to acknowledge receipt and processing of a specific message.",
+ "fields":[
+ {
+ "name":"messageIdentifier",
+ "type":"long",
+ "doc":"The message identifier of the message that was successfully processed."
+ }
+ ]
+ }
+]
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/common/bridge/avro/Header.avsc
----------------------------------------------------------------------
diff --git a/lang/common/bridge/avro/Header.avsc b/lang/common/bridge/avro/Header.avsc
new file mode 100644
index 0000000..c543f0b
--- /dev/null
+++ b/lang/common/bridge/avro/Header.avsc
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+[
+ /*
+ * Identify the next message in the Java/C# bridge protocol.
+ */
+ {
+ "namespace":"org.apache.reef.bridge.message",
+ "type":"record",
+ "name":"Header",
+ "doc":"Identifies the following message in the Java/C# bridge protocol.",
+ "fields":[
+ {
+ "name":"identifier",
+ "doc":"Identifier of the next message to be read.",
+ "type":"long"
+ },
+ {
+ "name":"className",
+ "doc":"The fully qualified name of the message class.",
+ "type":"string"
+ }
+ ]
+ }
+]
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/common/bridge/avro/Protocol.avsc
----------------------------------------------------------------------
diff --git a/lang/common/bridge/avro/Protocol.avsc b/lang/common/bridge/avro/Protocol.avsc
new file mode 100644
index 0000000..bb3c9e9
--- /dev/null
+++ b/lang/common/bridge/avro/Protocol.avsc
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+[
+ /*
+ * Notify Java bridge CLR bridge is ininitialized.
+ */
+ {
+ "namespace":"org.apache.reef.bridge.message",
+ "type":"record",
+ "name":"Protocol",
+ "doc":"Negotiate Java/C# bridge protocol messages.",
+ "fields":[
+ {
+ "name":"offset",
+ "type":"int",
+ "doc":"The index offset of the message identifiers."
+ }
+ ]
+ }
+]
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/common/bridge/avro/SystemOnStart.avsc
----------------------------------------------------------------------
diff --git a/lang/common/bridge/avro/SystemOnStart.avsc b/lang/common/bridge/avro/SystemOnStart.avsc
new file mode 100644
index 0000000..8f25fa1
--- /dev/null
+++ b/lang/common/bridge/avro/SystemOnStart.avsc
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+[
+ /*
+ * First message from the Java bridge to the CLR bridge.
+ */
+ {
+ "namespace":"org.apache.reef.bridge.message",
+ "type":"record",
+ "name":"SystemOnStart",
+ "doc":"The SystemOnStart message is sent to the CLR bridge from the Java bridge when the round trip communication path has been established.",
+ "fields":[
+ {
+ "name":"dateTime",
+ "type":"long",
+ "doc":"Date time in seconds as a long since January 1, 1970"
+ }
+ ]
+ }
+]
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/cs/AvroCodeGeneration.targets
----------------------------------------------------------------------
diff --git a/lang/cs/AvroCodeGeneration.targets b/lang/cs/AvroCodeGeneration.targets
new file mode 100644
index 0000000..48a6695
--- /dev/null
+++ b/lang/cs/AvroCodeGeneration.targets
@@ -0,0 +1,144 @@
+<?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.
+-->
+<!-- AVRO CODE GERNATION TARGETS FOR MSBUILD -->
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <UsingTask TaskName="AvscToCSharp" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
+ <ParameterGroup>
+ <!-- The directory where the project is located. This is typically $(ProjectDir) -->
+ <ProjectDirectory ParameterType="System.String" Required="true" />
+ <!-- This is the list of C# target files to be generaterd. This is typically @(Compile) -->
+ <SourceFileList ParameterType="System.String" Required="true" />
+ <!-- The directory where the .avsc schema files are located. -->
+ <AvroSchemaDirectory ParameterType="System.String" Required="true" />
+ <!-- The where Avro schema generator and dependent libraries are located. -->
+ <AvroBinaryDirectory ParameterType="System.String" Required="true" />
+ </ParameterGroup>
+ <Task>
+ <Using Namespace="System" />
+ <Using Namespace="System.IO" />
+ <Using Namespace="System.Diagnostics" />
+ <Code Type="Fragment" Language="cs"><![CDATA[
+ // Overall strategy: Copy the executuables and libraries needed
+ // to run the MS Avro code generator to a binary directory
+ // in the packages directory, and then run code generation for
+ // every message defined in the Messages directory.
+
+ // Create a temporary working directory.
+ String tempDir = Path.GetFullPath(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));
+ Directory.CreateDirectory(tempDir);
+ String[] sourceFiles = SourceFileList.Split(new char[]{';'});
+
+ // Get the full path where the avro avsc files are located.
+ String messageDirectory = Path.GetFullPath(AvroSchemaDirectory);
+
+ // Add the avro tools directory to the path.
+ String path = Environment.GetEnvironmentVariable("path");
+ path = Path.GetFullPath(AvroBinaryDirectory) + ";" + path;
+ Environment.SetEnvironmentVariable("path", path);
+
+ String copyright = String.Join(Environment.NewLine,
+ "// 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.");
+
+ // Setup the conversion process.
+ ProcessStartInfo rProcInfo = new ProcessStartInfo()
+ {
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ UseShellExecute = false,
+ FileName = "Microsoft.Avro.Tools.exe"
+ };
+
+ // Log the commands to a file.
+ bool conversionError = false;
+ using (StreamWriter logWriter = new StreamWriter(Path.Combine(tempDir, "avroout.log")))
+ {
+ logWriter.WriteLine(Environment.GetEnvironmentVariable("path"));
+ foreach (String file in sourceFiles)
+ {
+ if (file.Contains(@"Message\"))
+ {
+ // Build the name of the source avsc file from the destiname CS file and avro message path.
+ String avroSourceName = Path.Combine(messageDirectory, (Path.GetFileName(file)).Replace(".cs", ".avsc"));
+ rProcInfo.Arguments = String.Format(" CodeGen /I:{0} /O:{1}", avroSourceName, tempDir);
+ logWriter.Write(rProcInfo.FileName);
+ logWriter.WriteLine(rProcInfo.Arguments);
+
+ StringBuilder stdOutBuilder = new StringBuilder();
+ StringBuilder stdErrBuilder = new StringBuilder();
+
+ // Start the conversion process
+ using (Process rProc = Process.Start(rProcInfo))
+ {
+ stdOutBuilder.Append(rProc.StandardOutput.ReadToEnd());
+ stdErrBuilder.Append(rProc.StandardError.ReadToEnd());
+ rProc.WaitForExit();
+ if (rProc.ExitCode != 0)
+ {
+ conversionError = true;
+ }
+ }
+ logWriter.WriteLine(stdOutBuilder.ToString());
+ logWriter.WriteLine(stdErrBuilder.ToString());
+
+ using (StreamReader tmpReader = new StreamReader(Path.Combine(tempDir, Path.GetFileName(file))))
+ {
+ String source = tmpReader.ReadToEnd();
+ using (StreamWriter destWriter = new StreamWriter(Path.GetFullPath(file)))
+ {
+ destWriter.WriteLine(copyright);
+ destWriter.Write(source);
+ }
+ }
+ }
+ }
+ }
+ if (!conversionError)
+ {
+ Directory.Delete(tempDir, recursive : true);
+ }
+ ]]></Code>
+ </Task>
+ </UsingTask>
+ <Target Name="SetupAvroCodeGen" DependsOnTargets="RestorePackages">
+ <Message Text="Copying Avro code generation files to $(AvroBinaryDirectory)..." />
+ <Copy SourceFiles="$(AvroTools)" DestinationFolder="$(AvroBinaryDirectory)" />
+ <Copy SourceFiles="$(AvroLibrary)" DestinationFolder="$(AvroBinaryDirectory)" />
+ <Copy SourceFiles="$(NewtonsoftLibrary)" DestinationFolder="$(AvroBinaryDirectory)" />
+ </Target>
+ <Target Name="CodeGeneration" DependsOnTargets="SetupAvroCodeGen" BeforeTargets="CoreCompile">
+ <Message Text="Generating C# classes from Avro avsc files @(Compile)..." />
+ <AvscToCSharp ProjectDirectory="$(ProjectDir)" SourceFileList="@(Compile)" AvroSchemaDirectory="$(AvroSchemaDirectory)" AvroBinaryDirectory="$(AvroBinaryDirectory)" />
+ </Target>
+</Project>
+
+
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Acknowledgement.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Acknowledgement.cs b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Acknowledgement.cs
new file mode 100644
index 0000000..3125788
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Acknowledgement.cs
@@ -0,0 +1,66 @@
+// 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.
+//<auto-generated />
+namespace org.apache.reef.bridge.message
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+ using Microsoft.Hadoop.Avro;
+
+ /// <summary>
+ /// Used to serialize and deserialize Avro record org.apache.reef.bridge.message.Acknowledgement.
+ /// </summary>
+ [DataContract(Namespace = "org.apache.reef.bridge.message")]
+ public partial class Acknowledgement
+ {
+ private const string JsonSchema = @"{""type"":""record"",""name"":""org.apache.reef.bridge.message.Acknowledgement"",""doc"":""The Acknowledgement message is sent to the Java bridge to acknowledge receipt and processing of a specific message."",""fields"":[{""name"":""messageIdentifier"",""doc"":""The message identifier of the message that was successfully processed."",""type"":""long""}]}";
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public static string Schema
+ {
+ get
+ {
+ return JsonSchema;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the messageIdentifier field.
+ /// </summary>
+ [DataMember]
+ public long messageIdentifier { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Acknowledgement"/> class.
+ /// </summary>
+ public Acknowledgement()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Acknowledgement"/> class.
+ /// </summary>
+ /// <param name="messageIdentifier">The messageIdentifier.</param>
+ public Acknowledgement(long messageIdentifier)
+ {
+ this.messageIdentifier = messageIdentifier;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Header.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Header.cs b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Header.cs
new file mode 100644
index 0000000..cf0b939
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Header.cs
@@ -0,0 +1,74 @@
+// 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.
+//<auto-generated />
+namespace org.apache.reef.bridge.message
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+ using Microsoft.Hadoop.Avro;
+
+ /// <summary>
+ /// Used to serialize and deserialize Avro record org.apache.reef.bridge.message.Header.
+ /// </summary>
+ [DataContract(Namespace = "org.apache.reef.bridge.message")]
+ public partial class Header
+ {
+ private const string JsonSchema = @"{""type"":""record"",""name"":""org.apache.reef.bridge.message.Header"",""doc"":""Identifies the following message in the Java/C# bridge protocol."",""fields"":[{""name"":""identifier"",""doc"":""Identifier of the next message to be read."",""type"":""long""},{""name"":""className"",""doc"":""The fully qualified name of the message class."",""type"":""string""}]}";
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public static string Schema
+ {
+ get
+ {
+ return JsonSchema;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the identifier field.
+ /// </summary>
+ [DataMember]
+ public long identifier { get; set; }
+
+ /// <summary>
+ /// Gets or sets the className field.
+ /// </summary>
+ [DataMember]
+ public string className { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Header"/> class.
+ /// </summary>
+ public Header()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Header"/> class.
+ /// </summary>
+ /// <param name="identifier">The identifier.</param>
+ /// <param name="className">The className.</param>
+ public Header(long identifier, string className)
+ {
+ this.identifier = identifier;
+ this.className = className;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Protocol.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Protocol.cs b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Protocol.cs
new file mode 100644
index 0000000..2f88621
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/Protocol.cs
@@ -0,0 +1,66 @@
+// 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.
+//<auto-generated />
+namespace org.apache.reef.bridge.message
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+ using Microsoft.Hadoop.Avro;
+
+ /// <summary>
+ /// Used to serialize and deserialize Avro record org.apache.reef.bridge.message.Protocol.
+ /// </summary>
+ [DataContract(Namespace = "org.apache.reef.bridge.message")]
+ public partial class Protocol
+ {
+ private const string JsonSchema = @"{""type"":""record"",""name"":""org.apache.reef.bridge.message.Protocol"",""doc"":""Negotiate Java/C# bridge protocol messages."",""fields"":[{""name"":""offset"",""doc"":""The index offset of the message identifiers."",""type"":""int""}]}";
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public static string Schema
+ {
+ get
+ {
+ return JsonSchema;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the offset field.
+ /// </summary>
+ [DataMember]
+ public int offset { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Protocol"/> class.
+ /// </summary>
+ public Protocol()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Protocol"/> class.
+ /// </summary>
+ /// <param name="offset">The offset.</param>
+ public Protocol(int offset)
+ {
+ this.offset = offset;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/README.md
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/README.md b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/README.md
new file mode 100644
index 0000000..e6ba2f0
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/README.md
@@ -0,0 +1,10 @@
+# Java/C# Interop Avro Messages
+
+### DO NOT EDIT THESE C# FILES
+
+The C# files in this directory are generated during the build from the Avro
+record definition files in lang/common/bridge/avro. When adding a new .avsc
+file in lang/common/bridge/avro you must also put an empty .cs file here
+with the same name as the .cs file is the dependency. For example,
+
+ lang/common/bridge/avro/MyMsg.avsc -> lang/common/bridge/avro/MyMsg.cs
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/SystemOnStart.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/SystemOnStart.cs b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/SystemOnStart.cs
new file mode 100644
index 0000000..b066679
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge.CLR/Message/SystemOnStart.cs
@@ -0,0 +1,66 @@
+// 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.
+//<auto-generated />
+namespace org.apache.reef.bridge.message
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+ using Microsoft.Hadoop.Avro;
+
+ /// <summary>
+ /// Used to serialize and deserialize Avro record org.apache.reef.bridge.message.SystemOnStart.
+ /// </summary>
+ [DataContract(Namespace = "org.apache.reef.bridge.message")]
+ public partial class SystemOnStart
+ {
+ private const string JsonSchema = @"{""type"":""record"",""name"":""org.apache.reef.bridge.message.SystemOnStart"",""doc"":""The SystemOnStart message is sent to the CLR bridge from the Java bridge when the round trip communication path has been established."",""fields"":[{""name"":""dateTime"",""doc"":""Date time in seconds as a long since January 1, 1970"",""type"":""long""}]}";
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public static string Schema
+ {
+ get
+ {
+ return JsonSchema;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the dateTime field.
+ /// </summary>
+ [DataMember]
+ public long dateTime { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SystemOnStart"/> class.
+ /// </summary>
+ public SystemOnStart()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SystemOnStart"/> class.
+ /// </summary>
+ /// <param name="dateTime">The dateTime.</param>
+ public SystemOnStart(long dateTime)
+ {
+ this.dateTime = dateTime;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/cs/Org.Apache.REEF.Bridge.CLR/Org.Apache.REEF.Bridge.CLR.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.CLR/Org.Apache.REEF.Bridge.CLR.csproj b/lang/cs/Org.Apache.REEF.Bridge.CLR/Org.Apache.REEF.Bridge.CLR.csproj
new file mode 100644
index 0000000..cc50a6f
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge.CLR/Org.Apache.REEF.Bridge.CLR.csproj
@@ -0,0 +1,92 @@
+<?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.
+-->
+<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>{E19FF4F8-AB45-4631-8017-E18D94D882DD}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Org.Apache.REEF.Bridge</RootNamespace>
+ <AssemblyName>Org.Apache.REEF.Bridge.CLR</AssemblyName>
+ <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ <AvroBinaryDirectory>..\packages\AvroBin</AvroBinaryDirectory>
+ <AvroSchemaDirectory>..\..\common\bridge\avro</AvroSchemaDirectory>
+ <AvroTools>..\packages\Microsoft.Avro.Tools.0.1.0\lib\net451\Microsoft.Avro.Tools.exe</AvroTools>
+ <AvroLibrary>..\packages\Microsoft.Avro.Core.0.1.0\lib\net451\Microsoft.Avro.Core.dll</AvroLibrary>
+ <NewtonsoftLibrary>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</NewtonsoftLibrary>
+ </PropertyGroup>
+ <Import Project="$(SolutionDir)\build.props" />
+ <ItemGroup>
+ <Reference Include="Microsoft.Hadoop.Avro">
+ <HintPath>$(PackagesDir)\Microsoft.Hadoop.Avro.$(AvroVersion)\lib\net45\Microsoft.Hadoop.Avro.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.IO.Compression.FileSystem" />
+ <Reference Include="System.Numerics" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Xml.Linq" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="$(SolutionDir)\SharedAssemblyInfo.cs">
+ <Link>Properties\SharedAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="Message\Acknowledgement.cs" />
+ <Compile Include="Message\Header.cs" />
+ <Compile Include="Message\Protocol.cs" />
+ <Compile Include="Message\SystemOnStart.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Message\README.md" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
+ <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
+ <Name>ReefCommon</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>
+ <ProjectReference Include="..\Org.Apache.REEF.IO\Org.Apache.REEF.IO.csproj">
+ <Project>{dec0f0a8-dbef-4ebf-b69c-e2369c15abf1}</Project>
+ <Name>Org.Apache.REEF.IO</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup />
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\AvroCodeGeneration.Targets" Condition="Exists('$(SolutionDir)\AvroCodeGeneration.Targets')" />
+ <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+ <Import Project="$(PackagesDir)\StyleCop.MSBuild.$(StyleCopVersion)\build\StyleCop.MSBuild.Targets" Condition="Exists('$(PackagesDir)\StyleCop.MSBuild.$(StyleCopVersion)\build\StyleCop.MSBuild.Targets')" />
+</Project>
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/cs/Org.Apache.REEF.Bridge.CLR/packages.config
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.CLR/packages.config b/lang/cs/Org.Apache.REEF.Bridge.CLR/packages.config
new file mode 100644
index 0000000..26c8722
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge.CLR/packages.config
@@ -0,0 +1,27 @@
+<?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.Avro.Core" version="0.1.0" targetFramework="net451" developmentDependency="true" />
+ <package id="Microsoft.Avro.Tools" version="0.1.0" targetFramework="net451" developmentDependency="true" />
+ <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net451" developmentDependency="true" />
+ <package id="Microsoft.Hadoop.Avro" version="1.5.6" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
+ <package id="StyleCop.MSBuild" version="4.7.49.1" targetFramework="net45" developmentDependency="true" />
+</packages>
http://git-wip-us.apache.org/repos/asf/reef/blob/b0efd442/lang/cs/Org.Apache.REEF.sln
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.sln b/lang/cs/Org.Apache.REEF.sln
index 7678d9a..3889f24 100644
Binary files a/lang/cs/Org.Apache.REEF.sln and b/lang/cs/Org.Apache.REEF.sln differ