http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Tools/ClassHierarchyBuilder/ClassHierarchyBuilder.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Tools/ClassHierarchyBuilder/ClassHierarchyBuilder.csproj b/lang/cs/Source/Tools/ClassHierarchyBuilder/ClassHierarchyBuilder.csproj deleted file mode 100644 index 05809d2..0000000 --- a/lang/cs/Source/Tools/ClassHierarchyBuilder/ClassHierarchyBuilder.csproj +++ /dev/null @@ -1,107 +0,0 @@ -<?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> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{34A9CD98-0D15-4CA0-AEA5-E53593A31047}</ProjectGuid> - <OutputType>Exe</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>Org.Apache.Reef.Tools.ClassHierarchyBuilder</RootNamespace> - <AssemblyName>Org.Apache.Reef.Tools.ClassHierarchyBuilder</AssemblyName> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <RestorePackages>true</RestorePackages> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..</SolutionDir> - </PropertyGroup> - <Import Project="$(SolutionDir)\Source\build.props" /> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="Program.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="$(SourceDir)\REEF\reef-common\ReefCommon\ReefCommon.csproj"> - <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project> - <Name>ReefCommon</Name> - </ProjectReference> - <ProjectReference Include="$(SourceDir)\REEF\reef-tasks\Tasks\Tasks.csproj"> - <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project> - <Name>Tasks</Name> - </ProjectReference> - <ProjectReference Include="$(SourceDir)\Tang\Tang\Tang.csproj"> - <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project> - <Name>Tang</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Tools/ClassHierarchyBuilder/Program.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Tools/ClassHierarchyBuilder/Program.cs b/lang/cs/Source/Tools/ClassHierarchyBuilder/Program.cs deleted file mode 100644 index 32a85d0..0000000 --- a/lang/cs/Source/Tools/ClassHierarchyBuilder/Program.cs +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Tasks; -using Org.Apache.Reef.Tang.Implementations; -using Org.Apache.Reef.Tang.Interface; -using Org.Apache.Reef.Tang.Protobuf; -using Org.Apache.Reef.Tang.Types; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; - -namespace Org.Apache.Reef.Tools -{ - public class ClassHierarchyBuilder - { - /// <summary> - /// This program generates class hierarchy bin file for the list of dlls, plus a defalut list - /// The default list include: ITask, StreamTask1, HelloTask and ShellTask, please remove if not needed - /// </summary> - /// <param name="args"> additional dlls needed to build class hierarchy </param> - public static void Main(string[] args) - { - const string DllSubfix = ".dll"; - const string ClassHierarchyBinFileName = "task.bin"; - - List<string> taskDlls = new List<string>(); - - foreach (string arg in args) - { - string assemblyName = arg; - if (!arg.EndsWith(DllSubfix, StringComparison.OrdinalIgnoreCase)) - { - assemblyName += DllSubfix; - } - if (!File.Exists(assemblyName)) - { - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "invalid argument: assembly {0} cannot be found", assemblyName)); - } - taskDlls.Add(arg); - } - - taskDlls.Add(GetAssemblyName(typeof(ITask))); - taskDlls.Add(GetAssemblyName(typeof(HelloTask))); - taskDlls.Add(GetAssemblyName(typeof(ShellTask))); - taskDlls.Add(GetAssemblyName(typeof(StreamTask1))); - - IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(taskDlls.ToArray()); - - // the following is verification only - // to verify that a class indeeded has been added to the class hierarchy, check the class name - IClassNode streamTaskClassNode = (IClassNode)ns.GetNode(typeof(StreamTask1).AssemblyQualifiedName); - IClassNode helloTaskClassNode = (IClassNode)ns.GetNode(typeof(HelloTask).AssemblyQualifiedName); - IClassNode shellTaskClassNode = (IClassNode)ns.GetNode(typeof(ShellTask).AssemblyQualifiedName); - - ProtocolBufferClassHierarchy.Serialize(ClassHierarchyBinFileName, ns); - IClassHierarchy ch = ProtocolBufferClassHierarchy.DeSerialize(ClassHierarchyBinFileName); - - IClassNode retrievedStreamTaskClassNode = (IClassNode)ch.GetNode(typeof(StreamTask1).AssemblyQualifiedName); - IClassNode retrievedHelloTaskClassNode = (IClassNode)ch.GetNode(typeof(HelloTask).AssemblyQualifiedName); - IClassNode retrievedShellTaskClassNode = (IClassNode)ch.GetNode(typeof(ShellTask).AssemblyQualifiedName); - - if (!streamTaskClassNode.GetFullName().Equals(retrievedStreamTaskClassNode.GetFullName()) || - !helloTaskClassNode.GetFullName().Equals(retrievedHelloTaskClassNode.GetFullName()) || - !shellTaskClassNode.GetFullName().Equals(retrievedShellTaskClassNode.GetFullName())) - { - Console.WriteLine("Node deseriliazed is not equal"); - } - else - { - Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Class hierarchy written to [{0}].", Directory.GetCurrentDirectory())); - } - } - - private static string GetAssemblyName(Type type) - { - return type.Assembly.GetName().Name; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Tools/ClassHierarchyBuilder/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Tools/ClassHierarchyBuilder/Properties/AssemblyInfo.cs b/lang/cs/Source/Tools/ClassHierarchyBuilder/Properties/AssemblyInfo.cs deleted file mode 100644 index 02de849..0000000 --- a/lang/cs/Source/Tools/ClassHierarchyBuilder/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ClassHierarchyBuilder")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ClassHierarchyBuilder")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("8a034f16-c6c7-497a-b3c0-f8cfea1635e9")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Tools/ReefAll/ReefAll.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Tools/ReefAll/ReefAll.csproj b/lang/cs/Source/Tools/ReefAll/ReefAll.csproj index 4536bd6..2a1bf70 100644 --- a/lang/cs/Source/Tools/ReefAll/ReefAll.csproj +++ b/lang/cs/Source/Tools/ReefAll/ReefAll.csproj @@ -29,7 +29,6 @@ under the License. <FileAlignment>512</FileAlignment> <RestorePackages>true</RestorePackages> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..</SolutionDir> - </PropertyGroup> <Import Project="$(SolutionDir)\Source\build.props" /> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> @@ -87,29 +86,25 @@ under the License. <Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project> <Name>Evaluator</Name> </ProjectReference> - <ProjectReference Include="$(SourceDir)\REEF\reef-common\ReefCommon\ReefCommon.csproj"> - <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project> - <Name>ReefCommon</Name> - </ProjectReference> - <ProjectReference Include="$(SourceDir)\REEF\reef-common\ReefDriver\ReefDriver.csproj"> - <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project> - <Name>ReefDriver</Name> - </ProjectReference> <ProjectReference Include="$(SourceDir)\REEF\reef-io\NetWork\NetWork.csproj"> <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project> <Name>NetWork</Name> </ProjectReference> - <ProjectReference Include="$(SourceDir)\Tang\Tang\Tang.csproj"> - <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project> - <Name>Tang</Name> + <ProjectReference Include="..\..\..\Org.Apache.Reef.Common\Org.Apache.Reef.Common.csproj"> + <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project> + <Name>Org.Apache.Reef.Common</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Org.Apache.Reef.Driver\Org.Apache.Reef.Driver.csproj"> + <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project> + <Name>Org.Apache.Reef.Driver</Name> </ProjectReference> - <ProjectReference Include="$(SourceDir)\Utilities\Utilities.csproj"> - <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project> - <Name>Utilities</Name> + <ProjectReference Include="..\..\..\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="$(SourceDir)\WAKE\Wake\Wake.csproj"> + <ProjectReference Include="..\..\..\Org.Apache.Reef.Wake\Org.Apache.Reef.Wake.csproj"> <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project> - <Name>Wake</Name> + <Name>Org.Apache.Reef.Wake</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> @@ -120,4 +115,4 @@ under the License. <Target Name="AfterBuild"> </Target> --> -</Project> +</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/AvroUtils.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/AvroUtils.cs b/lang/cs/Source/Utilities/AvroUtils.cs deleted file mode 100644 index 1db652d..0000000 --- a/lang/cs/Source/Utilities/AvroUtils.cs +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Hadoop.Avro; - -namespace Org.Apache.Reef.Utilities -{ - public class AvroUtils - { - /// <summary> - /// Convert an object to byte array using Avro serializiation - /// </summary> - /// <param name="obj">The object to serialize</param> - /// <returns>The serialized object in a byte array</returns> - public static byte[] AvroSerialize<T>(T obj) - { - IAvroSerializer<T> serializer = AvroSerializer.Create<T>(); - using (MemoryStream stream = new MemoryStream()) - { - serializer.Serialize(stream, obj); - return stream.GetBuffer(); - } - } - - /// <summary> - /// Converts a byte array to an object using Avro deserialization. - /// </summary> - /// <param name="data">The byte array to deserialize</param> - /// <returns>The deserialized object</returns> - public static T AvroDeserialize<T>(byte[] data) - { - IAvroSerializer<T> deserializer = AvroSerializer.Create<T>(); - using (MemoryStream stream = new MemoryStream(data)) - { - return deserializer.Deserialize(stream); - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/ByteUtilities.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/ByteUtilities.cs b/lang/cs/Source/Utilities/ByteUtilities.cs deleted file mode 100644 index 655e9d2..0000000 --- a/lang/cs/Source/Utilities/ByteUtilities.cs +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using System.Text; - -namespace Org.Apache.Reef.Utilities -{ - public class ByteUtilities - { - public static byte[] StringToByteArrays(string s) - { - return Encoding.UTF8.GetBytes(s); - } - - public static string ByteArrarysToString(byte[] b) - { - return Encoding.UTF8.GetString(b); - } - - public static byte[] CopyBytesFrom(byte[] from) - { - int length = Buffer.ByteLength(from); - byte[] to = new byte[length]; - Buffer.BlockCopy(from, 0, to, 0, length); - return to; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/Diagnostics/DiagnosticsMessages.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/Diagnostics/DiagnosticsMessages.cs b/lang/cs/Source/Utilities/Diagnostics/DiagnosticsMessages.cs deleted file mode 100644 index c0a4d6e..0000000 --- a/lang/cs/Source/Utilities/Diagnostics/DiagnosticsMessages.cs +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Org.Apache.Reef.Utilities.Diagnostics -{ - public class DiagnosticsMessages - { - public const string ExceptionThrowing = "ExceptionThrowing"; - - public const string ExceptionCaught = "ExceptionCaught"; - - public const string DumperTimeout = "DumperTimeout"; - - public const string DumperError = "DumperError"; - - public const string CallingDumper = "CallingDumper"; - - public const string DumperException = "DumperException"; - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/Diagnostics/Exceptions.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/Diagnostics/Exceptions.cs b/lang/cs/Source/Utilities/Diagnostics/Exceptions.cs deleted file mode 100644 index 1308144..0000000 --- a/lang/cs/Source/Utilities/Diagnostics/Exceptions.cs +++ /dev/null @@ -1,282 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using System.Globalization; -using System.Text; -using Org.Apache.Reef.Utilities.Logging; - -namespace Org.Apache.Reef.Utilities.Diagnostics -{ - public static class Exceptions - { - #region methods - /// <summary> - /// Call this method to throw an exception. - /// </summary> - /// <remarks> - /// Calling this method will trace the exception and do other common processing, - /// and then it will throw the exception. This method traces the exception type - /// and message at error level and the full stack trace at all other levels. - /// </remarks> - /// <example> - /// Exceptions.Throw(new Exception("Some exception")); - /// </example> - /// <param name="exception">The exception to be thrown.</param> - /// <param name="message">The message from the caller class.</param> - /// <param name="logger">The logger from the caller class.</param> - public static void Throw(Exception exception, string message, Logger logger) - { - string logMessage = string.Concat(DiagnosticsMessages.ExceptionThrowing, " ", exception.GetType().Name, " ", message); - if (logger == null) - { - Console.WriteLine("Exception caught before logger is initiated, error message: " + logMessage + exception.Message); - } - else - { - logger.Log(Level.Error, logMessage, exception); - } - throw exception; - } - - /// <summary> - /// Call this method to throw an exception. - /// </summary> - /// <remarks> - /// Calling this method will trace the exception and do other common processing, - /// and then it will throw the exception. This method traces the exception type - /// and message at error level and the full stack trace at all other levels. - /// </remarks> - /// <example> - /// Exceptions.Throw(new Exception("Some exception")); - /// </example> - /// <param name="exception">The exception to be thrown.</param> - /// <param name="logger">The logger of the caller class.</param> - public static void Throw(Exception exception, Logger logger) - { - Throw(exception, string.Empty, logger); - } - - /// <summary> - /// Call this method every time when an exception is caught. - /// </summary> - /// <remarks> - /// Calling this method will trace the exception and do other common processing. - /// This method traces the exception type and message at error level and the full - /// stack trace at all other levels. - /// </remarks> - /// <example> - /// try - /// { - /// // Some code that can throw - /// } - /// catch (Exception e) - /// { - /// Exceptions.Caught(e); - /// // Exception handling code - /// } - /// </example> - /// <param name="exception">The exception being caught.</param> - /// <param name="level">The log level.</param> - /// <param name="logger">The logger from the caller class.</param> - public static void Caught(Exception exception, Level level, Logger logger) - { - Caught(exception, level, string.Empty, logger); - } - - /// <summary> - /// Call this method every time when an exception is caught. - /// </summary> - /// <remarks> - /// Calling this method will trace the exception and do other common processing. - /// This method traces the exception type and message at error level and the full - /// stack trace at all other levels. - /// </remarks> - /// <example> - /// try - /// { - /// // Some code that can throw - /// } - /// catch (Exception e) - /// { - /// Exceptions.Caught(e); - /// // Exception handling code - /// } - /// </example> - /// <param name="exception">The exception being caught.</param> - /// <param name="level">The log level.</param> - /// <param name="message">The additional messag to log.</param> - /// <param name="logger">The Logger from the caller class.</param> - public static void Caught(Exception exception, Level level, string message, Logger logger) - { - string logMessage = string.Concat(DiagnosticsMessages.ExceptionCaught, " ", exception.GetType().Name, " ", message); - if (logger == null) - { - Console.WriteLine("Exception caught before logger is initiated, error message: " + logMessage + exception.Message); - } - else - { - logger.Log(level, logMessage, exception); - } - } - - public static void CaughtAndThrow(Exception exception, Level level, Logger logger) - { - CaughtAndThrow(exception, level, string.Empty, logger); - } - - public static void CaughtAndThrow(Exception exception, Level level, string message, Logger logger) - { - string logMessage = string.Concat(DiagnosticsMessages.ExceptionCaught, " ", exception.GetType().Name, " ", message); - if (logger == null) - { - Console.WriteLine("Exception caught before logger is initiated, error message: " + logMessage + exception.Message); - } - else - { - logger.Log(level, logMessage, exception); - } - throw exception; - } - - /// <summary> - /// This method returns true if the exception passed as parameter is a critical exception - /// that should have not been caught. Examples for such exceptions are StackOverflowException - /// and OutOfMemoryException. - /// </summary> - /// <remarks> - /// Catch statements which catch all exceptions must call this method immediately and rethrow - /// wihtout further processing if the method returns true. - /// </remarks> - /// <example> - /// try - /// { - /// // Some code that can throw - /// } - /// catch (Exception e) - /// { - /// if (Exceptions.MustRethrow(e)) - /// { - /// throw; - /// } - /// // Exception handling code - /// } - /// </example> - /// <param name="exception">The exception to be checked.</param> - /// <returns>True if the exceptions is critical one and should not be caught and false otherwise.</returns> - public static bool MustRethrow(Exception exception) - { - return (exception is OutOfMemoryException || - exception is StackOverflowException); - } - - /// <summary> - /// Gets an exception message that includes the messages of the inner exceptions.. - /// </summary> - /// <param name="e">The excption.</param> - /// <returns>The meessage</returns> - public static string GetFullMessage(Exception e) - { - var fullMessage = new StringBuilder(); - bool firstLevel = true; - while (e != null) - { - if (firstLevel) - { - firstLevel = false; - } - else - { - fullMessage.Append("-->"); - } - fullMessage.Append(e.Message); - e = e.InnerException; - } - - return fullMessage.ToString(); - } - - /// <summary> - /// Call this method to throw ArgumentException for an invalid argument. - /// </summary> - /// <param name="argumentName">The invalid argument name.</param> - /// <param name="message">A message explaining the reason for th exception.</param> - /// <param name="logger">The logger of the caller class.</param> - public static void ThrowInvalidArgument(string argumentName, string message, Logger logger) - { - Throw(new ArgumentException(message, argumentName), logger); - } - - /// <summary> - /// Call this method to throw ArgumentOutOfRangeException exception. - /// </summary> - /// <param name="argumentName">The invalid argument name.</param> - /// <param name="message">A message explaining the reason for th exception.</param> - /// <param name="logger">The logger of the caller class.</param> - public static void ThrowArgumentOutOfRange(string argumentName, string message, Logger logger) - { - Throw(new ArgumentOutOfRangeException(argumentName, message), logger); - } - - /// <summary> - /// Call this method to check if an argument is null and throw ArgumentNullException exception. - /// </summary> - /// <param name="argument">The argument to be checked.</param> - /// <param name="name">The name of the argument.</param> - /// <param name="logger">The logger of the caller class.</param> - public static void ThrowIfArgumentNull(object argument, string name, Logger logger) - { - if (argument == null) - { - Exceptions.Throw(new ArgumentNullException(name), logger); - } - } - - /// <summary> - /// Call this method to throw ObjectDisposedException if an object is disposed. - /// </summary> - /// <remarks> - /// All disposable objects should check their state and throw in the beginning of each public method. - /// This helper method provides a shorter way to do this. - /// </remarks> - /// <example> - /// class SomeClass : IDisposable - /// { - /// bool _disposed; - /// // ... - /// public void SomePublicMethod() - /// { - /// Exceptions.ThrowIfObjectDisposed(_disposed, this); - /// // Method's code - /// } - /// } - /// </example> - /// <param name="disposed">True if the object is disposed.</param> - /// <param name="o">The object.</param> - /// <param name="logger">The logger of the caller class.</param> - public static void ThrowIfObjectDisposed(bool disposed, object o, Logger logger) - { - if (disposed) - { - Throw(new ObjectDisposedException(o.GetType().Name), logger); - } - } - #endregion - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/IIdentifiable.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/IIdentifiable.cs b/lang/cs/Source/Utilities/IIdentifiable.cs deleted file mode 100644 index 798f53c..0000000 --- a/lang/cs/Source/Utilities/IIdentifiable.cs +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Utilities -{ - public interface IIdentifiable - { - string Id { get; set; } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/IMessage.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/IMessage.cs b/lang/cs/Source/Utilities/IMessage.cs deleted file mode 100644 index 35ed55d..0000000 --- a/lang/cs/Source/Utilities/IMessage.cs +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Utilities -{ - /// <summary> - /// A message from a REEF component - /// </summary> - public interface IMessage - { - /// <summary> - /// Get Message payload - /// </summary> - /// <returns></returns> - byte[] Message { get; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/Logging/JavaLoggingSetting.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/Logging/JavaLoggingSetting.cs b/lang/cs/Source/Utilities/Logging/JavaLoggingSetting.cs deleted file mode 100644 index cabf1a7..0000000 --- a/lang/cs/Source/Utilities/Logging/JavaLoggingSetting.cs +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Utilities.Logging -{ - public enum JavaLoggingSetting - { - /// <summary> - /// info level log, and not transferred to CLR - /// </summary> - INFO = 0, - - /// <summary> - /// verbose log, but not to CLR - /// </summary> - VERBOSE = 1, - - /// <summary> - /// verbose log, transferred to CLR - /// </summary> - VERBOSE_TO_CLR = 2, - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/Logging/Level.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/Logging/Level.cs b/lang/cs/Source/Utilities/Logging/Level.cs deleted file mode 100644 index 71dd62f..0000000 --- a/lang/cs/Source/Utilities/Logging/Level.cs +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Utilities.Logging -{ - public enum Level - { - /// <summary> - /// Output no tracing and debugging messages. - /// </summary> - Off = 0, - - /// <summary> - /// Output error-handling messages. - /// </summary> - Error = 1, - - /// <summary> - /// Output warnings and error-handling messages. - /// </summary> - Warning = 2, - - /// <summary> - /// Trace a start event - /// </summary> - Start = 3, - - /// <summary> - /// Trace a stop event - /// </summary> - Stop = 4, - - /// <summary> - /// Output informational messages, warnings, and error-handling messages. - /// </summary> - Info = 5, - - /// <summary> - /// Output all debugging and tracing messages. - /// </summary> - Verbose = 6, - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/Logging/Logger.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/Logging/Logger.cs b/lang/cs/Source/Utilities/Logging/Logger.cs deleted file mode 100644 index 99ea80f..0000000 --- a/lang/cs/Source/Utilities/Logging/Logger.cs +++ /dev/null @@ -1,227 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; - -namespace Org.Apache.Reef.Utilities.Logging -{ - public class Logger - { - private static readonly string[] LogLevel = new string[] - { - "OFF", - "ERROR", - "WARNING", - "START", - "EXIT", - "INFO", - "VERBOSE" - }; - - private static readonly Dictionary<Level, TraceEventType> EventTypes - = new Dictionary<Level, TraceEventType>() - { - { Level.Off, TraceEventType.Stop }, - { Level.Error, TraceEventType.Error }, - { Level.Warning, TraceEventType.Warning }, - { Level.Start, TraceEventType.Start }, - { Level.Stop, TraceEventType.Stop }, - { Level.Info, TraceEventType.Information }, - { Level.Verbose, TraceEventType.Verbose }, - }; - - private static Level _customLevel = Level.Verbose; - - private static List<TraceListener> _traceListeners; - - private string _name; - - private TraceSource _traceSource; - - private Logger(string name) - { - _name = name; - _traceSource = new TraceSource(_name, SourceLevels.All); - CustcomLevel = _customLevel; - if (TraceListeners.Count == 0) - { - // before customized listener is added, we would need to log to console - _traceSource.Listeners.Add(new ConsoleTraceListener()); - } - else - { - _traceSource.Listeners.Clear(); - foreach (TraceListener listener in TraceListeners) - { - _traceSource.Listeners.Add(listener); - } - } - } - - public static Level CustcomLevel - { - get - { - return _customLevel; - } - - set - { - _customLevel = value; - } - } - - public static List<TraceListener> TraceListeners - { - get - { - if (_traceListeners == null) - { - _traceListeners = new List<TraceListener>(); - } - return _traceListeners; - } - } - - public static void SetCustomLevel(Level customLevel) - { - _customLevel = customLevel; - } - - public static void AddTraceListner(TraceListener listener) - { - TraceListeners.Add(listener); - } - - public static Logger GetLogger(Type type) - { - return GetLogger(type.FullName); - } - - public static Logger GetLogger(string name) - { - return new Logger(name); - } - - /// <summary> - /// Log the message with the specified Log Level. - /// - /// If addtional arguments are passed, the message will be treated as - /// a format string. The format string and the additional arguments - /// will be formatted according to string.Format() - /// </summary> - /// <param name="level"></param> - /// <param name="formatStr"></param> - /// <param name="args"></param> - public void Log(Level level, string formatStr, params object[] args) - { - if (CustcomLevel >= level) - { - string msg = FormatMessage(formatStr, args); - string logMessage = - DateTime.Now.ToString("o", CultureInfo.InvariantCulture) - + " " - + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString("D4", CultureInfo.InvariantCulture) - + Environment.NewLine + LogLevel[(int)level] + ": " - + msg; - - _traceSource.TraceEvent( - EventTypes[level], - 0, // we don't use event id for now, but this can be useful for e2e logging later - logMessage); - } - } - - public void Log(Level level, string msg, Exception exception) - { - string exceptionLog = string.Empty; - if (exception != null) - { - exceptionLog = string.Format( - CultureInfo.InvariantCulture, - "encountered error [{0}] with mesage [{1}] and stack trace [{2}]", - exception, - exception.Message, - exception.StackTrace); - } - Log(level, msg + exceptionLog); - } - - public IDisposable LogFunction(string function, params object[] args) - { - return LogScope(function, args); - } - - public IDisposable LogScope(string format, params object[] args) - { - return new LoggingScope(this, DateTime.Now + " " + format, args); - } - - private string FormatMessage(string formatStr, params object[] args) - { - return args.Length > 0 ? string.Format(CultureInfo.CurrentCulture, formatStr, args) : formatStr; - } - - /// <summary> - /// Represents a logging scope. - /// </summary> - /// <remarks> - /// A start log is written when an instance is created - /// and a stop trace is written when the instance is disposed. - /// </remarks> - private sealed class LoggingScope : IDisposable - { - private readonly Stopwatch _stopWatch; - - private readonly Logger _logger; - - private readonly string _content; - - /// <summary> - /// Initializes a new instance of the LoggingScope class. - /// </summary> - /// <param name="logger"></param> - /// <param name="format"></param> - /// <param name="args"></param> - public LoggingScope(Logger logger, string format, params object[] args) - { - _logger = logger; - - _stopWatch = Stopwatch.StartNew(); - - string content = args.Length > 0 ? string.Format(CultureInfo.InvariantCulture, format, args) : format; - _content = content; - - _logger.Log(Level.Start, content); - } - - /// <summary> - /// Logs the end of a scope. - /// </summary> - public void Dispose() - { - _logger.Log(Level.Stop, string.Format(CultureInfo.InvariantCulture, "{0}. Duration: [{1}].", _content, _stopWatch.Elapsed)); - _stopWatch.Stop(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/NetUtilities.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/NetUtilities.cs b/lang/cs/Source/Utilities/NetUtilities.cs deleted file mode 100644 index 5a56645..0000000 --- a/lang/cs/Source/Utilities/NetUtilities.cs +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Utilities.Diagnostics; -using Org.Apache.Reef.Utilities.Logging; -using System; -using System.Net; - -namespace Org.Apache.Reef.Utilities -{ - public class NetUtilities - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(NetUtilities)); - - public static IPEndPoint ParseIpEndpoint(string ipWithPort) - { - string ip = ipWithPort.TrimStart().TrimEnd(); - if (char.IsDigit(ip[0])) - { - ip = @"socket://" + ip; - } - Uri uri = new Uri(ip); - string driverAddress = uri.Host; - int driverCommunicationPort = uri.Port; - IPAddress ipAddress; - IPAddress.TryParse(driverAddress, out ipAddress); - if (ipAddress == null) - { - Exceptions.Throw(new FormatException("invalid format for ip: " + ipWithPort), LOGGER); - } - - return new IPEndPoint(ipAddress, driverCommunicationPort); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/Optional.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/Optional.cs b/lang/cs/Source/Utilities/Optional.cs deleted file mode 100644 index 2d85ff4..0000000 --- a/lang/cs/Source/Utilities/Optional.cs +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using Org.Apache.Reef.Utilities.Logging; - -namespace Org.Apache.Reef.Utilities -{ - [Serializable] - public sealed class Optional<T> - { - private readonly T _value; - - private Optional(T value) - { - _value = value; - } - - private Optional() - { - _value = default(T); - } - - public T Value - { - get { return _value; } - } - - public static Optional<T> Of(T value) - { - if (value == null) - { - Diagnostics.Exceptions.Throw(new ArgumentNullException("value", "Passed a null value. Use OfNullable() instead"), Logger.GetLogger(typeof(Optional<T>))); - } - return new Optional<T>(value); - } - - public static Optional<T> Empty() - { - return new Optional<T>(); - } - - public static Optional<T> OfNullable(T value) - { - if (value == null) - { - return Empty(); - } - else - { - return Of(value); - } - } - - public T OrElse(T other) - { - if (IsPresent()) - { - return Value; - } - else - { - return other; - } - } - - public bool IsPresent() - { - return (_value != null); - } - - public override bool Equals(object obj) - { - if (this == obj) - { - return true; - } - if (obj == null || obj.GetType() != this.GetType()) - { - return false; - } - Optional<T> optional = (Optional<T>)obj; - if (_value != null ? !_value.Equals(optional.Value) : optional.Value != null) - { - return false; - } - return true; - } - - public override int GetHashCode() - { - return _value != null ? _value.GetHashCode() : 0; - } - - public override string ToString() - { - return "Optional{value=" + _value + "}"; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/Properties/AssemblyInfo.cs b/lang/cs/Source/Utilities/Properties/AssemblyInfo.cs deleted file mode 100644 index 50e52c5..0000000 --- a/lang/cs/Source/Utilities/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Utilities")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Utilities")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a7bda51a-552a-4fba-a834-f715c19454ab")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/Utilities.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/Utilities.csproj b/lang/cs/Source/Utilities/Utilities.csproj deleted file mode 100644 index d5b7898..0000000 --- a/lang/cs/Source/Utilities/Utilities.csproj +++ /dev/null @@ -1,116 +0,0 @@ -<?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> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{79E7F89A-1DFB-45E1-8D43-D71A954AEB98}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>Org.Apache.Reef.Utilities</RootNamespace> - <AssemblyName>Org.Apache.Reef.Utilities</AssemblyName> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <RestorePackages>true</RestorePackages> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..</SolutionDir> - </PropertyGroup> - <Import Project="$(SolutionDir)\Source\build.props" /> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <PlatformTarget>AnyCPU</PlatformTarget> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <PlatformTarget>AnyCPU</PlatformTarget> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Microsoft.Hadoop.Avro"> - <HintPath>$(PackagesDir)\Microsoft.Hadoop.Avro.$(AvroVersion)\lib\net40\Microsoft.Hadoop.Avro.dll</HintPath> - </Reference> - <Reference Include="Newtonsoft.Json"> - <HintPath>$(PackagesDir)\Newtonsoft.Json.$(NewtonsoftJsonVersion)\lib\net45\Newtonsoft.Json.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="AvroUtils.cs" /> - <Compile Include="ByteUtilities.cs" /> - <Compile Include="Diagnostics\DiagnosticsMessages.cs" /> - <Compile Include="Diagnostics\Exceptions.cs" /> - <Compile Include="IIdentifiable.cs" /> - <Compile Include="IMessage.cs" /> - <Compile Include="Logging\JavaLoggingSetting.cs" /> - <Compile Include="Logging\Level.cs" /> - <Compile Include="Logging\Logger.cs" /> - <Compile Include="NetUtilities.cs" /> - <Compile Include="Optional.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="ValidationUtilities.cs" /> - </ItemGroup> - <ItemGroup> - <None Include="packages.config" /> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/ValidationUtilities.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/ValidationUtilities.cs b/lang/cs/Source/Utilities/ValidationUtilities.cs deleted file mode 100644 index a452f1f..0000000 --- a/lang/cs/Source/Utilities/ValidationUtilities.cs +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using System.Globalization; -using Org.Apache.Reef.Utilities.Logging; - -namespace Org.Apache.Reef.Utilities -{ - public class ValidationUtilities - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(ValidationUtilities)); - - public static string ValidateEnvVariable(string env) - { - string envVariable = Environment.GetEnvironmentVariable(env); - if (string.IsNullOrWhiteSpace(envVariable)) - { - Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0} not set. Please set the environment variable first. Exiting...", env)); - string msg = string.Format(CultureInfo.InvariantCulture, "No {0} found.", env); - Diagnostics.Exceptions.Throw(new InvalidOperationException(msg), msg, LOGGER); - } - return envVariable; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/Utilities/packages.config ---------------------------------------------------------------------- diff --git a/lang/cs/Source/Utilities/packages.config b/lang/cs/Source/Utilities/packages.config deleted file mode 100644 index c60eef8..0000000 --- a/lang/cs/Source/Utilities/packages.config +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<packages> - <package id="Microsoft.Hadoop.Avro" version="1.4.0.0" targetFramework="net45" /> - <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" /> -</packages> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/AbstractEStage.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/AbstractEStage.cs b/lang/cs/Source/WAKE/Wake/AbstractEStage.cs deleted file mode 100644 index c2b1188..0000000 --- a/lang/cs/Source/WAKE/Wake/AbstractEStage.cs +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Wake -{ - /// <summary> - /// An estage that implements metering - /// </summary> - /// <typeparam name="T">The estage type</typeparam> - public abstract class AbstractEStage<T> : IEStage<T> - { - /// <summary>Constructs an abstract estage</summary> - /// <param name="meterName">the meter name</param> - protected AbstractEStage(string meterName) - { - } - - /// <summary>Updates the meter</summary> - /// <param name="value">an event</param> - public virtual void OnNext(T value) - { - } - - public abstract void Dispose(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/IEStage.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/IEStage.cs b/lang/cs/Source/WAKE/Wake/IEStage.cs deleted file mode 100644 index cc88d26..0000000 --- a/lang/cs/Source/WAKE/Wake/IEStage.cs +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Wake -{ - /// <summary>Stage that executes an event handler</summary> - public interface IEStage<T> : IEventHandler<T>, IStage - { - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/IEventHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/IEventHandler.cs b/lang/cs/Source/WAKE/Wake/IEventHandler.cs deleted file mode 100644 index db6f0c1..0000000 --- a/lang/cs/Source/WAKE/Wake/IEventHandler.cs +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Wake -{ - /// <summary> - /// Handler to process an event - /// </summary> - /// <typeparam name="T">The type of event</typeparam> - public interface IEventHandler<T> - { - /// <summary> - /// Process an event - /// </summary> - /// <param name="value">The event to process</param> - void OnNext(T value); - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/IIdentifier.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/IIdentifier.cs b/lang/cs/Source/WAKE/Wake/IIdentifier.cs deleted file mode 100644 index 38e63aa..0000000 --- a/lang/cs/Source/WAKE/Wake/IIdentifier.cs +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Org.Apache.Reef.Wake -{ - /// <summary> - /// Identifier class for REEF. - /// - /// Identifiers are a generic naming primitive that carry some information about - /// the type of object that they point to. - /// - /// Examples include remote sockets or filenames. - /// </summary> - public abstract class IIdentifier - { - /// <summary> - /// Returns a hash code for the object - /// </summary> - /// <returns>The hash code value for this object</returns> - public abstract override int GetHashCode(); - - /// <summary> - /// Checks that another object is equal to this object - /// </summary> - /// <param name="o">The object to compare</param> - /// <returns>True if the object is the same as the object argument; false, otherwise</returns> - public abstract override bool Equals(object o); - - /// <summary> - /// Returns a string representation of this object - /// </summary> - /// <returns>A string representation of this object</returns> - public abstract override string ToString(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/IIdentifierFactory.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/IIdentifierFactory.cs b/lang/cs/Source/WAKE/Wake/IIdentifierFactory.cs deleted file mode 100644 index a06928a..0000000 --- a/lang/cs/Source/WAKE/Wake/IIdentifierFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Tang.Annotations; -using Org.Apache.Reef.Wake.Remote.Impl; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Org.Apache.Reef.Wake -{ - [DefaultImplementation(typeof(StringIdentifierFactory))] - public interface IIdentifierFactory - { - IIdentifier Create(string s); - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/IObserverFactory.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/IObserverFactory.cs b/lang/cs/Source/WAKE/Wake/IObserverFactory.cs deleted file mode 100644 index 32242d1..0000000 --- a/lang/cs/Source/WAKE/Wake/IObserverFactory.cs +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Org.Apache.Reef.Wake -{ - public interface IObserverFactory - { - object Create(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/IStage.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/IStage.cs b/lang/cs/Source/WAKE/Wake/IStage.cs deleted file mode 100644 index afc72a5..0000000 --- a/lang/cs/Source/WAKE/Wake/IStage.cs +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; - -namespace Org.Apache.Reef.Wake -{ - /// <summary>Stage is an execution unit for events and provides a way to reclaim its resources - /// </summary> - public interface IStage : IDisposable - { - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/Impl/LoggingEventHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/Impl/LoggingEventHandler.cs b/lang/cs/Source/WAKE/Wake/Impl/LoggingEventHandler.cs deleted file mode 100644 index 35549ae..0000000 --- a/lang/cs/Source/WAKE/Wake/Impl/LoggingEventHandler.cs +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Annotations; -using System; - -namespace Org.Apache.Reef.Wake.Impl -{ - /// <summary>A logging event handler</summary> - public class LoggingEventHandler<T> : IObserver<T> - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(T)); - - [Inject] - public LoggingEventHandler() - { - } - - /// <summary>Logs the event</summary> - /// <param name="value">an event</param> - public void OnNext(T value) - { - LOGGER.Log(Level.Verbose, "Event: " + DateTime.Now + 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/c1b5200f/lang/cs/Source/WAKE/Wake/Impl/MissingStartHandlerHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/Impl/MissingStartHandlerHandler.cs b/lang/cs/Source/WAKE/Wake/Impl/MissingStartHandlerHandler.cs deleted file mode 100644 index 60e7fa0..0000000 --- a/lang/cs/Source/WAKE/Wake/Impl/MissingStartHandlerHandler.cs +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using Org.Apache.Reef.Tang.Annotations; -using Org.Apache.Reef.Wake.Time; - -namespace Org.Apache.Reef.Wake.Impl -{ - public class MissingStartHandlerHandler : IObserver<StartTime> - { - [Inject] - public MissingStartHandlerHandler() - { - } - - public void OnNext(StartTime value) - { - // Do nothing, since we only use this for evaluator, not for driver. - // LOGGER.Log(Level.Info, "No binding to Clock.StartHandler. It is likely that the clock will immediately go idle and close."); - } - - 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/c1b5200f/lang/cs/Source/WAKE/Wake/Impl/MultiEventHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/Impl/MultiEventHandler.cs b/lang/cs/Source/WAKE/Wake/Impl/MultiEventHandler.cs deleted file mode 100644 index 855e459..0000000 --- a/lang/cs/Source/WAKE/Wake/Impl/MultiEventHandler.cs +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using System.Collections.Generic; -using Org.Apache.Reef.Utilities.Logging; - -namespace Org.Apache.Reef.Wake.Impl -{ - /// <summary>Event handler that dispatches an event to a specific handler based on an event class type - /// </summary> - public class MultiEventHandler<T> : IEventHandler<T> - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(MultiEventHandler<T>)); - private readonly IDictionary<Type, IEventHandler<T>> _map; - - /// <summary>Constructs a multi-event handler</summary> - /// <param name="map">a map of class types to event handlers</param> - public MultiEventHandler(IDictionary<Type, IEventHandler<T>> map) - { - foreach (Type item in map.Keys) - { - if (!typeof(T).IsAssignableFrom(item)) - { - Org.Apache.Reef.Utilities.Diagnostics.Exceptions.Throw(new WakeRuntimeException(typeof(T) + " is not assignable from " + item), LOGGER); - } - } - _map = map; - } - - /// <summary> - /// Invokes a specific handler for the event class type if it exists - /// </summary> - /// <param name="value">The event to handle</param> - public void OnNext(T value) - { - IEventHandler<T> handler = null; - bool success = _map.TryGetValue(value.GetType(), out handler); - if (success) - { - handler.OnNext(value); - } - else - { - Org.Apache.Reef.Utilities.Diagnostics.Exceptions.Throw(new WakeRuntimeException("No event " + value.GetType() + " handler"), LOGGER); - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/WAKE/Wake/Impl/PeriodicEvent.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/WAKE/Wake/Impl/PeriodicEvent.cs b/lang/cs/Source/WAKE/Wake/Impl/PeriodicEvent.cs deleted file mode 100644 index 417f008..0000000 --- a/lang/cs/Source/WAKE/Wake/Impl/PeriodicEvent.cs +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Wake.Impl -{ - /// <summary>Periodic event for timers</summary> - public class PeriodicEvent - { - } -}
