You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2017/09/28 13:35:58 UTC
[01/12] qpid-broker-j git commit: QPID-7531: [Java Broker,
AMQP 1.0] Defensive guard against NPE
Repository: qpid-broker-j
Updated Branches:
refs/heads/master d8613a623 -> 1b6034267
QPID-7531: [Java Broker, AMQP 1.0] Defensive guard against NPE
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/1b603426
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/1b603426
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/1b603426
Branch: refs/heads/master
Commit: 1b60342670f158e1d9e2c8350934f47184d9c99e
Parents: a352423
Author: Lorenz Quack <lq...@apache.org>
Authored: Mon Sep 25 12:09:10 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100
----------------------------------------------------------------------
.../qpid/server/protocol/v1_0/ConsumerTarget_1_0.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/1b603426/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
index a032d53..5c8cfd2 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
@@ -23,9 +23,7 @@ package org.apache.qpid.server.protocol.v1_0;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
-import java.util.concurrent.atomic.AtomicLong;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +37,6 @@ import org.apache.qpid.server.message.MessageDestination;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.MessageInstanceConsumer;
import org.apache.qpid.server.message.ServerMessage;
-import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.plugin.MessageConverter;
import org.apache.qpid.server.protocol.MessageConverterRegistry;
@@ -66,6 +63,7 @@ import org.apache.qpid.server.transport.ProtocolEngine;
import org.apache.qpid.server.txn.AutoCommitTransaction;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.Action;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.util.StateChangeListener;
class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0>
@@ -145,6 +143,14 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0>
{
converter =
(MessageConverter<? super ServerMessage, Message_1_0>) MessageConverterRegistry.getConverter(serverMessage.getClass(), Message_1_0.class);
+ if (converter == null)
+ {
+ throw new ServerScopedRuntimeException(String.format(
+ "Could not find message converter from '%s' to '%s'."
+ + " This is unexpected since we should not try to send if the converter is not present.",
+ serverMessage.getClass(),
+ Message_1_0.class));
+ }
message = converter.convert(serverMessage, _linkEndpoint.getAddressSpace());
}
@@ -497,7 +503,6 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0>
}
});
}
-
else if(outcome instanceof Modified)
{
txn.addPostTransactionAction(new ServerTransaction.Action()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[05/12] qpid-broker-j git commit: QPID-7531: [Java Broker,
AMQP 1.0] Refactor LazyConstructors in various
DescribedTypeConstructors
Posted by lq...@apache.org.
QPID-7531: [Java Broker, AMQP 1.0] Refactor LazyConstructors in various DescribedTypeConstructors
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/56cf7b8a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/56cf7b8a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/56cf7b8a
Branch: refs/heads/master
Commit: 56cf7b8a90cd6f6c6a13b27c52c721abf5578419
Parents: d8613a6
Author: Lorenz Quack <lq...@apache.org>
Authored: Fri Sep 22 16:25:29 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100
----------------------------------------------------------------------
.../codec/AbstractLazyConstructor.java | 76 +++++++++++
.../codec/AmqpValueSectionConstructor.java | 125 +++++++------------
.../messaging/codec/DataSectionConstructor.java | 48 ++-----
.../codec/DescribedListSectionConstructor.java | 49 ++------
.../codec/DescribedMapSectionConstructor.java | 52 ++------
5 files changed, 155 insertions(+), 195 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/56cf7b8a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AbstractLazyConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AbstractLazyConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AbstractLazyConstructor.java
new file mode 100644
index 0000000..3b80153
--- /dev/null
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AbstractLazyConstructor.java
@@ -0,0 +1,76 @@
+/*
+ * 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.server.bytebuffer.QpidByteBuffer;
+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;
+
+public abstract class AbstractLazyConstructor<T> implements TypeConstructor<T>
+{
+ private final int[] _originalPositions;
+
+ AbstractLazyConstructor(final int[] originalPositions)
+ {
+ _originalPositions = originalPositions;
+ }
+
+ @Override
+ public final T 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);
+ }
+ }
+ T object = createObject(encoding, handler);
+ for (QpidByteBuffer buffer : encoding)
+ {
+ buffer.dispose();
+ }
+ return object;
+ }
+
+ protected abstract T createObject(final List<QpidByteBuffer> encoding, final ValueHandler handler);
+
+ protected abstract void skipValue(final List<QpidByteBuffer> in) throws AmqpErrorException;
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/56cf7b8a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java
index daa76a9..274a2aa 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueSectionConstructor.java
@@ -23,7 +23,6 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import java.util.ArrayList;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
@@ -68,98 +67,68 @@ public class AmqpValueSectionConstructor implements DescribedTypeConstructor<Amq
}
- private class LazyConstructor implements TypeConstructor<AmqpValueSection>
+ private class LazyConstructor extends AbstractLazyConstructor<AmqpValueSection>
{
-
- private final int[] _originalPositions;
-
- public LazyConstructor(final int[] originalPositions)
+ LazyConstructor(final int[] originalPositions)
{
+ super(originalPositions);
+ }
- _originalPositions = originalPositions;
+ @Override
+ protected AmqpValueSection createObject(final List<QpidByteBuffer> encoding, final ValueHandler handler)
+ {
+ return new AmqpValueSection(encoding);
}
@Override
- public AmqpValueSection construct(final List<QpidByteBuffer> in, final ValueHandler handler)
- throws AmqpErrorException
+ protected void skipValue(final List<QpidByteBuffer> in) throws AmqpErrorException
{
- skipValue(in);
+ byte formatCode = QpidByteBufferUtils.get(in);
- List<QpidByteBuffer> encoding = new ArrayList<>();
- int offset = in.size() - _originalPositions.length;
- for (int i = offset; i < in.size(); i++)
+ if (formatCode == 0)
+ {
+ // This is only valid if the described value is not an array
+ skipValue(in);
+ skipValue(in);
+ }
+ else
{
- QpidByteBuffer buf = in.get(i);
- if (buf.position() == _originalPositions[i - offset])
+ int category = (formatCode >> 4) & 0x0F;
+ switch (category)
{
- if (buf.hasRemaining())
- {
+ case 0x04:
break;
- }
- }
- else
- {
- QpidByteBuffer dup = buf.duplicate();
- dup.position(_originalPositions[i - offset]);
- dup.limit(buf.position());
- encoding.add(dup);
+ 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");
}
}
- AmqpValueSection object = new AmqpValueSection(encoding);
- for (QpidByteBuffer buffer: encoding)
- {
- buffer.dispose();
- }
- 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");
- }
- }
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/56cf7b8a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java
index a5d2469..d9b331a 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataSectionConstructor.java
@@ -23,7 +23,6 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import java.util.ArrayList;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
@@ -84,23 +83,24 @@ public class DataSectionConstructor implements DescribedTypeConstructor<DataSect
}
- private class LazyConstructor implements TypeConstructor<DataSection>
+ private class LazyConstructor extends AbstractLazyConstructor<DataSection>
{
-
private final int _sizeBytes;
- private final int[] _originalPositions;
- public LazyConstructor(final int sizeBytes,
- final int[] originalPositions)
+ public LazyConstructor(final int sizeBytes, final int[] originalPositions)
{
-
+ super(originalPositions);
_sizeBytes = sizeBytes;
- _originalPositions = originalPositions;
}
@Override
- public DataSection construct(final List<QpidByteBuffer> in, final ValueHandler handler)
- throws AmqpErrorException
+ protected DataSection createObject(final List<QpidByteBuffer> encoding, final ValueHandler handler)
+ {
+ return new DataSection(encoding);
+ }
+
+ @Override
+ protected void skipValue(final List<QpidByteBuffer> in) throws AmqpErrorException
{
int size;
switch(_sizeBytes)
@@ -115,34 +115,6 @@ public class DataSectionConstructor implements DescribedTypeConstructor<DataSect
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(encoding);
- for (QpidByteBuffer buffer: encoding)
- {
- buffer.dispose();
- }
- return object;
-
}
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/56cf7b8a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java
index c01b560..d038f33 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedListSectionConstructor.java
@@ -23,7 +23,6 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import java.util.ArrayList;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
@@ -68,24 +67,24 @@ public abstract class DescribedListSectionConstructor<S extends AbstractSection>
}
- private class LazyConstructor implements TypeConstructor<S>
+ private class LazyConstructor extends AbstractLazyConstructor<S>
{
-
private final int _sizeBytes;
- private final int[] _originalPositions;
- private DescribedListSectionConstructor _describedTypeConstructor;
- public LazyConstructor(final int sizeBytes,
- final int[] originalPositions)
+ LazyConstructor(final int sizeBytes, final int[] originalPositions)
{
-
+ super(originalPositions);
_sizeBytes = sizeBytes;
- _originalPositions = originalPositions;
}
@Override
- public S construct(final List<QpidByteBuffer> in, final ValueHandler handler)
- throws AmqpErrorException
+ protected S createObject(final List<QpidByteBuffer> encoding, final ValueHandler handler)
+ {
+ return DescribedListSectionConstructor.this.createObject(encoding);
+ }
+
+ @Override
+ protected void skipValue(final List<QpidByteBuffer> in) throws AmqpErrorException
{
int size;
switch(_sizeBytes)
@@ -103,34 +102,6 @@ public abstract class DescribedListSectionConstructor<S extends AbstractSection>
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(encoding);
- for (QpidByteBuffer buffer: encoding)
- {
- buffer.dispose();
- }
- return object;
-
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/56cf7b8a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
index 718c6da..fb1f545 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
@@ -27,9 +27,9 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.bytebuffer.QpidByteBufferUtils;
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.bytebuffer.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;
@@ -67,24 +67,25 @@ public abstract class DescribedMapSectionConstructor<S extends AbstractSection>
}
- private class LazyConstructor implements TypeConstructor<S>
+ private class LazyConstructor extends AbstractLazyConstructor<S>
{
-
private final int _sizeBytes;
- private final int[] _originalPositions;
- private DescribedMapSectionConstructor _describedTypeConstructor;
- public LazyConstructor(final int sizeBytes,
- final int[] originalPositions)
+ LazyConstructor(final int sizeBytes, final int[] originalPositions)
{
-
+ super(originalPositions);
_sizeBytes = sizeBytes;
- _originalPositions = originalPositions;
}
@Override
- public S construct(final List<QpidByteBuffer> in, final ValueHandler handler)
- throws AmqpErrorException
+ protected S createObject(final List<QpidByteBuffer> encoding, final ValueHandler handler)
+ {
+ return DescribedMapSectionConstructor.this.createObject(((SectionDecoderRegistry) handler.getDescribedTypeRegistry())
+ .getUnderlyingRegistry(), encoding);
+ }
+
+ @Override
+ protected void skipValue(final List<QpidByteBuffer> in) throws AmqpErrorException
{
int size;
switch(_sizeBytes)
@@ -99,35 +100,6 @@ public abstract class DescribedMapSectionConstructor<S extends AbstractSection>
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(),
- encoding);
- for (QpidByteBuffer buffer: encoding)
- {
- buffer.dispose();
- }
- return object;
-
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[07/12] qpid-broker-j git commit: QPID-7932: [Java Broker,
AMQP 1.0] Improve error handling when deserializing composite types
Posted by lq...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TxnCapabilities.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TxnCapabilities.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TxnCapabilities.java
deleted file mode 100644
index 3759fce..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TxnCapabilities.java
+++ /dev/null
@@ -1,146 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transaction;
-
-
-
-import org.apache.qpid.server.protocol.v1_0.type.*;
-import org.apache.qpid.server.protocol.v1_0.type.TxnCapability;
-
-public class TxnCapabilities
- implements TxnCapability, RestrictedType<Symbol>
-
- {
-
-
-
- private final Symbol _val;
-
-
- public static final TxnCapabilities LOCAL_TXN = new TxnCapabilities(Symbol.valueOf("amqp:local-transactions"));
-
- public static final TxnCapabilities DISTRIBUTED_TXN = new TxnCapabilities(Symbol.valueOf("amqp:distributed-transactions"));
-
- public static final TxnCapabilities PROMOTABLE_TXN = new TxnCapabilities(Symbol.valueOf("amqp:promotable-transactions"));
-
- public static final TxnCapabilities MULTI_TXNS_PER_SSN = new TxnCapabilities(Symbol.valueOf("amqp:multi-txns-per-ssn"));
-
- public static final TxnCapabilities MULTI_SSNS_PER_TXN = new TxnCapabilities(Symbol.valueOf("amqp:multi-ssns-per-txn"));
-
- public static final TxnCapabilities MULTI_CONNS_PER_TXN = new TxnCapabilities(Symbol.valueOf("amqp:multi-conns-per-txn"));
-
-
-
- private TxnCapabilities(Symbol val)
- {
- _val = val;
- }
-
- @Override
- public Symbol getValue()
- {
- return _val;
- }
-
- @Override
- public String toString()
- {
-
- if(this == LOCAL_TXN)
- {
- return "local-txn";
- }
-
- if(this == DISTRIBUTED_TXN)
- {
- return "distributed-txn";
- }
-
- if(this == PROMOTABLE_TXN)
- {
- return "promotable-txn";
- }
-
- if(this == MULTI_TXNS_PER_SSN)
- {
- return "multi-txns-per-ssn";
- }
-
- if(this == MULTI_SSNS_PER_TXN)
- {
- return "multi-ssns-per-txn";
- }
-
- if(this == MULTI_CONNS_PER_TXN)
- {
- return "multi-conns-per-txn";
- }
-
- else
- {
- return String.valueOf(_val);
- }
- }
-
- public static TxnCapabilities valueOf(Object obj)
- {
- Symbol val = (Symbol) obj;
-
- if(LOCAL_TXN._val.equals(val))
- {
- return LOCAL_TXN;
- }
-
- if(DISTRIBUTED_TXN._val.equals(val))
- {
- return DISTRIBUTED_TXN;
- }
-
- if(PROMOTABLE_TXN._val.equals(val))
- {
- return PROMOTABLE_TXN;
- }
-
- if(MULTI_TXNS_PER_SSN._val.equals(val))
- {
- return MULTI_TXNS_PER_SSN;
- }
-
- if(MULTI_SSNS_PER_TXN._val.equals(val))
- {
- return MULTI_SSNS_PER_TXN;
- }
-
- if(MULTI_CONNS_PER_TXN._val.equals(val))
- {
- return MULTI_CONNS_PER_TXN;
- }
-
- // TODO ERROR
- return null;
- }
-
-
-
- }
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TxnCapability.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TxnCapability.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TxnCapability.java
index df16c49..c00dfcb 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TxnCapability.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TxnCapability.java
@@ -24,30 +24,24 @@
package org.apache.qpid.server.protocol.v1_0.type.transaction;
+import org.apache.qpid.server.protocol.v1_0.type.RestrictedType;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class TxnCapability
- implements org.apache.qpid.server.protocol.v1_0.type.TxnCapability, RestrictedType<Symbol>
-
- {
+public class TxnCapability implements org.apache.qpid.server.protocol.v1_0.type.TxnCapability, RestrictedType<Symbol>
+{
+ private final Symbol _val;
+ public static final TxnCapability LOCAL_TXN = new TxnCapability(Symbol.valueOf("amqp:local-transactions"));
+ public static final TxnCapability DISTRIBUTED_TXN =
+ new TxnCapability(Symbol.valueOf("amqp:distributed-transactions"));
- private final Symbol _val;
+ public static final TxnCapability PROMOTABLE_TXN =
+ new TxnCapability(Symbol.valueOf("amqp:promotable-transactions"));
-
- public static final TxnCapability LOCAL_TXN = new TxnCapability(Symbol.valueOf("amqp:local-transactions"));
-
- public static final TxnCapability DISTRIBUTED_TXN = new TxnCapability(Symbol.valueOf("amqp:distributed-transactions"));
-
- public static final TxnCapability PROMOTABLE_TXN = new TxnCapability(Symbol.valueOf("amqp:promotable-transactions"));
-
public static final TxnCapability MULTI_TXNS_PER_SSN = new TxnCapability(Symbol.valueOf("amqp:multi-txns-per-ssn"));
-
- public static final TxnCapability MULTI_SSNS_PER_TXN = new TxnCapability(Symbol.valueOf("amqp:multi-ssns-per-txn"));
-
+ public static final TxnCapability MULTI_SSNS_PER_TXN = new TxnCapability(Symbol.valueOf("amqp:multi-ssns-per-txn"));
private TxnCapability(Symbol val)
{
@@ -63,32 +57,32 @@ public class TxnCapability
@Override
public String toString()
{
-
- if(this == LOCAL_TXN)
+
+ if (this == LOCAL_TXN)
{
return "local-txn";
}
-
- if(this == DISTRIBUTED_TXN)
+
+ if (this == DISTRIBUTED_TXN)
{
return "distributed-txn";
}
-
- if(this == PROMOTABLE_TXN)
+
+ if (this == PROMOTABLE_TXN)
{
return "promotable-txn";
}
-
- if(this == MULTI_TXNS_PER_SSN)
+
+ if (this == MULTI_TXNS_PER_SSN)
{
return "multi-txns-per-ssn";
}
-
- if(this == MULTI_SSNS_PER_TXN)
+
+ if (this == MULTI_SSNS_PER_TXN)
{
return "multi-ssns-per-txn";
}
-
+
else
{
return String.valueOf(_val);
@@ -99,35 +93,32 @@ public class TxnCapability
{
Symbol val = (Symbol) obj;
- if(LOCAL_TXN._val.equals(val))
+ if (LOCAL_TXN._val.equals(val))
{
return LOCAL_TXN;
}
-
- if(DISTRIBUTED_TXN._val.equals(val))
+
+ if (DISTRIBUTED_TXN._val.equals(val))
{
return DISTRIBUTED_TXN;
}
-
- if(PROMOTABLE_TXN._val.equals(val))
+
+ if (PROMOTABLE_TXN._val.equals(val))
{
return PROMOTABLE_TXN;
}
-
- if(MULTI_TXNS_PER_SSN._val.equals(val))
+
+ if (MULTI_TXNS_PER_SSN._val.equals(val))
{
return MULTI_TXNS_PER_SSN;
}
-
- if(MULTI_SSNS_PER_TXN._val.equals(val))
+
+ if (MULTI_SSNS_PER_TXN._val.equals(val))
{
return MULTI_SSNS_PER_TXN;
}
-
+
// TODO ERROR
return null;
}
-
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorConstructor.java
deleted file mode 100644
index 657accb..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorConstructor.java
+++ /dev/null
@@ -1,117 +0,0 @@
-
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transaction.codec;
-
-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.transaction.*;
-import org.apache.qpid.server.protocol.v1_0.type.transaction.TxnCapability;
-
-import java.util.List;
-
-public class CoordinatorConstructor extends AbstractDescribedTypeConstructor<Coordinator>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:coordinator:list"),UnsignedLong.valueOf(0x0000000000000030L),
- };
-
- private static final CoordinatorConstructor INSTANCE = new CoordinatorConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Coordinator construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Coordinator obj = new Coordinator();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof TxnCapability[] )
- {
- obj.setCapabilities( (TxnCapability[]) val );
- }
- else if (val instanceof Symbol[])
- {
- Symbol[] symVal = (Symbol[]) val;
- TxnCapability[] cap = new TxnCapability[symVal.length];
- int i = 0;
- for(Symbol sym : symVal)
- {
- cap[i++] = TxnCapability.valueOf(sym);
- }
- obj.setCapabilities(cap);
- }
- else
- {
- try
- {
- obj.setCapabilities( new TxnCapability[] { (TxnCapability) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareConstructor.java
deleted file mode 100644
index 3fc1f42..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareConstructor.java
+++ /dev/null
@@ -1,100 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transaction.codec;
-
-import java.util.List;
-
-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.GlobalTxId;
-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.transaction.Declare;
-
-public class DeclareConstructor extends AbstractDescribedTypeConstructor<Declare>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:declare:list"),UnsignedLong.valueOf(0x0000000000000031L),
- };
-
- private static final DeclareConstructor INSTANCE = new DeclareConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Declare construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Declare obj = new Declare();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setGlobalId( (GlobalTxId) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredConstructor.java
deleted file mode 100644
index 6b6e380..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredConstructor.java
+++ /dev/null
@@ -1,99 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transaction.codec;
-
-import java.util.List;
-
-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.Binary;
-import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
-import org.apache.qpid.server.protocol.v1_0.type.transaction.Declared;
-
-public class DeclaredConstructor extends AbstractDescribedTypeConstructor<Declared>
-{
- private static final Object[] DESCRIPTORS =
- {
- Declared.DECLARED_SYMBOL,UnsignedLong.valueOf(0x0000000000000033L),
- };
-
- private static final DeclaredConstructor INSTANCE = new DeclaredConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Declared construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Declared obj = new Declared();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setTxnId( (Binary) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeConstructor.java
deleted file mode 100644
index f3c0611..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeConstructor.java
+++ /dev/null
@@ -1,126 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transaction.codec;
-
-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.transaction.*;
-
-
-import java.util.List;
-
-public class DischargeConstructor extends AbstractDescribedTypeConstructor<Discharge>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:discharge:list"),UnsignedLong.valueOf(0x0000000000000032L),
- };
-
- private static final DischargeConstructor INSTANCE = new DischargeConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Discharge construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Discharge obj = new Discharge();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setTxnId( (Binary) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setFail( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateConstructor.java
deleted file mode 100644
index 05a1cf2..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateConstructor.java
+++ /dev/null
@@ -1,126 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transaction.codec;
-
-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.transaction.*;
-
-
-import java.util.List;
-
-public class TransactionalStateConstructor extends AbstractDescribedTypeConstructor<TransactionalState>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:transactional-state:list"),UnsignedLong.valueOf(0x0000000000000034L),
- };
-
- private static final TransactionalStateConstructor INSTANCE = new TransactionalStateConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public TransactionalState construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- TransactionalState obj = new TransactionalState();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setTxnId( (Binary) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setOutcome( (Outcome) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/AmqpError.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/AmqpError.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/AmqpError.java
index 159f943..88c6202 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/AmqpError.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/AmqpError.java
@@ -121,7 +121,6 @@ public class AmqpError implements ErrorCondition, RestrictedType<Symbol>
return FRAME_SIZE_TOO_SMALL;
}
- // TODO ERROR
return null;
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Attach.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Attach.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Attach.java
index a821be5..5a40cb3 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Attach.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Attach.java
@@ -30,56 +30,58 @@ import org.apache.qpid.server.protocol.v1_0.ConnectionHandler;
import org.apache.qpid.server.protocol.v1_0.type.BaseSource;
import org.apache.qpid.server.protocol.v1_0.type.BaseTarget;
import org.apache.qpid.server.protocol.v1_0.type.Binary;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.DeliveryState;
import org.apache.qpid.server.protocol.v1_0.type.FrameBody;
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.UnsignedLong;
+@CompositeType( symbolicDescriptor = "amqp:attach:list", numericDescriptor = 0x0000000000000012L)
public class Attach implements FrameBody
{
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true)
private String _name;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 1, mandatory = true)
private UnsignedInteger _handle;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 2, mandatory = true)
private Role _role;
- @CompositeTypeField
+ @CompositeTypeField(index = 3)
private SenderSettleMode _sndSettleMode;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private ReceiverSettleMode _rcvSettleMode;
- @CompositeTypeField
+ @CompositeTypeField(index = 5)
private BaseSource _source;
- @CompositeTypeField
+ @CompositeTypeField(index = 6)
private BaseTarget _target;
- @CompositeTypeField
+ @CompositeTypeField(index = 7)
private Map<Binary, DeliveryState> _unsettled;
- @CompositeTypeField
+ @CompositeTypeField(index = 8)
private Boolean _incompleteUnsettled;
- @CompositeTypeField
+ @CompositeTypeField(index = 9)
private UnsignedInteger _initialDeliveryCount;
- @CompositeTypeField
+ @CompositeTypeField(index = 10)
private UnsignedLong _maxMessageSize;
- @CompositeTypeField
+ @CompositeTypeField(index = 11)
private Symbol[] _offeredCapabilities;
- @CompositeTypeField
+ @CompositeTypeField(index = 12)
private Symbol[] _desiredCapabilities;
- @CompositeTypeField
+ @CompositeTypeField(index = 13)
private Map<Symbol, Object> _properties;
public String getName()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Begin.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Begin.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Begin.java
index 4a280e4..c3de446 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Begin.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Begin.java
@@ -27,37 +27,39 @@ import java.util.Arrays;
import java.util.Map;
import org.apache.qpid.server.protocol.v1_0.ConnectionHandler;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.FrameBody;
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.UnsignedShort;
+@CompositeType( symbolicDescriptor = "amqp:begin:list", numericDescriptor = 0x0000000000000011L)
public class Begin implements FrameBody
{
- @CompositeTypeField
+ @CompositeTypeField(index = 0)
private UnsignedShort _remoteChannel;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 1, mandatory = true)
private UnsignedInteger _nextOutgoingId;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 2, mandatory = true)
private UnsignedInteger _incomingWindow;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 3, mandatory = true)
private UnsignedInteger _outgoingWindow;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private UnsignedInteger _handleMax;
- @CompositeTypeField
+ @CompositeTypeField(index = 5)
private Symbol[] _offeredCapabilities;
- @CompositeTypeField
+ @CompositeTypeField(index = 6)
private Symbol[] _desiredCapabilities;
- @CompositeTypeField
+ @CompositeTypeField(index = 7)
private Map<Symbol, Object> _properties;
public UnsignedShort getRemoteChannel()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Close.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Close.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Close.java
index 2505ca1..77a6ff6 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Close.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Close.java
@@ -24,13 +24,15 @@ package org.apache.qpid.server.protocol.v1_0.type.transport;
import org.apache.qpid.server.protocol.v1_0.ConnectionHandler;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.ErrorCarryingFrameBody;
+@CompositeType( symbolicDescriptor = "amqp:close:list", numericDescriptor = 0x0000000000000018L)
public class Close implements ErrorCarryingFrameBody
{
- @CompositeTypeField
+ @CompositeTypeField(index = 0)
private Error _error;
@Override
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/ConnectionError.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/ConnectionError.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/ConnectionError.java
index 491984b..e1fe139 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/ConnectionError.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/ConnectionError.java
@@ -69,7 +69,6 @@ public class ConnectionError implements ErrorCondition, RestrictedType<Symbol>
return SOCKET_ERROR;
}
- // TODO ERROR
return null;
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Detach.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Detach.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Detach.java
index 59454e2..96b596b 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Detach.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Detach.java
@@ -24,20 +24,22 @@ package org.apache.qpid.server.protocol.v1_0.type.transport;
import org.apache.qpid.server.protocol.v1_0.ConnectionHandler;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.ErrorCarryingFrameBody;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
+@CompositeType( symbolicDescriptor = "amqp:detach:list", numericDescriptor = 0x0000000000000016L)
public class Detach implements ErrorCarryingFrameBody
{
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true)
private UnsignedInteger _handle;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private Boolean _closed;
- @CompositeTypeField
+ @CompositeTypeField(index = 2)
private Error _error;
public UnsignedInteger getHandle()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Disposition.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Disposition.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Disposition.java
index 133f8c4..9650633 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Disposition.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Disposition.java
@@ -24,30 +24,32 @@ package org.apache.qpid.server.protocol.v1_0.type.transport;
import org.apache.qpid.server.protocol.v1_0.ConnectionHandler;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.DeliveryState;
import org.apache.qpid.server.protocol.v1_0.type.FrameBody;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
+@CompositeType( symbolicDescriptor = "amqp:disposition:list", numericDescriptor = 0x0000000000000015L)
public class Disposition implements FrameBody
{
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true)
private Role _role;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 1, mandatory = true)
private UnsignedInteger _first;
- @CompositeTypeField
+ @CompositeTypeField(index = 2)
private UnsignedInteger _last;
- @CompositeTypeField
+ @CompositeTypeField(index = 3)
private Boolean _settled;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private DeliveryState _state;
- @CompositeTypeField
+ @CompositeTypeField(index = 5)
private Boolean _batchable;
public Role getRole()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/End.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/End.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/End.java
index 0756790..a486bf6 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/End.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/End.java
@@ -24,13 +24,15 @@ package org.apache.qpid.server.protocol.v1_0.type.transport;
import org.apache.qpid.server.protocol.v1_0.ConnectionHandler;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.ErrorCarryingFrameBody;
+@CompositeType( symbolicDescriptor = "amqp:end:list", numericDescriptor = 0x0000000000000017L)
public class End implements ErrorCarryingFrameBody
{
- @CompositeTypeField
+ @CompositeTypeField(index = 0)
private Error _error;
@Override
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Error.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Error.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Error.java
index 0cf3eea..40217d4 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Error.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Error.java
@@ -25,19 +25,23 @@ package org.apache.qpid.server.protocol.v1_0.type.transport;
import java.util.Map;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.ErrorCondition;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+@CompositeType( symbolicDescriptor = "amqp:error:list", numericDescriptor = 0x000000000000001DL)
public class Error
{
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true,
+ deserializationConverter = "org.apache.qpid.server.protocol.v1_0.DeserializationFactories.convertToErrorCondition")
private ErrorCondition _condition;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private String _description;
- @CompositeTypeField
- private Map _info;
+ @CompositeTypeField(index = 2)
+ private Map<Symbol, Object> _info;
public Error()
{
@@ -69,12 +73,12 @@ public class Error
_description = description;
}
- public Map getInfo()
+ public Map<Symbol, Object> getInfo()
{
return _info;
}
- public void setInfo(Map info)
+ public void setInfo(Map<Symbol, Object> info)
{
_info = info;
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Flow.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Flow.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Flow.java
index ce9d63c..6eee901 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Flow.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Flow.java
@@ -26,45 +26,47 @@ package org.apache.qpid.server.protocol.v1_0.type.transport;
import java.util.Map;
import org.apache.qpid.server.protocol.v1_0.ConnectionHandler;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.FrameBody;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
+@CompositeType( symbolicDescriptor = "amqp:flow:list", numericDescriptor = 0x0000000000000013L)
public class Flow implements FrameBody
{
- @CompositeTypeField
+ @CompositeTypeField(index = 0)
private UnsignedInteger _nextIncomingId;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 1, mandatory = true)
private UnsignedInteger _incomingWindow;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 2, mandatory = true)
private UnsignedInteger _nextOutgoingId;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 3, mandatory = true)
private UnsignedInteger _outgoingWindow;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private UnsignedInteger _handle;
- @CompositeTypeField
+ @CompositeTypeField(index = 5)
private UnsignedInteger _deliveryCount;
- @CompositeTypeField
+ @CompositeTypeField(index = 6)
private UnsignedInteger _linkCredit;
- @CompositeTypeField
+ @CompositeTypeField(index = 7)
private UnsignedInteger _available;
- @CompositeTypeField
+ @CompositeTypeField(index = 8)
private Boolean _drain;
- @CompositeTypeField
+ @CompositeTypeField(index = 9)
private Boolean _echo;
- @CompositeTypeField
+ @CompositeTypeField(index = 10)
private Map<Symbol, Object> _properties;
public UnsignedInteger getNextIncomingId()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/LinkError.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/LinkError.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/LinkError.java
index 4c4e08a..99ec089 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/LinkError.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/LinkError.java
@@ -74,7 +74,6 @@ public class LinkError implements ErrorCondition, RestrictedType<Symbol>
return STOLEN;
}
- // TODO ERROR
return null;
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Open.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Open.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Open.java
index 7ea1a2b..eeae127 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Open.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Open.java
@@ -27,43 +27,45 @@ import java.util.Arrays;
import java.util.Map;
import org.apache.qpid.server.protocol.v1_0.ConnectionHandler;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.FrameBody;
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.UnsignedShort;
+@CompositeType( symbolicDescriptor = "amqp:open:list", numericDescriptor = 0x0000000000000010L)
public class Open implements FrameBody
{
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true)
private String _containerId;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private String _hostname;
- @CompositeTypeField
+ @CompositeTypeField(index = 2)
private UnsignedInteger _maxFrameSize;
- @CompositeTypeField
+ @CompositeTypeField(index = 3)
private UnsignedShort _channelMax;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private UnsignedInteger _idleTimeOut;
- @CompositeTypeField
+ @CompositeTypeField(index = 5)
private Symbol[] _outgoingLocales;
- @CompositeTypeField
+ @CompositeTypeField(index = 6)
private Symbol[] _incomingLocales;
- @CompositeTypeField
+ @CompositeTypeField(index = 7)
private Symbol[] _offeredCapabilities;
- @CompositeTypeField
+ @CompositeTypeField(index = 8)
private Symbol[] _desiredCapabilities;
- @CompositeTypeField
+ @CompositeTypeField(index = 9)
private Map<Symbol, Object> _properties;
public String getContainerId()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/SessionError.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/SessionError.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/SessionError.java
index 49b40b1..190bb3a 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/SessionError.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/SessionError.java
@@ -68,7 +68,6 @@ public class SessionError implements ErrorCondition, RestrictedType<Symbol>
return UNATTACHED_HANDLE;
}
- // TODO ERROR
return null;
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Transfer.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Transfer.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Transfer.java
index 75cd9dc..d757cb7 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Transfer.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/Transfer.java
@@ -29,46 +29,48 @@ import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
import org.apache.qpid.server.protocol.v1_0.ConnectionHandler;
import org.apache.qpid.server.protocol.v1_0.type.Binary;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.DeliveryState;
import org.apache.qpid.server.protocol.v1_0.type.FrameBody;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
+@CompositeType( symbolicDescriptor = "amqp:transfer:list", numericDescriptor = 0x0000000000000014L)
public class Transfer implements FrameBody
{
private volatile List<QpidByteBuffer> _payload;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true)
private UnsignedInteger _handle;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private UnsignedInteger _deliveryId;
- @CompositeTypeField
+ @CompositeTypeField(index = 2)
private Binary _deliveryTag;
- @CompositeTypeField
+ @CompositeTypeField(index = 3)
private UnsignedInteger _messageFormat;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private Boolean _settled;
- @CompositeTypeField
+ @CompositeTypeField(index = 5)
private Boolean _more;
- @CompositeTypeField
+ @CompositeTypeField(index = 6)
private ReceiverSettleMode _rcvSettleMode;
- @CompositeTypeField
+ @CompositeTypeField(index = 7)
private DeliveryState _state;
- @CompositeTypeField
+ @CompositeTypeField(index = 8)
private Boolean _resume;
- @CompositeTypeField
+ @CompositeTypeField(index = 9)
private Boolean _aborted;
- @CompositeTypeField
+ @CompositeTypeField(index = 10)
private Boolean _batchable;
public UnsignedInteger getHandle()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachConstructor.java
deleted file mode 100644
index 7d68efe..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachConstructor.java
+++ /dev/null
@@ -1,465 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-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.transport.*;
-
-
-import java.util.List;
-import java.util.Map;
-
-public class AttachConstructor extends AbstractDescribedTypeConstructor<Attach>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:attach:list"),UnsignedLong.valueOf(0x0000000000000012L),
- };
-
- private static final AttachConstructor INSTANCE = new AttachConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Attach construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Attach obj = new Attach();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setName( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setHandle( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setRole( Role.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setSndSettleMode( SenderSettleMode.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setRcvSettleMode( ReceiverSettleMode.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setSource( (BaseSource) val);
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setTarget( (BaseTarget) val);
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setUnsettled( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setIncompleteUnsettled( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setInitialDeliveryCount( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setMaxMessageSize( (UnsignedLong) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setOfferedCapabilities( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setOfferedCapabilities( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setDesiredCapabilities( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setDesiredCapabilities( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setProperties( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginConstructor.java
deleted file mode 100644
index 6acb6cc..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginConstructor.java
+++ /dev/null
@@ -1,303 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-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.transport.*;
-
-
-import java.util.List;
-import java.util.Map;
-
-public class BeginConstructor extends AbstractDescribedTypeConstructor<Begin>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:begin:list"),UnsignedLong.valueOf(0x0000000000000011L),
- };
-
- private static final BeginConstructor INSTANCE = new BeginConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Begin construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Begin obj = new Begin();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setRemoteChannel( (UnsignedShort) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setNextOutgoingId( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setIncomingWindow( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setOutgoingWindow( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setHandleMax( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setOfferedCapabilities( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setOfferedCapabilities( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setDesiredCapabilities( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setDesiredCapabilities( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setProperties( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseConstructor.java
deleted file mode 100644
index fd8d957..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseConstructor.java
+++ /dev/null
@@ -1,99 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-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.transport.*;
-
-
-import java.util.List;
-
-public class CloseConstructor extends AbstractDescribedTypeConstructor<Close>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:close:list"),UnsignedLong.valueOf(0x0000000000000018L),
- };
-
- private static final CloseConstructor INSTANCE = new CloseConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Close construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Close obj = new Close();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setError( (org.apache.qpid.server.protocol.v1_0.type.transport.Error) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachConstructor.java
deleted file mode 100644
index 9d0efea..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachConstructor.java
+++ /dev/null
@@ -1,153 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-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.transport.*;
-
-
-import java.util.List;
-
-public class DetachConstructor extends AbstractDescribedTypeConstructor<Detach>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:detach:list"),UnsignedLong.valueOf(0x0000000000000016L),
- };
-
- private static final DetachConstructor INSTANCE = new DetachConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Detach construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Detach obj = new Detach();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setHandle( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setClosed( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setError( (org.apache.qpid.server.protocol.v1_0.type.transport.Error) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionConstructor.java
deleted file mode 100644
index 03755de..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionConstructor.java
+++ /dev/null
@@ -1,234 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-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.transport.*;
-
-
-import java.util.List;
-
-public class DispositionConstructor extends AbstractDescribedTypeConstructor<Disposition>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:disposition:list"),UnsignedLong.valueOf(0x0000000000000015L),
- };
-
- private static final DispositionConstructor INSTANCE = new DispositionConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Disposition construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Disposition obj = new Disposition();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setRole( Role.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setFirst( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setLast( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setSettled( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setState( (DeliveryState) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setBatchable( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[09/12] qpid-broker-j git commit: QPID-7932: [Java Broker,
AMQP 1.0] Improve error handling when deserializing composite types
Posted by lq...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ValueHandler.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ValueHandler.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ValueHandler.java
index 5fcba82..56347f6 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ValueHandler.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ValueHandler.java
@@ -70,10 +70,8 @@ public class ValueHandler implements DescribedTypeConstructorRegistry.Source
StringTypeConstructor.getInstance(4),
null,
SymbolTypeConstructor.getInstance(4) },
- { CompoundTypeConstructor.getInstance(1, CompoundTypeConstructor.LIST_ASSEMBLER_FACTORY),
- CompoundTypeConstructor.getInstance(1, CompoundTypeConstructor.MAP_ASSEMBLER_FACTORY) },
- { CompoundTypeConstructor.getInstance(4, CompoundTypeConstructor.LIST_ASSEMBLER_FACTORY),
- CompoundTypeConstructor.getInstance(4, CompoundTypeConstructor.MAP_ASSEMBLER_FACTORY) },
+ { ListConstructor.getInstance(1), MapConstructor.getInstance(1) },
+ { ListConstructor.getInstance(4), MapConstructor.getInstance(4) },
{
ArrayTypeConstructor.getOneByteSizeTypeConstructor()
},
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/framing/FrameHandler.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/framing/FrameHandler.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/framing/FrameHandler.java
index 06bb3e8..baebf51 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/framing/FrameHandler.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/framing/FrameHandler.java
@@ -38,6 +38,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.ChannelFrameBody;
import org.apache.qpid.server.protocol.v1_0.type.transport.ConnectionError;
import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
import org.apache.qpid.server.protocol.v1_0.type.transport.Transfer;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class FrameHandler implements ProtocolHandler
{
@@ -206,6 +207,10 @@ public class FrameHandler implements ProtocolHandler
}
catch (RuntimeException e)
{
+ if (e instanceof ServerScopedRuntimeException)
+ {
+ throw e;
+ }
LOGGER.warn("Unexpected exception handling frame", e);
// This exception is unexpected. The up layer should handle error condition gracefully
_connectionHandler.handleError(this.createError(ConnectionError.CONNECTION_FORCED, e.toString()));
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/CompositeTypeField.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/CompositeTypeField.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/CompositeTypeField.java
deleted file mode 100644
index d23d6bd..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/CompositeTypeField.java
+++ /dev/null
@@ -1,33 +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.
- *
- */
-
-package org.apache.qpid.server.protocol.v1_0.type;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface CompositeTypeField
-{
- boolean mandatory() default false;
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java
index 0174b21..67ccb83 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java
@@ -350,7 +350,7 @@ public class AMQPDescribedTypeRegistry implements DescribedTypeConstructorRegist
}
else if(value.getClass().isArray())
{
- if(RestrictedType.class.isAssignableFrom(value.getClass().getComponentType()))
+ if(RestrictedType.class.isAssignableFrom(value.getClass().getComponentType()) && Array.getLength(value) > 0)
{
RestrictedType[] restrictedTypes = (RestrictedType[]) value;
Object[] newVals = (Object[]) Array.newInstance(restrictedTypes[0].getValue().getClass(),
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AbstractSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AbstractSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AbstractSection.java
index a6142db..ce284f1 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AbstractSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AbstractSection.java
@@ -25,8 +25,8 @@ import java.util.Collections;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
import org.apache.qpid.server.bytebuffer.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.codec.ValueHandler;
import org.apache.qpid.server.protocol.v1_0.messaging.SectionEncoder;
import org.apache.qpid.server.protocol.v1_0.messaging.SectionEncoderImpl;
@@ -74,7 +74,7 @@ public abstract class AbstractSection<T, S extends NonEncodingRetainingSection<T
_encodedSize = QpidByteBufferUtils.remaining(_encodedForm);
}
- protected abstract AbstractDescribedTypeConstructor<S> createNonEncodingRetainingSectionConstructor();
+ protected abstract DescribedTypeConstructor<S> createNonEncodingRetainingSectionConstructor();
@Override
public synchronized T getValue()
@@ -169,7 +169,7 @@ public abstract class AbstractSection<T, S extends NonEncodingRetainingSection<T
}
}
- private S decode(AbstractDescribedTypeConstructor<S> constructor)
+ private S decode(DescribedTypeConstructor<S> constructor)
{
List<QpidByteBuffer> input = getEncodedForm();
int[] originalPositions = new int[input.size()];
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Accepted.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Accepted.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Accepted.java
index abf8509..5f98113 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Accepted.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Accepted.java
@@ -23,9 +23,11 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
import org.apache.qpid.server.protocol.v1_0.type.Outcome;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+@CompositeType( symbolicDescriptor = "amqp:accepted:list", numericDescriptor = 0x0000000000000024L)
public class Accepted implements Outcome
{
public static final Symbol ACCEPTED_SYMBOL = Symbol.valueOf("amqp:accepted:list");
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpSequenceSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpSequenceSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpSequenceSection.java
index a9aaaa9..559e868 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpSequenceSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpSequenceSection.java
@@ -24,7 +24,7 @@ package org.apache.qpid.server.protocol.v1_0.type.messaging;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.AmqpSequenceConstructor;
public class AmqpSequenceSection extends AbstractSection<List, AmqpSequence>
@@ -51,7 +51,7 @@ public class AmqpSequenceSection extends AbstractSection<List, AmqpSequence>
}
@Override
- protected AbstractDescribedTypeConstructor<AmqpSequence> createNonEncodingRetainingSectionConstructor()
+ protected DescribedTypeConstructor<AmqpSequence> createNonEncodingRetainingSectionConstructor()
{
return new AmqpSequenceConstructor();
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpValueSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpValueSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpValueSection.java
index 4c892d3..2b4ab35 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpValueSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/AmqpValueSection.java
@@ -24,7 +24,7 @@ package org.apache.qpid.server.protocol.v1_0.type.messaging;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.AmqpValueConstructor;
public class AmqpValueSection extends AbstractSection<Object, AmqpValue>
@@ -51,7 +51,7 @@ public class AmqpValueSection extends AbstractSection<Object, AmqpValue>
}
@Override
- protected AbstractDescribedTypeConstructor<AmqpValue> createNonEncodingRetainingSectionConstructor()
+ protected DescribedTypeConstructor<AmqpValue> createNonEncodingRetainingSectionConstructor()
{
return new AmqpValueConstructor();
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationPropertiesSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationPropertiesSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationPropertiesSection.java
index 917dcb9..8dabc40 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationPropertiesSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationPropertiesSection.java
@@ -25,7 +25,7 @@ import java.util.List;
import java.util.Map;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.ApplicationPropertiesConstructor;
public class ApplicationPropertiesSection extends AbstractSection<Map<String,Object>, ApplicationProperties>
@@ -53,7 +53,7 @@ public class ApplicationPropertiesSection extends AbstractSection<Map<String,Obj
}
@Override
- protected AbstractDescribedTypeConstructor<ApplicationProperties> createNonEncodingRetainingSectionConstructor()
+ protected DescribedTypeConstructor<ApplicationProperties> createNonEncodingRetainingSectionConstructor()
{
return new ApplicationPropertiesConstructor();
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DataSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DataSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DataSection.java
index ccbd624..cf07dc6 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DataSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DataSection.java
@@ -24,7 +24,7 @@ package org.apache.qpid.server.protocol.v1_0.type.messaging;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.type.Binary;
import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.DataConstructor;
@@ -52,7 +52,7 @@ public class DataSection extends AbstractSection<Binary, Data>
}
@Override
- protected AbstractDescribedTypeConstructor<Data> createNonEncodingRetainingSectionConstructor()
+ protected DescribedTypeConstructor<Data> createNonEncodingRetainingSectionConstructor()
{
return new DataConstructor();
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnClose.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnClose.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnClose.java
index f99ffe4..849d4da 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnClose.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnClose.java
@@ -24,8 +24,10 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
import org.apache.qpid.server.protocol.v1_0.type.LifetimePolicy;
+@CompositeType( symbolicDescriptor = "amqp:delete-on-close:list", numericDescriptor = 0x000000000000002bL)
public class DeleteOnClose implements LifetimePolicy
{
@Override
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinks.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinks.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinks.java
index 8605d28..0d39f0b 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinks.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinks.java
@@ -24,8 +24,10 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
import org.apache.qpid.server.protocol.v1_0.type.LifetimePolicy;
+@CompositeType( symbolicDescriptor = "amqp:delete-on-no-links:list", numericDescriptor = 0x000000000000002cL)
public class DeleteOnNoLinks implements LifetimePolicy
{
@Override
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinksOrMessages.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinksOrMessages.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinksOrMessages.java
index 9e186b9..fc6ad3a 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinksOrMessages.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoLinksOrMessages.java
@@ -24,8 +24,10 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
import org.apache.qpid.server.protocol.v1_0.type.LifetimePolicy;
+@CompositeType( symbolicDescriptor = "amqp:delete-on-no-links-or-messages:list", numericDescriptor = 0x000000000000002eL)
public class DeleteOnNoLinksOrMessages implements LifetimePolicy
{
@Override
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoMessages.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoMessages.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoMessages.java
index 27362bf..63ab0a9 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoMessages.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeleteOnNoMessages.java
@@ -24,8 +24,10 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
import org.apache.qpid.server.protocol.v1_0.type.LifetimePolicy;
+@CompositeType( symbolicDescriptor = "amqp:delete-on-no-messages:list", numericDescriptor = 0x000000000000002dL)
public class DeleteOnNoMessages implements LifetimePolicy
{
@Override
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeliveryAnnotationsSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeliveryAnnotationsSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeliveryAnnotationsSection.java
index 63a6007..7c2ad51 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeliveryAnnotationsSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/DeliveryAnnotationsSection.java
@@ -25,7 +25,7 @@ import java.util.List;
import java.util.Map;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.DeliveryAnnotationsConstructor;
@@ -53,7 +53,7 @@ public class DeliveryAnnotationsSection extends AbstractSection<Map<Symbol,Objec
}
@Override
- protected AbstractDescribedTypeConstructor<DeliveryAnnotations> createNonEncodingRetainingSectionConstructor()
+ protected DescribedTypeConstructor<DeliveryAnnotations> createNonEncodingRetainingSectionConstructor()
{
return new DeliveryAnnotationsConstructor();
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/FooterSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/FooterSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/FooterSection.java
index e692568..01671b3 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/FooterSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/FooterSection.java
@@ -25,7 +25,7 @@ import java.util.List;
import java.util.Map;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.FooterConstructor;
@@ -53,7 +53,7 @@ public class FooterSection extends AbstractSection<Map<Symbol,Object>, Footer>
}
@Override
- protected AbstractDescribedTypeConstructor<Footer> createNonEncodingRetainingSectionConstructor()
+ protected DescribedTypeConstructor<Footer> createNonEncodingRetainingSectionConstructor()
{
return new FooterConstructor();
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Header.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Header.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Header.java
index 93eaf5a..efa9134 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Header.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Header.java
@@ -24,26 +24,28 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedByte;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
+@CompositeType( symbolicDescriptor = "amqp:header:list", numericDescriptor = 0x0000000000000070L)
public class Header implements NonEncodingRetainingSection<Header>
{
- @CompositeTypeField
+ @CompositeTypeField(index = 0)
private Boolean _durable;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private UnsignedByte _priority;
- @CompositeTypeField
+ @CompositeTypeField(index = 2)
private UnsignedInteger _ttl;
- @CompositeTypeField
+ @CompositeTypeField(index = 3)
private Boolean _firstAcquirer;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private UnsignedInteger _deliveryCount;
public Boolean getDurable()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java
index 823428e..cac9734 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/HeaderSection.java
@@ -24,7 +24,7 @@ package org.apache.qpid.server.protocol.v1_0.type.messaging;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.HeaderConstructor;
public class HeaderSection extends AbstractSection<Header, Header>
@@ -51,7 +51,7 @@ public class HeaderSection extends AbstractSection<Header, Header>
}
@Override
- protected AbstractDescribedTypeConstructor<Header> createNonEncodingRetainingSectionConstructor()
+ protected DescribedTypeConstructor<Header> createNonEncodingRetainingSectionConstructor()
{
return new HeaderConstructor();
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotationsSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotationsSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotationsSection.java
index 8f1ae3f..a90ce15 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotationsSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/MessageAnnotationsSection.java
@@ -25,7 +25,7 @@ import java.util.List;
import java.util.Map;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.MessageAnnotationsConstructor;
@@ -53,7 +53,7 @@ public class MessageAnnotationsSection extends AbstractSection<Map<Symbol,Object
}
@Override
- protected AbstractDescribedTypeConstructor<MessageAnnotations> createNonEncodingRetainingSectionConstructor()
+ protected DescribedTypeConstructor<MessageAnnotations> createNonEncodingRetainingSectionConstructor()
{
return new MessageAnnotationsConstructor();
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Modified.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Modified.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Modified.java
index 41d2fa7..dadaf92 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Modified.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Modified.java
@@ -26,22 +26,24 @@ package org.apache.qpid.server.protocol.v1_0.type.messaging;
import java.util.Map;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.Outcome;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+@CompositeType( symbolicDescriptor = "amqp:modified:list", numericDescriptor = 0x0000000000000027L)
public class Modified implements Outcome
{
public static final Symbol MODIFIED_SYMBOL = Symbol.valueOf("amqp:modified:list");
- @CompositeTypeField
+ @CompositeTypeField(index = 0)
private Boolean _deliveryFailed;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private Boolean _undeliverableHere;
- @CompositeTypeField
- private Map _messageAnnotations;
+ @CompositeTypeField(index = 2)
+ private Map<Symbol, Object> _messageAnnotations;
public Boolean getDeliveryFailed()
{
@@ -63,12 +65,12 @@ public class Modified implements Outcome
_undeliverableHere = undeliverableHere;
}
- public Map getMessageAnnotations()
+ public Map<Symbol, Object> getMessageAnnotations()
{
return _messageAnnotations;
}
- public void setMessageAnnotations(Map messageAnnotations)
+ public void setMessageAnnotations(Map<Symbol, Object> messageAnnotations)
{
_messageAnnotations = messageAnnotations;
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java
index 2b5ae60..9c10cee 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java
@@ -24,49 +24,51 @@ package org.apache.qpid.server.protocol.v1_0.type.messaging;
import java.util.Date;
import org.apache.qpid.server.protocol.v1_0.type.Binary;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
+@CompositeType( symbolicDescriptor = "amqp:properties:list", numericDescriptor = 0x0000000000000073L)
public class Properties implements NonEncodingRetainingSection<Properties>
{
- @CompositeTypeField
+ @CompositeTypeField(index = 0)
private Object _messageId;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private Binary _userId;
- @CompositeTypeField
+ @CompositeTypeField(index = 2)
private String _to;
- @CompositeTypeField
+ @CompositeTypeField(index = 3)
private String _subject;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private String _replyTo;
- @CompositeTypeField
+ @CompositeTypeField(index = 5)
private Object _correlationId;
- @CompositeTypeField
+ @CompositeTypeField(index = 6)
private Symbol _contentType;
- @CompositeTypeField
+ @CompositeTypeField(index = 7)
private Symbol _contentEncoding;
- @CompositeTypeField
+ @CompositeTypeField(index = 8)
private Date _absoluteExpiryTime;
- @CompositeTypeField
+ @CompositeTypeField(index = 9)
private Date _creationTime;
- @CompositeTypeField
+ @CompositeTypeField(index = 10)
private String _groupId;
- @CompositeTypeField
+ @CompositeTypeField(index = 11)
private UnsignedInteger _groupSequence;
- @CompositeTypeField
+ @CompositeTypeField(index = 12)
private String _replyToGroupId;
public Object getMessageId()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/PropertiesSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/PropertiesSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/PropertiesSection.java
index 87069ce..4c2b36b 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/PropertiesSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/PropertiesSection.java
@@ -24,7 +24,7 @@ package org.apache.qpid.server.protocol.v1_0.type.messaging;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeConstructor;
+import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructor;
import org.apache.qpid.server.protocol.v1_0.type.messaging.codec.PropertiesConstructor;
public class PropertiesSection extends AbstractSection<Properties, Properties>
@@ -51,7 +51,7 @@ public class PropertiesSection extends AbstractSection<Properties, Properties>
}
@Override
- protected AbstractDescribedTypeConstructor<Properties> createNonEncodingRetainingSectionConstructor()
+ protected DescribedTypeConstructor<Properties> createNonEncodingRetainingSectionConstructor()
{
return new PropertiesConstructor();
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Received.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Received.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Received.java
index 86d9554..43de13c 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Received.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Received.java
@@ -24,17 +24,19 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.DeliveryState;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
+@CompositeType( symbolicDescriptor = "amqp:received:list", numericDescriptor = 0x0000000000000023L)
public class Received implements DeliveryState
{
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true)
private UnsignedInteger _sectionNumber;
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 1, mandatory = true)
private UnsignedLong _sectionOffset;
public UnsignedInteger getSectionNumber()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Rejected.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Rejected.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Rejected.java
index e877a56..a715cc4 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Rejected.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Rejected.java
@@ -24,16 +24,18 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.Outcome;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
+@CompositeType( symbolicDescriptor = "amqp:rejected:list", numericDescriptor = 0x0000000000000025L)
public class Rejected implements Outcome
{
public static final Symbol REJECTED_SYMBOL = Symbol.valueOf("amqp:rejected:list");
- @CompositeTypeField
+ @CompositeTypeField(index = 0)
private Error _error;
public Error getError()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Released.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Released.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Released.java
index 945c7ce..8e67ca8 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Released.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Released.java
@@ -24,9 +24,11 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
import org.apache.qpid.server.protocol.v1_0.type.Outcome;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+@CompositeType( symbolicDescriptor = "amqp:released:list", numericDescriptor = 0x0000000000000026L)
public class Released implements Outcome
{
public static final Symbol RELEASED_SYMBOL = Symbol.valueOf("amqp:released:list");
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Source.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Source.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Source.java
index 348f885..a8537db 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Source.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Source.java
@@ -24,48 +24,51 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
-
import java.util.Arrays;
import java.util.Map;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.type.BaseSource;
+import org.apache.qpid.server.protocol.v1_0.type.DistributionMode;
+import org.apache.qpid.server.protocol.v1_0.type.Outcome;
+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.*;
-
+@CompositeType( symbolicDescriptor = "amqp:source:list", numericDescriptor = 0x0000000000000028L)
public class Source implements BaseSource
- {
-
-
- @CompositeTypeField
+{
+ @CompositeTypeField(index = 0)
private String _address;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private TerminusDurability _durable;
- @CompositeTypeField
+ @CompositeTypeField(index = 2)
private TerminusExpiryPolicy _expiryPolicy;
- @CompositeTypeField
+ @CompositeTypeField(index = 3)
private UnsignedInteger _timeout;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private Boolean _dynamic;
- @CompositeTypeField
+ @CompositeTypeField(index = 5, deserializationConverter = "org.apache.qpid.server.protocol.v1_0.DeserializationFactories.convertToNodeProperties")
private Map<Symbol, Object> _dynamicNodeProperties;
- @CompositeTypeField
+ @CompositeTypeField(index = 6, deserializationConverter = "org.apache.qpid.server.protocol.v1_0.DeserializationFactories.convertToDistributionMode")
private DistributionMode _distributionMode;
- @CompositeTypeField
- private Map _filter;
+ @CompositeTypeField(index = 7)
+ private Map<Symbol, Filter> _filter;
- @CompositeTypeField
+ @CompositeTypeField(index = 8)
private Outcome _defaultOutcome;
- @CompositeTypeField
+ @CompositeTypeField(index = 9)
private Symbol[] _outcomes;
- @CompositeTypeField
+ @CompositeTypeField(index = 10)
private Symbol[] _capabilities;
public String getAddress()
@@ -138,12 +141,12 @@ public class Source implements BaseSource
_distributionMode = distributionMode;
}
- public Map getFilter()
+ public Map<Symbol, Filter> getFilter()
{
return _filter;
}
- public void setFilter(Map filter)
+ public void setFilter(Map<Symbol, Filter> filter)
{
_filter = filter;
}
@@ -385,4 +388,4 @@ public class Source implements BaseSource
result = 31 * result + Arrays.hashCode(_capabilities);
return result;
}
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/StdDistMode.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/StdDistMode.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/StdDistMode.java
index 5b06eb0..3f0630e 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/StdDistMode.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/StdDistMode.java
@@ -24,24 +24,17 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import org.apache.qpid.server.protocol.v1_0.type.DistributionMode;
+import org.apache.qpid.server.protocol.v1_0.type.RestrictedType;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class StdDistMode
- implements DistributionMode, RestrictedType<Symbol>
-
- {
-
-
-
+public class StdDistMode implements DistributionMode, RestrictedType<Symbol>
+{
private final Symbol _val;
-
public static final StdDistMode MOVE = new StdDistMode(Symbol.valueOf("move"));
-
- public static final StdDistMode COPY = new StdDistMode(Symbol.valueOf("copy"));
-
+ public static final StdDistMode COPY = new StdDistMode(Symbol.valueOf("copy"));
private StdDistMode(Symbol val)
{
@@ -57,17 +50,16 @@ public class StdDistMode
@Override
public String toString()
{
-
- if(this == MOVE)
+ if (this == MOVE)
{
return "move";
}
-
- if(this == COPY)
+
+ if (this == COPY)
{
return "copy";
}
-
+
else
{
return String.valueOf(_val);
@@ -78,20 +70,16 @@ public class StdDistMode
{
Symbol val = (Symbol) obj;
- if(MOVE._val.equals(val))
+ if (MOVE._val.equals(val))
{
return MOVE;
}
-
- if(COPY._val.equals(val))
+
+ if (COPY._val.equals(val))
{
return COPY;
}
-
- // TODO ERROR
+
return null;
}
-
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Target.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Target.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Target.java
index d0a564b..0f81898 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Target.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Target.java
@@ -24,37 +24,37 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
-
import java.util.Arrays;
import java.util.Map;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.type.BaseTarget;
+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 Target
- implements BaseTarget
- {
-
-
- @CompositeTypeField
+@CompositeType( symbolicDescriptor = "amqp:target:list", numericDescriptor = 0x0000000000000029L)
+public class Target implements BaseTarget
+{
+ @CompositeTypeField(index = 0)
private String _address;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private TerminusDurability _durable;
- @CompositeTypeField
+ @CompositeTypeField(index = 2)
private TerminusExpiryPolicy _expiryPolicy;
- @CompositeTypeField
+ @CompositeTypeField(index = 3)
private UnsignedInteger _timeout;
- @CompositeTypeField
+ @CompositeTypeField(index = 4)
private Boolean _dynamic;
- @CompositeTypeField
+ @CompositeTypeField(index = 5, deserializationConverter = "org.apache.qpid.server.protocol.v1_0.DeserializationFactories.convertToNodeProperties")
private Map<Symbol, Object> _dynamicNodeProperties;
- @CompositeTypeField
+ @CompositeTypeField(index = 6)
private Symbol[] _capabilities;
public String getAddress()
@@ -163,8 +163,8 @@ public class Target
return false;
}
if (_dynamicNodeProperties != null
- ? !_dynamicNodeProperties.equals(target._dynamicNodeProperties)
- : target._dynamicNodeProperties != null)
+ ? !_dynamicNodeProperties.equals(target._dynamicNodeProperties)
+ : target._dynamicNodeProperties != null)
{
return false;
}
@@ -191,63 +191,63 @@ public class Target
StringBuilder builder = new StringBuilder("Target{");
final int origLength = builder.length();
- if(_address != null)
+ if (_address != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("address=").append(_address);
}
- if(_durable != null)
+ if (_durable != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("durable=").append(_durable);
}
- if(_expiryPolicy != null)
+ if (_expiryPolicy != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("expiryPolicy=").append(_expiryPolicy);
}
- if(_timeout != null)
+ if (_timeout != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("timeout=").append(_timeout);
}
- if(_dynamic != null)
+ if (_dynamic != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("dynamic=").append(_dynamic);
}
- if(_dynamicNodeProperties != null)
+ if (_dynamicNodeProperties != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("dynamicNodeProperties=").append(_dynamicNodeProperties);
}
- if(_capabilities != null)
+ if (_capabilities != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -257,6 +257,4 @@ public class Target
builder.append('}');
return builder.toString();
}
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusDurability.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusDurability.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusDurability.java
index 295d1f1..5b03e06 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusDurability.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusDurability.java
@@ -24,26 +24,18 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import org.apache.qpid.server.protocol.v1_0.type.RestrictedType;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class TerminusDurability
- implements RestrictedType<UnsignedInteger>
-
- {
-
-
-
+public class TerminusDurability implements RestrictedType<UnsignedInteger>
+{
private final UnsignedInteger _val;
-
public static final TerminusDurability NONE = new TerminusDurability(UnsignedInteger.valueOf(0));
-
+
public static final TerminusDurability CONFIGURATION = new TerminusDurability(UnsignedInteger.valueOf(1));
-
- public static final TerminusDurability UNSETTLED_STATE = new TerminusDurability(UnsignedInteger.valueOf(2));
-
+ public static final TerminusDurability UNSETTLED_STATE = new TerminusDurability(UnsignedInteger.valueOf(2));
private TerminusDurability(UnsignedInteger val)
{
@@ -59,22 +51,21 @@ public class TerminusDurability
@Override
public String toString()
{
-
- if(this == NONE)
+ if (this == NONE)
{
return "none";
}
-
- if(this == CONFIGURATION)
+
+ if (this == CONFIGURATION)
{
return "configuration";
}
-
- if(this == UNSETTLED_STATE)
+
+ if (this == UNSETTLED_STATE)
{
return "unsettled-state";
}
-
+
else
{
return String.valueOf(_val);
@@ -85,21 +76,21 @@ public class TerminusDurability
{
UnsignedInteger val = (UnsignedInteger) obj;
- if(NONE._val.equals(val))
+ if (NONE._val.equals(val))
{
return NONE;
}
-
- if(CONFIGURATION._val.equals(val))
+
+ if (CONFIGURATION._val.equals(val))
{
return CONFIGURATION;
}
-
- if(UNSETTLED_STATE._val.equals(val))
+
+ if (UNSETTLED_STATE._val.equals(val))
{
return UNSETTLED_STATE;
}
-
+
// TODO ERROR
return null;
}
@@ -110,5 +101,4 @@ public class TerminusDurability
int durabilityBValue = durabilityB != null ? durabilityB._val.intValue() : 0;
return TerminusDurability.valueOf(new UnsignedInteger(Math.min(durabilitAValue, durabilityBValue)));
}
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusExpiryPolicy.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusExpiryPolicy.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusExpiryPolicy.java
index 3d7d850..735eac8 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusExpiryPolicy.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/TerminusExpiryPolicy.java
@@ -24,28 +24,21 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging;
+import org.apache.qpid.server.protocol.v1_0.type.RestrictedType;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class TerminusExpiryPolicy
- implements RestrictedType<Symbol>
-
- {
-
-
-
+public class TerminusExpiryPolicy implements RestrictedType<Symbol>
+{
private final Symbol _val;
-
public static final TerminusExpiryPolicy LINK_DETACH = new TerminusExpiryPolicy(Symbol.valueOf("link-detach"));
-
+
public static final TerminusExpiryPolicy SESSION_END = new TerminusExpiryPolicy(Symbol.valueOf("session-end"));
-
- public static final TerminusExpiryPolicy CONNECTION_CLOSE = new TerminusExpiryPolicy(Symbol.valueOf("connection-close"));
-
- public static final TerminusExpiryPolicy NEVER = new TerminusExpiryPolicy(Symbol.valueOf("never"));
-
+ public static final TerminusExpiryPolicy CONNECTION_CLOSE =
+ new TerminusExpiryPolicy(Symbol.valueOf("connection-close"));
+
+ public static final TerminusExpiryPolicy NEVER = new TerminusExpiryPolicy(Symbol.valueOf("never"));
private TerminusExpiryPolicy(Symbol val)
{
@@ -61,27 +54,27 @@ public class TerminusExpiryPolicy
@Override
public String toString()
{
-
- if(this == LINK_DETACH)
+
+ if (this == LINK_DETACH)
{
return "link-detach";
}
-
- if(this == SESSION_END)
+
+ if (this == SESSION_END)
{
return "session-end";
}
-
- if(this == CONNECTION_CLOSE)
+
+ if (this == CONNECTION_CLOSE)
{
return "connection-close";
}
-
- if(this == NEVER)
+
+ if (this == NEVER)
{
return "never";
}
-
+
else
{
return String.valueOf(_val);
@@ -92,30 +85,27 @@ public class TerminusExpiryPolicy
{
Symbol val = (Symbol) obj;
- if(LINK_DETACH._val.equals(val))
+ if (LINK_DETACH._val.equals(val))
{
return LINK_DETACH;
}
-
- if(SESSION_END._val.equals(val))
+
+ if (SESSION_END._val.equals(val))
{
return SESSION_END;
}
-
- if(CONNECTION_CLOSE._val.equals(val))
+
+ if (CONNECTION_CLOSE._val.equals(val))
{
return CONNECTION_CLOSE;
}
-
- if(NEVER._val.equals(val))
+
+ if (NEVER._val.equals(val))
{
return NEVER;
}
-
+
// TODO ERROR
return null;
}
-
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedConstructor.java
deleted file mode 100644
index f5f83e8..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedConstructor.java
+++ /dev/null
@@ -1,72 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-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 java.util.List;
-
-public class AcceptedConstructor extends AbstractDescribedTypeConstructor<Accepted>
-{
- private static final Object[] DESCRIPTORS =
- {
- Accepted.ACCEPTED_SYMBOL,UnsignedLong.valueOf(0x0000000000000024L),
- };
-
- private static final AcceptedConstructor INSTANCE = new AcceptedConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Accepted construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Accepted obj = new Accepted();
- int position = 0;
- final int size = list.size();
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseConstructor.java
deleted file mode 100644
index 2f33bc1..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseConstructor.java
+++ /dev/null
@@ -1,72 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-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 java.util.List;
-
-public class DeleteOnCloseConstructor extends AbstractDescribedTypeConstructor<DeleteOnClose>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:delete-on-close:list"),UnsignedLong.valueOf(0x000000000000002bL),
- };
-
- private static final DeleteOnCloseConstructor INSTANCE = new DeleteOnCloseConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public DeleteOnClose construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- DeleteOnClose obj = new DeleteOnClose();
- int position = 0;
- final int size = list.size();
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksConstructor.java
deleted file mode 100644
index 2ac88ce..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksConstructor.java
+++ /dev/null
@@ -1,72 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-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 java.util.List;
-
-public class DeleteOnNoLinksConstructor extends AbstractDescribedTypeConstructor<DeleteOnNoLinks>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:delete-on-no-links:list"),UnsignedLong.valueOf(0x000000000000002cL),
- };
-
- private static final DeleteOnNoLinksConstructor INSTANCE = new DeleteOnNoLinksConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public DeleteOnNoLinks construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- DeleteOnNoLinks obj = new DeleteOnNoLinks();
- int position = 0;
- final int size = list.size();
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesConstructor.java
deleted file mode 100644
index c3cb84f..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesConstructor.java
+++ /dev/null
@@ -1,72 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-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 java.util.List;
-
-public class DeleteOnNoLinksOrMessagesConstructor extends AbstractDescribedTypeConstructor<DeleteOnNoLinksOrMessages>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:delete-on-no-links-or-messages:list"),UnsignedLong.valueOf(0x000000000000002eL),
- };
-
- private static final DeleteOnNoLinksOrMessagesConstructor INSTANCE = new DeleteOnNoLinksOrMessagesConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public DeleteOnNoLinksOrMessages construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- DeleteOnNoLinksOrMessages obj = new DeleteOnNoLinksOrMessages();
- int position = 0;
- final int size = list.size();
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesConstructor.java
deleted file mode 100644
index f4aa8b6..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesConstructor.java
+++ /dev/null
@@ -1,72 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-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 java.util.List;
-
-public class DeleteOnNoMessagesConstructor extends AbstractDescribedTypeConstructor<DeleteOnNoMessages>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:delete-on-no-messages:list"),UnsignedLong.valueOf(0x000000000000002dL),
- };
-
- private static final DeleteOnNoMessagesConstructor INSTANCE = new DeleteOnNoMessagesConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public DeleteOnNoMessages construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- DeleteOnNoMessages obj = new DeleteOnNoMessages();
- int position = 0;
- final int size = list.size();
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderConstructor.java
deleted file mode 100644
index cd16a69..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderConstructor.java
+++ /dev/null
@@ -1,209 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-import java.util.List;
-
-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.UnsignedByte;
-import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
-import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.Header;
-
-public class HeaderConstructor extends AbstractDescribedTypeConstructor<Header>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:header:list"),UnsignedLong.valueOf(0x0000000000000070L),
- };
-
- private static final HeaderConstructor INSTANCE = new HeaderConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Header construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Header obj = new Header();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDurable( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setPriority( (UnsignedByte) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setTtl( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setFirstAcquirer( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDeliveryCount( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedConstructor.java
deleted file mode 100644
index 8b971ab..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedConstructor.java
+++ /dev/null
@@ -1,153 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-import java.util.List;
-import java.util.Map;
-
-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.UnsignedLong;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.Modified;
-
-public class ModifiedConstructor extends AbstractDescribedTypeConstructor<Modified>
-{
- private static final Object[] DESCRIPTORS =
- {
- Modified.MODIFIED_SYMBOL,UnsignedLong.valueOf(0x0000000000000027L),
- };
-
- private static final ModifiedConstructor INSTANCE = new ModifiedConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Modified construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Modified obj = new Modified();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDeliveryFailed( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setUndeliverableHere( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setMessageAnnotations( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[03/12] qpid-broker-j git commit: QPID-7531: [Java Broker,
AMQP 1.0] Prevent possible NullPointerException in dynamic source
creation
Posted by lq...@apache.org.
QPID-7531: [Java Broker, AMQP 1.0] Prevent possible NullPointerException in dynamic source creation
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/16caf690
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/16caf690
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/16caf690
Branch: refs/heads/master
Commit: 16caf69050feb337e8d42b014fc1d85d9c735f5b
Parents: 56cf7b8
Author: Lorenz Quack <lq...@apache.org>
Authored: Fri Sep 22 16:27:55 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100
----------------------------------------------------------------------
.../qpid/server/protocol/v1_0/Session_1_0.java | 24 +++++++++++---------
1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/16caf690/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
index 2c44be0..801810e 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
@@ -696,8 +696,15 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
if (Boolean.TRUE.equals(source.getDynamic()))
{
- MessageSource tempQueue = createDynamicSource(link, source.getDynamicNodeProperties());
- source.setAddress(tempQueue.getName()); // todo : temporary topic
+ MessageSource tempSource = createDynamicSource(link, source.getDynamicNodeProperties());
+ if(tempSource != null)
+ {
+ source.setAddress(_primaryDomain + tempSource.getName());
+ }
+ else
+ {
+ throw new AmqpErrorException(AmqpError.INTERNAL_ERROR, "Cannot create dynamic source");
+ }
}
String address = source.getAddress();
@@ -763,10 +770,10 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
return exchangeDestination;
}
- private MessageSource createDynamicSource(final Link_1_0<?, ?> link,
- Map properties)
+ private MessageSource createDynamicSource(final Link_1_0<?, ?> link, Map properties) throws AmqpErrorException
{
- final String queueName = _primaryDomain + "TempQueue" + UUID.randomUUID().toString();
+ // TODO temporary topics?
+ final String queueName = "TempQueue" + UUID.randomUUID().toString();
try
{
Map<String, Object> attributes = convertDynamicNodePropertiesToAttributes(link, properties, queueName);
@@ -776,12 +783,7 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
}
catch (AccessControlException e)
{
- Error error = new Error();
- error.setCondition(AmqpError.UNAUTHORIZED_ACCESS);
- error.setDescription(e.getMessage());
-
- _connection.close(error);
- return null;
+ throw new AmqpErrorException(AmqpError.UNAUTHORIZED_ACCESS, e.getMessage());
}
catch (AbstractConfiguredObject.DuplicateNameException e)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[04/12] qpid-broker-j git commit: QPID-7837: [Java Broker,
AMQP1.0] Detach link when receiving message body containing anything
but sections.
Posted by lq...@apache.org.
QPID-7837: [Java Broker, AMQP1.0] Detach link when receiving message body containing anything but sections.
Previously if the message body contained anything but sections we closed the connection due to a ClassCastException.
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/85459e55
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/85459e55
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/85459e55
Branch: refs/heads/master
Commit: 85459e5559a91ffed65f84d7a8aa03da641de57f
Parents: 16caf69
Author: Lorenz Quack <lq...@apache.org>
Authored: Mon Sep 25 10:29:22 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100
----------------------------------------------------------------------
.../server/protocol/v1_0/MessageFormat_1_0.java | 30 +++++------
.../v1_0/StandardReceivingLinkEndpoint.java | 27 +++++++---
.../v1_0/messaging/SectionDecoderImpl.java | 17 +++++-
.../v1_0/type/AmqpErrorRuntimeException.java | 34 ++++++++++++
.../protocol/v1_0/messaging/MessageFormat.java | 57 ++++++++++++++++++--
5 files changed, 135 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/85459e55/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageFormat_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageFormat_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageFormat_1_0.java
index ff692c4..a474f4c 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageFormat_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageFormat_1_0.java
@@ -33,6 +33,7 @@ import org.apache.qpid.server.plugin.PluggableService;
import org.apache.qpid.server.protocol.v1_0.messaging.SectionDecoder;
import org.apache.qpid.server.protocol.v1_0.messaging.SectionDecoderImpl;
import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorRuntimeException;
import org.apache.qpid.server.protocol.v1_0.type.codec.AMQPDescribedTypeRegistry;
import org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpSequenceSection;
import org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValueSection;
@@ -94,7 +95,17 @@ public class MessageFormat_1_0 implements MessageFormat<Message_1_0>
{
List<EncodingRetainingSection<?>> dataSections = new ArrayList<>();
- MessageMetaData_1_0 mmd = createMessageMetaData(buf, dataSections);
+ List<EncodingRetainingSection<?>> allSections;
+ try
+ {
+ allSections = getSectionDecoder().parseAll(buf);
+ }
+ catch (AmqpErrorException e)
+ {
+ throw new AmqpErrorRuntimeException(e);
+ }
+ MessageMetaData_1_0 mmd = createMessageMetaData(allSections, dataSections);
+
MessageHandle<MessageMetaData_1_0> handle = store.addMessage(mmd);
for (EncodingRetainingSection<?> dataSection : dataSections)
@@ -112,22 +123,9 @@ public class MessageFormat_1_0 implements MessageFormat<Message_1_0>
return message;
}
- private MessageMetaData_1_0 createMessageMetaData(final List<QpidByteBuffer> fragments,
+ private MessageMetaData_1_0 createMessageMetaData(final List<EncodingRetainingSection<?>> allSections,
final List<EncodingRetainingSection<?>> dataSections)
{
-
- List<EncodingRetainingSection<?>> sections;
- try
- {
- sections = getSectionDecoder().parseAll(fragments);
- }
- catch (AmqpErrorException e)
- {
- LOGGER.error("Decoding read section error", e);
- // TODO - fix error handling
- throw new IllegalArgumentException(e);
- }
-
long contentSize = 0L;
HeaderSection headerSection = null;
@@ -137,7 +135,7 @@ public class MessageFormat_1_0 implements MessageFormat<Message_1_0>
ApplicationPropertiesSection applicationPropertiesSection = null;
FooterSection footerSection = null;
- Iterator<EncodingRetainingSection<?>> iter = sections.iterator();
+ Iterator<EncodingRetainingSection<?>> iter = allSections.iterator();
EncodingRetainingSection<?> s = iter.hasNext() ? iter.next() : null;
if (s instanceof HeaderSection)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/85459e55/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/StandardReceivingLinkEndpoint.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/StandardReceivingLinkEndpoint.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/StandardReceivingLinkEndpoint.java
index 1c2b9e3..ea4b8b8 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/StandardReceivingLinkEndpoint.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/StandardReceivingLinkEndpoint.java
@@ -40,6 +40,7 @@ import org.apache.qpid.server.model.PublishingLink;
import org.apache.qpid.server.plugin.MessageFormat;
import org.apache.qpid.server.protocol.MessageFormatRegistry;
import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorRuntimeException;
import org.apache.qpid.server.protocol.v1_0.type.Binary;
import org.apache.qpid.server.protocol.v1_0.type.DeliveryState;
import org.apache.qpid.server.protocol.v1_0.type.Outcome;
@@ -151,11 +152,28 @@ public class StandardReceivingLinkEndpoint extends AbstractReceivingLinkEndpoint
ServerMessage<?> serverMessage;
UnsignedInteger messageFormat = delivery.getMessageFormat();
DeliveryState xfrState = delivery.getState();
- List<QpidByteBuffer> fragments = delivery.getPayload();
MessageFormat format = MessageFormatRegistry.getFormat(messageFormat.intValue());
if(format != null)
{
- serverMessage = format.createMessage(fragments, getAddressSpace().getMessageStore(), getSession().getConnection().getReference());
+ List<QpidByteBuffer> fragments = delivery.getPayload();
+ try
+ {
+ serverMessage = format.createMessage(fragments,
+ getAddressSpace().getMessageStore(),
+ getSession().getConnection().getReference());
+ }
+ catch (AmqpErrorRuntimeException e)
+ {
+ return e.getCause().getError();
+ }
+ finally
+ {
+ for(QpidByteBuffer fragment: fragments)
+ {
+ fragment.dispose();
+ }
+ fragments = null;
+ }
}
else
{
@@ -165,11 +183,6 @@ public class StandardReceivingLinkEndpoint extends AbstractReceivingLinkEndpoint
return err;
}
- for(QpidByteBuffer fragment: fragments)
- {
- fragment.dispose();
- }
- fragments = null;
MessageReference<?> reference = serverMessage.newReference();
try
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/85459e55/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java
index f55c49f..982a242 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java
@@ -28,6 +28,8 @@ import org.apache.qpid.server.protocol.v1_0.codec.SectionDecoderRegistry;
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.EncodingRetainingSection;
+import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
+import org.apache.qpid.server.protocol.v1_0.type.transport.ConnectionError;
public class SectionDecoderImpl implements SectionDecoder
{
@@ -47,8 +49,19 @@ public class SectionDecoderImpl implements SectionDecoder
List<EncodingRetainingSection<?>> obj = new ArrayList<>();
while(QpidByteBufferUtils.hasRemaining(buf))
{
- EncodingRetainingSection<?> section = (EncodingRetainingSection<?>) _valueHandler.parse(buf);
- obj.add(section);
+
+ final Object parsedObject = _valueHandler.parse(buf);
+ if (parsedObject instanceof EncodingRetainingSection)
+ {
+ EncodingRetainingSection<?> section = (EncodingRetainingSection<?>) parsedObject;
+ obj.add(section);
+ }
+ else
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Invalid Message: Expected type \"section\" but found \"%s\"",
+ parsedObject.getClass().getSimpleName()));
+ }
}
return obj;
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/85459e55/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/AmqpErrorRuntimeException.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/AmqpErrorRuntimeException.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/AmqpErrorRuntimeException.java
new file mode 100644
index 0000000..8640cca
--- /dev/null
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/AmqpErrorRuntimeException.java
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+public class AmqpErrorRuntimeException extends RuntimeException
+{
+ public AmqpErrorRuntimeException(final AmqpErrorException underlyingException)
+ {
+ super(underlyingException);
+ }
+
+ @Override
+ public synchronized AmqpErrorException getCause()
+ {
+ return ((AmqpErrorException) super.getCause());
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/85459e55/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
index a4058a5..b9148aa 100644
--- a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
@@ -20,21 +20,28 @@
package org.apache.qpid.tests.protocol.v1_0.messaging;
+import static org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError.DECODE_ERROR;
+import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.fail;
import java.net.InetSocketAddress;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.StringWriter;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotations;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotationsSection;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.Header;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.HeaderSection;
import org.apache.qpid.server.protocol.v1_0.type.transport.Attach;
import org.apache.qpid.server.protocol.v1_0.type.transport.Begin;
import org.apache.qpid.server.protocol.v1_0.type.transport.Close;
@@ -45,12 +52,12 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
import org.apache.qpid.server.protocol.v1_0.type.transport.Flow;
import org.apache.qpid.server.protocol.v1_0.type.transport.Open;
import org.apache.qpid.server.protocol.v1_0.type.transport.Role;
-import org.apache.qpid.tests.protocol.v1_0.Utils;
-import org.apache.qpid.tests.utils.BrokerAdmin;
import org.apache.qpid.tests.protocol.v1_0.FrameTransport;
-import org.apache.qpid.tests.utils.BrokerAdminUsingTestBase;
import org.apache.qpid.tests.protocol.v1_0.Response;
import org.apache.qpid.tests.protocol.v1_0.SpecificationTest;
+import org.apache.qpid.tests.protocol.v1_0.Utils;
+import org.apache.qpid.tests.utils.BrokerAdmin;
+import org.apache.qpid.tests.utils.BrokerAdminUsingTestBase;
public class MessageFormat extends BrokerAdminUsingTestBase
{
@@ -121,4 +128,44 @@ public class MessageFormat extends BrokerAdminUsingTestBase
assertThat(error, is(notNullValue()));
}
}
+
+ @Test
+ @SpecificationTest(section = "3.2",
+ description = "Altogether a message consists of the following sections: Zero or one header,"
+ + " Zero or one delivery-annotations, [...]")
+ public void illegalMessageFormatPayload() throws Exception
+ {
+ try (FrameTransport transport = new FrameTransport(_brokerAddress).connect())
+ {
+
+ List<QpidByteBuffer> combinedPayload = new ArrayList<>();
+ final HeaderSection headerSection = new Header().createEncodingRetainingSection();
+ combinedPayload.addAll(headerSection.getEncodedForm());
+ headerSection.dispose();
+ final StringWriter stringWriter = new StringWriter("string in between annotation sections");
+ QpidByteBuffer encodedString = QpidByteBuffer.allocate(stringWriter.getEncodedSize());
+ stringWriter.writeToBuffer(encodedString);
+ encodedString.flip();
+ combinedPayload.add(encodedString);
+ final DeliveryAnnotationsSection deliveryAnnotationsSection = new DeliveryAnnotations(Collections.emptyMap()).createEncodingRetainingSection();
+ combinedPayload.addAll(deliveryAnnotationsSection.getEncodedForm());
+ deliveryAnnotationsSection.dispose();
+
+ final Detach detachResponse = transport.newInteraction()
+ .negotiateProtocol().consumeResponse()
+ .open().consumeResponse(Open.class)
+ .begin().consumeResponse(Begin.class)
+ .attachRole(Role.SENDER)
+ .attachTargetAddress(BrokerAdmin.TEST_QUEUE_NAME)
+ .attach().consumeResponse(Attach.class)
+ .consumeResponse(Flow.class)
+ .transferMessageFormat(UnsignedInteger.ZERO)
+ .transferPayload(combinedPayload)
+ .transfer()
+ .consumeResponse()
+ .getLatestResponse(Detach.class);
+ assertThat(detachResponse.getError(), is(notNullValue()));
+ assertThat(detachResponse.getError().getCondition(), is(equalTo(DECODE_ERROR)));
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[10/12] qpid-broker-j git commit: QPID-7932: [Java Broker,
AMQP 1.0] Improve error handling when deserializing composite types
Posted by lq...@apache.org.
QPID-7932: [Java Broker, AMQP 1.0] Improve error handling when deserializing composite types
The constructors are now auto-generated with generation being driven from annotations.
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/6a267175
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/6a267175
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/6a267175
Branch: refs/heads/master
Commit: 6a2671755d49f849e69d1392eeaef2c1a9783713
Parents: 85459e5
Author: Lorenz Quack <lq...@apache.org>
Authored: Mon Sep 25 10:36:14 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100
----------------------------------------------------------------------
.../server/protocol/v1_0/CompositeType.java | 34 ++
.../v1_0/CompositeTypeConstructorGenerator.java | 443 ++++++++++++++++++
.../protocol/v1_0/CompositeTypeField.java | 35 ++
.../javax.annotation.processing.Processor | 1 +
.../protocol/v1_0/DeserializationFactories.java | 345 ++++++++++++++
.../qpid/server/protocol/v1_0/Session_1_0.java | 86 +---
.../codec/AbstractCompositeTypeConstructor.java | 297 ++++++++++++
.../codec/AbstractDescribedTypeConstructor.java | 68 +--
.../v1_0/codec/CompoundTypeConstructor.java | 193 --------
.../protocol/v1_0/codec/ListConstructor.java | 95 ++++
.../protocol/v1_0/codec/MapConstructor.java | 144 ++++++
.../protocol/v1_0/codec/ValueHandler.java | 6 +-
.../protocol/v1_0/framing/FrameHandler.java | 5 +
.../protocol/v1_0/type/CompositeTypeField.java | 33 --
.../type/codec/AMQPDescribedTypeRegistry.java | 2 +-
.../v1_0/type/messaging/AbstractSection.java | 6 +-
.../protocol/v1_0/type/messaging/Accepted.java | 2 +
.../type/messaging/AmqpSequenceSection.java | 4 +-
.../v1_0/type/messaging/AmqpValueSection.java | 4 +-
.../messaging/ApplicationPropertiesSection.java | 4 +-
.../v1_0/type/messaging/DataSection.java | 4 +-
.../v1_0/type/messaging/DeleteOnClose.java | 2 +
.../v1_0/type/messaging/DeleteOnNoLinks.java | 2 +
.../messaging/DeleteOnNoLinksOrMessages.java | 2 +
.../v1_0/type/messaging/DeleteOnNoMessages.java | 2 +
.../messaging/DeliveryAnnotationsSection.java | 4 +-
.../v1_0/type/messaging/FooterSection.java | 4 +-
.../protocol/v1_0/type/messaging/Header.java | 14 +-
.../v1_0/type/messaging/HeaderSection.java | 4 +-
.../messaging/MessageAnnotationsSection.java | 4 +-
.../protocol/v1_0/type/messaging/Modified.java | 16 +-
.../v1_0/type/messaging/Properties.java | 30 +-
.../v1_0/type/messaging/PropertiesSection.java | 4 +-
.../protocol/v1_0/type/messaging/Received.java | 8 +-
.../protocol/v1_0/type/messaging/Rejected.java | 6 +-
.../protocol/v1_0/type/messaging/Released.java | 2 +
.../protocol/v1_0/type/messaging/Source.java | 45 +-
.../v1_0/type/messaging/StdDistMode.java | 42 +-
.../protocol/v1_0/type/messaging/Target.java | 66 ++-
.../v1_0/type/messaging/TerminusDurability.java | 48 +-
.../type/messaging/TerminusExpiryPolicy.java | 64 ++-
.../messaging/codec/AcceptedConstructor.java | 72 ---
.../codec/DeleteOnCloseConstructor.java | 72 ---
.../codec/DeleteOnNoLinksConstructor.java | 72 ---
.../DeleteOnNoLinksOrMessagesConstructor.java | 72 ---
.../codec/DeleteOnNoMessagesConstructor.java | 72 ---
.../type/messaging/codec/HeaderConstructor.java | 209 ---------
.../messaging/codec/ModifiedConstructor.java | 153 ------
.../messaging/codec/PropertiesConstructor.java | 426 -----------------
.../messaging/codec/ReceivedConstructor.java | 126 -----
.../messaging/codec/RejectedConstructor.java | 98 ----
.../messaging/codec/ReleasedConstructor.java | 71 ---
.../type/messaging/codec/SourceConstructor.java | 385 ---------------
.../type/messaging/codec/TargetConstructor.java | 270 -----------
.../v1_0/type/security/SaslChallenge.java | 27 +-
.../protocol/v1_0/type/security/SaslCode.java | 70 ++-
.../protocol/v1_0/type/security/SaslInit.java | 37 +-
.../v1_0/type/security/SaslMechanisms.java | 22 +-
.../v1_0/type/security/SaslOutcome.java | 33 +-
.../v1_0/type/security/SaslResponse.java | 27 +-
.../codec/SaslChallengeConstructor.java | 99 ----
.../security/codec/SaslInitConstructor.java | 153 ------
.../codec/SaslMechanismsConstructor.java | 106 -----
.../security/codec/SaslOutcomeConstructor.java | 126 -----
.../security/codec/SaslResponseConstructor.java | 99 ----
.../v1_0/type/transaction/Coordinator.java | 24 +-
.../protocol/v1_0/type/transaction/Declare.java | 19 +-
.../v1_0/type/transaction/Declared.java | 6 +-
.../v1_0/type/transaction/Discharge.java | 26 +-
.../type/transaction/TransactionErrors.java | 62 +--
.../type/transaction/TransactionalState.java | 8 +-
.../v1_0/type/transaction/TxnCapabilities.java | 146 ------
.../v1_0/type/transaction/TxnCapability.java | 75 ++-
.../codec/CoordinatorConstructor.java | 117 -----
.../transaction/codec/DeclareConstructor.java | 100 ----
.../transaction/codec/DeclaredConstructor.java | 99 ----
.../transaction/codec/DischargeConstructor.java | 126 -----
.../codec/TransactionalStateConstructor.java | 126 -----
.../protocol/v1_0/type/transport/AmqpError.java | 1 -
.../protocol/v1_0/type/transport/Attach.java | 32 +-
.../protocol/v1_0/type/transport/Begin.java | 20 +-
.../protocol/v1_0/type/transport/Close.java | 6 +-
.../v1_0/type/transport/ConnectionError.java | 1 -
.../protocol/v1_0/type/transport/Detach.java | 10 +-
.../v1_0/type/transport/Disposition.java | 16 +-
.../protocol/v1_0/type/transport/End.java | 6 +-
.../protocol/v1_0/type/transport/Error.java | 18 +-
.../protocol/v1_0/type/transport/Flow.java | 26 +-
.../protocol/v1_0/type/transport/LinkError.java | 1 -
.../protocol/v1_0/type/transport/Open.java | 24 +-
.../v1_0/type/transport/SessionError.java | 1 -
.../protocol/v1_0/type/transport/Transfer.java | 26 +-
.../type/transport/codec/AttachConstructor.java | 465 -------------------
.../type/transport/codec/BeginConstructor.java | 303 ------------
.../type/transport/codec/CloseConstructor.java | 99 ----
.../type/transport/codec/DetachConstructor.java | 153 ------
.../transport/codec/DispositionConstructor.java | 234 ----------
.../type/transport/codec/EndConstructor.java | 99 ----
.../type/transport/codec/ErrorConstructor.java | 224 ---------
.../type/transport/codec/FlowConstructor.java | 370 ---------------
.../type/transport/codec/OpenConstructor.java | 373 ---------------
.../transport/codec/TransferConstructor.java | 369 ---------------
.../protocol/v1_0/store/LinkStoreTestCase.java | 2 +-
.../tests/protocol/v1_0/DecodeErrorTest.java | 196 ++++++++
.../protocol/v1_0/messaging/MessageFormat.java | 49 --
105 files changed, 2115 insertions(+), 7020 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeType.java
----------------------------------------------------------------------
diff --git a/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeType.java b/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeType.java
new file mode 100644
index 0000000..41281c7
--- /dev/null
+++ b/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeType.java
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface CompositeType
+{
+ String symbolicDescriptor();
+ long numericDescriptor();
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeTypeConstructorGenerator.java
----------------------------------------------------------------------
diff --git a/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeTypeConstructorGenerator.java b/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeTypeConstructorGenerator.java
new file mode 100644
index 0000000..47308c8
--- /dev/null
+++ b/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeTypeConstructorGenerator.java
@@ -0,0 +1,443 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Consumer;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Filer;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.ArrayType;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
+import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
+
+import org.apache.qpid.server.License;
+
+
+public class CompositeTypeConstructorGenerator extends AbstractProcessor
+{
+ private static final List<String> RESTRICTED_TYPES = Arrays.asList(
+ "org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError",
+ "org.apache.qpid.server.protocol.v1_0.type.transport.ConnectionError",
+ "org.apache.qpid.server.protocol.v1_0.type.transport.SessionError",
+ "org.apache.qpid.server.protocol.v1_0.type.transport.LinkError",
+ "org.apache.qpid.server.protocol.v1_0.type.transaction.TransactionErrors",
+ "org.apache.qpid.server.protocol.v1_0.type.transport.ReceiverSettleMode",
+ "org.apache.qpid.server.protocol.v1_0.type.transport.SenderSettleMode",
+ "org.apache.qpid.server.protocol.v1_0.type.transport.Role",
+ "org.apache.qpid.server.protocol.v1_0.type.security.SaslCode",
+ "org.apache.qpid.server.protocol.v1_0.type.extensions.soleconn.SoleConnectionDetectionPolicy",
+ "org.apache.qpid.server.protocol.v1_0.type.extensions.soleconn.SoleConnectionEnforcementPolicy",
+ "org.apache.qpid.server.protocol.v1_0.type.messaging.StdDistMode",
+ "org.apache.qpid.server.protocol.v1_0.type.messaging.TerminusDurability",
+ "org.apache.qpid.server.protocol.v1_0.type.messaging.TerminusExpiryPolicy",
+ "org.apache.qpid.server.protocol.v1_0.type.transaction.TxnCapability");
+
+
+ @Override
+ public SourceVersion getSupportedSourceVersion()
+ {
+ return SourceVersion.latest();
+ }
+
+ @Override
+ public Set<String> getSupportedAnnotationTypes()
+ {
+ return Collections.singleton(CompositeType.class.getName());
+ }
+
+ @Override
+ public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnvironment)
+ {
+ if(roundEnvironment.processingOver())
+ {
+ return true;
+ }
+
+ Filer filer = processingEnv.getFiler();
+ try
+ {
+ for (Element e : roundEnvironment.getElementsAnnotatedWith(CompositeType.class))
+ {
+ if(e.getKind() == ElementKind.CLASS)
+ {
+ generateCompositeTypeConstructor(filer, (TypeElement) e);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ try(StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw))
+ {
+ e.printStackTrace(pw);
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Unexpected Error: " + sw.toString());
+ }
+ catch (IOException ioe)
+ {
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Error: " + ioe.getLocalizedMessage());
+ }
+ }
+ return true;
+ }
+
+
+ private void generateCompositeTypeConstructor(final Filer filer, final TypeElement typeElement)
+ {
+ String objectQualifiedClassName = typeElement.getQualifiedName().toString();
+ String objectSimpleName = typeElement.getSimpleName().toString();
+ String compositeTypeConstructorNameSimpleName = objectSimpleName + "Constructor";
+ PackageElement packageElement = (PackageElement) typeElement.getEnclosingElement();
+ final String compositeTypeConstructorPackage = packageElement.getQualifiedName() + ".codec";
+ String compositeTypeConstructorName = compositeTypeConstructorPackage + "." + compositeTypeConstructorNameSimpleName;
+ final CompositeType annotation = typeElement.getAnnotation(CompositeType.class);
+
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Generating composite constructor file for " + objectQualifiedClassName);
+
+ try
+ {
+ JavaFileObject factoryFile = filer.createSourceFile(compositeTypeConstructorName);
+ PrintWriter pw = new PrintWriter(new OutputStreamWriter(factoryFile.openOutputStream(), "UTF-8"));
+ pw.println("/*");
+ for(String headerLine : License.LICENSE)
+ {
+ pw.println(" *" + headerLine);
+ }
+ pw.println(" */");
+ pw.println();
+ pw.print("package ");
+ pw.print(compositeTypeConstructorPackage);
+ pw.println(";");
+ pw.println();
+
+ pw.println("import java.util.List;");
+ pw.println();
+ pw.println("import org.apache.qpid.server.protocol.v1_0.codec.AbstractCompositeTypeConstructor;");
+ pw.println("import org.apache.qpid.server.protocol.v1_0.codec.DescribedTypeConstructorRegistry;");
+ pw.println("import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;");
+ pw.println("import org.apache.qpid.server.protocol.v1_0.type.Symbol;");
+ pw.println("import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;");
+ pw.println("import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;");
+ pw.println("import org.apache.qpid.server.protocol.v1_0.type.transport.Error;");
+ pw.println("import " + objectQualifiedClassName + ";");
+ pw.println();
+
+ pw.println("public final class " + compositeTypeConstructorNameSimpleName + " extends AbstractCompositeTypeConstructor<"+ objectSimpleName +">");
+ pw.println("{");
+ pw.println(" private static final " + compositeTypeConstructorNameSimpleName + " INSTANCE = new " + compositeTypeConstructorNameSimpleName + "();");
+ pw.println();
+
+ pw.println(" public static void register(DescribedTypeConstructorRegistry registry)");
+ pw.println(" {");
+ pw.println(" registry.register(Symbol.valueOf(\"" + annotation.symbolicDescriptor() + "\"), INSTANCE);");
+ pw.println(String.format(" registry.register(UnsignedLong.valueOf(%#016x), INSTANCE);", annotation.numericDescriptor()));
+ pw.println(" }");
+ pw.println();
+
+ pw.println(" @Override");
+ pw.println(" protected String getTypeName()");
+ pw.println(" {");
+ pw.println(" return " + objectSimpleName + ".class.getSimpleName();");
+ pw.println(" }");
+ pw.println();
+
+ pw.println(" @Override");
+ pw.println(" protected " + objectSimpleName + " construct(final FieldValueReader fieldValueReader) throws AmqpErrorException");
+ pw.println(" {");
+ pw.println(" " + objectSimpleName + " obj = new " + objectSimpleName + "();");
+ pw.println();
+ generateAssigners(pw, typeElement);
+ pw.println(" return obj;");
+ pw.println(" }");
+ pw.println("}");
+ pw.close();
+ }
+ catch (IOException e)
+ {
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,
+ "Failed to write composite constructor file: "
+ + compositeTypeConstructorName
+ + " - "
+ + e.getLocalizedMessage());
+ }
+ }
+
+ private void generateAssigners(final PrintWriter pw, final TypeElement typeElement)
+ {
+ Types typeUtils = processingEnv.getTypeUtils();
+
+ final List<AnnotatedField> annotatedFields = new ArrayList<>();
+ for (Element element : typeElement.getEnclosedElements())
+ {
+ if (element instanceof VariableElement && element.getKind() == ElementKind.FIELD)
+ {
+ boolean annotationFound = false;
+ for(AnnotationMirror annotationMirror : element.getAnnotationMirrors())
+ {
+ if(annotationMirror.getAnnotationType().toString().equals("org.apache.qpid.server.protocol.v1_0.CompositeTypeField"))
+ {
+ if (annotationFound)
+ {
+ processingEnv.getMessager()
+ .printMessage(Diagnostic.Kind.ERROR,
+ String.format(
+ "More than one CompositeTypeField annotations on field '%s.%s'",
+ typeElement.getSimpleName(),
+ element.getSimpleName()));
+ }
+ annotationFound = true;
+ annotatedFields.add(new AnnotatedField((VariableElement) element, annotationMirror));
+ }
+ }
+ }
+ }
+
+ annotatedFields.sort(Comparator.comparingInt(AnnotatedField::getIndex));
+
+ for (int index = 0; index < annotatedFields.size(); ++index)
+ {
+ AnnotatedField annotatedField = annotatedFields.get(index);
+ final VariableElement variableElement = annotatedField.getVariableElement();
+ final String fieldName = stripUnderscore(variableElement.getSimpleName().toString());
+ if (annotatedField.getIndex() != index)
+ {
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,String.format(
+ "Unexpected CompositeTypeField index '%d' is specified on field '%s' of '%s'. Expected %d.",
+ annotatedField.getIndex(),
+ fieldName,
+ typeElement.getSimpleName(),
+ index));
+ }
+
+ final String baseIndent = " ";
+ if (variableElement.asType().getKind() == TypeKind.ARRAY)
+ {
+ final TypeMirror componentType = ((ArrayType) variableElement.asType()).getComponentType();
+ final String functionString;
+ if (annotatedField.getFactory() != null)
+ {
+ functionString = "x -> " + annotatedField.getFactory() + "(x)";
+ }
+ else if (RESTRICTED_TYPES.contains(componentType))
+ {
+ functionString = variableElement.asType().toString() + "::valueOf";
+ }
+ else
+ {
+ functionString = "x -> (" + componentType + ") x";
+ }
+ pw.println(String.format(" %s %s = fieldValueReader.readArrayValue(%d, \"%s\", %s, %s.class, %s);",
+ annotatedField.getVariableElement().asType(),
+ fieldName,
+ index,
+ fieldName,
+ annotatedField.isMandatory(),
+ componentType,
+ functionString));
+ optionallyWrapInNullCheck(!annotatedField.isMandatory(), pw, baseIndent, fieldName, indent -> {
+ pw.println(indent + "obj." + getSetterName(variableElement) + "(" + fieldName + ");");
+ });
+ }
+ else if (annotatedField.getFactory() != null || RESTRICTED_TYPES.contains(variableElement.asType().toString()))
+ {
+ String functionName = annotatedField.getFactory() != null ? annotatedField.getFactory() : variableElement.asType().toString() + ".valueOf";
+ pw.println(String.format(" Object %s = fieldValueReader.readValue(%d, \"%s\", %s, Object.class);",
+ fieldName,
+ index,
+ fieldName,
+ annotatedField.isMandatory()));
+ optionallyWrapInNullCheck(!annotatedField.isMandatory(), pw, baseIndent, fieldName, indent -> {
+ pw.println(indent + "try");
+ pw.println(indent + "{");
+ pw.println(indent + " obj." + getSetterName(variableElement) + "(" + functionName + "(" + fieldName + "));");
+ pw.println(indent + "}");
+ pw.println(indent + "catch (RuntimeException e)");
+ pw.println(indent + "{");
+ pw.println(indent + " Error error = new Error(AmqpError.DECODE_ERROR, \"Could not decode value field '" + fieldName + "' of '" + typeElement.getSimpleName() + "'\");");
+ pw.println(indent + " throw new AmqpErrorException(error, e);");
+ pw.println(indent + "}");
+ });
+ }
+ else if (typeUtils.isSameType(typeUtils.erasure(variableElement.asType()),
+ getErasure(processingEnv, "java.util.Map")))
+ {
+ List<? extends TypeMirror> args = ((DeclaredType) variableElement.asType()).getTypeArguments();
+ if (args.size() != 2)
+ {
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,
+ "Map types must have exactly two type arguments");
+ }
+ pw.println(String.format(" %s %s = fieldValueReader.readMapValue(%d, \"%s\", %s, %s.class, %s.class);",
+ annotatedField.getVariableElement().asType(),
+ fieldName,
+ index,
+ fieldName,
+ annotatedField.isMandatory(),
+ args.get(0),
+ args.get(1)));
+ optionallyWrapInNullCheck(!annotatedField.isMandatory(), pw, baseIndent, fieldName, indent -> {
+ pw.println(indent + "obj." + getSetterName(variableElement) + "(" + fieldName + ");");
+ });
+ }
+ else
+ {
+ pw.println(String.format(" %s %s = fieldValueReader.readValue(%d, \"%s\", %s, %s.class);",
+ annotatedField.getVariableElement().asType(),
+ fieldName,
+ index,
+ fieldName,
+ annotatedField.isMandatory(),
+ annotatedField.getVariableElement().asType()));
+ optionallyWrapInNullCheck(!annotatedField.isMandatory(), pw, baseIndent, fieldName, indent -> {
+ pw.println(indent + "obj." + getSetterName(variableElement) + "(" + fieldName + ");");
+ });
+ }
+
+ pw.println();
+ }
+ }
+
+ private void optionallyWrapInNullCheck(boolean wrap, PrintWriter pw, String indent, String fieldName, Consumer<String> f)
+ {
+ if (wrap)
+ {
+ pw.println(indent + "if (" + fieldName + " != null)");
+ pw.println(indent + "{");
+ indent += " ";
+ }
+ f.accept(indent);
+ if (wrap)
+ {
+ indent = indent.substring(4);
+ pw.println(indent + "}");
+ }
+ }
+
+ private String getSetterName(final VariableElement variableElement)
+ {
+ final String fieldName = stripUnderscore(variableElement.getSimpleName().toString());
+ return "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
+ }
+
+ private String stripUnderscore(final String fieldName)
+ {
+ if (fieldName.startsWith("_"))
+ {
+ return fieldName.substring(1);
+ }
+ return fieldName;
+ }
+
+ private static class AnnotatedField
+ {
+ private final VariableElement _variableElement;
+ private final AnnotationMirror _annotationMirror;
+ private final int _index;
+ private final String _factory;
+ private final boolean _mandatory;
+
+ public AnnotatedField(final VariableElement variableElement, final AnnotationMirror annotationMirror)
+ {
+ _variableElement = variableElement;
+ _annotationMirror = annotationMirror;
+ String factory = null;
+ boolean mandatory = false;
+ int index = -1;
+ for (Map.Entry<? extends ExecutableElement,? extends AnnotationValue> entry : annotationMirror.getElementValues().entrySet())
+ {
+ if ("index".contentEquals(entry.getKey().getSimpleName()))
+ {
+ index = (int) entry.getValue().getValue();
+ }
+ else if ("deserializationConverter".contentEquals(entry.getKey().getSimpleName()))
+ {
+ factory = (String) entry.getValue().getValue();
+ }
+ else if ("mandatory".contentEquals(entry.getKey().getSimpleName()))
+ {
+ mandatory = (boolean) entry.getValue().getValue();
+ }
+ }
+ _index = index;
+ _mandatory = mandatory;
+ _factory = factory;
+ }
+
+ public VariableElement getVariableElement()
+ {
+ return _variableElement;
+ }
+
+ public AnnotationMirror getAnnotationMirror()
+ {
+ return _annotationMirror;
+ }
+
+ public int getIndex()
+ {
+ return _index;
+ }
+
+ public String getFactory()
+ {
+ return _factory;
+ }
+
+ public boolean isMandatory()
+ {
+ return _mandatory;
+ }
+ }
+
+ private static TypeMirror getErasure(ProcessingEnvironment processingEnv, final String className)
+ {
+ final Types typeUtils = processingEnv.getTypeUtils();
+ final Elements elementUtils = processingEnv.getElementUtils();
+ return typeUtils.erasure(elementUtils.getTypeElement(className).asType());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeTypeField.java
----------------------------------------------------------------------
diff --git a/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeTypeField.java b/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeTypeField.java
new file mode 100644
index 0000000..be2893e
--- /dev/null
+++ b/broker-codegen/src/main/java/org/apache/qpid/server/protocol/v1_0/CompositeTypeField.java
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface CompositeTypeField
+{
+ int index();
+ boolean mandatory() default false;
+ String deserializationConverter() default "";
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-codegen/src/main/resources/META-INF/services/javax.annotation.processing.Processor
----------------------------------------------------------------------
diff --git a/broker-codegen/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/broker-codegen/src/main/resources/META-INF/services/javax.annotation.processing.Processor
index c8ef012..8e295cf 100644
--- a/broker-codegen/src/main/resources/META-INF/services/javax.annotation.processing.Processor
+++ b/broker-codegen/src/main/resources/META-INF/services/javax.annotation.processing.Processor
@@ -25,3 +25,4 @@ org.apache.qpid.server.model.validation.AttributeFieldValidation
org.apache.qpid.server.model.validation.ManagedAnnotationValidator
org.apache.qpid.server.model.validation.OperationAnnotationValidator
org.apache.qpid.server.model.validation.ContentHeaderAnnotationValidator
+org.apache.qpid.server.protocol.v1_0.CompositeTypeConstructorGenerator
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/DeserializationFactories.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/DeserializationFactories.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/DeserializationFactories.java
new file mode 100644
index 0000000..f76edf4
--- /dev/null
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/DeserializationFactories.java
@@ -0,0 +1,345 @@
+/*
+ * 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;
+
+import java.lang.reflect.Array;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.DistributionMode;
+import org.apache.qpid.server.protocol.v1_0.type.ErrorCondition;
+import org.apache.qpid.server.protocol.v1_0.type.LifetimePolicy;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+import org.apache.qpid.server.protocol.v1_0.type.TxnCapability;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.StdDistMode;
+import org.apache.qpid.server.protocol.v1_0.type.transaction.TransactionErrors;
+import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
+import org.apache.qpid.server.protocol.v1_0.type.transport.ConnectionError;
+import org.apache.qpid.server.protocol.v1_0.type.transport.LinkError;
+import org.apache.qpid.server.protocol.v1_0.type.transport.SessionError;
+
+public class DeserializationFactories
+{
+ @SuppressWarnings("unused")
+ public static Map<Symbol, Object> convertToNodeProperties(final Object value) throws AmqpErrorException
+ {
+ if (value != null)
+ {
+ if (!(value instanceof Map))
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Cannot construct 'node-properties' from type '%s'",
+ value.getClass().getSimpleName()));
+ }
+ Map<Symbol, Object> nodeProperties = new LinkedHashMap<>();
+ Map<?, ?> map = (Map<?, ?>) value;
+ for (Map.Entry<?,?> entry : map.entrySet())
+ {
+ Object key = entry.getKey();
+ if (!(key instanceof Symbol))
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("'node-properties' must have only keys of type 'symbol' but got '%s'",
+ key.getClass().getSimpleName()));
+ }
+ if (Session_1_0.LIFETIME_POLICY.equals(key))
+ {
+ final Object lifetimePolicy = entry.getValue();
+ if (!(lifetimePolicy instanceof LifetimePolicy))
+ {
+ String typeName = lifetimePolicy == null ? null : lifetimePolicy.getClass().getSimpleName();
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Cannot construct 'lifetime-policy' from type '%s'",
+ typeName));
+ }
+ nodeProperties.put((Symbol) key, lifetimePolicy);
+ }
+ else if (Symbol.valueOf("supported-dist-modes").equals(key))
+ {
+ final Object distributionMode = entry.getValue();
+ final DistributionMode[] converted;
+ if (distributionMode == null)
+ {
+ converted = null;
+
+ }
+ else if (distributionMode.getClass().isArray())
+ {
+ converted = new DistributionMode[Array.getLength(distributionMode)];
+ for (int i = 0; i < converted.length; ++i)
+ {
+ final Object item = Array.get(distributionMode, i);
+ if (item == null)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ "'null' not allowed in 'supported-distribution-modes'");
+ }
+ converted[i] = convertToDistributionMode(item);
+ }
+ }
+ else
+ {
+ converted = new DistributionMode[] {convertToDistributionMode(distributionMode)};
+ }
+ nodeProperties.put((Symbol) key, converted);
+ }
+ else
+ {
+ nodeProperties.put((Symbol) key, entry.getValue());
+ }
+ }
+ return nodeProperties;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @SuppressWarnings("unused")
+ public static DistributionMode convertToDistributionMode(final Object value) throws AmqpErrorException
+ {
+ DistributionMode distributionMode = null;
+ if (value != null)
+ {
+ if (value instanceof DistributionMode)
+ {
+ distributionMode = (DistributionMode) value;
+ }
+ else if (value instanceof Symbol)
+ {
+ distributionMode = StdDistMode.valueOf(value);
+ if (distributionMode == null)
+ {
+ distributionMode = new UnknownDistributionMode((Symbol) value);
+ }
+ }
+ else
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Cannot construct 'distribution-mode' from type '%s'",
+ value.getClass().getSimpleName()));
+ }
+ }
+ return distributionMode;
+ }
+
+ @SuppressWarnings("unused")
+ public static TxnCapability convertToTxnCapability(final Object value) throws AmqpErrorException
+ {
+ TxnCapability capability = null;
+ if (value != null)
+ {
+ if (value instanceof TxnCapability)
+ {
+ capability = (TxnCapability) value;
+ }
+ else if (value instanceof Symbol)
+ {
+ capability = org.apache.qpid.server.protocol.v1_0.type.transaction.TxnCapability.valueOf(value);
+ if (capability == null)
+ {
+ capability = new UnknownTxnCapability((Symbol) value);
+ }
+ }
+ else
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Cannot construct 'txn-capability' from type '%s'",
+ value.getClass().getSimpleName()));
+ }
+ }
+ return capability;
+ }
+
+ @SuppressWarnings("unsued")
+ public static ErrorCondition convertToErrorCondition(final Object value) throws AmqpErrorException
+ {
+ ErrorCondition condition = null;
+ if (value != null)
+ {
+ if (value instanceof ErrorCondition)
+ {
+ condition = (ErrorCondition) value;
+ }
+ else if (value instanceof Symbol)
+ {
+ condition = AmqpError.valueOf(value);
+ if (condition == null)
+ {
+ condition = ConnectionError.valueOf(value);
+ if (condition == null)
+ {
+ condition = SessionError.valueOf(value);
+ if (condition == null)
+ {
+ condition = LinkError.valueOf(value);
+ if (condition == null)
+ {
+ condition = TransactionErrors.valueOf(value);
+ if (condition == null)
+ {
+ condition = new UnknownErrorCondition((Symbol) value);
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Cannot construct 'error-condition' from type '%s'",
+ value.getClass().getSimpleName()));
+ }
+ }
+ return condition;
+ }
+
+ private static final class UnknownErrorCondition implements ErrorCondition
+ {
+ private final Symbol _value;
+
+ public UnknownErrorCondition(final Symbol value)
+ {
+ _value = value;
+ }
+
+ @Override
+ public Symbol getValue()
+ {
+ return _value;
+ }
+
+ @Override
+ public boolean equals(final Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ final UnknownErrorCondition that = (UnknownErrorCondition) o;
+
+ if (!_value.equals(that._value))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _value.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _value.toString();
+ }
+ }
+
+ private static class UnknownTxnCapability implements TxnCapability
+ {
+ private final Symbol _value;
+
+ public UnknownTxnCapability(final Symbol value)
+ {
+ _value = value;
+ }
+
+ @Override
+ public boolean equals(final Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ final UnknownTxnCapability that = (UnknownTxnCapability) o;
+
+ return _value.equals(that._value);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _value.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _value.toString();
+ }
+ }
+
+ private static class UnknownDistributionMode implements DistributionMode
+ {
+ private final Symbol _value;
+
+ public UnknownDistributionMode(final Symbol value)
+ {
+ _value = value;
+ }
+
+ @Override
+ public boolean equals(final Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ final UnknownDistributionMode that = (UnknownDistributionMode) o;
+
+ return _value.equals(that._value);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _value.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _value.toString();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
index 801810e..a78df1a 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
@@ -988,15 +988,7 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
@Override
public void block(final Queue<?> queue)
{
- getAMQPConnection().doOnIOThreadAsync(
- new Runnable()
- {
- @Override
- public void run()
- {
- doBlock(queue);
- }
- });
+ getAMQPConnection().doOnIOThreadAsync(() -> doBlock(queue));
}
private void doBlock(final Queue<?> queue)
@@ -1025,15 +1017,7 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
@Override
public void unblock(final Queue<?> queue)
{
- getAMQPConnection().doOnIOThreadAsync(
- new Runnable()
- {
- @Override
- public void run()
- {
- doUnblock(queue);
- }
- });
+ getAMQPConnection().doOnIOThreadAsync(() -> doUnblock(queue));
}
private void doUnblock(final Queue<?> queue)
@@ -1058,15 +1042,7 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
@Override
public void block()
{
- getAMQPConnection().doOnIOThreadAsync(
- new Runnable()
- {
- @Override
- public void run()
- {
- doBlock();
- }
- });
+ getAMQPConnection().doOnIOThreadAsync(this::doBlock);
}
private void doBlock()
@@ -1088,15 +1064,7 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
@Override
public void unblock()
{
- getAMQPConnection().doOnIOThreadAsync(
- new Runnable()
- {
- @Override
- public void run()
- {
- doUnblock();
- }
- });
+ getAMQPConnection().doOnIOThreadAsync(this::doUnblock);
}
private void doUnblock()
@@ -1388,38 +1356,32 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
@Override
public void onSuccess(final T endpoint)
{
- doOnIOThreadAsync(new Runnable()
- {
- @Override
- public void run()
+ doOnIOThreadAsync(() -> {
+ _associatedLinkEndpoints.add(endpoint);
+ endpoint.setLocalHandle(findNextAvailableOutputHandle());
+ if (endpoint instanceof ErrantLinkEndpoint)
{
- _associatedLinkEndpoints.add(endpoint);
- endpoint.setLocalHandle(findNextAvailableOutputHandle());
- if (endpoint instanceof ErrantLinkEndpoint)
+ endpoint.sendAttach();
+ ((ErrantLinkEndpoint) endpoint).closeWithError();
+ }
+ else
+ {
+ if (endpoint instanceof StandardReceivingLinkEndpoint
+ && (_blockingEntities.contains(Session_1_0.this)
+ || _blockingEntities.contains(((StandardReceivingLinkEndpoint) endpoint).getReceivingDestination())))
+ {
+ endpoint.setStopped(true);
+ }
+ _inputHandleToEndpoint.put(_attach.getHandle(), endpoint);
+ if (!_endpointToOutputHandle.containsKey(endpoint))
{
+ _endpointToOutputHandle.put(endpoint, endpoint.getLocalHandle());
endpoint.sendAttach();
- ((ErrantLinkEndpoint) endpoint).closeWithError();
+ endpoint.start();
}
else
{
- if (endpoint instanceof StandardReceivingLinkEndpoint
- && (_blockingEntities.contains(Session_1_0.this)
- || _blockingEntities.contains(((StandardReceivingLinkEndpoint) endpoint).getReceivingDestination())))
- {
- endpoint.setStopped(true);
- }
- _inputHandleToEndpoint.put(_attach.getHandle(), endpoint);
- if (!_endpointToOutputHandle.containsKey(endpoint))
- {
- _endpointToOutputHandle.put(endpoint, endpoint.getLocalHandle());
- endpoint.sendAttach();
- endpoint.start();
- }
- else
- {
- // TODO - link stealing???
- }
-
+ // TODO - link stealing???
}
}
});
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/AbstractCompositeTypeConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/AbstractCompositeTypeConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/AbstractCompositeTypeConstructor.java
new file mode 100644
index 0000000..c417b69
--- /dev/null
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/AbstractCompositeTypeConstructor.java
@@ -0,0 +1,297 @@
+/*
+ * 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.codec;
+
+
+import java.lang.reflect.Array;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.bytebuffer.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
+
+public abstract class AbstractCompositeTypeConstructor<T> 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 FieldValueReader();
+ }
+
+ protected abstract String getTypeName();
+
+ protected abstract T construct(FieldValueReader x) throws AmqpErrorException;
+
+ protected class FieldValueReader implements TypeConstructor<T>
+ {
+ private List<QpidByteBuffer> _in;
+ private ValueHandler _valueHandler;
+ private int _count;
+
+ @Override
+ public T construct(final List<QpidByteBuffer> in, final ValueHandler handler) throws AmqpErrorException
+ {
+ _in = in;
+ _valueHandler = handler;
+ return constructType();
+ }
+
+ private T constructType() throws AmqpErrorException
+ {
+ final TypeConstructor typeConstructor = _valueHandler.readConstructor(_in);
+ if (typeConstructor instanceof ListConstructor)
+ {
+ ListConstructor listConstructor = (ListConstructor) typeConstructor;
+ int size;
+ long remaining = QpidByteBufferUtils.remaining(_in);
+ if (remaining < listConstructor.getSize())
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Not sufficient data for deserialization of '%s'."
+ + " Expected at least %d bytes. Got %d bytes.",
+ getTypeName(),
+ listConstructor.getSize(),
+ remaining));
+ }
+
+ if (listConstructor.getSize() == 1)
+ {
+ size = QpidByteBufferUtils.get(_in) & 0xFF;
+ _count = QpidByteBufferUtils.get(_in) & 0xFF;
+ }
+ else
+ {
+ size = QpidByteBufferUtils.getInt(_in);
+ _count = QpidByteBufferUtils.getInt(_in);
+ }
+
+ remaining -= listConstructor.getSize();
+ if (remaining < size)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Not sufficient data for deserialization of '%s'."
+ + " Expected at least %d bytes. Got %d bytes.",
+ getTypeName(),
+ size,
+ remaining));
+ }
+ }
+ else if (typeConstructor instanceof ZeroListConstructor)
+ {
+ _count = 0;
+ }
+ else
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Unexpected format when deserializing of '%s'",
+ getTypeName()));
+ }
+ return AbstractCompositeTypeConstructor.this.construct(this);
+ }
+
+
+ public <F> F readValue(final int fieldIndex,
+ final String fieldName,
+ final boolean mandatory,
+ final Class<F> expectedType) throws AmqpErrorException
+ {
+ if (fieldIndex >= _count)
+ {
+ if (mandatory)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Mandatory field '%s' of '%s' was not provided",
+ fieldName,
+ getTypeName()));
+ }
+ return null;
+ }
+
+ Object value = _valueHandler.parse(_in);
+
+
+ if (value == null && mandatory)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Mandatory field '%s' of '%s' was not provided",
+ fieldName,
+ getTypeName()));
+ }
+
+ if (value != null && !expectedType.isAssignableFrom(value.getClass()))
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format(
+ "Wrong type for field '%s' of '%s'. Expected '%s' but got '%s'.",
+ fieldName,
+ getTypeName(),
+ expectedType.getSimpleName(),
+ value.getClass().getSimpleName()));
+ }
+
+ return (F) value;
+ }
+
+ public <K, V> Map<K, V> readMapValue(final int fieldIndex,
+ final String fieldName,
+ final boolean mandatory,
+ final Class<K> expectedKeyType,
+ final Class<V> expectedValueType)
+ throws AmqpErrorException
+ {
+ if (fieldIndex >= _count)
+ {
+ if (mandatory)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Mandatory field '%s' of '%s' was not provided",
+ fieldName,
+ getTypeName()));
+ }
+ return null;
+ }
+
+ TypeConstructor typeConstructor = _valueHandler.readConstructor(_in);
+ if (typeConstructor instanceof MapConstructor)
+ {
+ MapConstructor mapConstructor = ((MapConstructor) typeConstructor);
+
+ return mapConstructor.construct(_in,
+ _valueHandler,
+ expectedKeyType,
+ expectedValueType);
+ }
+ else if (typeConstructor instanceof NullTypeConstructor)
+ {
+ if (mandatory)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ "Mandatory field '%s' of '%s' was not provided",
+ fieldName,
+ getTypeName());
+ }
+ }
+ else
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Could not decode value field '%s' of '%s'",
+ fieldName,
+ getTypeName()));
+ }
+
+ return null;
+ }
+
+ public <F> F[] readArrayValue(final int fieldIndex,
+ final String fieldName,
+ final boolean mandatory,
+ final Class<F> expectedType,
+ final Converter<F> converter) throws AmqpErrorException
+ {
+ if (fieldIndex >= _count)
+ {
+ if (mandatory)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Mandatory field '%s' of '%s' was not provided",
+ fieldName,
+ getTypeName()));
+ }
+ return null;
+ }
+
+ Object value = _valueHandler.parse(_in);
+
+ if (mandatory && value == null)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Mandatory field '%s' of '%s' was not provided",
+ fieldName,
+ getTypeName()));
+ }
+
+ if (value != null)
+ {
+ if (value.getClass().isArray())
+ {
+ if (expectedType.isAssignableFrom(value.getClass().getComponentType()))
+ {
+ return (F[]) value;
+ }
+ else
+ {
+ final Object[] objects = (Object[]) value;
+ F[] array = (F[]) Array.newInstance(expectedType, objects.length);
+ try
+ {
+ for (int i = 0; i < objects.length; ++i)
+ {
+ array[i] = converter.convert(objects[i]);
+ }
+ }
+ catch (RuntimeException e)
+ {
+ Error error = new Error(AmqpError.DECODE_ERROR,
+ String.format("Could not decode value field '%s' of '%s'", fieldName, getTypeName()));
+ throw new AmqpErrorException(error, e);
+ }
+ return array;
+ }
+ }
+ else if (expectedType.isAssignableFrom(value.getClass()))
+ {
+ F[] array = (F[]) Array.newInstance(expectedType, 1);
+ array[0] = (F) value;
+ return array;
+ }
+ else
+ {
+ try
+ {
+ final F convertedValue = converter.convert(value);
+ F[] array = (F[]) Array.newInstance(expectedType, 1);
+ array[0] = convertedValue;
+ return array;
+ }
+ catch (RuntimeException e)
+ {
+ Error error = new Error(AmqpError.DECODE_ERROR,
+ String.format("Could not decode value field '%s' of '%s'", fieldName, getTypeName()));
+ throw new AmqpErrorException(error, e);
+ }
+ }
+ }
+
+ return null;
+ }
+ }
+
+ public interface Converter<T>
+ {
+ T convert(Object o) throws AmqpErrorException;
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/AbstractDescribedTypeConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/AbstractDescribedTypeConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/AbstractDescribedTypeConstructor.java
index e8a14ff..c8da269 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/AbstractDescribedTypeConstructor.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/AbstractDescribedTypeConstructor.java
@@ -20,43 +20,29 @@
*/
package org.apache.qpid.server.protocol.v1_0.codec;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
-import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
public abstract class AbstractDescribedTypeConstructor<T extends Object> implements DescribedTypeConstructor<T>
{
- private static final Logger LOGGER = LoggerFactory.getLogger(AbstractDescribedTypeConstructor.class);
-
@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));
}
- protected abstract T construct(Object underlying);
+ protected abstract T construct(Object underlying) throws AmqpErrorException;
private static class TypeConstructorFromUnderlying<S extends Object> implements TypeConstructor<S>
{
private final TypeConstructor _describedConstructor;
private AbstractDescribedTypeConstructor<S> _describedTypeConstructor;
- private static final Map<Class<?>, CompositeTypeValidator> _validators = new ConcurrentHashMap<>();
public TypeConstructorFromUnderlying(final AbstractDescribedTypeConstructor<S> describedTypeConstructor,
final TypeConstructor describedConstructor)
@@ -68,57 +54,7 @@ public abstract class AbstractDescribedTypeConstructor<T extends Object> impleme
@Override
public S construct(final List<QpidByteBuffer> in, final ValueHandler handler) throws AmqpErrorException
{
- final S constructedObject =
- _describedTypeConstructor.construct(_describedConstructor.construct(in, handler));
- CompositeTypeValidator<S> validator =
- _validators.computeIfAbsent(constructedObject.getClass(), k -> createValidator(constructedObject));
- validator.validate(constructedObject);
- return constructedObject;
- }
-
- private CompositeTypeValidator<S> createValidator(final S constructedObject)
- {
- final List<Field> mandatoryFields = new ArrayList<>();
- for (Field field : constructedObject.getClass().getDeclaredFields())
- {
- Annotation[] annotations = field.getDeclaredAnnotationsByType(CompositeTypeField.class);
- for (Annotation annotation : annotations)
- {
- if (annotation instanceof CompositeTypeField && ((CompositeTypeField) annotation).mandatory())
- {
- field.setAccessible(true);
- mandatoryFields.add(field);
- }
- }
- }
- return objectToValidate ->
- {
- try
- {
- if (!mandatoryFields.isEmpty())
- {
- for (Field field : mandatoryFields)
- {
- if (field.get(objectToValidate) == null)
- {
- throw new AmqpErrorException(AmqpError.DECODE_ERROR,
- String.format("Missing mandatory field '%s'.",
- field.getName()));
- }
- }
- }
- }
- catch (IllegalAccessException e)
- {
- LOGGER.error(String.format("Error validating AMQP 1.0 object '%s'", constructedObject.toString()), e);
- throw new AmqpErrorException(AmqpError.INTERNAL_ERROR, "Failure during object validation");
- }
- };
- }
-
- private interface CompositeTypeValidator<S>
- {
- void validate(final S constructedObject) throws AmqpErrorException;
+ return _describedTypeConstructor.construct(_describedConstructor.construct(in, handler));
}
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/CompoundTypeConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/CompoundTypeConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/CompoundTypeConstructor.java
deleted file mode 100644
index 8d54691..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/CompoundTypeConstructor.java
+++ /dev/null
@@ -1,193 +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.
- *
- */
-package org.apache.qpid.server.protocol.v1_0.codec;
-
-import java.util.ArrayList;
-import java.util.Formatter;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.bytebuffer.QpidByteBufferUtils;
-import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
-import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
-import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
-
-public class CompoundTypeConstructor<T> extends VariableWidthTypeConstructor<T>
-{
- private final CompoundTypeAssembler.Factory<T> _assemblerFactory;
-
- public static final CompoundTypeAssembler.Factory LIST_ASSEMBLER_FACTORY =
- new CompoundTypeAssembler.Factory()
- {
-
- @Override
- public CompoundTypeAssembler newInstance()
- {
- return new ListAssembler();
- }
- };
-
-
-
- private static class ListAssembler implements CompoundTypeAssembler<List>
- {
- private List _list;
-
- @Override
- public void init(final int count) throws AmqpErrorException
- {
- _list = new ArrayList(count);
- }
-
- @Override
- public void addItem(final Object obj) throws AmqpErrorException
- {
- _list.add(obj);
- }
-
- @Override
- public List complete() throws AmqpErrorException
- {
- return _list;
- }
-
- @Override
- public String toString()
- {
- return "ListAssembler{" +
- "_list=" + _list +
- '}';
- }
- }
-
-
- public static final CompoundTypeAssembler.Factory MAP_ASSEMBLER_FACTORY =
- new CompoundTypeAssembler.Factory<Map>()
- {
-
- @Override
- public CompoundTypeAssembler<Map> newInstance()
- {
- return new MapAssembler();
- }
- };
-
- private static class MapAssembler implements CompoundTypeAssembler<Map>
- {
- private Map _map;
- private Object _lastKey;
- private static final Object NOT_A_KEY = new Object();
-
-
- @Override
- public void init(final int count) throws AmqpErrorException
- {
- // Can't have an odd number of elements in a map
- if((count & 0x1) == 1)
- {
- Error error = new Error();
- error.setCondition(AmqpError.DECODE_ERROR);
- Formatter formatter = new Formatter();
- formatter.format("map cannot have odd number of elements: %d", count);
- error.setDescription(formatter.toString());
- throw new AmqpErrorException(error);
- }
- _map = new HashMap(count);
- _lastKey = NOT_A_KEY;
- }
-
- @Override
- public void addItem(final Object obj) throws AmqpErrorException
- {
- if(_lastKey != NOT_A_KEY)
- {
- if(_map.put(_lastKey, obj) != null)
- {
- Error error = new Error();
- error.setCondition(AmqpError.DECODE_ERROR);
- Formatter formatter = new Formatter();
- formatter.format("map cannot have duplicate keys: %s has values (%s, %s)", _lastKey, _map.get(_lastKey), obj);
- error.setDescription(formatter.toString());
-
- throw new AmqpErrorException(error);
- }
- _lastKey = NOT_A_KEY;
- }
- else
- {
- _lastKey = obj;
- }
-
- }
-
- @Override
- public Map complete() throws AmqpErrorException
- {
- return _map;
- }
- }
-
-
- public static <X> CompoundTypeConstructor<X> getInstance(int i,
- CompoundTypeAssembler.Factory<X> assemblerFactory)
- {
- return new CompoundTypeConstructor<>(i, assemblerFactory);
- }
-
-
- private CompoundTypeConstructor(int size,
- final CompoundTypeAssembler.Factory<T> assemblerFactory)
- {
- super(size);
- _assemblerFactory = assemblerFactory;
- }
-
- @Override
- public T construct(final List<QpidByteBuffer> in, final ValueHandler handler) throws AmqpErrorException
- {
- int size;
- int count;
-
- if(getSize() == 1)
- {
- size = QpidByteBufferUtils.get(in) & 0xFF;
- count = QpidByteBufferUtils.get(in) & 0xFF;
- }
- else
- {
- size = QpidByteBufferUtils.getInt(in);
- count = QpidByteBufferUtils.getInt(in);
- }
-
- CompoundTypeAssembler<T> assembler = _assemblerFactory.newInstance();
-
- assembler.init(count);
-
- for(int i = 0; i < count; i++)
- {
- assembler.addItem(handler.parse(in));
- }
-
- return assembler.complete();
- }
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ListConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ListConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ListConstructor.java
new file mode 100644
index 0000000..87011d2
--- /dev/null
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ListConstructor.java
@@ -0,0 +1,95 @@
+/*
+ * 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.codec;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.bytebuffer.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
+
+public class ListConstructor extends VariableWidthTypeConstructor<List>
+{
+ private ListConstructor(final int size)
+ {
+ super(size);
+ }
+
+ @Override
+ public List construct(final List<QpidByteBuffer> in, final ValueHandler handler) throws AmqpErrorException
+ {
+ int size;
+ int count;
+ long remaining = QpidByteBufferUtils.remaining(in);
+ if (remaining < getSize())
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Not sufficient data for deserialization of 'list'."
+ + " Expected at least %d bytes. Got %d bytes.",
+ getSize(),
+ remaining));
+ }
+
+ if(getSize() == 1)
+ {
+ size = QpidByteBufferUtils.get(in) & 0xFF;
+ count = QpidByteBufferUtils.get(in) & 0xFF;
+ }
+ else
+ {
+ size = QpidByteBufferUtils.getInt(in);
+ count = QpidByteBufferUtils.getInt(in);
+ }
+ remaining -= getSize();
+ if (remaining < size)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Not sufficient data for deserialization of 'list'."
+ + " Expected at least %d bytes. Got %d bytes.",
+ size,
+ remaining));
+ }
+ return construct(in, handler, size, count);
+ }
+
+ protected List construct(final List<QpidByteBuffer> in,
+ final ValueHandler handler,
+ final int size,
+ final int count)
+ throws AmqpErrorException
+ {
+ List list = new ArrayList(count);
+
+ for(int i = 0; i < count; i++)
+ {
+ list.add(handler.parse(in));
+ }
+
+ return list;
+ }
+
+ public static TypeConstructor getInstance(final int size)
+ {
+ return new ListConstructor(size);
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/MapConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/MapConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/MapConstructor.java
new file mode 100644
index 0000000..4c791e8
--- /dev/null
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/MapConstructor.java
@@ -0,0 +1,144 @@
+/*
+ * 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.codec;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.bytebuffer.QpidByteBufferUtils;
+import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
+import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
+
+public class MapConstructor extends VariableWidthTypeConstructor<Map>
+{
+ private MapConstructor(final int size)
+ {
+ super(size);
+ }
+
+ @Override
+ public Map construct(final List<QpidByteBuffer> in, final ValueHandler handler) throws AmqpErrorException
+ {
+ return construct(in, handler, Object.class, Object.class);
+ }
+
+ public <T,S> Map<T, S> construct(final List<QpidByteBuffer> in, final ValueHandler handler,
+ Class<T> keyType,
+ Class<S> valueType) throws AmqpErrorException
+ {
+ int size;
+ int count;
+
+ long remaining = QpidByteBufferUtils.remaining(in);
+ if (remaining < getSize())
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Not sufficient data for deserialization of 'map'."
+ + " Expected at least %d bytes. Got %d bytes.",
+ getSize(),
+ remaining));
+ }
+
+ if(getSize() == 1)
+ {
+ size = QpidByteBufferUtils.get(in) & 0xFF;
+ count = QpidByteBufferUtils.get(in) & 0xFF;
+ }
+ else
+ {
+ size = QpidByteBufferUtils.getInt(in);
+ count = QpidByteBufferUtils.getInt(in);
+ }
+ remaining -= getSize();
+ if (remaining < size)
+ {
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR,
+ String.format("Not sufficient data for deserialization of 'map'."
+ + " Expected at least %d bytes. Got %d bytes.",
+ size,
+ remaining));
+ }
+
+ return construct(in, handler, size, count, keyType, valueType);
+ }
+
+
+ private <T, S> Map<T,S> construct(final List<QpidByteBuffer> in,
+ final ValueHandler handler,
+ final int size,
+ final int count,
+ Class<T> keyType,
+ Class<S> valueType)
+ throws AmqpErrorException
+ {
+
+ // Can't have an odd number of elements in a map
+ if ((count & 0x1) == 1)
+ {
+ String message = String.format("Map cannot have odd number of elements: %d", count);
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR, message);
+ }
+
+ Map<T, S> map = new LinkedHashMap<>(count);
+
+ final int mapSize = count / 2;
+ for(int i = 0; i < mapSize; i++)
+ {
+ Object key = handler.parse(in);
+ if (key != null && !keyType.isAssignableFrom(key.getClass()))
+ {
+ String message = String.format("Expected key type is '%s' but got '%s'",
+ keyType.getSimpleName(),
+ key.getClass().getSimpleName());
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR, message);
+ }
+
+ Object value = handler.parse(in);
+ if (value != null && !valueType.isAssignableFrom(value.getClass()))
+ {
+ String message = String.format("Expected key type is '%s' but got '%s'",
+ valueType.getSimpleName(),
+ value.getClass().getSimpleName());
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR, message);
+ }
+
+ Object oldValue;
+ if ((oldValue = map.put((T)key, (S)value)) != null)
+ {
+ String message = String.format("Map cannot have duplicate keys: %s has values (%s, %s)",
+ key,
+ oldValue,
+ value);
+ throw new AmqpErrorException(AmqpError.DECODE_ERROR, message);
+ }
+
+ }
+ return map;
+ }
+
+
+ public static MapConstructor getInstance(int size)
+ {
+ return new MapConstructor(size);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[11/12] qpid-broker-j git commit: QPID-7531: [Java Broker,
AMQP 1.0] Tidy up imports and redundant type declarations
Posted by lq...@apache.org.
QPID-7531: [Java Broker, AMQP 1.0] Tidy up imports and redundant type declarations
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/a352423f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/a352423f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/a352423f
Branch: refs/heads/master
Commit: a352423fa50aa59e34d9c5c551dbd8261b0e1135
Parents: d84509a
Author: Lorenz Quack <lq...@apache.org>
Authored: Mon Sep 25 12:08:19 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100
----------------------------------------------------------------------
.../qpid/server/protocol/v1_0/MessageConverter_to_1_0.java | 5 +++--
.../apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java | 3 +--
.../apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java | 2 +-
.../java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java | 4 ++--
.../qpid/server/protocol/v1_0/codec/SymbolTypeConstructor.java | 2 +-
.../server/protocol/v1_0/messaging/SectionDecoderImpl.java | 1 -
.../java/org/apache/qpid/server/protocol/v1_0/type/Symbol.java | 2 +-
.../protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java | 6 +++---
.../type/messaging/codec/DescribedMapSectionConstructor.java | 1 -
9 files changed, 12 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/a352423f/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
index eab7093..3ad1500 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
@@ -21,7 +21,9 @@
package org.apache.qpid.server.protocol.v1_0;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.apache.qpid.server.message.mimecontentconverter.ConversionUtils.*;
+import static org.apache.qpid.server.message.mimecontentconverter.ConversionUtils.BYTES_MESSAGE_CONTENT_TYPES;
+import static org.apache.qpid.server.message.mimecontentconverter.ConversionUtils.LIST_MESSAGE_CONTENT_TYPES;
+import static org.apache.qpid.server.message.mimecontentconverter.ConversionUtils.MAP_MESSAGE_CONTENT_TYPES;
import static org.apache.qpid.server.message.mimecontentconverter.ConversionUtils.OBJECT_MESSAGE_CONTENT_TYPES;
import static org.apache.qpid.server.message.mimecontentconverter.ConversionUtils.TEXT_CONTENT_TYPES;
import static org.apache.qpid.server.protocol.v1_0.JmsMessageTypeAnnotation.BYTES_MESSAGE;
@@ -45,7 +47,6 @@ import java.util.Map;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
import org.apache.qpid.server.message.ServerMessage;
-import org.apache.qpid.server.message.mimecontentconverter.ConversionUtils;
import org.apache.qpid.server.message.mimecontentconverter.MimeContentConverterRegistry;
import org.apache.qpid.server.message.mimecontentconverter.MimeContentToObjectConverter;
import org.apache.qpid.server.model.NamedAddressSpace;
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/a352423f/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java
index 1564fb1..5b6d6b8 100755
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.protocol.v1_0;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Collections;
-import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -698,7 +697,7 @@ public class MessageMetaData_1_0 implements StorableMessageMetaData
public Map<String, Object> getHeadersAsMap()
{
- return _applicationPropertiesSection == null ? new HashMap<String, Object>() : new HashMap<>(
+ return _applicationPropertiesSection == null ? new HashMap<>() : new HashMap<>(
_applicationPropertiesSection.getValue());
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/a352423f/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java
index cac4c8a..fe3a629 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java
@@ -133,7 +133,7 @@ public class SendingLinkEndpoint extends AbstractLinkEndpoint<Source, Target>
Map<Symbol,Filter> filters = source.getFilter();
- Map<Symbol,Filter> actualFilters = new HashMap<Symbol,Filter>();
+ Map<Symbol,Filter> actualFilters = new HashMap<>();
if(filters != null)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/a352423f/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
index d0d24d7..46718fb 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
@@ -154,7 +154,7 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
"Force detach the link because the session is remotely ended.");
private final String _primaryDomain;
- private final Set<Object> _blockingEntities = Collections.newSetFromMap(new ConcurrentHashMap<Object,Boolean>());
+ private final Set<Object> _blockingEntities = Collections.newSetFromMap(new ConcurrentHashMap<>());
private volatile long _startedTransactions;
private volatile long _committedTransactions;
private volatile long _rolledBackTransactions;
@@ -944,7 +944,7 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
if(_closed.compareAndSet(false, true))
{
- List<Action<? super Session_1_0>> taskList = new ArrayList<Action<? super Session_1_0>>(_taskList);
+ List<Action<? super Session_1_0>> taskList = new ArrayList<>(_taskList);
_taskList.clear();
for(Action<? super Session_1_0> task : taskList)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/a352423f/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolTypeConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolTypeConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolTypeConstructor.java
index 07a7aac..c58a52f 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolTypeConstructor.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolTypeConstructor.java
@@ -37,7 +37,7 @@ public class SymbolTypeConstructor extends VariableWidthTypeConstructor<Symbol>
private static final Charset ASCII = Charset.forName("US-ASCII");
private static final ConcurrentMap<BinaryString, Symbol> SYMBOL_MAP =
- new ConcurrentHashMap<BinaryString, Symbol>(2048);
+ new ConcurrentHashMap<>(2048);
public static SymbolTypeConstructor getInstance(int i)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/a352423f/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java
index 982a242..7b9f742 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/messaging/SectionDecoderImpl.java
@@ -29,7 +29,6 @@ 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.EncodingRetainingSection;
import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
-import org.apache.qpid.server.protocol.v1_0.type.transport.ConnectionError;
public class SectionDecoderImpl implements SectionDecoder
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/a352423f/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/Symbol.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/Symbol.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/Symbol.java
index 94d57de..21cbaf2 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/Symbol.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/Symbol.java
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentMap;
public final class Symbol implements Comparable<Symbol>, CharSequence
{
private final String _underlying;
- private static final ConcurrentMap<String, Symbol> _symbols = new ConcurrentHashMap<String, Symbol>(2048);
+ private static final ConcurrentMap<String, Symbol> _symbols = new ConcurrentHashMap<>(2048);
private Symbol(String underlying)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/a352423f/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java
index 67ccb83..29c136c 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/codec/AMQPDescribedTypeRegistry.java
@@ -70,8 +70,8 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.codec.*;
public class AMQPDescribedTypeRegistry implements DescribedTypeConstructorRegistry, ValueWriter.Registry
{
- private final Map<Object, DescribedTypeConstructor> _constructorRegistry = new HashMap<Object, DescribedTypeConstructor>();
- private final Map<Object, DescribedTypeConstructor> _sectionDecoderRegistryMap = new HashMap<Object, DescribedTypeConstructor>();
+ private final Map<Object, DescribedTypeConstructor> _constructorRegistry = new HashMap<>();
+ private final Map<Object, DescribedTypeConstructor> _sectionDecoderRegistryMap = new HashMap<>();
@@ -320,7 +320,7 @@ public class AMQPDescribedTypeRegistry implements DescribedTypeConstructorRegist
}
- private final Map<Class, ValueWriter.Factory> _writerMap = new HashMap<Class, ValueWriter.Factory>();
+ private final Map<Class, ValueWriter.Factory> _writerMap = new HashMap<>();
@Override
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/a352423f/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
index fb1f545..9c58321 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DescribedMapSectionConstructor.java
@@ -23,7 +23,6 @@
package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-import java.util.ArrayList;
import java.util.List;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[02/12] qpid-broker-j git commit: QPID-7531: [Java Broker,
AMQP 1.0] Fix String format arguments in error message.
Posted by lq...@apache.org.
QPID-7531: [Java Broker, AMQP 1.0] Fix String format arguments in error message.
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/d84509a0
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/d84509a0
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/d84509a0
Branch: refs/heads/master
Commit: d84509a0d4182c4264c987ab62f7dfea874a9aa9
Parents: 2632d13
Author: Lorenz Quack <lq...@apache.org>
Authored: Mon Sep 25 11:16:59 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100
----------------------------------------------------------------------
.../java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d84509a0/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
index a78df1a..d0d24d7 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
@@ -400,8 +400,8 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
final End end = new End();
end.setError(new Error(SessionError.WINDOW_VIOLATION,
String.format("Next incoming id '%d' exceeds next outgoing id '%d'",
- flowNextIncomingId,
- _nextOutgoingId)));
+ flowNextIncomingId.longValue(),
+ _nextOutgoingId.longValue())));
end(end);
}
else
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[08/12] qpid-broker-j git commit: QPID-7932: [Java Broker,
AMQP 1.0] Improve error handling when deserializing composite types
Posted by lq...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesConstructor.java
deleted file mode 100644
index e3b226d..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesConstructor.java
+++ /dev/null
@@ -1,426 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-import java.util.Date;
-import java.util.List;
-
-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.Binary;
-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.UnsignedLong;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.Properties;
-
-public class PropertiesConstructor extends AbstractDescribedTypeConstructor<Properties>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:properties:list"),UnsignedLong.valueOf(0x0000000000000073L),
- };
-
- private static final PropertiesConstructor INSTANCE = new PropertiesConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Properties construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Properties obj = new Properties();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setMessageId( val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setUserId( (Binary) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setTo( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setSubject( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setReplyTo( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setCorrelationId( val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setContentType( (Symbol) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setContentEncoding( (Symbol) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setAbsoluteExpiryTime( (Date) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setCreationTime( (Date) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setGroupId( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setGroupSequence( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setReplyToGroupId( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedConstructor.java
deleted file mode 100644
index 6fca7c7..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedConstructor.java
+++ /dev/null
@@ -1,126 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-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 java.util.List;
-
-public class ReceivedConstructor extends AbstractDescribedTypeConstructor<Received>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:received:list"),UnsignedLong.valueOf(0x0000000000000023L),
- };
-
- private static final ReceivedConstructor INSTANCE = new ReceivedConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Received construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Received obj = new Received();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setSectionNumber( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setSectionOffset( (UnsignedLong) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedConstructor.java
deleted file mode 100644
index f4941e0..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedConstructor.java
+++ /dev/null
@@ -1,98 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-import java.util.List;
-
-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.UnsignedLong;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.Rejected;
-
-public class RejectedConstructor extends AbstractDescribedTypeConstructor<Rejected>
-{
- private static final Object[] DESCRIPTORS =
- {
- Rejected.REJECTED_SYMBOL,UnsignedLong.valueOf(0x0000000000000025L),
- };
-
- private static final RejectedConstructor INSTANCE = new RejectedConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Rejected construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Rejected obj = new Rejected();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setError( (org.apache.qpid.server.protocol.v1_0.type.transport.Error) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedConstructor.java
deleted file mode 100644
index 605ea2b..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedConstructor.java
+++ /dev/null
@@ -1,71 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-import java.util.List;
-
-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.UnsignedLong;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.Released;
-
-public class ReleasedConstructor extends AbstractDescribedTypeConstructor<Released>
-{
- private static final Object[] DESCRIPTORS =
- {
- Released.RELEASED_SYMBOL,UnsignedLong.valueOf(0x0000000000000026L),
- };
-
- private static final ReleasedConstructor INSTANCE = new ReleasedConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Released construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Released obj = new Released();
- int position = 0;
- final int size = list.size();
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceConstructor.java
deleted file mode 100644
index 7156c06..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceConstructor.java
+++ /dev/null
@@ -1,385 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-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.messaging.Source;
-
-
-import java.util.List;
-import java.util.Map;
-
-public class SourceConstructor extends AbstractDescribedTypeConstructor<Source>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:source:list"),UnsignedLong.valueOf(0x0000000000000028L),
- };
-
- private static final SourceConstructor INSTANCE = new SourceConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Source construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Source obj = new Source();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setAddress( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDurable( TerminusDurability.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setExpiryPolicy( TerminusExpiryPolicy.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setTimeout( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDynamic( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDynamicNodeProperties( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDistributionMode( StdDistMode.valueOf(val) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setFilter( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDefaultOutcome( (Outcome) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setOutcomes( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setOutcomes( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setCapabilities( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setCapabilities( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetConstructor.java
deleted file mode 100644
index 2294acc..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetConstructor.java
+++ /dev/null
@@ -1,270 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
-
-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.messaging.Target;
-
-
-import java.util.List;
-import java.util.Map;
-
-public class TargetConstructor extends AbstractDescribedTypeConstructor<Target>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:target:list"),UnsignedLong.valueOf(0x0000000000000029L),
- };
-
- private static final TargetConstructor INSTANCE = new TargetConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Target construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Target obj = new Target();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setAddress( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDurable( TerminusDurability.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setExpiryPolicy( TerminusExpiryPolicy.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setTimeout( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDynamic( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDynamicNodeProperties( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setCapabilities( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setCapabilities( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslChallenge.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslChallenge.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslChallenge.java
index ac28d18..5c15541 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslChallenge.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslChallenge.java
@@ -25,16 +25,15 @@ package org.apache.qpid.server.protocol.v1_0.type.security;
import org.apache.qpid.server.protocol.v1_0.SASLEndpoint;
-
-
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class SaslChallenge
- implements SaslFrameBody
- {
-
-
- @CompositeTypeField(mandatory = true)
+import org.apache.qpid.server.protocol.v1_0.type.Binary;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.type.SaslFrameBody;
+
+@CompositeType( symbolicDescriptor = "amqp:sasl-challenge:list", numericDescriptor = 0x0000000000000042L)
+public class SaslChallenge implements SaslFrameBody
+{
+ @CompositeTypeField(index = 0, mandatory = true)
private Binary _challenge;
public Binary getChallenge()
@@ -53,9 +52,9 @@ public class SaslChallenge
StringBuilder builder = new StringBuilder("SaslChallenge{");
final int origLength = builder.length();
- if(_challenge != null)
+ if (_challenge != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -71,6 +70,4 @@ public class SaslChallenge
{
conn.receiveSaslChallenge(this);
}
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslCode.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslCode.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslCode.java
index 7894104..ec58ef4 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslCode.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslCode.java
@@ -24,30 +24,22 @@
package org.apache.qpid.server.protocol.v1_0.type.security;
+import org.apache.qpid.server.protocol.v1_0.type.RestrictedType;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedByte;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class SaslCode
- implements RestrictedType<UnsignedByte>
-
- {
-
-
-
+public class SaslCode implements RestrictedType<UnsignedByte>
+{
private final UnsignedByte _val;
-
public static final SaslCode OK = new SaslCode(UnsignedByte.valueOf((byte) 0));
-
+
public static final SaslCode AUTH = new SaslCode(UnsignedByte.valueOf((byte) 1));
-
+
public static final SaslCode SYS = new SaslCode(UnsignedByte.valueOf((byte) 2));
-
+
public static final SaslCode SYS_PERM = new SaslCode(UnsignedByte.valueOf((byte) 3));
-
- public static final SaslCode SYS_TEMP = new SaslCode(UnsignedByte.valueOf((byte) 4));
-
+ public static final SaslCode SYS_TEMP = new SaslCode(UnsignedByte.valueOf((byte) 4));
private SaslCode(UnsignedByte val)
{
@@ -63,32 +55,31 @@ public class SaslCode
@Override
public String toString()
{
-
- if(this == OK)
+ if (this == OK)
{
return "ok";
}
-
- if(this == AUTH)
+
+ if (this == AUTH)
{
return "auth";
}
-
- if(this == SYS)
+
+ if (this == SYS)
{
return "sys";
}
-
- if(this == SYS_PERM)
+
+ if (this == SYS_PERM)
{
return "sys-perm";
}
-
- if(this == SYS_TEMP)
+
+ if (this == SYS_TEMP)
{
return "sys-temp";
}
-
+
else
{
return String.valueOf(_val);
@@ -99,35 +90,32 @@ public class SaslCode
{
UnsignedByte val = (UnsignedByte) obj;
- if(OK._val.equals(val))
+ if (OK._val.equals(val))
{
return OK;
}
-
- if(AUTH._val.equals(val))
+
+ if (AUTH._val.equals(val))
{
return AUTH;
}
-
- if(SYS._val.equals(val))
+
+ if (SYS._val.equals(val))
{
return SYS;
}
-
- if(SYS_PERM._val.equals(val))
+
+ if (SYS_PERM._val.equals(val))
{
return SYS_PERM;
}
-
- if(SYS_TEMP._val.equals(val))
+
+ if (SYS_TEMP._val.equals(val))
{
return SYS_TEMP;
}
-
+
// TODO ERROR
return null;
}
-
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslInit.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslInit.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslInit.java
index 54d02e0..a7ff3d4 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslInit.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslInit.java
@@ -25,22 +25,23 @@ package org.apache.qpid.server.protocol.v1_0.type.security;
import org.apache.qpid.server.protocol.v1_0.SASLEndpoint;
+import org.apache.qpid.server.protocol.v1_0.type.Binary;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.type.SaslFrameBody;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+@CompositeType( symbolicDescriptor = "amqp:sasl-init:list", numericDescriptor = 0x0000000000000041L)
+public class SaslInit implements SaslFrameBody
+{
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class SaslInit
- implements SaslFrameBody
- {
-
-
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true)
private Symbol _mechanism;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private Binary _initialResponse;
- @CompositeTypeField
+ @CompositeTypeField(index = 2)
private String _hostname;
public Symbol getMechanism()
@@ -79,27 +80,27 @@ public class SaslInit
StringBuilder builder = new StringBuilder("SaslInit{");
final int origLength = builder.length();
- if(_mechanism != null)
+ if (_mechanism != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("mechanism=").append(_mechanism);
}
- if(_initialResponse != null)
+ if (_initialResponse != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("initialResponse=").append(_initialResponse);
}
- if(_hostname != null)
+ if (_hostname != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -115,6 +116,4 @@ public class SaslInit
{
conn.receiveSaslInit(this);
}
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslMechanisms.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslMechanisms.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslMechanisms.java
index 3817839..350bfdd 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslMechanisms.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslMechanisms.java
@@ -25,17 +25,17 @@ package org.apache.qpid.server.protocol.v1_0.type.security;
import java.util.Arrays;
+
import org.apache.qpid.server.protocol.v1_0.SASLEndpoint;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.SaslFrameBody;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
-public class SaslMechanisms
- implements SaslFrameBody
- {
-
-
- @CompositeTypeField(mandatory = true)
+@CompositeType( symbolicDescriptor = "amqp:sasl-mechanisms:list", numericDescriptor = 0x0000000000000040L)
+public class SaslMechanisms implements SaslFrameBody
+{
+ @CompositeTypeField(index = 0, mandatory = true)
private Symbol[] _saslServerMechanisms;
public Symbol[] getSaslServerMechanisms()
@@ -54,9 +54,9 @@ public class SaslMechanisms
StringBuilder builder = new StringBuilder("SaslMechanisms{");
final int origLength = builder.length();
- if(_saslServerMechanisms != null)
+ if (_saslServerMechanisms != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -72,6 +72,4 @@ public class SaslMechanisms
{
conn.receiveSaslMechanisms(this);
}
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslOutcome.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslOutcome.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslOutcome.java
index 9c1c3b7..aeb1c57 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslOutcome.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslOutcome.java
@@ -25,19 +25,18 @@ package org.apache.qpid.server.protocol.v1_0.type.security;
import org.apache.qpid.server.protocol.v1_0.SASLEndpoint;
-
-
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class SaslOutcome
- implements SaslFrameBody
- {
-
-
- @CompositeTypeField(mandatory = true)
+import org.apache.qpid.server.protocol.v1_0.type.Binary;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.type.SaslFrameBody;
+
+@CompositeType( symbolicDescriptor = "amqp:sasl-outcome:list", numericDescriptor = 0x0000000000000044L)
+public class SaslOutcome implements SaslFrameBody
+{
+ @CompositeTypeField(index = 0, mandatory = true)
private SaslCode _code;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private Binary _additionalData;
public SaslCode getCode()
@@ -66,18 +65,18 @@ public class SaslOutcome
StringBuilder builder = new StringBuilder("SaslOutcome{");
final int origLength = builder.length();
- if(_code != null)
+ if (_code != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("code=").append(_code);
}
- if(_additionalData != null)
+ if (_additionalData != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -93,6 +92,4 @@ public class SaslOutcome
{
conn.receiveSaslOutcome(this);
}
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslResponse.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslResponse.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslResponse.java
index 848ff1b..9679168 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslResponse.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/SaslResponse.java
@@ -25,16 +25,15 @@ package org.apache.qpid.server.protocol.v1_0.type.security;
import org.apache.qpid.server.protocol.v1_0.SASLEndpoint;
-
-
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class SaslResponse
- implements SaslFrameBody
- {
-
-
- @CompositeTypeField(mandatory = true)
+import org.apache.qpid.server.protocol.v1_0.type.Binary;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.type.SaslFrameBody;
+
+@CompositeType( symbolicDescriptor = "amqp:sasl-response:list", numericDescriptor = 0x0000000000000043L)
+public class SaslResponse implements SaslFrameBody
+{
+ @CompositeTypeField(index = 0, mandatory = true)
private Binary _response;
public Binary getResponse()
@@ -53,9 +52,9 @@ public class SaslResponse
StringBuilder builder = new StringBuilder("SaslResponse{");
final int origLength = builder.length();
- if(_response != null)
+ if (_response != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -71,6 +70,4 @@ public class SaslResponse
{
conn.receiveSaslResponse(this);
}
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeConstructor.java
deleted file mode 100644
index 3f1c93b..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeConstructor.java
+++ /dev/null
@@ -1,99 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.security.codec;
-
-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.security.*;
-
-
-import java.util.List;
-
-public class SaslChallengeConstructor extends AbstractDescribedTypeConstructor<SaslChallenge>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:sasl-challenge:list"),UnsignedLong.valueOf(0x0000000000000042L),
- };
-
- private static final SaslChallengeConstructor INSTANCE = new SaslChallengeConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public SaslChallenge construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- SaslChallenge obj = new SaslChallenge();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setChallenge( (Binary) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitConstructor.java
deleted file mode 100644
index bb0a882..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitConstructor.java
+++ /dev/null
@@ -1,153 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.security.codec;
-
-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.security.*;
-
-
-import java.util.List;
-
-public class SaslInitConstructor extends AbstractDescribedTypeConstructor<SaslInit>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:sasl-init:list"),UnsignedLong.valueOf(0x0000000000000041L),
- };
-
- private static final SaslInitConstructor INSTANCE = new SaslInitConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public SaslInit construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- SaslInit obj = new SaslInit();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setMechanism( (Symbol) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setInitialResponse( (Binary) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setHostname( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsConstructor.java
deleted file mode 100644
index 7af4d03..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsConstructor.java
+++ /dev/null
@@ -1,106 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.security.codec;
-
-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.security.*;
-
-
-import java.util.List;
-
-public class SaslMechanismsConstructor extends AbstractDescribedTypeConstructor<SaslMechanisms>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:sasl-mechanisms:list"),UnsignedLong.valueOf(0x0000000000000040L),
- };
-
- private static final SaslMechanismsConstructor INSTANCE = new SaslMechanismsConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public SaslMechanisms construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- SaslMechanisms obj = new SaslMechanisms();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setSaslServerMechanisms( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setSaslServerMechanisms( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeConstructor.java
deleted file mode 100644
index eb8b0fd..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeConstructor.java
+++ /dev/null
@@ -1,126 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.security.codec;
-
-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.security.*;
-
-
-import java.util.List;
-
-public class SaslOutcomeConstructor extends AbstractDescribedTypeConstructor<SaslOutcome>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:sasl-outcome:list"),UnsignedLong.valueOf(0x0000000000000044L),
- };
-
- private static final SaslOutcomeConstructor INSTANCE = new SaslOutcomeConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public SaslOutcome construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- SaslOutcome obj = new SaslOutcome();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setCode( SaslCode.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setAdditionalData( (Binary) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseConstructor.java
deleted file mode 100644
index 14ab4aa..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseConstructor.java
+++ /dev/null
@@ -1,99 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.security.codec;
-
-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.security.*;
-
-
-import java.util.List;
-
-public class SaslResponseConstructor extends AbstractDescribedTypeConstructor<SaslResponse>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:sasl-response:list"),UnsignedLong.valueOf(0x0000000000000043L),
- };
-
- private static final SaslResponseConstructor INSTANCE = new SaslResponseConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public SaslResponse construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- SaslResponse obj = new SaslResponse();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setResponse( (Binary) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Coordinator.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Coordinator.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Coordinator.java
index 09182d6..a0f33ab 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Coordinator.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Coordinator.java
@@ -24,17 +24,17 @@
package org.apache.qpid.server.protocol.v1_0.type.transaction;
-
import java.util.Arrays;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.type.BaseTarget;
+import org.apache.qpid.server.protocol.v1_0.type.TxnCapability;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class Coordinator
- implements BaseTarget
- {
-
-
+@CompositeType(symbolicDescriptor = "amqp:coordinator:list", numericDescriptor = 0x0000000000000030L)
+public class Coordinator implements BaseTarget
+{
+ @CompositeTypeField(index = 0, deserializationConverter = "org.apache.qpid.server.protocol.v1_0.DeserializationFactories.convertToTxnCapability")
private TxnCapability[] _capabilities;
public TxnCapability[] getCapabilities()
@@ -53,9 +53,9 @@ public class Coordinator
StringBuilder builder = new StringBuilder("Coordinator{");
final int origLength = builder.length();
- if(_capabilities != null)
+ if (_capabilities != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -65,6 +65,4 @@ public class Coordinator
builder.append('}');
return builder.toString();
}
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declare.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declare.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declare.java
index 95b983a..42f5006 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declare.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declare.java
@@ -24,13 +24,14 @@
package org.apache.qpid.server.protocol.v1_0.type.transaction;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.type.GlobalTxId;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
+@CompositeType( symbolicDescriptor = "amqp:declare:list", numericDescriptor = 0x0000000000000031L)
public class Declare
- {
-
-
+{
+ @CompositeTypeField(index = 0)
private GlobalTxId _globalId;
public GlobalTxId getGlobalId()
@@ -49,9 +50,9 @@ public class Declare
StringBuilder builder = new StringBuilder("Declare{");
final int origLength = builder.length();
- if(_globalId != null)
+ if (_globalId != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -61,6 +62,4 @@ public class Declare
builder.append('}');
return builder.toString();
}
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declared.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declared.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declared.java
index a9b9343..2aac59d 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declared.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Declared.java
@@ -25,15 +25,17 @@ package org.apache.qpid.server.protocol.v1_0.type.transaction;
import org.apache.qpid.server.protocol.v1_0.type.Binary;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.Outcome;
import org.apache.qpid.server.protocol.v1_0.type.Symbol;
+@CompositeType( symbolicDescriptor = "amqp:declared:list", numericDescriptor = 0x0000000000000033L)
public class Declared implements Outcome
{
public static final Symbol DECLARED_SYMBOL = Symbol.valueOf("amqp:declared:list");
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true)
private Binary _txnId;
public Binary getTxnId()
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Discharge.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Discharge.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Discharge.java
index 16a055e..f74c813 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Discharge.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/Discharge.java
@@ -24,17 +24,17 @@
package org.apache.qpid.server.protocol.v1_0.type.transaction;
+import org.apache.qpid.server.protocol.v1_0.type.Binary;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
+@CompositeType( symbolicDescriptor = "amqp:discharge:list", numericDescriptor = 0x0000000000000032L)
public class Discharge
- {
-
-
- @CompositeTypeField(mandatory = true)
+{
+ @CompositeTypeField(index = 0, mandatory = true)
private Binary _txnId;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private Boolean _fail;
public Binary getTxnId()
@@ -63,18 +63,18 @@ public class Discharge
StringBuilder builder = new StringBuilder("Discharge{");
final int origLength = builder.length();
- if(_txnId != null)
+ if (_txnId != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
builder.append("txnId=").append(_txnId);
}
- if(_fail != null)
+ if (_fail != null)
{
- if(builder.length() != origLength)
+ if (builder.length() != origLength)
{
builder.append(',');
}
@@ -84,6 +84,4 @@ public class Discharge
builder.append('}');
return builder.toString();
}
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionErrors.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionErrors.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionErrors.java
index b065585..5297f8f 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionErrors.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionErrors.java
@@ -1,4 +1,3 @@
-
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,31 +18,25 @@
* under the License.
*
*/
-
-
package org.apache.qpid.server.protocol.v1_0.type.transaction;
+import org.apache.qpid.server.protocol.v1_0.type.ErrorCondition;
+import org.apache.qpid.server.protocol.v1_0.type.RestrictedType;
+import org.apache.qpid.server.protocol.v1_0.type.Symbol;
-import org.apache.qpid.server.protocol.v1_0.type.*;
-
-public class TransactionErrors
- implements ErrorCondition, RestrictedType<Symbol>
-
- {
-
-
-
+public class TransactionErrors implements ErrorCondition, RestrictedType<Symbol>
+{
private final Symbol _val;
-
- public static final TransactionErrors UNKNOWN_ID = new TransactionErrors(Symbol.valueOf("amqp:transaction:unknown-id"));
-
- public static final TransactionErrors TRANSACTION_ROLLBACK = new TransactionErrors(Symbol.valueOf("amqp:transaction:rollback"));
-
- public static final TransactionErrors TRANSACTION_TIMEOUT = new TransactionErrors(Symbol.valueOf("amqp:transaction:timeout"));
-
+ public static final TransactionErrors UNKNOWN_ID =
+ new TransactionErrors(Symbol.valueOf("amqp:transaction:unknown-id"));
+ public static final TransactionErrors TRANSACTION_ROLLBACK =
+ new TransactionErrors(Symbol.valueOf("amqp:transaction:rollback"));
+
+ public static final TransactionErrors TRANSACTION_TIMEOUT =
+ new TransactionErrors(Symbol.valueOf("amqp:transaction:timeout"));
private TransactionErrors(Symbol val)
{
@@ -59,22 +52,21 @@ public class TransactionErrors
@Override
public String toString()
{
-
- if(this == UNKNOWN_ID)
+ if (this == UNKNOWN_ID)
{
return "unknown-id";
}
-
- if(this == TRANSACTION_ROLLBACK)
+
+ if (this == TRANSACTION_ROLLBACK)
{
return "transaction-rollback";
}
-
- if(this == TRANSACTION_TIMEOUT)
+
+ if (this == TRANSACTION_TIMEOUT)
{
return "transaction-timeout";
}
-
+
else
{
return String.valueOf(_val);
@@ -85,25 +77,21 @@ public class TransactionErrors
{
Symbol val = (Symbol) obj;
- if(UNKNOWN_ID._val.equals(val))
+ if (UNKNOWN_ID._val.equals(val))
{
return UNKNOWN_ID;
}
-
- if(TRANSACTION_ROLLBACK._val.equals(val))
+
+ if (TRANSACTION_ROLLBACK._val.equals(val))
{
return TRANSACTION_ROLLBACK;
}
-
- if(TRANSACTION_TIMEOUT._val.equals(val))
+
+ if (TRANSACTION_TIMEOUT._val.equals(val))
{
return TRANSACTION_TIMEOUT;
}
-
- // TODO ERROR
+
return null;
}
-
-
-
- }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionalState.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionalState.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionalState.java
index 20db2a1..226d265 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionalState.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/TransactionalState.java
@@ -25,16 +25,18 @@ package org.apache.qpid.server.protocol.v1_0.type.transaction;
import org.apache.qpid.server.protocol.v1_0.type.Binary;
-import org.apache.qpid.server.protocol.v1_0.type.CompositeTypeField;
+import org.apache.qpid.server.protocol.v1_0.CompositeType;
+import org.apache.qpid.server.protocol.v1_0.CompositeTypeField;
import org.apache.qpid.server.protocol.v1_0.type.DeliveryState;
import org.apache.qpid.server.protocol.v1_0.type.Outcome;
+@CompositeType( symbolicDescriptor = "amqp:transactional-state:list", numericDescriptor = 0x0000000000000034L)
public class TransactionalState implements DeliveryState
{
- @CompositeTypeField(mandatory = true)
+ @CompositeTypeField(index = 0, mandatory = true)
private Binary _txnId;
- @CompositeTypeField
+ @CompositeTypeField(index = 1)
private Outcome _outcome;
public Binary getTxnId()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[12/12] qpid-broker-j git commit: QPID-7531: [Java Broker,
AMQP 1.0] Fix detection of GZIP compression in Message Conversion for
AMQP 1.0
Posted by lq...@apache.org.
QPID-7531: [Java Broker, AMQP 1.0] Fix detection of GZIP compression in Message Conversion for AMQP 1.0
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/2632d13e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/2632d13e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/2632d13e
Branch: refs/heads/master
Commit: 2632d13e9888facfa619c75c754801ea1556ec23
Parents: 6a26717
Author: Lorenz Quack <lq...@apache.org>
Authored: Mon Sep 25 11:16:24 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100
----------------------------------------------------------------------
.../apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/2632d13e/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
index 6d4b653..eab7093 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
@@ -366,7 +366,7 @@ public abstract class MessageConverter_to_1_0<M extends ServerMessage> implement
}
byte[] uncompressed;
- if(Symbol.valueOf(GZIPUtils.GZIP_CONTENT_ENCODING).equals(serverMessage.getMessageHeader().getEncoding())
+ if(GZIPUtils.GZIP_CONTENT_ENCODING.equals(serverMessage.getMessageHeader().getEncoding())
&& (uncompressed = GZIPUtils.uncompressBufferToArray(ByteBuffer.wrap(data))) != null)
{
data = uncompressed;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[06/12] qpid-broker-j git commit: QPID-7932: [Java Broker,
AMQP 1.0] Improve error handling when deserializing composite types
Posted by lq...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndConstructor.java
deleted file mode 100644
index 6bc3958..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndConstructor.java
+++ /dev/null
@@ -1,99 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-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.transport.*;
-
-
-import java.util.List;
-
-public class EndConstructor extends AbstractDescribedTypeConstructor<End>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:end:list"),UnsignedLong.valueOf(0x0000000000000017L),
- };
-
- private static final EndConstructor INSTANCE = new EndConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public End construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- End obj = new End();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setError( (org.apache.qpid.server.protocol.v1_0.type.transport.Error) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorConstructor.java
deleted file mode 100644
index cbbbf78..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorConstructor.java
+++ /dev/null
@@ -1,224 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-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.transaction.TransactionErrors;
-import org.apache.qpid.server.protocol.v1_0.type.transport.*;
-import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
-
-
-import java.util.List;
-import java.util.Map;
-
-public class ErrorConstructor extends AbstractDescribedTypeConstructor<Error>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:error:list"),UnsignedLong.valueOf(0x000000000000001dL),
- };
-
- private static final ErrorConstructor INSTANCE = new ErrorConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public org.apache.qpid.server.protocol.v1_0.type.transport.Error construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- org.apache.qpid.server.protocol.v1_0.type.transport.Error obj = new org.apache.qpid.server.protocol.v1_0.type.transport.Error();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
- if(val instanceof ErrorCondition)
- {
- obj.setCondition( (ErrorCondition) val );
- }
- else if(val instanceof Symbol)
- {
- ErrorCondition condition = null;
- condition = AmqpError.valueOf(val);
- if(condition == null)
- {
- condition = ConnectionError.valueOf(val);
- if(condition == null)
- {
- condition = SessionError.valueOf(val);
- if(condition == null)
- {
- condition = LinkError.valueOf(val);
- if(condition == null)
- {
- condition = TransactionErrors.valueOf(val);
- if(condition == null)
- {
- condition = new UnknownErrorCondition((Symbol)val);
- }
- }
- }
- }
- }
- obj.setCondition(condition);
- }
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDescription( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setInfo( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
- private static final class UnknownErrorCondition implements ErrorCondition
- {
- private final Symbol _value;
-
- public UnknownErrorCondition(final Symbol value)
- {
- _value = value;
- }
-
- @Override
- public Symbol getValue()
- {
- return _value;
- }
-
- @Override
- public boolean equals(final Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o == null || getClass() != o.getClass())
- {
- return false;
- }
-
- final UnknownErrorCondition that = (UnknownErrorCondition) o;
-
- if (!_value.equals(that._value))
- {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- return _value.hashCode();
- }
-
- @Override
- public String toString()
- {
- return _value.toString();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowConstructor.java
deleted file mode 100644
index 6031f11..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowConstructor.java
+++ /dev/null
@@ -1,370 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-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.transport.*;
-
-
-import java.util.List;
-import java.util.Map;
-
-public class FlowConstructor extends AbstractDescribedTypeConstructor<Flow>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:flow:list"),UnsignedLong.valueOf(0x0000000000000013L),
- };
-
- private static final FlowConstructor INSTANCE = new FlowConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Flow construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Flow obj = new Flow();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setNextIncomingId( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setIncomingWindow( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setNextOutgoingId( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setOutgoingWindow( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setHandle( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDeliveryCount( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setLinkCredit( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setAvailable( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDrain( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setEcho( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setProperties( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenConstructor.java
deleted file mode 100644
index 3716690..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenConstructor.java
+++ /dev/null
@@ -1,373 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-import java.util.List;
-import java.util.Map;
-
-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.UnsignedInteger;
-import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
-import org.apache.qpid.server.protocol.v1_0.type.UnsignedShort;
-import org.apache.qpid.server.protocol.v1_0.type.transport.Open;
-
-public class OpenConstructor extends AbstractDescribedTypeConstructor<Open>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:open:list"),UnsignedLong.valueOf(0x0000000000000010L),
- };
-
- private static final OpenConstructor INSTANCE = new OpenConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Open construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Open obj = new Open();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setContainerId( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setHostname( (String) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setMaxFrameSize( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setChannelMax( (UnsignedShort) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setIdleTimeOut( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setOutgoingLocales( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setOutgoingLocales( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setIncomingLocales( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setIncomingLocales( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setOfferedCapabilities( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setOfferedCapabilities( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
-
- if (val instanceof Symbol[] )
- {
- obj.setDesiredCapabilities( (Symbol[]) val );
- }
- else
- {
- try
- {
- obj.setDesiredCapabilities( new Symbol[] { (Symbol) val } );
- }
- catch(ClassCastException e)
- {
- // TODO Error
- }
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setProperties( (Map) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferConstructor.java
deleted file mode 100644
index cfe641c..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferConstructor.java
+++ /dev/null
@@ -1,369 +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.
-*
-*/
-
-
-package org.apache.qpid.server.protocol.v1_0.type.transport.codec;
-
-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.transport.*;
-
-
-import java.util.List;
-
-public class TransferConstructor extends AbstractDescribedTypeConstructor<Transfer>
-{
- private static final Object[] DESCRIPTORS =
- {
- Symbol.valueOf("amqp:transfer:list"),UnsignedLong.valueOf(0x0000000000000014L),
- };
-
- private static final TransferConstructor INSTANCE = new TransferConstructor();
-
- public static void register(DescribedTypeConstructorRegistry registry)
- {
- for(Object descriptor : DESCRIPTORS)
- {
- registry.register(descriptor, INSTANCE);
- }
- }
-
- @Override
- public Transfer construct(Object underlying)
- {
- if(underlying instanceof List)
- {
- List list = (List) underlying;
- Transfer obj = new Transfer();
- int position = 0;
- final int size = list.size();
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setHandle( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDeliveryId( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setDeliveryTag( (Binary) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setMessageFormat( (UnsignedInteger) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setSettled( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setMore( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setRcvSettleMode( ReceiverSettleMode.valueOf( val ) );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setState( (DeliveryState) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setResume( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setAborted( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
- if(position < size)
- {
- Object val = list.get(position);
- position++;
-
- if(val != null)
- {
-
- try
- {
- obj.setBatchable( (Boolean) val );
- }
- catch(ClassCastException e)
- {
-
- // TODO Error
- }
-
- }
-
-
- }
- else
- {
- return obj;
- }
-
-
- return obj;
- }
- else
- {
- // TODO - error
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/store/LinkStoreTestCase.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/store/LinkStoreTestCase.java b/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/store/LinkStoreTestCase.java
index 2f0e1db..06e058e 100644
--- a/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/store/LinkStoreTestCase.java
+++ b/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/store/LinkStoreTestCase.java
@@ -64,7 +64,7 @@ public abstract class LinkStoreTestCase extends QpidTestCase
_source.setDurable(TerminusDurability.UNSETTLED_STATE);
_source.setDynamic(Boolean.TRUE);
_source.setExpiryPolicy(TerminusExpiryPolicy.CONNECTION_CLOSE);
- _source.setFilter(Collections.singletonMap("foo", NoLocalFilter.INSTANCE));
+ _source.setFilter(Collections.singletonMap(Symbol.valueOf("foo"), NoLocalFilter.INSTANCE));
_source.setOutcomes(new Accepted().getSymbol());
_source.setDynamicNodeProperties(Collections.singletonMap(Symbol.valueOf("dynamicProperty"),
"dynamicPropertyValue"));
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/DecodeErrorTest.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/DecodeErrorTest.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/DecodeErrorTest.java
new file mode 100644
index 0000000..8cc6f92
--- /dev/null
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/DecodeErrorTest.java
@@ -0,0 +1,196 @@
+/*
+ * 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.tests.protocol.v1_0;
+
+import static org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError.DECODE_ERROR;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.fail;
+
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.server.protocol.v1_0.codec.StringWriter;
+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.messaging.DeliveryAnnotations;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotationsSection;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.Header;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.HeaderSection;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.Source;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.Target;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Attach;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Begin;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Close;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Detach;
+import org.apache.qpid.server.protocol.v1_0.type.transport.End;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Flow;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Open;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Role;
+import org.apache.qpid.tests.utils.BrokerAdmin;
+import org.apache.qpid.tests.utils.BrokerAdminUsingTestBase;
+
+public class DecodeErrorTest extends BrokerAdminUsingTestBase
+{
+ private InetSocketAddress _brokerAddress;
+
+ @Before
+ public void setUp()
+ {
+ _brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
+ getBrokerAdmin().createQueue(BrokerAdmin.TEST_QUEUE_NAME);
+ }
+
+ @Test
+ @SpecificationTest(section = "3.2",
+ description = "Altogether a message consists of the following sections: Zero or one header,"
+ + " Zero or one delivery-annotations, [...]")
+ public void illegalMessageFormatPayload() throws Exception
+ {
+ try (FrameTransport transport = new FrameTransport(_brokerAddress).connect())
+ {
+
+ List<QpidByteBuffer> combinedPayload = new ArrayList<>();
+ final HeaderSection headerSection = new Header().createEncodingRetainingSection();
+ combinedPayload.addAll(headerSection.getEncodedForm());
+ headerSection.dispose();
+ final StringWriter stringWriter = new StringWriter("string in between annotation sections");
+ QpidByteBuffer encodedString = QpidByteBuffer.allocate(stringWriter.getEncodedSize());
+ stringWriter.writeToBuffer(encodedString);
+ encodedString.flip();
+ combinedPayload.add(encodedString);
+ final DeliveryAnnotationsSection
+ deliveryAnnotationsSection =
+ new DeliveryAnnotations(Collections.emptyMap()).createEncodingRetainingSection();
+ combinedPayload.addAll(deliveryAnnotationsSection.getEncodedForm());
+ deliveryAnnotationsSection.dispose();
+
+ final Detach detachResponse = transport.newInteraction()
+ .negotiateProtocol().consumeResponse()
+ .open().consumeResponse(Open.class)
+ .begin().consumeResponse(Begin.class)
+ .attachRole(Role.SENDER)
+ .attachTargetAddress(BrokerAdmin.TEST_QUEUE_NAME)
+ .attach().consumeResponse(Attach.class)
+ .consumeResponse(Flow.class)
+ .transferMessageFormat(UnsignedInteger.ZERO)
+ .transferPayload(combinedPayload)
+ .transfer()
+ .consumeResponse()
+ .getLatestResponse(Detach.class);
+ assertThat(detachResponse.getError(), is(notNullValue()));
+ assertThat(detachResponse.getError().getCondition(), is(equalTo(DECODE_ERROR)));
+ }
+ }
+
+ @Test
+ @SpecificationTest(section = "3.5.9",
+ description = "The value of this entry MUST be of a type which provides the lifetime-policy archetype.")
+ public void nodePropertiesLifetimePolicy() throws Exception
+ {
+ try (FrameTransport transport = new FrameTransport(_brokerAddress).connect())
+ {
+ final Source source = new Source();
+ source.setDynamic(Boolean.TRUE);
+ source.setDynamicNodeProperties(Collections.singletonMap(Symbol.valueOf("lifetime-policy"),
+ UnsignedInteger.MAX_VALUE));
+ final Response<?> latestResponse = transport.newInteraction()
+ .negotiateProtocol().consumeResponse()
+ .open().consumeResponse(Open.class)
+ .begin().consumeResponse(Begin.class)
+ .attachSource(source)
+ .attachRole(Role.SENDER)
+ .attach().consumeResponse()
+ .getLatestResponse();
+
+ assertThat(latestResponse, is(notNullValue()));
+ final Object responseBody = latestResponse.getBody();
+ final Error error;
+ if (responseBody instanceof End)
+ {
+ error = ((End) responseBody).getError();
+ }
+ else if (responseBody instanceof Close)
+ {
+ error = ((Close) responseBody).getError();
+ }
+ else
+ {
+ fail(String.format("Expected response of either Detach, End, or Close. Got '%s'", responseBody));
+ error = null;
+ }
+
+ assertThat(error, is(notNullValue()));
+ assertThat(error.getCondition(), is(equalTo(DECODE_ERROR)));
+ }
+ }
+
+ @Test
+ @SpecificationTest(section = "3.5.9",
+ description = "The value of this entry MUST be of a type which provides the lifetime-policy archetype.")
+ public void nodePropertiesSupportedDistributionModes() throws Exception
+ {
+ try (FrameTransport transport = new FrameTransport(_brokerAddress).connect())
+ {
+ final Target target = new Target();
+ target.setDynamic(Boolean.TRUE);
+ target.setDynamicNodeProperties(Collections.singletonMap(Symbol.valueOf("supported-dist-modes"),
+ UnsignedInteger.ZERO));
+ final Response<?> latestResponse = transport.newInteraction()
+ .negotiateProtocol().consumeResponse()
+ .open().consumeResponse(Open.class)
+ .begin().consumeResponse(Begin.class)
+ .attachTarget(target)
+ .attachRole(Role.SENDER)
+ .attach().consumeResponse()
+ .getLatestResponse();
+
+ assertThat(latestResponse, is(notNullValue()));
+ final Object responseBody = latestResponse.getBody();
+ final Error error;
+ if (responseBody instanceof End)
+ {
+ error = ((End) responseBody).getError();
+ }
+ else if (responseBody instanceof Close)
+ {
+ error = ((Close) responseBody).getError();
+ }
+ else
+ {
+ fail(String.format("Expected response of either Detach, End, or Close. Got '%s'", responseBody));
+ error = null;
+ }
+
+ assertThat(error, is(notNullValue()));
+ assertThat(error.getCondition(), is(equalTo(DECODE_ERROR)));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a267175/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
index b9148aa..6a373d1 100644
--- a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
@@ -20,28 +20,19 @@
package org.apache.qpid.tests.protocol.v1_0.messaging;
-import static org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError.DECODE_ERROR;
-import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.fail;
import java.net.InetSocketAddress;
-import java.util.ArrayList;
import java.util.Collections;
-import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v1_0.codec.StringWriter;
import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotations;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotationsSection;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.Header;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.HeaderSection;
import org.apache.qpid.server.protocol.v1_0.type.transport.Attach;
import org.apache.qpid.server.protocol.v1_0.type.transport.Begin;
import org.apache.qpid.server.protocol.v1_0.type.transport.Close;
@@ -128,44 +119,4 @@ public class MessageFormat extends BrokerAdminUsingTestBase
assertThat(error, is(notNullValue()));
}
}
-
- @Test
- @SpecificationTest(section = "3.2",
- description = "Altogether a message consists of the following sections: Zero or one header,"
- + " Zero or one delivery-annotations, [...]")
- public void illegalMessageFormatPayload() throws Exception
- {
- try (FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
-
- List<QpidByteBuffer> combinedPayload = new ArrayList<>();
- final HeaderSection headerSection = new Header().createEncodingRetainingSection();
- combinedPayload.addAll(headerSection.getEncodedForm());
- headerSection.dispose();
- final StringWriter stringWriter = new StringWriter("string in between annotation sections");
- QpidByteBuffer encodedString = QpidByteBuffer.allocate(stringWriter.getEncodedSize());
- stringWriter.writeToBuffer(encodedString);
- encodedString.flip();
- combinedPayload.add(encodedString);
- final DeliveryAnnotationsSection deliveryAnnotationsSection = new DeliveryAnnotations(Collections.emptyMap()).createEncodingRetainingSection();
- combinedPayload.addAll(deliveryAnnotationsSection.getEncodedForm());
- deliveryAnnotationsSection.dispose();
-
- final Detach detachResponse = transport.newInteraction()
- .negotiateProtocol().consumeResponse()
- .open().consumeResponse(Open.class)
- .begin().consumeResponse(Begin.class)
- .attachRole(Role.SENDER)
- .attachTargetAddress(BrokerAdmin.TEST_QUEUE_NAME)
- .attach().consumeResponse(Attach.class)
- .consumeResponse(Flow.class)
- .transferMessageFormat(UnsignedInteger.ZERO)
- .transferPayload(combinedPayload)
- .transfer()
- .consumeResponse()
- .getLatestResponse(Detach.class);
- assertThat(detachResponse.getError(), is(notNullValue()));
- assertThat(detachResponse.getError().getCondition(), is(equalTo(DECODE_ERROR)));
- }
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org