diff options
| author | Robert Greig <rgreig@apache.org> | 2007-01-05 17:00:41 +0000 |
|---|---|---|
| committer | Robert Greig <rgreig@apache.org> | 2007-01-05 17:00:41 +0000 |
| commit | c37fb7c4b27419cae13c45fb38e24506fd009ea4 (patch) | |
| tree | 4c0a380c17f0406fe95aa2ece26d52759f200800 /dotnet/Qpid.Common | |
| parent | 2d976b546f26b04f41606df6675f3217058d2d6f (diff) | |
| download | qpid-python-c37fb7c4b27419cae13c45fb38e24506fd009ea4.tar.gz | |
Qpid-246-2 patch applied. Adds serializability to exceptions missed by the first patch.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@493087 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Common')
| -rw-r--r-- | dotnet/Qpid.Common/AMQChannelClosedException.cs | 10 | ||||
| -rw-r--r-- | dotnet/Qpid.Common/AMQConnectionClosedException.cs | 10 | ||||
| -rw-r--r-- | dotnet/Qpid.Common/AMQDisconnectedException.cs | 10 | ||||
| -rw-r--r-- | dotnet/Qpid.Common/AMQUndeliveredException.cs | 18 | ||||
| -rw-r--r-- | dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs | 9 | ||||
| -rw-r--r-- | dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs | 10 | ||||
| -rw-r--r-- | dotnet/Qpid.Common/build.xml | 62 |
7 files changed, 102 insertions, 27 deletions
diff --git a/dotnet/Qpid.Common/AMQChannelClosedException.cs b/dotnet/Qpid.Common/AMQChannelClosedException.cs index 957e3b627d..77d8c06802 100644 --- a/dotnet/Qpid.Common/AMQChannelClosedException.cs +++ b/dotnet/Qpid.Common/AMQChannelClosedException.cs @@ -18,13 +18,23 @@ * under the License. * */ + +using System; +using System.Runtime.Serialization; + namespace Qpid { + [Serializable] public class AMQChannelClosedException : AMQException { public AMQChannelClosedException(int errorCode, string message) : base(errorCode, message) { } + + protected AMQChannelClosedException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } diff --git a/dotnet/Qpid.Common/AMQConnectionClosedException.cs b/dotnet/Qpid.Common/AMQConnectionClosedException.cs index 06d30e3d0a..977dcee73a 100644 --- a/dotnet/Qpid.Common/AMQConnectionClosedException.cs +++ b/dotnet/Qpid.Common/AMQConnectionClosedException.cs @@ -18,13 +18,23 @@ * under the License. * */ + +using System; +using System.Runtime.Serialization; + namespace Qpid { + [Serializable] public class AMQConnectionClosedException : AMQException { public AMQConnectionClosedException(int errorCode, string message) : base(errorCode, message) { } + + protected AMQConnectionClosedException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } diff --git a/dotnet/Qpid.Common/AMQDisconnectedException.cs b/dotnet/Qpid.Common/AMQDisconnectedException.cs index e7cb2ff590..5ea9672839 100644 --- a/dotnet/Qpid.Common/AMQDisconnectedException.cs +++ b/dotnet/Qpid.Common/AMQDisconnectedException.cs @@ -18,8 +18,13 @@ * under the License. * */ + +using System; +using System.Runtime.Serialization; + namespace Qpid { + [Serializable] public class AMQDisconnectedException : AMQException { public AMQDisconnectedException(int errorCode, string message) @@ -31,5 +36,10 @@ namespace Qpid : base(message) { } + + protected AMQDisconnectedException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } diff --git a/dotnet/Qpid.Common/AMQUndeliveredException.cs b/dotnet/Qpid.Common/AMQUndeliveredException.cs index 1cbc56c0ce..225a94e9b8 100644 --- a/dotnet/Qpid.Common/AMQUndeliveredException.cs +++ b/dotnet/Qpid.Common/AMQUndeliveredException.cs @@ -18,13 +18,19 @@ * under the License. * */ + +using System; +using System.Runtime.Serialization; + namespace Qpid { /// <summary> /// Thrown when a message has been bounced by the broker, indicating it could not be delivered. /// </summary> + [Serializable] public class AMQUndeliveredException : AMQException { + // TODO: Warning, no guarantee that the value stored here is serializable! private object _bounced; public AMQUndeliveredException(int errorCode, string message, object bounced) @@ -33,6 +39,18 @@ namespace Qpid _bounced = bounced; } + protected AMQUndeliveredException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + _bounced = info.GetValue("bounced", typeof(object)); + } + + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("bounced", _bounced); + } + public object GetUndeliveredMessage() { return _bounced; diff --git a/dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs b/dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs index e7223c9850..82891b5986 100644 --- a/dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs +++ b/dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs @@ -19,6 +19,7 @@ * */ using System; +using System.Runtime.Serialization; using log4net; namespace Qpid.Framing @@ -27,6 +28,7 @@ namespace Qpid.Framing /// Thrown when a frame cannot be decoded. This generally indicates a mismatch between the broker and the /// client. /// </summary> + [Serializable] public class AMQFrameDecodingException : AMQException { public AMQFrameDecodingException(string message) @@ -47,6 +49,11 @@ namespace Qpid.Framing public AMQFrameDecodingException(ILog logger, string message, Exception innerException) : base(logger, message, innerException) { - } + } + + protected AMQFrameDecodingException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } diff --git a/dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs b/dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs index 7ea509c78a..555cf1e6af 100644 --- a/dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs +++ b/dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs @@ -18,12 +18,22 @@ * under the License. * */ + +using System; +using System.Runtime.Serialization; + namespace Qpid.Framing { + [Serializable] public class AMQProtocolHeaderException : AMQException { public AMQProtocolHeaderException(string message) : base(message) { } + + protected AMQProtocolHeaderException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } diff --git a/dotnet/Qpid.Common/build.xml b/dotnet/Qpid.Common/build.xml index fa3dd50338..e976859b15 100644 --- a/dotnet/Qpid.Common/build.xml +++ b/dotnet/Qpid.Common/build.xml @@ -1,15 +1,9 @@ +<!-- + This sole purpose of this build script is to generate the framing layer for the .net client from the AMQ spec. + --> <project name="AMQ Dot Net Framing Layer" default="generate"> - <property name="amq.home" value="../../.."/> - <path id="amq.home.path"> - <pathelement location="${amq.home}"/> - </path> - <pathconvert targetos="unix" property="amq.home.fixed" refid="amq.home.path"/> - -<!-- - <property name="amq.asl" value="${amq.home.fixed}/amqp.org/specs/amqp.xml"/> ---> - <property name="amq.asl" value="amqp.xml"/> + <property name="amq.home" value="../.."/> <property name="stylesheet" value="stylesheets/framing.xsl"/> <property name="registry_stylesheet" value="stylesheets/registry.xsl"/> @@ -20,25 +14,42 @@ <property name="resources" value="resources"/> <property name="base.lib" value="lib"/> - <path id="project.classpath"> - <fileset dir="${base.lib}"> - <include name="**/*.jar"/> - </fileset> + <path id="amq.home.path"> + <pathelement location="${amq.home}"/> </path> - <target name="prepare"> - <mkdir dir="classes"/> - </target> + <pathconvert targetos="unix" property="amq.home.fixed" refid="amq.home.path"/> - <target name="regenerate" depends="clean, generate" description="generates code"> +<!-- Some spec changes break the build, reverting to private copy in Qpid.Common temporarily till this is fixed. --> +<!-- <property name="amq.asl" value="${amq.home.fixed}/specs/amqp.0-8.xml"/> --> + <property name="amq.asl" value="amqp.xml"/> + + <target name="clean" description="Deletes the generated sources."> + <delete> + <fileset dir="${generated.src}" includes="**/*"/> + </delete> </target> - <target name="check-generate"> - <uptodate property="generateNotRequired" targetfile="${generated.src}/results.out" srcfile="${amq.asl}"/> + <!-- + Checks if the generation step needs to be performed. It will be skipped if the sources are up to date with the spec and provided that the + force flag has not been set. + --> + <target name="check-generate" + description="Checks if the generated sources are up-to-date. Use -Dforce=true or the 'forcegen' target to force generation."> + + <condition property="generateNotRequired"> + <and> + <uptodate targetfile="${generated.src}/results.out" srcfile="${amq.asl}"/> + <not><isset property="force"/></not> + </and> + </condition> </target> - <target name="generate" depends="check-generate" unless="${generateNotRequired}" description="generates code"> + <!-- Applies a transformation to the AMQP spec to generate the framing layer. --> + <target name="generate" depends="check-generate" unless="generateNotRequired" description="generates code"> + <mkdir dir="${generated.src}"/> + <java jar="${saxon.jar}" fork="true"> <arg value="-o"/> <arg value="${generated.src}/results.out"/> @@ -47,6 +58,7 @@ <arg value="asl_base=${asl.base}"/> <arg value="registry_name=MainRegistry"/> </java> + <java jar="${saxon.jar}" fork="true"> <arg value="-o"/> <arg value="${generated.src}/registry.out"/> @@ -55,10 +67,8 @@ </java> </target> - <target name="clean" depends="prepare" description="deletes any products of the compile and generate tasks"> - <delete> - <fileset dir="classes" includes="**/*"/> - <fileset dir="${generated.src}" includes="**/*"/> - </delete> + <!-- Does a clean and forces re-generation of the sources. --> + <target name="forcegen" depends="clean, generate" description="Forces clean re-generation of the code."> </target> + </project> |
