http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableSerializer.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableSerializer.cs deleted file mode 100644 index ac40dd7..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableSerializer.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 Apache.Ignite.Core.Portable -{ - /// <summary> - /// Portable serializer. - /// </summary> - public interface IPortableSerializer - { - /// <summary> - /// Write portalbe object. - /// </summary> - /// <param name="obj">Object.</param> - /// <param name="writer">Poratble writer.</param> - void WritePortable(object obj, IPortableWriter writer); - - /// <summary> - /// Read portable object. - /// </summary> - /// <param name="obj">Instantiated empty object.</param> - /// <param name="reader">Poratble reader.</param> - void ReadPortable(object obj, IPortableReader reader); - } -}
http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs deleted file mode 100644 index c7b8e11..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Portable -{ - using System; - using System.Collections; - - /// <summary> - /// Writer for portable objects. - /// </summary> - public interface IPortableWriter - { - /// <summary> - /// Write named byte value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Byte value.</param> - void WriteByte(string fieldName, byte val); - - /// <summary> - /// Write named byte array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Byte array.</param> - void WriteByteArray(string fieldName, byte[] val); - - /// <summary> - /// Write named char value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Char value.</param> - void WriteChar(string fieldName, char val); - - /// <summary> - /// Write named char array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Char array.</param> - void WriteCharArray(string fieldName, char[] val); - - /// <summary> - /// Write named short value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Short value.</param> - void WriteShort(string fieldName, short val); - - /// <summary> - /// Write named short array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Short array.</param> - void WriteShortArray(string fieldName, short[] val); - - /// <summary> - /// Write named int value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Int value.</param> - void WriteInt(string fieldName, int val); - - /// <summary> - /// Write named int array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Int array.</param> - void WriteIntArray(string fieldName, int[] val); - - /// <summary> - /// Write named long value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Long value.</param> - void WriteLong(string fieldName, long val); - - /// <summary> - /// Write named long array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Long array.</param> - void WriteLongArray(string fieldName, long[] val); - - /// <summary> - /// Write named boolean value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Boolean value.</param> - void WriteBoolean(string fieldName, bool val); - - /// <summary> - /// Write named boolean array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Boolean array.</param> - void WriteBooleanArray(string fieldName, bool[] val); - - /// <summary> - /// Write named float value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Float value.</param> - void WriteFloat(string fieldName, float val); - - /// <summary> - /// Write named float array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Float array.</param> - void WriteFloatArray(string fieldName, float[] val); - - /// <summary> - /// Write named double value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Double value.</param> - void WriteDouble(string fieldName, double val); - - /// <summary> - /// Write named double array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Double array.</param> - void WriteDoubleArray(string fieldName, double[] val); - - /// <summary> - /// Write named decimal value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Decimal value.</param> - void WriteDecimal(string fieldName, decimal? val); - - /// <summary> - /// Write named decimal array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Decimal array.</param> - void WriteDecimalArray(string fieldName, decimal?[] val); - - /// <summary> - /// Write named date value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Date value.</param> - void WriteTimestamp(string fieldName, DateTime? val); - - /// <summary> - /// Write named date array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Date array.</param> - void WriteTimestampArray(string fieldName, DateTime?[] val); - - /// <summary> - /// Write named string value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">String value.</param> - void WriteString(string fieldName, string val); - - /// <summary> - /// Write named string array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">String array.</param> - void WriteStringArray(string fieldName, string[] val); - - /// <summary> - /// Write named GUID value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">GUID value.</param> - void WriteGuid(string fieldName, Guid? val); - - /// <summary> - /// Write named GUID array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">GUID array.</param> - void WriteGuidArray(string fieldName, Guid?[] val); - - /// <summary> - /// Write named enum value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Enum value.</param> - void WriteEnum<T>(string fieldName, T val); - - /// <summary> - /// Write named enum array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Enum array.</param> - void WriteEnumArray<T>(string fieldName, T[] val); - - /// <summary> - /// Write named object value. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Object value.</param> - void WriteObject<T>(string fieldName, T val); - - /// <summary> - /// Write named object array. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Object array.</param> - void WriteArray<T>(string fieldName, T[] val); - - /// <summary> - /// Writes a named collection in interoperable form. - /// - /// Use this method to communicate with other platforms - /// or with nodes that need to read collection elements in portable form. - /// - /// When there is no need for portables or interoperability, please use <see cref="WriteObject{T}" />, - /// which will properly preserve generic collection type. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Collection.</param> - void WriteCollection(string fieldName, ICollection val); - - /// <summary> - /// Writes a named dictionary in interoperable form. - /// - /// Use this method to communicate with other platforms - /// or with nodes that need to read dictionary elements in portable form. - /// - /// When there is no need for portables or interoperability, please use <see cref="WriteObject{T}" />, - /// which will properly preserve generic dictionary type. - /// </summary> - /// <param name="fieldName">Field name.</param> - /// <param name="val">Dictionary.</param> - void WriteDictionary(string fieldName, IDictionary val); - - /// <summary> - /// Get raw writer. - /// </summary> - /// <returns>Raw writer.</returns> - IPortableRawWriter GetRawWriter(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortables.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortables.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortables.cs deleted file mode 100644 index b1e77a6..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortables.cs +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Portable -{ - using System; - using System.Collections.Generic; - - /// <summary> - /// Defines portable objects functionality. With portable objects you are able to: - /// <list type="bullet"> - /// <item> - /// <description>Seamlessly interoperate between Java, .NET, and C++.</description> - /// </item> - /// <item> - /// <description>Make any object portable with zero code change to your existing code.</description> - /// </item> - /// <item> - /// <description>Nest portable objects within each other.</description> - /// </item> - /// <item> - /// <description>Automatically handle <c>circular</c> or <c>null</c> references.</description> - /// </item> - /// <item> - /// <description>Automatically convert collections and maps between Java, .NET, and C++.</description> - /// </item> - /// <item> - /// <description>Optionally avoid deserialization of objects on the server side.</description> - /// </item> - /// <item> - /// <description>Avoid need to have concrete class definitions on the server side.</description> - /// </item> - /// <item> - /// <description>Dynamically change structure of the classes without having to restart the cluster.</description> - /// </item> - /// <item> - /// <description>Index into portable objects for querying purposes.</description> - /// </item> - /// </list> - /// </summary> - public interface IPortables - { - /// <summary> - /// Converts provided object to portable form. - /// <para /> - /// Note that object's type needs to be configured in <see cref="PortableConfiguration"/>. - /// </summary> - /// <param name="obj">Object to convert.</param> - /// <returns>Converted object.</returns> - T ToPortable<T>(object obj); - - /// <summary> - /// Create builder for the given portable object type. Note that this - /// type must be specified in <see cref="PortableConfiguration"/>. - /// </summary> - /// <param name="type"></param> - /// <returns>Builder.</returns> - IPortableBuilder GetBuilder(Type type); - - /// <summary> - /// Create builder for the given portable object type name. Note that this - /// type name must be specified in <see cref="PortableConfiguration"/>. - /// </summary> - /// <param name="typeName">Type name.</param> - /// <returns>Builder.</returns> - IPortableBuilder GetBuilder(string typeName); - - /// <summary> - /// Create builder over existing portable object. - /// </summary> - /// <param name="obj"></param> - /// <returns>Builder.</returns> - IPortableBuilder GetBuilder(IPortableObject obj); - - /// <summary> - /// Gets type id for the given type name. - /// </summary> - /// <param name="typeName">Type name.</param> - /// <returns>Type id.</returns> - int GetTypeId(string typeName); - - /// <summary> - /// Gets metadata for all known types. - /// </summary> - /// <returns>Metadata.</returns> - ICollection<IPortableMetadata> GetMetadata(); - - /// <summary> - /// Gets metadata for specified type id. - /// </summary> - /// <returns>Metadata.</returns> - IPortableMetadata GetMetadata(int typeId); - - /// <summary> - /// Gets metadata for specified type name. - /// </summary> - /// <returns>Metadata.</returns> - IPortableMetadata GetMetadata(string typeName); - - /// <summary> - /// Gets metadata for specified type. - /// </summary> - /// <returns>Metadata.</returns> - IPortableMetadata GetMetadata(Type type); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableConfiguration.cs deleted file mode 100644 index 5531423..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableConfiguration.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Portable -{ - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - - /// <summary> - /// Portable type configuration. - /// </summary> - public class PortableConfiguration - { - /// <summary> - /// Constructor. - /// </summary> - public PortableConfiguration() - { - DefaultKeepDeserialized = true; - } - - /// <summary> - /// Copying constructor. - /// </summary> - /// <param name="cfg">Configuration to copy.</param> - public PortableConfiguration(PortableConfiguration cfg) - { - DefaultIdMapper = cfg.DefaultIdMapper; - DefaultNameMapper = cfg.DefaultNameMapper; - DefaultKeepDeserialized = cfg.DefaultKeepDeserialized; - DefaultSerializer = cfg.DefaultSerializer; - - Types = cfg.Types != null ? new List<string>(cfg.Types) : null; - - if (cfg.TypeConfigurations != null) - { - TypeConfigurations = new List<PortableTypeConfiguration>(cfg.TypeConfigurations.Count); - - foreach (PortableTypeConfiguration typeCfg in cfg.TypeConfigurations) - TypeConfigurations.Add(new PortableTypeConfiguration(typeCfg)); - } - } - - /// <summary> - /// Type configurations. - /// </summary> - [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public ICollection<PortableTypeConfiguration> TypeConfigurations - { - get; - set; - } - - /// <summary> - /// Portable types. Shorthand for creating PortableTypeConfiguration. - /// </summary> - [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public ICollection<string> Types - { - get; - set; - } - - /// <summary> - /// Default name mapper. - /// </summary> - public IPortableNameMapper DefaultNameMapper - { - get; - set; - } - - /// <summary> - /// Default ID mapper. - /// </summary> - public IPortableIdMapper DefaultIdMapper - { - get; - set; - } - - /// <summary> - /// Default serializer. - /// </summary> - public IPortableSerializer DefaultSerializer - { - get; - set; - } - - /// <summary> - /// Default keep deserialized flag. - /// </summary> - public bool DefaultKeepDeserialized - { - get; - set; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableException.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableException.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableException.cs deleted file mode 100644 index 95edbc0..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableException.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Portable -{ - using System; - using System.Runtime.Serialization; - using Apache.Ignite.Core.Common; - - /// <summary> - /// Indicates an error during portable marshalling. - /// </summary> - [Serializable] - public class PortableException : IgniteException - { - /// <summary> - /// Constructs an exception. - /// </summary> - public PortableException() - { - // No-op. - } - - /// <summary> - /// Initializes a new instance of the <see cref="PortableException"/> class. - /// </summary> - /// <param name="message">The message that describes the error.</param> - public PortableException(string message) - : base(message) { - } - - /// <summary> - /// Initializes a new instance of the <see cref="PortableException"/> class. - /// </summary> - /// <param name="message">The message.</param> - /// <param name="cause">The cause.</param> - public PortableException(string message, Exception cause) - : base(message, cause) { - } - - /// <summary> - /// Constructs an exception. - /// </summary> - /// <param name="info">Serialization info.</param> - /// <param name="ctx">Streaming context.</param> - protected PortableException(SerializationInfo info, StreamingContext ctx) - : base(info, ctx) { - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeConfiguration.cs deleted file mode 100644 index 441b81b..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeConfiguration.cs +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Portable -{ - using System; - - /// <summary> - /// Portable type configuration. - /// </summary> - public class PortableTypeConfiguration - { - /// <summary> - /// Constructor. - /// </summary> - public PortableTypeConfiguration() - { - // No-op. - } - - /// <summary> - /// Constructor. - /// </summary> - /// <param name="typeName">Type name.</param> - public PortableTypeConfiguration(string typeName) - { - TypeName = typeName; - } - - /// <summary> - /// Constructor. - /// </summary> - /// <param name="type">Type.</param> - public PortableTypeConfiguration(Type type) - { - TypeName = type.AssemblyQualifiedName; - } - - /// <summary> - /// Copying constructor. - /// </summary> - /// <param name="cfg">Configuration to copy.</param> - public PortableTypeConfiguration(PortableTypeConfiguration cfg) - { - AffinityKeyFieldName = cfg.AffinityKeyFieldName; - IdMapper = cfg.IdMapper; - NameMapper = cfg.NameMapper; - Serializer = cfg.Serializer; - TypeName = cfg.TypeName; - KeepDeserialized = cfg.KeepDeserialized; - } - - /// <summary> - /// Fully qualified type name. - /// </summary> - public string TypeName { get; set; } - - /// <summary> - /// Name mapper for the given type. - /// </summary> - public IPortableNameMapper NameMapper { get; set; } - - /// <summary> - /// ID mapper for the given type. When it is necessary to resolve class (field) ID, then - /// this property will be checked first. If not set, then PortableClassIdAttribute - /// (PortableFieldIdAttribute) will be checked in class through reflection. If required - /// attribute is not set, then ID will be hash code of the class (field) simple name in lower case. - /// </summary> - public IPortableIdMapper IdMapper { get; set; } - - /// <summary> - /// Serializer for the given type. If not provided and class implements IPortable - /// then its custom logic will be used. If not provided and class doesn't implement IPortable - /// then all fields of the class except of those with [NotSerialized] attribute will be serialized - ///with help of reflection. - /// </summary> - public IPortableSerializer Serializer { get; set; } - - /// <summary> - /// Affinity key field name. - /// </summary> - public string AffinityKeyFieldName { get; set; } - - /// <summary> - /// Keep deserialized flag. If set to non-null value, overrides default value set in - /// PortableConfiguration. - /// </summary> - public bool? KeepDeserialized { get; set; } - - /// <summary> - /// Returns a string that represents the current object. - /// </summary> - /// <returns> - /// A string that represents the current object. - /// </returns> - public override string ToString() - { - return typeof (PortableTypeConfiguration).Name + " [TypeName=" + TypeName + - ", NameMapper=" + NameMapper + ", IdMapper=" + IdMapper + ", Serializer=" + Serializer + - ", AffinityKeyFieldName=" + AffinityKeyFieldName + ']'; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs deleted file mode 100644 index 14d9da9..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Portable -{ - /// <summary> - /// Portable type name constants. - /// </summary> - public static class PortableTypeNames - { - /** Type name: boolean. */ - public const string TypeNameBool = "boolean"; - - /** Type name: byte. */ - public const string TypeNameByte = "byte"; - - /** Type name: short. */ - public const string TypeNameShort = "short"; - - /** Type name: char. */ - public const string TypeNameChar = "char"; - - /** Type name: int. */ - public const string TypeNameInt = "int"; - - /** Type name: long. */ - public const string TypeNameLong = "long"; - - /** Type name: float. */ - public const string TypeNameFloat = "float"; - - /** Type name: double. */ - public const string TypeNameDouble = "double"; - - /** Type name: decimal. */ - public const string TypeNameDecimal = "decimal"; - - /** Type name: String. */ - public const string TypeNameString = "String"; - - /** Type name: UUID. */ - public const string TypeNameGuid = "UUID"; - - /** Type name: date. */ - public const string TypeNameDate = "Date"; - - /** Type name: timestamp. */ - public const string TypeNameTimestamp = "Timestamp"; - - /** Type name: Enum. */ - public const string TypeNameEnum = "Enum"; - - /** Type name: Object. */ - public const string TypeNameObject = "Object"; - - /** Type name: boolean array. */ - public const string TypeNameArrayBool = "boolean[]"; - - /** Type name: byte array. */ - public const string TypeNameArrayByte = "byte[]"; - - /** Type name: short array. */ - public const string TypeNameArrayShort = "short[]"; - - /** Type name: char array. */ - public const string TypeNameArrayChar = "char[]"; - - /** Type name: int array. */ - public const string TypeNameArrayInt = "int[]"; - - /** Type name: long array. */ - public const string TypeNameArrayLong = "long[]"; - - /** Type name: float array. */ - public const string TypeNameArrayFloat = "float[]"; - - /** Type name: double array. */ - public const string TypeNameArrayDouble = "double[]"; - - /** Type name: decimal array. */ - public const string TypeNameArrayDecimal = "decimal[]"; - - /** Type name: String array. */ - public const string TypeNameArrayString = "String[]"; - - /** Type name: UUID array. */ - public const string TypeNameArrayGuid = "UUID[]"; - - /** Type name: timestamp array. */ - public const string TypeNameArrayDate = "Date[]"; - - /** Type name: timestamp array. */ - public const string TypeNameArrayTimestamp = "Timestamp[]"; - - /** Type name: Enum array. */ - public const string TypeNameArrayEnum = "Enum[]"; - - /** Type name: Object array. */ - public const string TypeNameArrayObject = "Object[]"; - - /** Type name: Collection. */ - public const string TypeNameCollection = "Collection"; - - /** Type name: Map. */ - public const string TypeNameMap = "Map"; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Services/IServices.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Services/IServices.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Services/IServices.cs index da7394f..ac9b4d9 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Services/IServices.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Services/IServices.cs @@ -240,17 +240,17 @@ namespace Apache.Ignite.Core.Services T GetServiceProxy<T>(string name, bool sticky) where T : class; /// <summary> - /// Returns an instance with portable mode enabled. - /// Service method results will be kept in portable form. + /// Returns an instance with binary mode enabled. + /// Service method results will be kept in binary form. /// </summary> - /// <returns>Instance with portable mode enabled.</returns> - IServices WithKeepPortable(); + /// <returns>Instance with binary mode enabled.</returns> + IServices WithKeepBinary(); /// <summary> - /// Returns an instance with server-side portable mode enabled. - /// Service method arguments will be kept in portable form. + /// Returns an instance with server-side binary mode enabled. + /// Service method arguments will be kept in binary form. /// </summary> - /// <returns>Instance with server-side portable mode enabled.</returns> - IServices WithServerKeepPortable(); + /// <returns>Instance with server-side binary mode enabled.</returns> + IServices WithServerKeepBinary(); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Services/ServiceInvocationException.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Services/ServiceInvocationException.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Services/ServiceInvocationException.cs index fe83cbc..50365d3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Services/ServiceInvocationException.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Services/ServiceInvocationException.cs @@ -19,8 +19,8 @@ namespace Apache.Ignite.Core.Services { using System; using System.Runtime.Serialization; + using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Common; - using Apache.Ignite.Core.Portable; /// <summary> /// Indicates an error during Grid Services invocation. @@ -29,10 +29,10 @@ namespace Apache.Ignite.Core.Services public class ServiceInvocationException : IgniteException { /** Serializer key. */ - private const string KeyPortableCause = "PortableCause"; + private const string KeyBinaryCause = "BinaryCause"; /** Cause. */ - private readonly IPortableObject _portableCause; + private readonly IBinaryObject _binaryCause; /// <summary> /// Initializes a new instance of the <see cref="ServiceInvocationException"/> class. @@ -64,11 +64,11 @@ namespace Apache.Ignite.Core.Services /// Initializes a new instance of the <see cref="ServiceInvocationException"/> class. /// </summary> /// <param name="message">The message.</param> - /// <param name="portableCause">The portable cause.</param> - public ServiceInvocationException(string message, IPortableObject portableCause) + /// <param name="binaryCause">The binary cause.</param> + public ServiceInvocationException(string message, IBinaryObject binaryCause) :base(message) { - _portableCause = portableCause; + _binaryCause = binaryCause; } /// <summary> @@ -79,21 +79,21 @@ namespace Apache.Ignite.Core.Services protected ServiceInvocationException(SerializationInfo info, StreamingContext ctx) : base(info, ctx) { - _portableCause = (IPortableObject) info.GetValue(KeyPortableCause, typeof (IPortableObject)); + _binaryCause = (IBinaryObject) info.GetValue(KeyBinaryCause, typeof (IBinaryObject)); } /// <summary> - /// Gets the portable cause. + /// Gets the binary cause. /// </summary> - public IPortableObject PortableCause + public IBinaryObject BinaryCause { - get { return _portableCause; } + get { return _binaryCause; } } /** <inheritdoc /> */ public override void GetObjectData(SerializationInfo info, StreamingContext context) { - info.AddValue(KeyPortableCause, _portableCause); + info.AddValue(KeyBinaryCause, _binaryCause); base.GetObjectData(info, context); } http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs index bace1b9..70ca00c 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs @@ -19,10 +19,11 @@ using System; using System.Collections.Generic; using Apache.Ignite.Core; using Apache.Ignite.ExamplesDll.Compute; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.Examples.Compute { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// Example demonstrating task execution. /// <para /> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs index 270d147..5c07204 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs @@ -18,13 +18,14 @@ using System; using System.Collections.Generic; using Apache.Ignite.Core; -using Apache.Ignite.Core.Portable; -using Apache.Ignite.ExamplesDll.Portable; +using Apache.Ignite.Core.Binary; namespace Apache.Ignite.Examples.Datagrid { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> - /// This example demonstrates use of portable objects between different platforms. + /// This example demonstrates use of binary objects between different platforms. /// <para/> /// This example must be run with standalone Java node. To achieve this start a node from %IGNITE_HOME% /// using "ignite.bat" with proper configuration: @@ -99,10 +100,10 @@ namespace Apache.Ignite.Examples.Datagrid // Retrieve value stored by C++ client. GetFromCpp(ignite); - // Gets portable value from cache in portable format, without de-serializing it. - GetDotNetPortableInstance(ignite); + // Gets binary value from cache in binary format, without de-serializing it. + GetDotNetBinaryInstance(ignite); - // Gets portable value form cache as a strongly-typed fully de-serialized instance. + // Gets binary value form cache as a strongly-typed fully de-serialized instance. GetDotNetTypedInstance(ignite); Console.WriteLine(); @@ -121,12 +122,12 @@ namespace Apache.Ignite.Examples.Datagrid /// <param name="ignite">Ignite instance.</param> private static void GetFromJava(IIgnite ignite) { - var cache = ignite.GetOrCreateCache<int, IPortableObject>(CacheName) - .WithKeepPortable<int, IPortableObject>(); + var cache = ignite.GetOrCreateCache<int, IBinaryObject>(CacheName) + .WithKeepBinary<int, IBinaryObject>(); - var orgPortable = cache.GetAsync(KeyJava).Result; + var orgBinary = cache.GetAsync(KeyJava).Result; - if (orgPortable == null) + if (orgBinary == null) { Console.WriteLine(">>> Java client hasn't put entry to cache. Run Java example before this example " + "to see the output."); @@ -134,8 +135,8 @@ namespace Apache.Ignite.Examples.Datagrid else { Console.WriteLine(">>> Entry from Java client:"); - Console.WriteLine(">>> Portable: " + orgPortable); - Console.WriteLine(">>> Deserialized: " + orgPortable.Deserialize<Organization>()); + Console.WriteLine(">>> Binary: " + orgBinary); + Console.WriteLine(">>> Deserialized: " + orgBinary.Deserialize<Organization>()); } } @@ -146,14 +147,14 @@ namespace Apache.Ignite.Examples.Datagrid /// <param name="ignite">Ignite instance.</param> private static void GetFromCpp(IIgnite ignite) { - var cache = ignite.GetOrCreateCache<int, IPortableObject>(CacheName) - .WithKeepPortable<int, IPortableObject>(); + var cache = ignite.GetOrCreateCache<int, IBinaryObject>(CacheName) + .WithKeepBinary<int, IBinaryObject>(); - var orgPortable = cache.GetAsync(KeyCpp).Result; + var orgBinary = cache.GetAsync(KeyCpp).Result; Console.WriteLine(); - if (orgPortable == null) + if (orgBinary == null) { Console.WriteLine(">>> CPP client hasn't put entry to cache. Run CPP example before this example " + "to see the output."); @@ -161,31 +162,31 @@ namespace Apache.Ignite.Examples.Datagrid else { Console.WriteLine(">>> Entry from CPP client:"); - Console.WriteLine(">>> Portable: " + orgPortable); - Console.WriteLine(">>> Deserialized: " + orgPortable.Deserialize<Organization>()); + Console.WriteLine(">>> Binary: " + orgBinary); + Console.WriteLine(">>> Deserialized: " + orgBinary.Deserialize<Organization>()); } } /// <summary> - /// Gets portable value from cache in portable format, without de-serializing it. + /// Gets binary value from cache in binary format, without de-serializing it. /// </summary> /// <param name="ignite">Ignite instance.</param> - private static void GetDotNetPortableInstance(IIgnite ignite) + private static void GetDotNetBinaryInstance(IIgnite ignite) { - // Apply "KeepPortable" flag on data projection. - var cache = ignite.GetOrCreateCache<int, IPortableObject>(CacheName) - .WithKeepPortable<int, IPortableObject>(); + // Apply "KeepBinary" flag on data projection. + var cache = ignite.GetOrCreateCache<int, IBinaryObject>(CacheName) + .WithKeepBinary<int, IBinaryObject>(); var org = cache.Get(KeyDotnet); string name = org.GetField<string>("name"); Console.WriteLine(); - Console.WriteLine(">>> Retrieved organization name from portable field: " + name); + Console.WriteLine(">>> Retrieved organization name from binary field: " + name); } /// <summary> - /// Gets portable value form cache as a strongly-typed fully de-serialized instance. + /// Gets binary value form cache as a strongly-typed fully de-serialized instance. /// </summary> /// <param name="ignite">Ignite instance.</param> private static void GetDotNetTypedInstance(IIgnite ignite) http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs index 354e3be..a841331 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs @@ -20,10 +20,11 @@ using System.Collections.Generic; using System.Diagnostics; using Apache.Ignite.Core; using Apache.Ignite.Core.Datastream; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.Examples.Datagrid { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// Demonstrates how cache can be populated with data utilizing <see cref="IDataStreamer{TK,TV}"/>. /// Data streamer is a lot more efficient to use than standard cache put operation http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs index ff6c4de..91d3f94 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs @@ -18,15 +18,16 @@ using System; using System.Collections.Generic; using Apache.Ignite.Core; -using Apache.Ignite.Core.Portable; -using Apache.Ignite.ExamplesDll.Portable; +using Apache.Ignite.Core.Binary; namespace Apache.Ignite.Examples.Datagrid { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// This example demonstrates several put-get operations on Ignite cache - /// with portable values. Note that portable object can be retrieved in - /// fully-deserialized form or in portable object format using special + /// with binary values. Note that binary object can be retrieved in + /// fully-deserialized form or in binary object format using special /// cache projection. /// <para /> /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build). @@ -66,9 +67,9 @@ namespace Apache.Ignite.Examples.Datagrid ignite.GetOrCreateCache<object, object>(CacheName).Clear(); PutGet(ignite); - PutGetPortable(ignite); + PutGetBinary(ignite); PutAllGetAll(ignite); - PutAllGetAllPortable(ignite); + PutAllGetAllBinary(ignite); Console.WriteLine(); } @@ -105,10 +106,10 @@ namespace Apache.Ignite.Examples.Datagrid } /// <summary> - /// Execute individual Put and Get, getting value in portable format, without de-serializing it. + /// Execute individual Put and Get, getting value in binary format, without de-serializing it. /// </summary> /// <param name="ignite">Ignite instance.</param> - private static void PutGetPortable(IIgnite ignite) + private static void PutGetBinary(IIgnite ignite) { var cache = ignite.GetCache<int, Organization>(CacheName); @@ -123,17 +124,17 @@ namespace Apache.Ignite.Examples.Datagrid // Put created data entry to cache. cache.Put(1, org); - // Create projection that will get values as portable objects. - var portableCache = cache.WithKeepPortable<int, IPortableObject>(); + // Create projection that will get values as binary objects. + var binaryCache = cache.WithKeepBinary<int, IBinaryObject>(); - // Get recently created organization as a portable object. - var portableOrg = portableCache.Get(1); + // Get recently created organization as a binary object. + var binaryOrg = binaryCache.Get(1); - // Get organization's name from portable object (note that object doesn't need to be fully deserialized). - string name = portableOrg.GetField<string>("name"); + // Get organization's name from binary object (note that object doesn't need to be fully deserialized). + string name = binaryOrg.GetField<string>("name"); Console.WriteLine(); - Console.WriteLine(">>> Retrieved organization name from portable object: " + name); + Console.WriteLine(">>> Retrieved organization name from binary object: " + name); } /// <summary> @@ -175,10 +176,10 @@ namespace Apache.Ignite.Examples.Datagrid } /// <summary> - /// Execute bulk Put and Get operations getting values in portable format, without de-serializing it. + /// Execute bulk Put and Get operations getting values in binary format, without de-serializing it. /// </summary> /// <param name="ignite">Ignite instance.</param> - private static void PutAllGetAllPortable(IIgnite ignite) + private static void PutAllGetAllBinary(IIgnite ignite) { var cache = ignite.GetCache<int, Organization>(CacheName); @@ -202,17 +203,16 @@ namespace Apache.Ignite.Examples.Datagrid // Put created data entries to cache. cache.PutAll(map); - // Create projection that will get values as portable objects. - var portableCache = cache.WithKeepPortable<int, IPortableObject>(); + // Create projection that will get values as binary objects. + var binaryCache = cache.WithKeepBinary<int, IBinaryObject>(); - // Get recently created organizations as portable objects. - IDictionary<int, IPortableObject> portableMap = - portableCache.GetAll(new List<int> { 1, 2 }); + // Get recently created organizations as binary objects. + IDictionary<int, IBinaryObject> binaryMap = binaryCache.GetAll(new List<int> { 1, 2 }); Console.WriteLine(); - Console.WriteLine(">>> Retrieved organization names from portable objects:"); + Console.WriteLine(">>> Retrieved organization names from binary objects:"); - foreach (IPortableObject poratbleOrg in portableMap.Values) + foreach (IBinaryObject poratbleOrg in binaryMap.Values) Console.WriteLine(">>> " + poratbleOrg.GetField<string>("name")); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs index a8c26c7..1951c5e 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs @@ -21,10 +21,11 @@ using System.Collections.Generic; using Apache.Ignite.Core; using Apache.Ignite.Core.Cache; using Apache.Ignite.Core.Cache.Query; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.Examples.Datagrid { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// This example populates cache with sample data and runs several SQL and /// full text queries over this data. http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs index 34721bc..2e5629b 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs @@ -19,10 +19,11 @@ using System; using System.Collections.Generic; using Apache.Ignite.Core; using Apache.Ignite.ExamplesDll.Datagrid; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.Examples.Datagrid { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// Example demonstrating cache store. /// <para /> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs index 6182a2c..80081e7 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs @@ -19,10 +19,11 @@ using System; using System.Collections.Generic; using Apache.Ignite.Core; using Apache.Ignite.Core.Transactions; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.Examples.Datagrid { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// This example demonstrates how to use transactions on Apache cache. /// <para /> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs index f9d54b9..91a41d4 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs @@ -22,10 +22,11 @@ using Apache.Ignite.Core; using Apache.Ignite.Core.Events; using Apache.Ignite.ExamplesDll.Compute; using Apache.Ignite.ExamplesDll.Events; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.Examples.Events { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// Example demonstrating Ignite events. /// <para /> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj index 7b20fd5..60e1ec7 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj @@ -59,12 +59,12 @@ <Compile Include="Messaging\RemoteOrderedListener.cs" /> <Compile Include="Messaging\RemoteUnorderedListener.cs" /> <Compile Include="Messaging\Topic.cs" /> - <Compile Include="Portable\Account.cs" /> - <Compile Include="Portable\Address.cs" /> - <Compile Include="Portable\Employee.cs" /> - <Compile Include="Portable\EmployeeKey.cs" /> - <Compile Include="Portable\Organization.cs" /> - <Compile Include="Portable\OrganizationType.cs" /> + <Compile Include="Binary\Account.cs" /> + <Compile Include="Binary\Address.cs" /> + <Compile Include="Binary\Employee.cs" /> + <Compile Include="Binary\EmployeeKey.cs" /> + <Compile Include="Binary\Organization.cs" /> + <Compile Include="Binary\OrganizationType.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Services\MapService.cs" /> </ItemGroup> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Account.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Account.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Account.cs new file mode 100644 index 0000000..f51c3c2 --- /dev/null +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Account.cs @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.ExamplesDll.Binary +{ + using System; + + /// <summary> + /// Account object. Used in transaction example. + /// </summary> + [Serializable] + public class Account + { + /// <summary> + /// Constructor. + /// </summary> + /// <param name="id">Account ID.</param> + /// <param name="balance">Account balance.</param> + public Account(int id, decimal balance) + { + Id = id; + Balance = balance; + } + + /// <summary> + /// Account ID. + /// </summary> + public int Id { get; set; } + + /// <summary> + /// Account balance. + /// </summary> + public decimal Balance { get; set; } + + /// <summary> + /// Returns a string that represents the current object. + /// </summary> + /// <returns> + /// A string that represents the current object. + /// </returns> + override public String ToString() + { + return string.Format("{0} [id={1}, balance={2}]", typeof(Account).Name, Id, Balance); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Address.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Address.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Address.cs new file mode 100644 index 0000000..0490f24 --- /dev/null +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Address.cs @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.ExamplesDll.Binary +{ + using System; + using Apache.Ignite.Core.Binary; + + /// <summary> + /// Address. + /// </summary> + [Serializable] + public class Address : IBinarizable + { + /// <summary> + /// Constructor. + /// </summary> + /// <param name="street">Street.</param> + /// <param name="zip">ZIP code.</param> + public Address(string street, int zip) + { + Street = street; + Zip = zip; + } + + /// <summary> + /// Street. + /// </summary> + public string Street { get; set; } + + /// <summary> + /// ZIP code. + /// </summary> + public int Zip { get; set; } + + /// <summary> + /// Writes this object to the given writer. + /// </summary> + /// <param name="writer">Writer.</param> + public void WriteBinary(IBinaryWriter writer) + { + writer.WriteString("street", Street); + writer.WriteInt("zip", Zip); + } + + /// <summary> + /// Reads this object from the given reader. + /// </summary> + /// <param name="reader">Reader.</param> + public void ReadBinary(IBinaryReader reader) + { + Street = reader.ReadString("street"); + Zip = reader.ReadInt("zip"); + } + + /// <summary> + /// Returns a string that represents the current object. + /// </summary> + /// <returns> + /// A string that represents the current object. + /// </returns> + override public string ToString() + { + return string.Format("{0} [street={1}, zip={2}]", typeof(Address).Name, Street, Zip); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Employee.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Employee.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Employee.cs new file mode 100644 index 0000000..7d0af08 --- /dev/null +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Employee.cs @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.ExamplesDll.Binary +{ + using System; + using System.Collections.Generic; + using System.Linq; + + /// <summary> + /// Employee. + /// </summary> + [Serializable] + public class Employee + { + /// <summary> + /// Constructor. + /// </summary> + /// <param name="name">Name.</param> + /// <param name="salary">Salary.</param> + /// <param name="address">Address.</param> + /// <param name="departments">Departments.</param> + public Employee(string name, long salary, Address address, ICollection<string> departments) + { + Name = name; + Salary = salary; + Address = address; + Departments = departments; + } + + /// <summary> + /// Name. + /// </summary> + public string Name { get; set; } + + /// <summary> + /// Salary. + /// </summary> + public long Salary { get; set; } + + /// <summary> + /// Address. + /// </summary> + public Address Address { get; set; } + + /// <summary> + /// Departments. + /// </summary> + public ICollection<string> Departments { get; set; } + + /// <summary> + /// Returns a string that represents the current object. + /// </summary> + /// <returns> + /// A string that represents the current object. + /// </returns> + override public string ToString() + { + return string.Format("{0} [name={1}, salary={2}, address={3}, departments={4}]", typeof(Employee).Name, + Name, Salary, Address, CollectionToString(Departments)); + } + + /// <summary> + /// Get string representation of collection. + /// </summary> + /// <returns></returns> + private static string CollectionToString<T>(ICollection<T> col) + { + if (col == null) + return "null"; + + var elements = col.Any() + ? col.Select(x => x.ToString()).Aggregate((x, y) => x + ", " + y) + : string.Empty; + + return string.Format("[{0}]", elements); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/EmployeeKey.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/EmployeeKey.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/EmployeeKey.cs new file mode 100644 index 0000000..04012be --- /dev/null +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/EmployeeKey.cs @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.ExamplesDll.Binary +{ + using System; + + /// <summary> + /// Employee key. Used in query example to co-locate employees with their organizations. + /// </summary> + [Serializable] + public class EmployeeKey + { + /// <summary> + /// Constructor. + /// </summary> + /// <param name="id">ID.</param> + /// <param name="orgId">Organization ID.</param> + public EmployeeKey(int id, int orgId) + { + Id = id; + OrganizationId = orgId; + } + + /// <summary> + /// ID. + /// </summary> + public int Id { get; private set; } + + /// <summary> + /// Organization ID. + /// </summary> + public int OrganizationId { get; private set; } + + /// <summary> + /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>. + /// </summary> + /// <returns> + /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false. + /// </returns> + /// <param name="obj">The object to compare with the current object. </param><filterpriority>2</filterpriority> + public override bool Equals(object obj) + { + EmployeeKey other = obj as EmployeeKey; + + return other != null && Id == other.Id && OrganizationId == other.OrganizationId; + } + + /// <summary> + /// Serves as a hash function for a particular type. + /// </summary> + /// <returns> + /// A hash code for the current <see cref="T:System.Object"/>. + /// </returns> + /// <filterpriority>2</filterpriority> + public override int GetHashCode() + { + return 31 * Id + OrganizationId; + } + + /// <summary> + /// Returns a string that represents the current object. + /// </summary> + /// <returns> + /// A string that represents the current object. + /// </returns> + public override string ToString() + { + return string.Format("{0} [id={1}, organizationId={2}]", typeof (EmployeeKey).Name, Id, OrganizationId); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Organization.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Organization.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Organization.cs new file mode 100644 index 0000000..060966a --- /dev/null +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Organization.cs @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.ExamplesDll.Binary +{ + using System; + + /// <summary> + /// Organization. + /// </summary> + [Serializable] + public class Organization + { + /// <summary> + /// Default constructor. + /// </summary> + public Organization() + { + // No-op. + } + + /// <summary> + /// Constructor. + /// </summary> + /// <param name="name">Name.</param> + /// <param name="address">Address.</param> + /// <param name="type">Type.</param> + /// <param name="lastUpdated">Last update time.</param> + public Organization(string name, Address address, OrganizationType type, DateTime lastUpdated) + { + Name = name; + Address = address; + Type = type; + LastUpdated = lastUpdated; + } + + /// <summary> + /// Name. + /// </summary> + public string Name { get; set; } + + /// <summary> + /// Address. + /// </summary> + public Address Address { get; set; } + + /// <summary> + /// Type. + /// </summary> + public OrganizationType Type { get; set; } + + /// <summary> + /// Last update time. + /// </summary> + public DateTime LastUpdated { get; set; } + + /// <summary> + /// Returns a string that represents the current object. + /// </summary> + /// <returns> + /// A string that represents the current object. + /// </returns> + /// <filterpriority>2</filterpriority> + public override string ToString() + { + return string.Format("{0} [name={1}, address={2}, type={3}, lastUpdated={4}]", typeof (Organization).Name, + Name, Address, Type, LastUpdated); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/OrganizationType.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/OrganizationType.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/OrganizationType.cs new file mode 100644 index 0000000..9ff0c3a --- /dev/null +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/OrganizationType.cs @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.ExamplesDll.Binary +{ + using System; + + /// <summary> + /// Organization type. + /// </summary> + [Serializable] + public enum OrganizationType + { + /// <summary> + /// Non-profit organization. + /// </summary> + NonProfit, + + /// <summary> + /// Private organization. + /// </summary> + Private, + + /// <summary> + /// Government organization. + /// </summary> + Government + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs index e4713d4..e05a436 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs @@ -18,10 +18,11 @@ using System; using System.Collections.Generic; using Apache.Ignite.Core.Compute; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.ExamplesDll.Compute { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// Average salary job. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs index 3dba104..3af166f 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs @@ -19,10 +19,11 @@ using System; using System.Collections.Generic; using System.Linq; using Apache.Ignite.Core.Compute; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.ExamplesDll.Compute { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// Average salary task. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs index 742b048..561d83f 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs @@ -21,10 +21,11 @@ using System.Collections.Concurrent; using System.Collections.Generic; using Apache.Ignite.Core.Cache; using Apache.Ignite.Core.Cache.Store; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.ExamplesDll.Datagrid { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// Example cache store implementation. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs index a585e5e..c25b2fa 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs @@ -17,10 +17,11 @@ using System; using Apache.Ignite.Core.Cache; -using Apache.Ignite.ExamplesDll.Portable; namespace Apache.Ignite.ExamplesDll.Datagrid { + using Apache.Ignite.ExamplesDll.Binary; + /// <summary> /// Example cache entry predicate. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Portable/Account.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Portable/Account.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Portable/Account.cs deleted file mode 100644 index 8e247e3..0000000 --- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Portable/Account.cs +++ /dev/null @@ -1,60 +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 Apache.Ignite.ExamplesDll.Portable -{ - /// <summary> - /// Account object. Used in transaction example. - /// </summary> - [Serializable] - public class Account - { - /// <summary> - /// Constructor. - /// </summary> - /// <param name="id">Account ID.</param> - /// <param name="balance">Account balance.</param> - public Account(int id, decimal balance) - { - Id = id; - Balance = balance; - } - - /// <summary> - /// Account ID. - /// </summary> - public int Id { get; set; } - - /// <summary> - /// Account balance. - /// </summary> - public decimal Balance { get; set; } - - /// <summary> - /// Returns a string that represents the current object. - /// </summary> - /// <returns> - /// A string that represents the current object. - /// </returns> - override public String ToString() - { - return string.Format("{0} [id={1}, balance={2}]", typeof(Account).Name, Id, Balance); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Portable/Address.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Portable/Address.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Portable/Address.cs deleted file mode 100644 index ca069cb..0000000 --- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Portable/Address.cs +++ /dev/null @@ -1,81 +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 Apache.Ignite.Core.Portable; - -namespace Apache.Ignite.ExamplesDll.Portable -{ - /// <summary> - /// Address. - /// </summary> - [Serializable] - public class Address : IPortableMarshalAware - { - /// <summary> - /// Constructor. - /// </summary> - /// <param name="street">Street.</param> - /// <param name="zip">ZIP code.</param> - public Address(string street, int zip) - { - Street = street; - Zip = zip; - } - - /// <summary> - /// Street. - /// </summary> - public string Street { get; set; } - - /// <summary> - /// ZIP code. - /// </summary> - public int Zip { get; set; } - - /// <summary> - /// Writes this object to the given writer. - /// </summary> - /// <param name="writer">Writer.</param> - public void WritePortable(IPortableWriter writer) - { - writer.WriteString("street", Street); - writer.WriteInt("zip", Zip); - } - - /// <summary> - /// Reads this object from the given reader. - /// </summary> - /// <param name="reader">Reader.</param> - public void ReadPortable(IPortableReader reader) - { - Street = reader.ReadString("street"); - Zip = reader.ReadInt("zip"); - } - - /// <summary> - /// Returns a string that represents the current object. - /// </summary> - /// <returns> - /// A string that represents the current object. - /// </returns> - override public string ToString() - { - return string.Format("{0} [street={1}, zip={2}]", typeof(Address).Name, Street, Zip); - } - } -}
