You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/12/06 14:23:00 UTC
svn commit: r1772901 [4/5] - in /qpid/java/trunk:
broker-core/src/main/java/org/apache/qpid/server/queue/
broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/
broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpi...
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,98 @@
+/*
+*
+* 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.
+*
+*/
+
+package org.apache.qpid.server.protocol.v1_0.type.messaging;
+
+import java.util.List;
+
+import org.apache.qpid.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.codec.ValueHandler;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.HeaderConstructor;
+
+public class HeaderSection extends AbstractSection<Header>
+{
+
+ private final DescribedTypeConstructorRegistry _typeRegistry;
+ private Header _header;
+
+ public HeaderSection(final DescribedTypeConstructorRegistry describedTypeRegistry)
+ {
+ _typeRegistry = describedTypeRegistry;
+ }
+
+ public HeaderSection(final Header header,
+ final List<QpidByteBuffer> encodedForm,
+ final DescribedTypeConstructorRegistry registry)
+ {
+ _header = header;
+ _typeRegistry = registry;
+ setEncodedForm(encodedForm);
+ }
+
+ @Override
+ public String toString()
+ {
+ return getValue().toString();
+ }
+
+ @Override
+ public synchronized Header getValue()
+ {
+ if(_header == null)
+ {
+ decode();
+ }
+ return _header;
+ }
+
+ private void decode()
+ {
+ try
+ {
+
+ List<QpidByteBuffer> input = getEncodedForm();
+ int[] originalPositions = new int[input.size()];
+ for(int i = 0; i < input.size(); i++)
+ {
+ originalPositions[i] = input.get(i).position();
+ }
+ int describedByte = QpidByteBufferUtils.get(input);
+ ValueHandler handler = new ValueHandler(_typeRegistry);
+ Object descriptor = handler.parse(input);
+ HeaderConstructor constructor = new HeaderConstructor();
+ _header = constructor.construct(descriptor, input, originalPositions, handler).construct(input, handler);
+ for(int i = 0; i < input.size(); i++)
+ {
+ input.get(i).dispose();
+ }
+
+ }
+ catch (AmqpErrorException e)
+ {
+ // TODO
+ e.printStackTrace();
+ }
+ // TODO
+ }
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotations.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotations.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotations.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotations.java Tue Dec 6 14:22:59 2016
@@ -1,4 +1,3 @@
-
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,45 +19,26 @@
*
*/
-
package org.apache.qpid.server.protocol.v1_0.type.messaging;
-
-import org.apache.qpid.server.protocol.v1_0.messaging.SectionEncoder;
-
-
import java.util.Map;
+import org.apache.qpid.server.protocol.v1_0.type.Section;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class MessageAnnotations
- implements Section
- {
-
+public class MessageAnnotations implements Section<Map<Symbol,Object>>
+{
+ private final Map<Symbol,Object> _value;
-
- private final Map _value;
-
- public MessageAnnotations(Map value)
+ public MessageAnnotations(Map<Symbol,Object> value)
{
_value = value;
}
- public Map getValue()
+ @Override
+ public Map<Symbol,Object> getValue()
{
return _value;
}
-
-
-
- public Binary encode(final SectionEncoder encoder)
- {
- encoder.reset();
- encoder.encodeObject(this);
- return encoder.getEncoding();
- }
-
-
- }
+}
Copied: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotationsSection.java (from r1772546, qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotations.java)
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotationsSection.java?p2=qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotationsSection.java&p1=qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotations.java&r1=1772546&r2=1772901&rev=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotations.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotationsSection.java Tue Dec 6 14:22:59 2016
@@ -1,4 +1,3 @@
-
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,45 +19,76 @@
*
*/
-
package org.apache.qpid.server.protocol.v1_0.type.messaging;
-
-import org.apache.qpid.server.protocol.v1_0.messaging.SectionEncoder;
-
-
+import java.util.List;
import java.util.Map;
+import org.apache.qpid.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.codec.ValueHandler;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.MessageAnnotationsConstructor;
+
+public class MessageAnnotationsSection extends AbstractSection<Map<Symbol,Object>>
+{
+ private Map<Symbol,Object> _value;
+ private final DescribedTypeConstructorRegistry _typeRegistry;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class MessageAnnotations
- implements Section
- {
-
-
-
- private final Map _value;
+ public MessageAnnotationsSection(DescribedTypeConstructorRegistry registry)
+ {
+ _typeRegistry = registry;
+ }
- public MessageAnnotations(Map value)
+ public MessageAnnotationsSection(final MessageAnnotations messageAnnotations,
+ final List<QpidByteBuffer> encodedForm,
+ final DescribedTypeConstructorRegistry registry)
{
- _value = value;
+ _value = messageAnnotations.getValue();
+ _typeRegistry = registry;
+ setEncodedForm(encodedForm);
}
- public Map getValue()
+ @Override
+ public synchronized Map<Symbol,Object> getValue()
{
+ if(_value == null)
+ {
+ decode();
+ }
return _value;
}
+ private void decode()
+ {
+ try
+ {
-
- public Binary encode(final SectionEncoder encoder)
- {
- encoder.reset();
- encoder.encodeObject(this);
- return encoder.getEncoding();
- }
-
-
- }
+ List<QpidByteBuffer> input = getEncodedForm();
+ int[] originalPositions = new int[input.size()];
+ for(int i = 0; i < input.size(); i++)
+ {
+ originalPositions[i] = input.get(i).position();
+ }
+ int describedByte = QpidByteBufferUtils.get(input);
+ ValueHandler handler = new ValueHandler(_typeRegistry);
+ Object descriptor = handler.parse(input);
+ MessageAnnotationsConstructor constructor = new MessageAnnotationsConstructor();
+ _value = constructor.construct(descriptor, input, originalPositions, handler).construct(input, handler).getValue();
+ for(int i = 0; i < input.size(); i++)
+ {
+ input.get(i).dispose();
+ }
+
+ }
+ catch (AmqpErrorException e)
+ {
+ // TODO
+ e.printStackTrace();
+ }
+ // TODO
+ }
+}
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java Tue Dec 6 14:22:59 2016
@@ -1,4 +1,3 @@
-
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,24 +19,17 @@
*
*/
-
package org.apache.qpid.server.protocol.v1_0.type.messaging;
-
-import org.apache.qpid.server.protocol.v1_0.messaging.SectionEncoder;
-
-
import java.util.Date;
+import org.apache.qpid.server.protocol.v1_0.type.Binary;
+import org.apache.qpid.server.protocol.v1_0.type.Section;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
-
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class Properties
- implements Section
- {
-
-
+public class Properties implements Section<Properties>
+{
private Object _messageId;
private Binary _userId;
@@ -200,117 +192,117 @@ public class Properties
StringBuilder builder = new StringBuilder("Properties{");
final int origLength = builder.length();
- if(_messageId != null)
+ if (_messageId != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("messageId=").append(_messageId);
}
- if(_userId != null)
+ if (_userId != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("userId=").append(_userId);
}
- if(_to != null)
+ if (_to != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("to=").append(_to);
}
- if(_subject != null)
+ if (_subject != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("subject=").append(_subject);
}
- if(_replyTo != null)
+ if (_replyTo != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("replyTo=").append(_replyTo);
}
- if(_correlationId != null)
+ if (_correlationId != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("correlationId=").append(_correlationId);
}
- if(_contentType != null)
+ if (_contentType != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("contentType=").append(_contentType);
}
- if(_contentEncoding != null)
+ if (_contentEncoding != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("contentEncoding=").append(_contentEncoding);
}
- if(_absoluteExpiryTime != null)
+ if (_absoluteExpiryTime != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("absoluteExpiryTime=").append(_absoluteExpiryTime);
}
- if(_creationTime != null)
+ if (_creationTime != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("creationTime=").append(_creationTime);
}
- if(_groupId != null)
+ if (_groupId != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("groupId=").append(_groupId);
}
- if(_groupSequence != null)
+ if (_groupSequence != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("groupSequence=").append(_groupSequence);
}
- if(_replyToGroupId != null)
+ if (_replyToGroupId != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -321,13 +313,10 @@ public class Properties
return builder.toString();
}
+ @Override
+ public Properties getValue()
+ {
+ return this;
+ }
- public Binary encode(final SectionEncoder encoder)
- {
- encoder.reset();
- encoder.encodeObject(this);
- return encoder.getEncoding();
- }
-
-
- }
+}
Copied: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/PropertiesSection.java (from r1772546, qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java)
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/PropertiesSection.java?p2=qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/PropertiesSection.java&p1=qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java&r1=1772546&r2=1772901&rev=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/PropertiesSection.java Tue Dec 6 14:22:59 2016
@@ -1,4 +1,3 @@
-
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,314 +19,80 @@
*
*/
-
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import java.util.List;
-import org.apache.qpid.server.protocol.v1_0.messaging.SectionEncoder;
-
-
-import java.util.Date;
-
-
-
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class Properties
- implements Section
- {
-
-
- private Object _messageId;
-
- private Binary _userId;
-
- private String _to;
-
- private String _subject;
-
- private String _replyTo;
-
- private Object _correlationId;
-
- private Symbol _contentType;
-
- private Symbol _contentEncoding;
-
- private Date _absoluteExpiryTime;
-
- private Date _creationTime;
-
- private String _groupId;
-
- private UnsignedInteger _groupSequence;
-
- private String _replyToGroupId;
-
- public Object getMessageId()
- {
- return _messageId;
- }
-
- public void setMessageId(Object messageId)
- {
- _messageId = messageId;
- }
-
- public Binary getUserId()
- {
- return _userId;
- }
-
- public void setUserId(Binary userId)
- {
- _userId = userId;
- }
-
- public String getTo()
- {
- return _to;
- }
-
- public void setTo(String to)
- {
- _to = to;
- }
-
- public String getSubject()
- {
- return _subject;
- }
-
- public void setSubject(String subject)
- {
- _subject = subject;
- }
-
- public String getReplyTo()
- {
- return _replyTo;
- }
-
- public void setReplyTo(String replyTo)
- {
- _replyTo = replyTo;
- }
-
- public Object getCorrelationId()
- {
- return _correlationId;
- }
-
- public void setCorrelationId(Object correlationId)
- {
- _correlationId = correlationId;
- }
-
- public Symbol getContentType()
- {
- return _contentType;
- }
+import org.apache.qpid.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.codec.ValueHandler;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.PropertiesConstructor;
- public void setContentType(Symbol contentType)
- {
- _contentType = contentType;
- }
+public class PropertiesSection extends AbstractSection<Properties>
+{
- public Symbol getContentEncoding()
- {
- return _contentEncoding;
- }
+ private final DescribedTypeConstructorRegistry _typeRegistry;
+ private Properties _properties;
- public void setContentEncoding(Symbol contentEncoding)
+ public PropertiesSection(final DescribedTypeConstructorRegistry describedTypeRegistry)
{
- _contentEncoding = contentEncoding;
+ _typeRegistry = describedTypeRegistry;
}
- public Date getAbsoluteExpiryTime()
+ public PropertiesSection(final Properties properties,
+ final List<QpidByteBuffer> encodedForm,
+ final DescribedTypeConstructorRegistry registry)
{
- return _absoluteExpiryTime;
+ _properties = properties;
+ _typeRegistry = registry;
+ setEncodedForm(encodedForm);
}
- public void setAbsoluteExpiryTime(Date absoluteExpiryTime)
- {
- _absoluteExpiryTime = absoluteExpiryTime;
- }
-
- public Date getCreationTime()
- {
- return _creationTime;
- }
-
- public void setCreationTime(Date creationTime)
- {
- _creationTime = creationTime;
- }
-
- public String getGroupId()
- {
- return _groupId;
- }
-
- public void setGroupId(String groupId)
- {
- _groupId = groupId;
- }
-
- public UnsignedInteger getGroupSequence()
- {
- return _groupSequence;
- }
-
- public void setGroupSequence(UnsignedInteger groupSequence)
- {
- _groupSequence = groupSequence;
- }
-
- public String getReplyToGroupId()
- {
- return _replyToGroupId;
- }
-
- public void setReplyToGroupId(String replyToGroupId)
+ @Override
+ public String toString()
{
- _replyToGroupId = replyToGroupId;
+ return getValue().toString();
}
@Override
- public String toString()
+ public synchronized Properties getValue()
{
- StringBuilder builder = new StringBuilder("Properties{");
- final int origLength = builder.length();
-
- if(_messageId != null)
- {
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("messageId=").append(_messageId);
- }
-
- if(_userId != null)
- {
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("userId=").append(_userId);
- }
-
- if(_to != null)
+ if(_properties == null)
{
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("to=").append(_to);
- }
-
- if(_subject != null)
- {
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("subject=").append(_subject);
- }
-
- if(_replyTo != null)
- {
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("replyTo=").append(_replyTo);
+ decode();
}
+ return _properties;
+ }
- if(_correlationId != null)
+ private void decode()
+ {
+ try
{
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("correlationId=").append(_correlationId);
- }
- if(_contentType != null)
- {
- if(builder.length() != origLength)
+ List<QpidByteBuffer> input = getEncodedForm();
+ int[] originalPositions = new int[input.size()];
+ for(int i = 0; i < input.size(); i++)
{
- builder.append(',');
+ originalPositions[i] = input.get(i).position();
}
- builder.append("contentType=").append(_contentType);
- }
-
- if(_contentEncoding != null)
- {
- if(builder.length() != origLength)
+ int describedByte = QpidByteBufferUtils.get(input);
+ ValueHandler handler = new ValueHandler(_typeRegistry);
+ Object descriptor = handler.parse(input);
+ PropertiesConstructor constructor = new PropertiesConstructor();
+ _properties = constructor.construct(descriptor, input, originalPositions, handler).construct(input, handler);
+ for(int i = 0; i < input.size(); i++)
{
- builder.append(',');
+ input.get(i).dispose();
}
- builder.append("contentEncoding=").append(_contentEncoding);
- }
- if(_absoluteExpiryTime != null)
- {
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("absoluteExpiryTime=").append(_absoluteExpiryTime);
}
-
- if(_creationTime != null)
+ catch (AmqpErrorException e)
{
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("creationTime=").append(_creationTime);
+ // TODO
+ e.printStackTrace();
}
-
- if(_groupId != null)
- {
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("groupId=").append(_groupId);
- }
-
- if(_groupSequence != null)
- {
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("groupSequence=").append(_groupSequence);
- }
-
- if(_replyToGroupId != null)
- {
- if(builder.length() != origLength)
- {
- builder.append(',');
- }
- builder.append("replyToGroupId=").append(_replyToGroupId);
- }
-
- builder.append('}');
- return builder.toString();
+ // TODO
}
-
-
- public Binary encode(final SectionEncoder encoder)
- {
- encoder.reset();
- encoder.encodeObject(this);
- return encoder.getEncoding();
- }
-
-
- }
+}
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AbstractEncodingRetainingConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AbstractEncodingRetainingConstructor.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AbstractEncodingRetainingConstructor.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AbstractEncodingRetainingConstructor.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,92 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.qpid.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.TypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.ValueHandler;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+
+abstract public class AbstractEncodingRetainingConstructor<T extends EncodingRetaining> implements DescribedTypeConstructor<T>
+{
+ @Override
+ public TypeConstructor<T> construct(final Object descriptor,
+ final List<QpidByteBuffer> in,
+ final int[] originalPositions,
+ final ValueHandler valueHandler)
+ throws AmqpErrorException
+ {
+ return new TypeConstructorFromUnderlying<>(this, valueHandler.readConstructor(in), originalPositions);
+ }
+
+ abstract protected T construct(Object underlying);
+
+ private static class TypeConstructorFromUnderlying<S extends EncodingRetaining> implements TypeConstructor<S>
+ {
+
+ private final TypeConstructor _describedConstructor;
+ private final int[] _originalPositions;
+ private AbstractEncodingRetainingConstructor<S> _describedTypeConstructor;
+
+ public TypeConstructorFromUnderlying(final AbstractEncodingRetainingConstructor<S> describedTypeConstructor,
+ final TypeConstructor describedConstructor, final int[] originalPositions)
+ {
+ _describedConstructor = describedConstructor;
+ _describedTypeConstructor = describedTypeConstructor;
+ _originalPositions = originalPositions;
+ }
+
+ @Override
+ public S construct(final List<QpidByteBuffer> in, final ValueHandler handler) throws AmqpErrorException
+ {
+
+ S object = _describedTypeConstructor.construct(_describedConstructor.construct(in, handler));
+ List<QpidByteBuffer> encoding = new ArrayList<>();
+ int offset = in.size() - _originalPositions.length;
+ for(int i = offset; i < in.size(); i++)
+ {
+ QpidByteBuffer buf = in.get(i);
+ if(buf.position() == _originalPositions[i-offset])
+ {
+ if(buf.hasRemaining())
+ {
+ break;
+ }
+ }
+ else
+ {
+ QpidByteBuffer dup = buf.duplicate();
+ dup.position(_originalPositions[i-offset]);
+ dup.limit(buf.position());
+ encoding.add(dup);
+ }
+ }
+ object.setEncodedForm(encoding);
+ return object;
+ }
+ }
+
+
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AbstractEncodingRetainingConstructor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,7 +23,7 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
import org.apache.qpid.server.protocol.v1_0.type.*;
import org.apache.qpid.server.protocol.v1_0.type.messaging.*;
@@ -31,7 +31,7 @@ import org.apache.qpid.server.protocol.v
import java.util.List;
-public class AcceptedConstructor extends DescribedTypeConstructor<Accepted>
+public class AcceptedConstructor extends AbstractDescribedTypeConstructor<Accepted>
{
public static final Symbol SYMBOL_CONSTRUCTOR = Symbol.valueOf("amqp:accepted:list");
private static final Object[] DESCRIPTORS =
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,15 +23,15 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.*;
-
-
import java.util.List;
-public class AmqpSequenceConstructor extends DescribedTypeConstructor<AmqpSequence>
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpSequence;
+
+public class AmqpSequenceConstructor extends AbstractDescribedTypeConstructor<AmqpSequence>
{
private static final Object[] DESCRIPTORS =
{
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceSectionConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceSectionConstructor.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceSectionConstructor.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceSectionConstructor.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,54 @@
+
+/*
+*
+* 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.
+*
+*/
+
+
+package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
+
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpSequenceSection;
+
+public class AmqpSequenceSectionConstructor extends DescribedListSectionConstructor<AmqpSequenceSection>
+{
+ private static final Object[] DESCRIPTORS =
+ {
+ Symbol.valueOf("amqp:amqp-sequence:list"),UnsignedLong.valueOf(0x0000000000000076L),
+ };
+
+ private static final AmqpSequenceSectionConstructor INSTANCE = new AmqpSequenceSectionConstructor();
+
+ public static void register(DescribedTypeConstructorRegistry registry)
+ {
+ for(Object descriptor : DESCRIPTORS)
+ {
+ registry.register(descriptor, INSTANCE);
+ }
+ }
+
+ @Override
+ protected AmqpSequenceSection createObject(final DescribedTypeConstructorRegistry describedTypeRegistry)
+ {
+ return new AmqpSequenceSection(describedTypeRegistry);
+ }
+
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceSectionConstructor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,13 +23,13 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
import org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue;
-public class AmqpValueConstructor extends DescribedTypeConstructor<AmqpValue>
+public class AmqpValueConstructor extends AbstractDescribedTypeConstructor<AmqpValue>
{
private static final Object[] DESCRIPTORS =
{
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,164 @@
+
+/*
+*
+* 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.
+*
+*/
+
+
+package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.qpid.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.codec.SectionDecoderRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.TypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.ValueHandler;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValueSection;
+import org.apache.qpid.server.protocol.v1_0.type.transport.ConnectionError;
+
+public class AmqpValueSectionConstructor implements DescribedTypeConstructor<AmqpValueSection>
+{
+
+ private static final Object[] DESCRIPTORS =
+ {
+ Symbol.valueOf("amqp:amqp-value:*"),UnsignedLong.valueOf(0x0000000000000077L),
+ };
+
+ private static final AmqpValueSectionConstructor INSTANCE = new AmqpValueSectionConstructor();
+
+ public static void register(DescribedTypeConstructorRegistry registry)
+ {
+ for(Object descriptor : DESCRIPTORS)
+ {
+ registry.register(descriptor, INSTANCE);
+ }
+ }
+
+
+ @Override
+ public TypeConstructor<AmqpValueSection> construct(final Object descriptor,
+ final List<QpidByteBuffer> in,
+ final int[] originalPositions,
+ final ValueHandler valueHandler)
+ throws AmqpErrorException
+ {
+ return new LazyConstructor(originalPositions);
+ }
+
+
+ private class LazyConstructor implements TypeConstructor<AmqpValueSection>
+ {
+
+ private final int[] _originalPositions;
+
+ public LazyConstructor(final int[] originalPositions)
+ {
+
+ _originalPositions = originalPositions;
+ }
+
+ @Override
+ public AmqpValueSection construct(final List<QpidByteBuffer> in, final ValueHandler handler)
+ throws AmqpErrorException
+ {
+ skipValue(in);
+
+ List<QpidByteBuffer> encoding = new ArrayList<>();
+ int offset = in.size() - _originalPositions.length;
+ for (int i = offset; i < in.size(); i++)
+ {
+ QpidByteBuffer buf = in.get(i);
+ if (buf.position() == _originalPositions[i - offset])
+ {
+ if (buf.hasRemaining())
+ {
+ break;
+ }
+ }
+ else
+ {
+ QpidByteBuffer dup = buf.duplicate();
+ dup.position(_originalPositions[i - offset]);
+ dup.limit(buf.position());
+ encoding.add(dup);
+ }
+ }
+ AmqpValueSection object =
+ new AmqpValueSection(((SectionDecoderRegistry) handler.getDescribedTypeRegistry()).getUnderlyingRegistry());
+ object.setEncodedForm(encoding);
+ return object;
+ }
+ }
+
+ private void skipValue(final List<QpidByteBuffer> in) throws AmqpErrorException
+ {
+ byte formatCode = QpidByteBufferUtils.get(in);
+
+ if (formatCode == 0)
+ {
+ // This is only valid if the described value is not an array
+ skipValue(in);
+ skipValue(in);
+ }
+ else
+ {
+ int category = (formatCode >> 4) & 0x0F;
+ switch (category)
+ {
+ case 0x04:
+ break;
+ case 0x05:
+ QpidByteBufferUtils.skip(in, 1);
+ break;
+ case 0x06:
+ QpidByteBufferUtils.skip(in, 2);
+ break;
+ case 0x07:
+ QpidByteBufferUtils.skip(in, 4);
+ break;
+ case 0x08:
+ QpidByteBufferUtils.skip(in, 8);
+ break;
+ case 0x09:
+ QpidByteBufferUtils.skip(in, 16);
+ break;
+ case 0x0a:
+ case 0x0c:
+ case 0x0e:
+ QpidByteBufferUtils.skip(in, ((int) QpidByteBufferUtils.get(in)) & 0xFF);
+ break;
+ case 0x0b:
+ case 0x0d:
+ case 0x0f:
+ QpidByteBufferUtils.skip(in, QpidByteBufferUtils.getInt(in));
+ break;
+ default:
+ throw new AmqpErrorException(ConnectionError.FRAMING_ERROR, "Unknown type");
+ }
+ }
+ }
+
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,15 +23,15 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.*;
-
-
import java.util.Map;
-public class ApplicationPropertiesConstructor extends DescribedTypeConstructor<ApplicationProperties>
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties;
+
+public class ApplicationPropertiesConstructor extends AbstractDescribedTypeConstructor<ApplicationProperties>
{
private static final Object[] DESCRIPTORS =
{
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesSectionConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesSectionConstructor.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesSectionConstructor.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesSectionConstructor.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,54 @@
+
+/*
+*
+* 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.
+*
+*/
+
+
+package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
+
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationPropertiesSection;
+
+public class ApplicationPropertiesSectionConstructor extends DescribedMapSectionConstructor<ApplicationPropertiesSection>
+{
+ private static final Object[] DESCRIPTORS =
+ {
+ Symbol.valueOf("amqp:application-properties:map"),UnsignedLong.valueOf(0x0000000000000074L),
+ };
+
+ private static final ApplicationPropertiesSectionConstructor INSTANCE = new ApplicationPropertiesSectionConstructor();
+
+ public static void register(DescribedTypeConstructorRegistry registry)
+ {
+ for(Object descriptor : DESCRIPTORS)
+ {
+ registry.register(descriptor, INSTANCE);
+ }
+ }
+
+ @Override
+ protected ApplicationPropertiesSection createObject(final DescribedTypeConstructorRegistry describedTypeRegistry)
+ {
+ return new ApplicationPropertiesSection(describedTypeRegistry);
+ }
+
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesSectionConstructor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,12 +23,14 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.*;
+import org.apache.qpid.server.protocol.v1_0.type.Binary;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.Data;
-public class DataConstructor extends DescribedTypeConstructor<Data>
+public class DataConstructor extends AbstractDescribedTypeConstructor<Data>
{
private static final Object[] DESCRIPTORS =
{
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,146 @@
+
+/*
+*
+* 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.
+*
+*/
+
+
+package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.qpid.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.codec.SectionDecoderRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.TypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.ValueHandler;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.DataSection;
+import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
+import org.apache.qpid.server.protocol.v1_0.type.transport.ConnectionError;
+
+public class DataSectionConstructor implements DescribedTypeConstructor<DataSection>
+{
+
+ private static final Object[] DESCRIPTORS =
+ {
+ Symbol.valueOf("amqp:data:binary"), UnsignedLong.valueOf(0x0000000000000075L),
+ };
+
+ private static final DataSectionConstructor INSTANCE = new DataSectionConstructor();
+
+ public static void register(DescribedTypeConstructorRegistry registry)
+ {
+ for(Object descriptor : DESCRIPTORS)
+ {
+ registry.register(descriptor, INSTANCE);
+ }
+ }
+
+
+ @Override
+ public TypeConstructor<DataSection> construct(final Object descriptor,
+ final List<QpidByteBuffer> in,
+ final int[] originalPositions,
+ final ValueHandler valueHandler)
+ throws AmqpErrorException
+ {
+ int constructorByte = QpidByteBufferUtils.get(in) & 0xff;
+ int sizeBytes;
+ switch(constructorByte)
+ {
+ case 0xa0:
+ sizeBytes = 1;
+ break;
+ case 0xb0:
+ sizeBytes = 4;
+ break;
+ default:
+ throw new AmqpErrorException(ConnectionError.FRAMING_ERROR,
+ "The described section must always be binary");
+ }
+
+ return new LazyConstructor(sizeBytes, originalPositions);
+ }
+
+
+ private class LazyConstructor implements TypeConstructor<DataSection>
+ {
+
+ private final int _sizeBytes;
+ private final int[] _originalPositions;
+
+ public LazyConstructor(final int sizeBytes,
+ final int[] originalPositions)
+ {
+
+ _sizeBytes = sizeBytes;
+ _originalPositions = originalPositions;
+ }
+
+ @Override
+ public DataSection construct(final List<QpidByteBuffer> in, final ValueHandler handler)
+ throws AmqpErrorException
+ {
+ int size;
+ switch(_sizeBytes)
+ {
+ case 1:
+ size = QpidByteBufferUtils.get(in) & 0xff;
+ break;
+ case 4:
+ size = QpidByteBufferUtils.getInt(in);
+ break;
+ default:
+ throw new AmqpErrorException(AmqpError.INVALID_FIELD, "Unexpected constructor type, can only be 1 or 4");
+ }
+ QpidByteBufferUtils.skip(in, size);
+
+ List<QpidByteBuffer> encoding = new ArrayList<>();
+ int offset = in.size() - _originalPositions.length;
+ for(int i = offset; i < in.size(); i++)
+ {
+ QpidByteBuffer buf = in.get(i);
+ if(buf.position() == _originalPositions[i-offset])
+ {
+ if(buf.hasRemaining())
+ {
+ break;
+ }
+ }
+ else
+ {
+ QpidByteBuffer dup = buf.duplicate();
+ dup.position(_originalPositions[i-offset]);
+ dup.limit(buf.position());
+ encoding.add(dup);
+ }
+ }
+ DataSection object = new DataSection(((SectionDecoderRegistry)handler.getDescribedTypeRegistry()).getUnderlyingRegistry());
+ object.setEncodedForm(encoding);
+ return object;
+
+ }
+ }
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,7 +23,7 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
import org.apache.qpid.server.protocol.v1_0.type.*;
import org.apache.qpid.server.protocol.v1_0.type.messaging.*;
@@ -31,7 +31,7 @@ import org.apache.qpid.server.protocol.v
import java.util.List;
-public class DeleteOnCloseConstructor extends DescribedTypeConstructor<DeleteOnClose>
+public class DeleteOnCloseConstructor extends AbstractDescribedTypeConstructor<DeleteOnClose>
{
private static final Object[] DESCRIPTORS =
{
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,7 +23,7 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
import org.apache.qpid.server.protocol.v1_0.type.*;
import org.apache.qpid.server.protocol.v1_0.type.messaging.*;
@@ -31,7 +31,7 @@ import org.apache.qpid.server.protocol.v
import java.util.List;
-public class DeleteOnNoLinksConstructor extends DescribedTypeConstructor<DeleteOnNoLinks>
+public class DeleteOnNoLinksConstructor extends AbstractDescribedTypeConstructor<DeleteOnNoLinks>
{
private static final Object[] DESCRIPTORS =
{
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,7 +23,7 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
import org.apache.qpid.server.protocol.v1_0.type.*;
import org.apache.qpid.server.protocol.v1_0.type.messaging.*;
@@ -31,7 +31,7 @@ import org.apache.qpid.server.protocol.v
import java.util.List;
-public class DeleteOnNoLinksOrMessagesConstructor extends DescribedTypeConstructor<DeleteOnNoLinksOrMessages>
+public class DeleteOnNoLinksOrMessagesConstructor extends AbstractDescribedTypeConstructor<DeleteOnNoLinksOrMessages>
{
private static final Object[] DESCRIPTORS =
{
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,7 +23,7 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
import org.apache.qpid.server.protocol.v1_0.type.*;
import org.apache.qpid.server.protocol.v1_0.type.messaging.*;
@@ -31,7 +31,7 @@ import org.apache.qpid.server.protocol.v
import java.util.List;
-public class DeleteOnNoMessagesConstructor extends DescribedTypeConstructor<DeleteOnNoMessages>
+public class DeleteOnNoMessagesConstructor extends AbstractDescribedTypeConstructor<DeleteOnNoMessages>
{
private static final Object[] DESCRIPTORS =
{
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,15 +23,15 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.*;
-
-
import java.util.Map;
-public class DeliveryAnnotationsConstructor extends DescribedTypeConstructor<DeliveryAnnotations>
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotations;
+
+public class DeliveryAnnotationsConstructor extends AbstractDescribedTypeConstructor<DeliveryAnnotations>
{
private static final Object[] DESCRIPTORS =
{
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsSectionConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsSectionConstructor.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsSectionConstructor.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsSectionConstructor.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,54 @@
+
+/*
+*
+* 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.
+*
+*/
+
+
+package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
+
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotationsSection;
+
+public class DeliveryAnnotationsSectionConstructor extends DescribedMapSectionConstructor<DeliveryAnnotationsSection>
+{
+ private static final Object[] DESCRIPTORS =
+ {
+ Symbol.valueOf("amqp:delivery-annotations:map"),UnsignedLong.valueOf(0x0000000000000071L),
+ };
+
+ private static final DeliveryAnnotationsSectionConstructor INSTANCE = new DeliveryAnnotationsSectionConstructor();
+
+ public static void register(DescribedTypeConstructorRegistry registry)
+ {
+ for(Object descriptor : DESCRIPTORS)
+ {
+ registry.register(descriptor, INSTANCE);
+ }
+ }
+
+ @Override
+ protected DeliveryAnnotationsSection createObject(final DescribedTypeConstructorRegistry describedTypeRegistry)
+ {
+ return new DeliveryAnnotationsSection(describedTypeRegistry);
+ }
+
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsSectionConstructor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,137 @@
+
+/*
+*
+* 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.
+*
+*/
+
+
+package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.qpid.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.codec.SectionDecoderRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.TypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.ValueHandler;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.AbstractSection;
+import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
+import org.apache.qpid.server.protocol.v1_0.type.transport.ConnectionError;
+
+public abstract class DescribedListSectionConstructor<S extends AbstractSection> implements DescribedTypeConstructor<S>
+{
+
+ @Override
+ public TypeConstructor<S> construct(final Object descriptor,
+ final List<QpidByteBuffer> in,
+ final int[] originalPositions,
+ final ValueHandler valueHandler)
+ throws AmqpErrorException
+ {
+ int constructorByte = QpidByteBufferUtils.get(in) & 0xff;
+ int sizeBytes;
+ switch(constructorByte)
+ {
+ case 0x45:
+ sizeBytes = 0;
+ break;
+ case 0xc0:
+ sizeBytes = 1;
+ break;
+ case 0xd0:
+ sizeBytes = 4;
+ break;
+ default:
+ throw new AmqpErrorException(ConnectionError.FRAMING_ERROR,
+ "The described section must always be a list");
+ }
+
+ return new LazyConstructor(sizeBytes, originalPositions);
+ }
+
+
+ private class LazyConstructor implements TypeConstructor<S>
+ {
+
+ private final int _sizeBytes;
+ private final int[] _originalPositions;
+ private DescribedListSectionConstructor _describedTypeConstructor;
+
+ public LazyConstructor(final int sizeBytes,
+ final int[] originalPositions)
+ {
+
+ _sizeBytes = sizeBytes;
+ _originalPositions = originalPositions;
+ }
+
+ @Override
+ public S construct(final List<QpidByteBuffer> in, final ValueHandler handler)
+ throws AmqpErrorException
+ {
+ int size;
+ switch(_sizeBytes)
+ {
+ case 0:
+ size = 0;
+ break;
+ case 1:
+ size = QpidByteBufferUtils.get(in) & 0xFF;
+ break;
+ case 4:
+ size = QpidByteBufferUtils.getInt(in);
+ break;
+ default:
+ throw new AmqpErrorException(AmqpError.INVALID_FIELD, "Unexpected constructor type, can only be 0,1 or 4");
+ }
+ QpidByteBufferUtils.skip(in, size);
+
+ List<QpidByteBuffer> encoding = new ArrayList<>();
+ int offset = in.size() - _originalPositions.length;
+ for(int i = offset; i < in.size(); i++)
+ {
+ QpidByteBuffer buf = in.get(i);
+ if(buf.position() == _originalPositions[i-offset])
+ {
+ if(buf.hasRemaining())
+ {
+ break;
+ }
+ }
+ else
+ {
+ QpidByteBuffer dup = buf.duplicate();
+ dup.position(_originalPositions[i-offset]);
+ dup.limit(buf.position());
+ encoding.add(dup);
+ }
+ }
+ S object = createObject(((SectionDecoderRegistry)handler.getDescribedTypeRegistry()).getUnderlyingRegistry());
+ object.setEncodedForm(encoding);
+ return object;
+
+ }
+ }
+
+ protected abstract S createObject(final DescribedTypeConstructorRegistry describedTypeRegistry);
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,131 @@
+
+/*
+*
+* 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.
+*
+*/
+
+
+package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.qpid.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.codec.SectionDecoderRegistry;
+import org.apache.qpid.server.protocol.v1_0.codec.TypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.ValueHandler;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.AbstractSection;
+import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
+import org.apache.qpid.server.protocol.v1_0.type.transport.ConnectionError;
+
+public abstract class DescribedMapSectionConstructor<S extends AbstractSection> implements DescribedTypeConstructor<S>
+{
+
+ @Override
+ public TypeConstructor<S> construct(final Object descriptor,
+ final List<QpidByteBuffer> in,
+ final int[] originalPositions,
+ final ValueHandler valueHandler)
+ throws AmqpErrorException
+ {
+ int constructorByte = QpidByteBufferUtils.get(in) & 0xff;
+ int sizeBytes;
+ switch(constructorByte)
+ {
+ case 0xc1:
+ sizeBytes = 1;
+ break;
+ case 0xd1:
+ sizeBytes = 4;
+ break;
+ default:
+ throw new AmqpErrorException(ConnectionError.FRAMING_ERROR,
+ "The described section must always be a map");
+ }
+
+ return new LazyConstructor(sizeBytes, originalPositions);
+ }
+
+
+ private class LazyConstructor implements TypeConstructor<S>
+ {
+
+ private final int _sizeBytes;
+ private final int[] _originalPositions;
+ private DescribedMapSectionConstructor _describedTypeConstructor;
+
+ public LazyConstructor(final int sizeBytes,
+ final int[] originalPositions)
+ {
+
+ _sizeBytes = sizeBytes;
+ _originalPositions = originalPositions;
+ }
+
+ @Override
+ public S construct(final List<QpidByteBuffer> in, final ValueHandler handler)
+ throws AmqpErrorException
+ {
+ int size;
+ switch(_sizeBytes)
+ {
+ case 1:
+ size = QpidByteBufferUtils.get(in) & 0xff;
+ break;
+ case 4:
+ size = QpidByteBufferUtils.getInt(in);
+ break;
+ default:
+ throw new AmqpErrorException(AmqpError.INVALID_FIELD, "Unexpected constructor type, can only be 1 or 4");
+ }
+ QpidByteBufferUtils.skip(in, size);
+
+ List<QpidByteBuffer> encoding = new ArrayList<>();
+ int offset = in.size() - _originalPositions.length;
+ for(int i = offset; i < in.size(); i++)
+ {
+ QpidByteBuffer buf = in.get(i);
+ if(buf.position() == _originalPositions[i-offset])
+ {
+ if(buf.hasRemaining())
+ {
+ break;
+ }
+ }
+ else
+ {
+ QpidByteBuffer dup = buf.duplicate();
+ dup.position(_originalPositions[i-offset]);
+ dup.limit(buf.position());
+ encoding.add(dup);
+ }
+ }
+ S object = createObject(((SectionDecoderRegistry)handler.getDescribedTypeRegistry()).getUnderlyingRegistry());
+ object.setEncodedForm(encoding);
+ return object;
+
+ }
+ }
+
+ protected abstract S createObject(final DescribedTypeConstructorRegistry describedTypeRegistry);
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/EncodingRetaining.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/EncodingRetaining.java?rev=1772901&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/EncodingRetaining.java (added)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/EncodingRetaining.java Tue Dec 6 14:22:59 2016
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
+
+import java.util.List;
+
+import org.apache.qpid.bytebuffer.QpidByteBuffer;
+
+public interface EncodingRetaining
+{
+ void setEncodedForm(List<QpidByteBuffer> encodedForm);
+ List<QpidByteBuffer> getEncodedForm();
+ void dispose();
+ long getEncodedSize();
+ void writeTo(QpidByteBuffer dest);
+
+
+}
Propchange: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/EncodingRetaining.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterConstructor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterConstructor.java?rev=1772901&r1=1772900&r2=1772901&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterConstructor.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterConstructor.java Tue Dec 6 14:22:59 2016
@@ -23,12 +23,12 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
import org.apache.qpid.server.protocol.v1_0.type.messaging.ExactSubjectFilter;
-public class ExactSubjectFilterConstructor extends DescribedTypeConstructor<ExactSubjectFilter>
+public class ExactSubjectFilterConstructor extends AbstractDescribedTypeConstructor<ExactSubjectFilter>
{
private static final Object[] DESCRIPTORS =
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org