Пример #1
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteString(0, type);
     writer.WriteString(1, message);
     writer.WriteObject(2, stackTrace);
     writer.WriteObject(3, innerException);
 }
Пример #2
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteS64(0, accountId);
     writer.WriteString(1, accountName);
     writer.WriteString(2, email);
     writer.WriteS64(3, expirationTime.ToBinary());
 }
Пример #3
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteU32(0, kVersion);
     writer.WriteString(1, SourceDirectory);
     writer.WriteString(2, DestinationDirectory);
     writer.WriteS32(3, ThumbnailsToGenerate);
 }
 /// <summary>
 /// Save the contents of a POF user type instance by writing its
 /// state using the specified <see cref="IPofWriter"/> object.
 /// </summary>
 /// <param name="writer">
 /// The <b>IPofWriter</b> to which to write the object's state.
 /// </param>
 /// <exception cref="IOException">
 /// If an I/O error occurs.
 /// </exception>
 public void WriteExternal(IPofWriter writer)
 {
     writer.WriteInt64(OID, m_oid);
     writer.WriteString(ORIGAIRPORT, m_origAirport);
     writer.WriteString(DESTAIRPORT, m_destAirport);
     writer.WriteDouble(DEALAPPEAL, m_dealAppeal);
 }
Пример #5
0
        /// <summary>
        /// Save the contents of a POF user type instance by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            writer.WriteString(1, ProtocolName);
            writer.WriteString(2, ReceiverName);
            writer.WriteByteArray(3, IdentityToken);
        }
Пример #6
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteU32(0, kVersion);
     writer.WriteGuid(1, id);
     writer.WriteString(2, name);
     writer.WriteCollection(3, authors);
     writer.WriteString(4, website);
     writer.WriteCollection(5, targets.Select(target => target.Value));
 }
Пример #7
0
 /// <see cref="IPortableObject"/>
 void IPortableObject.WriteExternal(IPofWriter writer)
 {
     writer.WriteString(FIRST_NAME, m_firstName);
     writer.WriteString(LAST_NAME, m_lastName);
     writer.WriteObject(HOME_ADDRESS, m_addrHome);
     writer.WriteObject(WORK_ADDRESS, m_addrWork);
     writer.WriteDictionary(PHONE_NUMBERS, m_dictPhoneNumber,
                            typeof(string), typeof(PhoneNumber));
     writer.WriteDate(BIRTH_DATE, m_dtBirth);
 }
        /// <summary>
        /// Save the contents of a POF user type instance by writing
        /// its state using the specified <see cref="IPofWriter"/>
        /// object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's
        /// state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            writer.WriteObject(1, ClientId);
            writer.WriteInt32(2, Edition);
            writer.WriteDictionary(3, ProtocolVersionMap, typeof(string), typeof(Int32[]));
            writer.WriteByteArray(4, IdentityToken);
            writer.WriteObject(5, Member);
            writer.WriteString(6, ClusterName);
            writer.WriteString(7, ServiceName);
        }
Пример #9
0
 /// <see cref="IPortableObject"/>
 void IPortableObject.WriteExternal(IPofWriter writer)
 {
     writer.WriteString(POSITION_ID, m_positionId);
     writer.WriteString(FIELD_1, m_field1);
     writer.WriteString(FIELD_2, m_field2);
     writer.WriteString(FIELD_3, m_field3);
     writer.WriteString(FIELD_4, m_field4);
     writer.WriteString(FIELD_5, m_field5);
     writer.WriteString(FIELD_6, m_field6);
     writer.WriteString(FIELD_7, m_field7);
     writer.WriteString(FIELD_8, m_field8);
     writer.WriteString(FIELD_9, m_field9);
 }
Пример #10
0
 /// <summary>
 /// Save the contents of a POF user type instance by writing its
 /// state using the specified <see cref="IPofWriter"/> object.
 /// </summary>
 /// <param name="writer">
 /// The <b>IPofWriter</b> to which to write the object's state.
 /// </param>
 /// <exception cref="IOException">
 /// If an I/O error occurs.
 /// </exception>
 public override void WriteExternal(IPofWriter writer)
 {
     writer.WriteBoolean(0, m_fetchExtractor);
     writer.WriteString(1, m_query);
     writer.WriteArray(2, m_env);
     writer.WriteDictionary(3, m_bindings);
 }
Пример #11
0
            public void Serialize(IPofWriter writer)
            {
                int i = 0;

                writer.WriteU64(i++, id);
                writer.WriteString(i++, name);
            }
Пример #12
0
 /// <summary>
 /// Save the contents of a POF user type instance by writing its
 /// state using the specified <see cref="IPofWriter"/> object.
 /// </summary>
 /// <param name="writer">
 /// The <b>IPofWriter</b> to which to write the object's state.
 /// </param>
 /// <exception cref="IOException">
 /// If an I/O error occurs.
 /// </exception>
 public virtual void WriteExternal(IPofWriter writer)
 {
     writer.WriteString(0, m_memberName);
     // slot #1 is not used since Coherence 3.5
     writer.WriteArray(2, m_parameters);
     writer.WriteInt32(3, m_target);
 }
Пример #13
0
        public void WriteExternal(IPofWriter writer)
        {
            writer.WriteInt32(0, INTEGER);

            IPofWriter nested1 = writer.CreateNestedPofWriter(1);

            IPofWriter nested2 = nested1.CreateNestedPofWriter(0);

            nested2.WriteString(0, STRING);
            nested2.WriteSingleArray(2, FLOAT_ARRAY);

            IPofWriter nested3 = nested2.CreateNestedPofWriter(3);

            nested3.WriteArray(0, STRING_ARRAY, typeof(String));

            nested2.WriteBoolean(4, false);
            nested2.WriteRemainder(null);

            IList list = (IList)set;

            nested1.WriteCollection(1, list);
            nested1.WriteDouble(2, 2.0);
            nested1.WriteInt32(3, 5);
            nested1.WriteCollection(4, set);
            nested1.WriteDouble(10, 2.222);

            writer.WriteDouble(2, 4.444);
            writer.WriteInt32(3, 15);
        }
Пример #14
0
 public virtual void WriteExternal(IPofWriter writer)
 {
     if (writer.UserTypeId == 3)
     {
         writer.WriteString(0, Species);
     }
 }
        public void WriteExternal(IPofWriter writer)
        {
            writer.WriteInt32(0, INTEGER);

            IPofWriter nested1 = writer.CreateNestedPofWriter(1);

            IPofWriter nested2 = nested1.CreateNestedPofWriter(0);

            nested2.WriteString(0, STRING);
            nested2.WriteObject(1, PERSON);
            nested2.WriteDoubleArray(2, DOUBLE_ARRAY);

            IPofWriter nested3 = nested2.CreateNestedPofWriter(3);

            nested3.WriteArray(0, STRING_ARRAY, typeof(String));

            nested2.WriteBoolean(4, false);
            nested2.WriteRemainder(null);

            nested1.WriteCollection(1, (ICollection <String>)set);
            nested1.WriteDouble(2, 2.0);
            nested1.WriteInt32(3, 5);
            nested1.WriteCollection(4, set, typeof(String));
            nested1.WriteObject(5, PERSON);
            nested1.WriteDouble(10, 2.222);

            writer.WriteDouble(2, 4.444);
            writer.WriteInt32(3, 15);
            writer.WriteObject(4, PERSON);
        }
        /// <summary>
        /// Serialize a user type instance to a POF stream by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> with which to write the object's state.
        /// </param>
        /// <param name="o">
        /// The object to serialize.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public void Serialize(IPofWriter writer, object o)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                using (TextWriter txtWriter = new StringWriter(sb))
                {
                    new System.Xml.Serialization.XmlSerializer(o.GetType()).Serialize(txtWriter, o);
                }
                writer.WriteString(0, sb.ToString());
                writer.WriteRemainder(null);
            }
            catch (InvalidOperationException e)
            {
                string typeName = null;
                try
                {
                    typeName = writer.PofContext.GetTypeName(m_typeId);
                }
                catch (Exception)
                {}

                string actual = o.GetType().FullName;
                throw new IOException(
                          "An exception occurred writing an object"
                          + " user type to a POF stream: type-id=" + m_typeId
                          + (typeName == null ? "" : ", class-name=" + typeName)
                          + (actual == null ? "" : ", actual class-name=" + actual)
                          + ", exception=\n" + e);
            }
        }
Пример #17
0
        /// <summary>
        /// Serialize a user type instance to a POF stream by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <remarks>
        /// An implementation of <b>IPofSerializer</b> is required to follow
        /// the following steps in sequence for writing out an object of a
        /// user type:
        /// <list type="number">
        /// <item>
        /// <description>
        /// If the object is evolvable, the implementation must set the
        /// version by calling <see cref="IPofWriter.VersionId"/>.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// The implementation may write any combination of the properties of
        /// the user type by using the "write" methods of the
        /// <b>IPofWriter</b>, but it must do so in the order of the property
        /// indexes.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// After all desired properties of the user type have been written,
        /// the implementation must terminate the writing of the user type by
        /// calling <see cref="IPofWriter.WriteRemainder"/>.
        /// </description>
        /// </item>
        /// </list>
        /// </remarks>
        /// <param name="writer">
        /// The <b>IPofWriter</b> with which to write the object's state.
        /// </param>
        /// <param name="o">
        /// The object to serialize.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public void Serialize(IPofWriter writer, object o)
        {
            IIdentity identity = (IIdentity)o;

            writer.WriteString(0, identity.Name);
            writer.WriteRemainder(null);
        }
Пример #18
0
 public virtual void WriteExternal(IPofWriter writer)
 {
     if (writer.UserTypeId == 1)
     {
         writer.WriteString(0, Name);
     }
 }
Пример #19
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteU32(0, invocationId);
     writer.WriteGuid(1, serviceGuid);
     writer.WriteString(2, methodName);
     writer.WriteObject(3, genericArguments);
     writer.WriteObject(4, methodArguments);
 }
        /// <summary>
        /// Save the contents of a POF user type instance by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public virtual void WriteExternal(IPofWriter writer)
        {
            // note: this object is not responsible for writing out its parent

            object o = m_value;

            if (o == null)
            {
                writer.WriteByte(0, 0);
            }
            else if (o is string)
            {
                writer.WriteByte(0, (byte)XmlValueType.String);
                writer.WriteString(1, (string)o);
            }
            else if (o is bool)
            {
                writer.WriteByte(0, (byte)XmlValueType.Boolean);
                writer.WriteBoolean(1, (bool)o);
            }
            else if (o is int)
            {
                writer.WriteByte(0, (byte)XmlValueType.Integer);
                writer.WriteInt32(1, (int)o);
            }
            else if (o is long)
            {
                writer.WriteByte(0, (byte)XmlValueType.Long);
                writer.WriteInt64(1, (long)o);
            }
            else if (o is double)
            {
                writer.WriteByte(0, (byte)XmlValueType.Double);
                writer.WriteDouble(1, (Double)o);
            }
            else if (o is decimal)
            {
                writer.WriteByte(0, (byte )XmlValueType.Decimal);
                writer.WriteDecimal(1, (decimal)o);
            }
            else if (o is Binary)
            {
                writer.WriteByte(0, (byte)XmlValueType.Binary);
                writer.WriteBinary(1, (Binary)o);
            }
            else if (o is DateTime)
            {
                writer.WriteByte(0, (byte)XmlValueType.DateTime);
                writer.WriteDateTime(1, (DateTime)o);
            }
            else
            {
                throw new IOException("unsupported type to write: " + o.GetType().FullName);
            }

            writer.WriteBoolean(2, m_isAttribute);
            writer.WriteBoolean(3, m_isMutable);
        }
Пример #21
0
            public void Serialize(IPofWriter pofWriter, object o)
            {
                var c = (Customer)o;

                pofWriter.WriteString(0, c.getName());
                pofWriter.WriteObject(1, c.getProduct());
                pofWriter.WriteObject(2, c.getBalance());
                pofWriter.WriteRemainder(null);
            }
        /// <summary>
        /// Serialize an enum instance to a POF stream by writing its
        /// value using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> with which to write the object's state.
        /// </param>
        /// <param name="o">
        /// The object to serialize.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public void Serialize(IPofWriter writer, object o)
        {
            if (o == null || !o.GetType().IsEnum)
            {
                throw new ArgumentException(
                          "EnumPofSerializer can only be used to serialize enum types.");
            }

            writer.WriteString(0, o.ToString());
            writer.WriteRemainder(null);
        }
 public override void WriteExternal(IPofWriter writer)
 {
     if (writer.UserTypeId == 2)
     {
         writer.WriteString(0, Breed);
     }
     else
     {
         base.WriteExternal(writer);
     }
 }
Пример #24
0
 public override void WriteExternal(IPofWriter writer)
 {
     if (writer.UserTypeId == 1)
     {
         writer.WriteString(0, Name);
         writer.WriteInt32(1, Age);
     }
     else
     {
         base.WriteExternal(writer);
     }
 }
 public void WriteExternal(IPofWriter writer)
 {
     writer.WriteCollection(0, getList1());
     writer.WriteCollection(1, getList2());
     writer.WriteCollection(2, getList3());
     writer.WriteDictionary(3, getMap1());
     writer.WriteDictionary(4, getMap2());
     writer.WriteDictionary(5, getMap3());
     writer.WriteInt32(6, getNumber());
     writer.WriteString(7, getText());
     writer.WriteArray(8, getChildren(), typeof(PofChild));
 }
Пример #26
0
 /// <summary>
 /// Save the contents of a POF user type instance by writing its
 /// state using the specified <see cref="IPofWriter"/> object.
 /// </summary>
 /// <param name="writer">
 /// The <b>IPofWriter</b> to which to write the object's state.
 /// </param>
 /// <exception cref="IOException">
 /// If an I/O error occurs.
 /// </exception>
 public virtual void WriteExternal(IPofWriter writer)
 {
     writer.WriteObject(0, m_uuid);
     writer.WriteString(6, ClusterName);
     writer.WriteString(7, m_siteName);
     writer.WriteString(8, m_rackName);
     writer.WriteString(9, m_machineName);
     writer.WriteString(10, m_processName);
     writer.WriteString(11, m_memberName);
     writer.WriteString(12, m_roleName);
 }
Пример #27
0
        /// <summary>
        /// Save the contents of a POF user type instance by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            string dtdUri   = m_dtdUri;
            string dtdName  = m_dtdName;
            string encoding = m_encoding;
            string comment  = m_comment;

            bool hasDtdUri   = dtdUri != null;
            bool hasDtdName  = dtdName != null;
            bool hasEncoding = encoding != null;
            bool hasComment  = comment != null;

            writer.WriteBoolean(12, hasDtdUri);
            if (hasDtdUri)
            {
                writer.WriteString(13, m_dtdUri);
            }

            writer.WriteBoolean(14, hasDtdName);
            if (hasDtdName)
            {
                writer.WriteString(15, m_dtdName);
            }

            writer.WriteBoolean(16, hasEncoding);
            if (hasEncoding)
            {
                writer.WriteString(17, m_encoding);
            }

            writer.WriteBoolean(18, hasComment);
            if (hasComment)
            {
                writer.WriteString(19, m_comment);
            }
        }
        /// <summary>
        /// Write the exception to the specified stream.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to write to.
        /// </param>
        /// <param name="e">
        /// The <b>Exception</b> to write.
        /// </param>
        public static void WriteException(IPofWriter writer, Exception e)
        {
            string name;

            string[] arrTrace;

            if (e is PortableException)
            {
                PortableException pe = (PortableException)e;
                name     = pe.Name;
                arrTrace = pe.FullStackTrace;
            }
            else
            {
                name     = e.GetType().FullName;
                arrTrace = new string[] { e.StackTrace };
            }

            writer.WriteString(0, name);
            writer.WriteString(1, e.Message);
            writer.WriteCollection(2, new ArrayList(arrTrace), typeof(string));
            writer.WriteObject(3, e.InnerException);
        }
Пример #29
0
 /// <see cref="IPortableObject"/>
 void IPortableObject.WriteExternal(IPofWriter writer)
 {
     writer.WriteString(STREET_1, m_street1);
     writer.WriteString(STREET_2, m_street2);
     writer.WriteString(CITY, m_city);
     writer.WriteString(STATE, m_state);
     writer.WriteString(ZIP, m_zip);
     writer.WriteString(COUNTRY, m_country);
 }
Пример #30
0
            /// <summary>
            /// Serialize a user type instance to a POF stream by writing its
            /// state using the specified <see cref="IPofWriter"/> object.
            /// </summary>
            /// <remarks>
            /// An implementation of <b>IPofSerializer</b> is required to follow
            /// the following steps in sequence for writing out an object of a
            /// user type:
            /// <list type="number">
            /// <item>
            /// <description>
            /// If the object is evolvable, the implementation must set the
            /// version by calling <see cref="IPofWriter.VersionId"/>.
            /// </description>
            /// </item>
            /// <item>
            /// <description>
            /// The implementation may write any combination of the properties of
            /// the user type by using the "write" methods of the
            /// <b>IPofWriter</b>, but it must do so in the order of the property
            /// indexes.
            /// </description>
            /// </item>
            /// <item>
            /// <description>
            /// After all desired properties of the user type have been written,
            /// the implementation must terminate the writing of the user type by
            /// calling <see cref="IPofWriter.WriteRemainder"/>.
            /// </description>
            /// </item>
            /// </list>
            /// </remarks>
            /// <param name="writer">
            /// The <b>IPofWriter</b> with which to write the object's state.
            /// </param>
            /// <param name="o">
            /// The object to serialize.
            /// </param>
            /// <exception cref="IOException">
            /// If an I/O error occurs.
            /// </exception>
            public void Serialize(IPofWriter writer, Object o)
            {
                var             buffer         = new BinaryMemoryStream(1024 * 8);
                PofStreamWriter userTypeWriter = new PofStreamWriter.UserTypeWriter(
                    new DataWriter(buffer), m_pofContext, TYPE_PORTABLE, -1);

                // COH-5065: due to the complexity of maintaining references
                // in future data, we won't support them for IEvolvable objects
                if (m_pofContext.IsReferenceEnabled && !(o is IEvolvable))
                {
                    userTypeWriter.EnableReference();
                }

                m_serializer.Serialize(userTypeWriter, o);

                String typeName = o.GetType().AssemblyQualifiedName;

                writer.WriteString(0, typeName);
                writer.WriteBinary(1, buffer.ToBinary());
                writer.WriteRemainder(null);

                Register(typeName);
            }
Пример #31
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteU32(0, kVersion);
      writer.WriteGuid(1, id);
      writer.WriteString(2, name);
      writer.WriteCollection(3, authors);
      writer.WriteString(4, website);
      writer.WriteCollection(5, targets.Select(target => target.Value));
 }
Пример #32
0
 public void Serialize(IPofWriter writer) {
    writer.WriteString(0, Type);
    writer.AssignSlot(1, Data);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteU32(0, kVersion);
    writer.WriteString(1, SourceDirectory);
    writer.WriteString(2, DestinationDirectory);
    writer.WriteS32(3, ThumbnailsToGenerate);
 }
 public void Serialize(IPofWriter writer)
 {
     writer.WriteS32(0, kVersion);
      writer.WriteString(1, SelectedThumbnailPath);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteString(0, name);
    writer.WriteU32(1, value);
 }
Пример #36
0
 public void Serialize(IPofWriter writer) {
    writer.WriteString(0, value);
 }