diff options
Diffstat (limited to 'dotnet/Qpid.Codec')
20 files changed, 0 insertions, 1364 deletions
diff --git a/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs b/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs deleted file mode 100644 index 6cfd75c851..0000000000 --- a/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs +++ /dev/null @@ -1,152 +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 log4net; -using Apache.Qpid.Buffer; - -namespace Apache.Qpid.Codec -{ - public abstract class CumulativeProtocolDecoder : IProtocolDecoder - { - static ILog _logger = LogManager.GetLogger(typeof(CumulativeProtocolDecoder)); - - ByteBuffer _remaining; - - /// <summary> - /// Creates a new instance with the 4096 bytes initial capacity of - /// cumulative buffer. - /// </summary> - protected CumulativeProtocolDecoder() - { - _remaining = AllocateBuffer(); - } - - /// <summary> - /// Cumulates content of <tt>in</tt> into internal buffer and forwards - /// decoding request to {@link #doDecode(IoSession, ByteBuffer, ProtocolDecoderOutput)}. - /// <tt>doDecode()</tt> is invoked repeatedly until it returns <tt>false</tt> - /// and the cumulative buffer is compacted after decoding ends. - /// </summary> - /// <exception cref="Exception"> - /// if your <tt>doDecode()</tt> returned <tt>true</tt> not consuming the cumulative buffer. - /// </exception> - public void Decode(ByteBuffer input, IProtocolDecoderOutput output) - { - if ( _remaining.Position != 0 ) // If there were remaining undecoded bytes - { - DecodeRemainingAndInput(input, output); - } else - { - DecodeInput(input, output); - } - } - - private void DecodeInput(ByteBuffer input, IProtocolDecoderOutput output) - { - _logger.Debug(string.Format("DecodeInput: input {0}", input.Remaining)); - // Just decode the input buffer and remember any remaining undecoded bytes. - try - { - DecodeAll(input, output); - } finally - { - if ( input.HasRemaining ) - { - _remaining.Put(input); - } - } - } - - private void DecodeRemainingAndInput(ByteBuffer input, IProtocolDecoderOutput output) - { - _logger.Debug(string.Format("DecodeRemainingAndInput: input {0}, remaining {1}", input.Remaining, _remaining.Position)); - // replace the _remainder buffer, so that we can leave the - // original one alone. Necessary because some consumer splice - // the buffer and only consume it until later, causing - // a race condition if we compact it too soon. - ByteBuffer newRemainding = AllocateBuffer(); - ByteBuffer temp = _remaining; - _remaining = newRemainding; - temp.Put(input); - temp.Flip(); - try - { - DecodeAll(temp, output); - } finally - { - if ( temp.Remaining > 0 ) - _remaining.Put(temp); - } - } - - private void DecodeAll(ByteBuffer buf, IProtocolDecoderOutput output) - { - for ( ; ; ) - { - int oldPos = buf.Position; - bool decoded = DoDecode(buf, output); - if ( decoded ) - { - if ( buf.Position == oldPos ) - { - throw new Exception( - "doDecode() can't return true when buffer is not consumed."); - } - - if ( !buf.HasRemaining ) - { - break; - } - } else - { - break; - } - } - } - - /// <summary> - /// Implement this method to consume the specified cumulative buffer and - /// decode its content into message(s). - /// </summary> - /// <param name="input">the cumulative buffer</param> - /// <param name="output">decoder output</param> - /// <returns> - /// <tt>true</tt> if and only if there's more to decode in the buffer - /// and you want to have <tt>doDecode</tt> method invoked again. - /// Return <tt>false</tt> if remaining data is not enough to decode, - /// then this method will be invoked again when more data is cumulated. - /// </returns> - /// <exception cref="Exception">If cannot decode</exception> - protected abstract bool DoDecode(ByteBuffer input, IProtocolDecoderOutput output); - - public void Dispose() - { - _remaining = null; - } - - private ByteBuffer AllocateBuffer() - { - ByteBuffer buffer = ByteBuffer.Allocate(4096); - buffer.IsAutoExpand = true; - return buffer; - } - } -} diff --git a/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs b/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs deleted file mode 100644 index 78276202d6..0000000000 --- a/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs +++ /dev/null @@ -1,387 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -using System; -using System.Collections; -using Apache.Qpid.Buffer; - -namespace Apache.Qpid.Codec.Demux -{ - public class DemuxingProtocolCodecFactory : IProtocolCodecFactory - { - private ArrayList _decoderFactories = new ArrayList(); - private ArrayList _encoderFactories = new ArrayList(); - - public void Register(Type encoderOrDecoderClass) - { - if (encoderOrDecoderClass == null) - { - throw new ArgumentNullException("encoderOrDecoderClass"); - } - - bool registered = false; - if (typeof(IMessageEncoder).IsAssignableFrom(encoderOrDecoderClass)) - { - Register(new DefaultConstructorMessageEncoderFactory(encoderOrDecoderClass)); - registered = true; - } - - if (typeof(IMessageDecoder).IsAssignableFrom(encoderOrDecoderClass)) - { - Register(new DefaultConstructorMessageDecoderFactory(encoderOrDecoderClass)); - registered = true; - } - - if (!registered) - { - throw new ArgumentException("Unregisterable type: " + encoderOrDecoderClass); - } - } - - public void Register(IMessageEncoder encoder) - { - Register(new SingletonMessageEncoderFactory(encoder)); - } - - public void Register(IMessageEncoderFactory factory) - { - if (factory == null) - { - throw new ArgumentNullException("factory"); - } - - _encoderFactories.Add(factory); - } - - public void Register(IMessageDecoder decoder) - { - Register(new SingletonMessageDecoderFactory(decoder)); - } - - public void Register(IMessageDecoderFactory factory) - { - if (factory == null) - { - throw new ArgumentNullException("factory"); - } - _decoderFactories.Add(factory); - } - - public IProtocolEncoder Encoder - { - get - { - return new ProtocolEncoderImpl(this); - } - } - - public IProtocolDecoder Decoder - { - get - { - return new ProtocolDecoderImpl(this); - } - } - - protected void DisposeCodecResources() - { - // Do nothing by default - } - - private class ProtocolEncoderImpl : IProtocolEncoder - { - private readonly Hashtable _encoders = new Hashtable(); - - private DemuxingProtocolCodecFactory _enclosing; - - public ProtocolEncoderImpl(DemuxingProtocolCodecFactory enclosing) - { - _enclosing = enclosing; - ArrayList encoderFactories = enclosing._encoderFactories; - for (int i = encoderFactories.Count - 1; i >= 0; i--) - { - IMessageEncoder encoder = ((IMessageEncoderFactory)encoderFactories[i]).NewEncoder(); - foreach (Type type in encoder.MessageTypes.Keys) - { - _encoders[type] = encoder; - } - } - } - - public void Encode(object message, IProtocolEncoderOutput output) - { - Type type = message.GetType(); - IMessageEncoder encoder = FindEncoder(type); - if (encoder == null) - { - throw new ProtocolEncoderException("Unexpected message type: " + type); - } - - encoder.Encode(message, output); - } - - private IMessageEncoder FindEncoder(Type type) - { - IMessageEncoder encoder = (IMessageEncoder)_encoders[type]; - if (encoder == null) - { - encoder = FindEncoder(type, new Hashtable()); - } - - return encoder; - } - - private IMessageEncoder FindEncoder(Type type, Hashtable triedClasses) - { - IMessageEncoder encoder; - - if (triedClasses.Contains(type)) - { - return null; - } - triedClasses[type] = 1; - - encoder = (IMessageEncoder)_encoders[type]; - if (encoder == null) - { - encoder = FindEncoder(type, triedClasses); - if (encoder != null) - { - return encoder; - } - - Type[] interfaces = type.GetInterfaces(); - for (int i = 0; i < interfaces.Length; i++) - { - encoder = FindEncoder(interfaces[i], triedClasses); - if (encoder != null) - { - return encoder; - } - } - - return null; - } - else - return encoder; - } - - public void Dispose() - { - _enclosing.DisposeCodecResources(); - } - } - - private class ProtocolDecoderImpl : CumulativeProtocolDecoder - { - private readonly IMessageDecoder[] _decoders; - private IMessageDecoder _currentDecoder; - private DemuxingProtocolCodecFactory _enclosing; - - public ProtocolDecoderImpl(DemuxingProtocolCodecFactory enclosing) - { - _enclosing = enclosing; - ArrayList decoderFactories = _enclosing._decoderFactories; - _decoders = new IMessageDecoder[decoderFactories.Count]; - for (int i = decoderFactories.Count - 1; i >= 0; i--) - { - _decoders[i] = ((IMessageDecoderFactory) decoderFactories[i]).NewDecoder(); - } - } - - protected override bool DoDecode(ByteBuffer input, IProtocolDecoderOutput output) - { - MessageDecoderResult result; - if (_currentDecoder == null) - { - IMessageDecoder[] decoders = _decoders; - int undecodables = 0; - - for (int i = decoders.Length - 1; i >= 0; i --) - { - IMessageDecoder decoder = decoders[i]; - int limit = input.Limit; - int pos = input.Position; - - try - { - result = decoder.Decodable(input); - } - finally - { - input.Position = pos; - input.Limit = limit; - } - - if (result == MessageDecoderResult.OK) - { - _currentDecoder = decoder; - break; - } - else if(result == MessageDecoderResult.NOT_OK) - { - undecodables ++; - } - else if (result != MessageDecoderResult.NEED_DATA) - { - throw new Exception("Unexpected decode result (see your decodable()): " + result); - } - } - - if (undecodables == _decoders.Length) - { - // Throw an exception if all decoders cannot decode data. - input.Position = input.Limit; // Skip data - throw new ProtocolDecoderException( - "No appropriate message decoder: " + input.GetHexDump()); - } - - if (_currentDecoder == null) - { - // Decoder is not determined yet (i.e. we need more data) - return false; - } - } - - result = _currentDecoder.Decode(input, output); - if (result == MessageDecoderResult.OK) - { - _currentDecoder = null; - return true; - } - else if (result == MessageDecoderResult.NEED_DATA) - { - return false; - } - else if (result == MessageDecoderResult.NOT_OK) - { - throw new ProtocolDecoderException("Message decoder returned NOT_OK."); - } - else - { - throw new Exception("Unexpected decode result (see your decode()): " + result); - } - } - } - - private class SingletonMessageEncoderFactory : IMessageEncoderFactory - { - private readonly IMessageEncoder _encoder; - - public SingletonMessageEncoderFactory(IMessageEncoder encoder) - { - if (encoder == null) - { - throw new ArgumentNullException("encoder"); - } - _encoder = encoder; - } - - public IMessageEncoder NewEncoder() - { - return _encoder; - } - } - - private class SingletonMessageDecoderFactory : IMessageDecoderFactory - { - private readonly IMessageDecoder _decoder; - - public SingletonMessageDecoderFactory(IMessageDecoder decoder) - { - if (decoder == null) - { - throw new ArgumentNullException("decoder"); - } - _decoder = decoder; - } - - public IMessageDecoder NewDecoder() - { - return _decoder; - } - } - - private class DefaultConstructorMessageEncoderFactory : IMessageEncoderFactory - { - private readonly Type _encoderClass; - - public DefaultConstructorMessageEncoderFactory(Type encoderClass) - { - if (encoderClass == null) - { - throw new ArgumentNullException("encoderClass"); - } - - if(!typeof(IMessageEncoder).IsAssignableFrom(encoderClass)) - { - throw new ArgumentException("encoderClass is not assignable to MessageEncoder"); - } - _encoderClass = encoderClass; - } - - public IMessageEncoder NewEncoder() - { - try - { - return (IMessageEncoder) Activator.CreateInstance(_encoderClass); - } - catch (Exception e) - { - throw new Exception( "Failed to create a new instance of " + _encoderClass, e); - } - } - } - - private class DefaultConstructorMessageDecoderFactory : IMessageDecoderFactory - { - private readonly Type _decoderClass; - - public DefaultConstructorMessageDecoderFactory(Type decoderClass) - { - if (decoderClass == null) - { - throw new ArgumentNullException("decoderClass"); - } - - if(!typeof(IMessageDecoder).IsAssignableFrom(decoderClass)) - { - throw new ArgumentException("decoderClass is not assignable to MessageDecoder"); - } - _decoderClass = decoderClass; - } - - public IMessageDecoder NewDecoder() - { - try - { - return (IMessageDecoder) Activator.CreateInstance(_decoderClass); - } - catch (Exception e) - { - throw new Exception("Failed to create a new instance of " + _decoderClass, e); - } - } - } - } -} - - - diff --git a/dotnet/Qpid.Codec/Demux/IMessageDecoder.cs b/dotnet/Qpid.Codec/Demux/IMessageDecoder.cs deleted file mode 100644 index 5892673440..0000000000 --- a/dotnet/Qpid.Codec/Demux/IMessageDecoder.cs +++ /dev/null @@ -1,56 +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.Qpid.Buffer; - -namespace Apache.Qpid.Codec.Demux -{ - public interface IMessageDecoder - { - /// <summary> - /// Checks the specified buffer is decodable by this decoder. - /// </summary> - /// <param name="buffer">The buffer to read data from.</param> - /// <returns> - /// OK if this decoder can decode the specified buffer. - /// NOT_OK if this decoder cannot decode the specified buffer. - /// if more data is required to determine if the - /// specified buffer is decodable ({@link #OK}) or not decodable - /// {@link #NOT_OK}.</returns> - MessageDecoderResult Decodable(ByteBuffer buffer); - - /// <summary> - /// Decodes binary or protocol-specific content into higher-level message objects. - /// MINA invokes {@link #decode(IoSession, ByteBuffer, ProtocolDecoderOutput)} - /// method with read data, and then the decoder implementation puts decoded - /// messages into {@link ProtocolDecoderOutput}. - /// </summary> - /// <returns> - /// {@link #OK} if you finished decoding messages successfully. - /// {@link #NEED_DATA} if you need more data to finish decoding current message. - /// {@link #NOT_OK} if you cannot decode current message due to protocol specification violation. - /// </returns> - /// <exception cref="Exception">if the read data violated protocol specification </exception> - MessageDecoderResult Decode(ByteBuffer buffer, IProtocolDecoderOutput output); - } -} - - diff --git a/dotnet/Qpid.Codec/Demux/IMessageDecoderFactory.cs b/dotnet/Qpid.Codec/Demux/IMessageDecoderFactory.cs deleted file mode 100644 index 9e333d670f..0000000000 --- a/dotnet/Qpid.Codec/Demux/IMessageDecoderFactory.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -namespace Apache.Qpid.Codec.Demux -{ - public interface IMessageDecoderFactory - { - /// <summary> - /// Creates a new message decoder. - /// </summary> - IMessageDecoder NewDecoder(); - } -} - - diff --git a/dotnet/Qpid.Codec/Demux/IMessageEncoder.cs b/dotnet/Qpid.Codec/Demux/IMessageEncoder.cs deleted file mode 100644 index 75ae23592b..0000000000 --- a/dotnet/Qpid.Codec/Demux/IMessageEncoder.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -using System; -using System.Collections; - -namespace Apache.Qpid.Codec.Demux -{ - public interface IMessageEncoder - { - /// <summary> - /// Returns the set of message classes this encoder can encode. - /// </summary> - Hashtable MessageTypes - { - get; - } - - /// <summary> - /// Encodes higher-level message objects into binary or protocol-specific data. - /// MINA invokes {@link #encode(IoSession, Object, ProtocolEncoderOutput)} - /// method with message which is popped from the session write queue, and then - /// the encoder implementation puts encoded {@link ByteBuffer}s into - /// {@link ProtocolEncoderOutput}. - /// </summary> - /// <exception cref="Exception">if the message violated protocol specification</exception> - void Encode(Object message, IProtocolEncoderOutput output); - } -} - - diff --git a/dotnet/Qpid.Codec/Demux/IMessageEncoderFactory.cs b/dotnet/Qpid.Codec/Demux/IMessageEncoderFactory.cs deleted file mode 100644 index 3001d1a963..0000000000 --- a/dotnet/Qpid.Codec/Demux/IMessageEncoderFactory.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -namespace Apache.Qpid.Codec.Demux -{ - public interface IMessageEncoderFactory - { - /// <summary> - /// Creates a new message encoder. - /// </summary> - IMessageEncoder NewEncoder(); - } -} - - diff --git a/dotnet/Qpid.Codec/Demux/MessageDecoderResult.cs b/dotnet/Qpid.Codec/Demux/MessageDecoderResult.cs deleted file mode 100644 index ab01864bc0..0000000000 --- a/dotnet/Qpid.Codec/Demux/MessageDecoderResult.cs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -namespace Apache.Qpid.Codec.Demux -{ - public enum MessageDecoderResult - { - OK, NOT_OK, NEED_DATA - } -} - - diff --git a/dotnet/Qpid.Codec/IProtocolCodecFactory.cs b/dotnet/Qpid.Codec/IProtocolCodecFactory.cs deleted file mode 100644 index a26b91b16c..0000000000 --- a/dotnet/Qpid.Codec/IProtocolCodecFactory.cs +++ /dev/null @@ -1,37 +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.Qpid.Codec -{ - public interface IProtocolCodecFactory - { - IProtocolEncoder Encoder - { - get; - } - - IProtocolDecoder Decoder - { - get; - } - } -} - - diff --git a/dotnet/Qpid.Codec/IProtocolDecoder.cs b/dotnet/Qpid.Codec/IProtocolDecoder.cs deleted file mode 100644 index 3cccb0f7da..0000000000 --- a/dotnet/Qpid.Codec/IProtocolDecoder.cs +++ /dev/null @@ -1,41 +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.Qpid.Buffer; - -namespace Apache.Qpid.Codec -{ - public interface IProtocolDecoder : IDisposable - { - /// <summary> - /// Decodes binary or protocol-specific content into higher-level message objects. - /// MINA invokes {@link #decode(IoSession, ByteBuffer, ProtocolDecoderOutput)} - /// method with read data, and then the decoder implementation puts decoded - /// messages into {@link ProtocolDecoderOutput}. - /// </summary> - /// <param name="input"></param> - /// <param name="output"></param> - /// <exception cref="Exception">if the read data violated protocol specification</exception> - void Decode(ByteBuffer input, IProtocolDecoderOutput output); - } -} - - diff --git a/dotnet/Qpid.Codec/IProtocolDecoderOutput.cs b/dotnet/Qpid.Codec/IProtocolDecoderOutput.cs deleted file mode 100644 index 77a1aea9db..0000000000 --- a/dotnet/Qpid.Codec/IProtocolDecoderOutput.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -namespace Apache.Qpid.Codec -{ - public interface IProtocolDecoderOutput - { - /// <summary> - /// Callback for {@link ProtocolDecoder} to generate decoded messages. - /// {@link ProtocolDecoder} must call {@link #write(Object)} for each - /// decoded messages. - /// </summary> - /// <param name="message">the decoded message</param> - void Write(object message); - } -} - - diff --git a/dotnet/Qpid.Codec/IProtocolEncoder.cs b/dotnet/Qpid.Codec/IProtocolEncoder.cs deleted file mode 100644 index a16f2ad9d6..0000000000 --- a/dotnet/Qpid.Codec/IProtocolEncoder.cs +++ /dev/null @@ -1,41 +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.Qpid.Codec -{ - public interface IProtocolEncoder : IDisposable - { - /// <summary> - /// Encodes higher-level message objects into binary or protocol-specific data. - /// MINA invokes {@link #encode(IoSession, Object, ProtocolEncoderOutput)} - /// method with message which is popped from the session write queue, and then - /// the encoder implementation puts encoded {@link ByteBuffer}s into - /// {@link ProtocolEncoderOutput}. - /// </summary> - /// <param name="message"></param> - /// <param name="output"></param> - /// <exception cref="Exception">if the message violated protocol specification</exception> - void Encode(Object message, IProtocolEncoderOutput output); - } -} - - diff --git a/dotnet/Qpid.Codec/IProtocolEncoderOutput.cs b/dotnet/Qpid.Codec/IProtocolEncoderOutput.cs deleted file mode 100644 index 70f9be38dc..0000000000 --- a/dotnet/Qpid.Codec/IProtocolEncoderOutput.cs +++ /dev/null @@ -1,37 +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 Apache.Qpid.Buffer; - -namespace Apache.Qpid.Codec -{ - public interface IProtocolEncoderOutput - { - /// <summary> - /// Callback for {@link ProtocolEncoder} to generate encoded - /// {@link ByteBuffer}s. {@link ProtocolEncoder} must call - /// {@link #write(ByteBuffer)} for each decoded messages. - /// </summary> - /// <param name="buf">the buffer which contains encoded data</param> - void Write(ByteBuffer buf); - } -} - - diff --git a/dotnet/Qpid.Codec/Properties/AssemblyInfo.cs b/dotnet/Qpid.Codec/Properties/AssemblyInfo.cs deleted file mode 100644 index 5261a62ec5..0000000000 --- a/dotnet/Qpid.Codec/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -using System.Reflection; -using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Apache.Qpid.Codec")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Apache.Qpid.Codec")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("8bfe84f8-cd88-48f7-b0d2-0010411a14e5")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("0.5.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/dotnet/Qpid.Codec/ProtocolCodecException.cs b/dotnet/Qpid.Codec/ProtocolCodecException.cs deleted file mode 100644 index 49678d2c11..0000000000 --- a/dotnet/Qpid.Codec/ProtocolCodecException.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -using System; -using System.Runtime.Serialization; - -namespace Apache.Qpid.Codec -{ - [Serializable] - public class ProtocolCodecException : Exception - { - public ProtocolCodecException() : base() - { - } - - public ProtocolCodecException(string message) : base(message) - { - } - - public ProtocolCodecException(Exception cause) : base("Codec Exception", cause) - { - } - - protected ProtocolCodecException(SerializationInfo info, StreamingContext ctxt) - : base(info, ctxt) - { - } - } -} - - - diff --git a/dotnet/Qpid.Codec/ProtocolDecoderException.cs b/dotnet/Qpid.Codec/ProtocolDecoderException.cs deleted file mode 100644 index 8e7e6da145..0000000000 --- a/dotnet/Qpid.Codec/ProtocolDecoderException.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -using System; -using System.Runtime.Serialization; - -namespace Apache.Qpid.Codec -{ - [Serializable] - public class ProtocolDecoderException : ProtocolCodecException - { - private string _hexdump; - - public ProtocolDecoderException() : base() - { - } - - public ProtocolDecoderException(string message) : base(message) - { - } - - public ProtocolDecoderException(Exception cause) : base(cause) - { - } - - protected ProtocolDecoderException(SerializationInfo info, StreamingContext ctxt) - : base(info, ctxt) - { - _hexdump = info.GetString("HexDump"); - } - - public string HexDump - { - get - { - return _hexdump; - } - set - { - _hexdump = value; - } - } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - info.AddValue("HexDump", _hexdump); - } - } -} - - - diff --git a/dotnet/Qpid.Codec/ProtocolEncoderException.cs b/dotnet/Qpid.Codec/ProtocolEncoderException.cs deleted file mode 100644 index ac565a308b..0000000000 --- a/dotnet/Qpid.Codec/ProtocolEncoderException.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -using System; -using System.Runtime.Serialization; - -namespace Apache.Qpid.Codec -{ - [Serializable] - public class ProtocolEncoderException : ProtocolCodecException - { - public ProtocolEncoderException() : base() - { - } - - public ProtocolEncoderException(string message) : base(message) - { - } - - public ProtocolEncoderException(Exception cause) : base(cause) - { - } - - protected ProtocolEncoderException(SerializationInfo info, StreamingContext ctxt) - : base(info, ctxt) - { - } - } -} - - - diff --git a/dotnet/Qpid.Codec/Qpid.Codec.csproj b/dotnet/Qpid.Codec/Qpid.Codec.csproj deleted file mode 100644 index a0217cffa3..0000000000 --- a/dotnet/Qpid.Codec/Qpid.Codec.csproj +++ /dev/null @@ -1,82 +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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{22D0D0C2-77AF-4DE3-B456-7FF3893F9F88}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Qpid.Codec</RootNamespace>
- <AssemblyName>Apache.Qpid.Codec</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>..\bin\net-2.0\debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>..\bin\net-2.0\release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken=500ffcafb14f92df">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\Qpid.Common\lib\log4net\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="**\*.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Qpid.Buffer\Qpid.Buffer.csproj">
- <Project>{44384DF2-B0A4-4580-BDBC-EE4BAA87D995}</Project>
- <Name>Qpid.Buffer</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
diff --git a/dotnet/Qpid.Codec/Support/SimpleProtocolDecoderOutput.cs b/dotnet/Qpid.Codec/Support/SimpleProtocolDecoderOutput.cs deleted file mode 100644 index 0a4ff10ff0..0000000000 --- a/dotnet/Qpid.Codec/Support/SimpleProtocolDecoderOutput.cs +++ /dev/null @@ -1,44 +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.Collections; - -namespace Apache.Qpid.Codec.Support -{ - public class SimpleProtocolDecoderOutput : IProtocolDecoderOutput - { - private readonly Queue _messageQueue = new Queue(); - - public Queue MessageQueue - { - get - { - return _messageQueue; - } - } - - public void Write(object message) - { - _messageQueue.Enqueue(message); - } - } -} - - diff --git a/dotnet/Qpid.Codec/Support/SimpleProtocolEncoderOutput.cs b/dotnet/Qpid.Codec/Support/SimpleProtocolEncoderOutput.cs deleted file mode 100644 index 2e4224ef98..0000000000 --- a/dotnet/Qpid.Codec/Support/SimpleProtocolEncoderOutput.cs +++ /dev/null @@ -1,43 +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.Collections; -using Apache.Qpid.Buffer; - -namespace Apache.Qpid.Codec.Support -{ - public abstract class SimpleProtocolEncoderOutput : IProtocolEncoderOutput - { - private readonly Queue _bufferQueue = new Queue(); - - public Queue BufferQueue - { - get - { - return _bufferQueue; - } - } - - public void Write(ByteBuffer buf) - { - _bufferQueue.Enqueue(buf); - } - } -} diff --git a/dotnet/Qpid.Codec/default.build b/dotnet/Qpid.Codec/default.build deleted file mode 100644 index dd59df7d6a..0000000000 --- a/dotnet/Qpid.Codec/default.build +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.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. - ---> - -<project name="Apache.Qpid.Codec" default="build"> - <!-- - Properties that come from master build file - - build.dir: root directory for build - - build.debug: true if building debug release - - build.defines: variables to define during build - --> - - <target name="build"> - <csc target="library" - define="${build.defines}" - debug="${build.debug}" - output="${build.dir}/${project::get-name()}.dll"> - - <sources> - <include name="**/*.cs" /> - </sources> - <references> - <include name="${build.dir}/log4net.dll" /> - <include name="${build.dir}/Apache.Qpid.Buffer.dll" /> - </references> - </csc> - </target> -</project> - |