http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/NullElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/NullElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/NullElement.java deleted file mode 100644 index c5020f8..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/NullElement.java +++ /dev/null @@ -1,63 +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.proton.codec.impl; - -import java.nio.ByteBuffer; - -import org.apache.qpid.proton.codec.Data; - -class NullElement extends AtomicElement<Void> -{ - NullElement(Element parent, Element prev) - { - super(parent, prev); - } - - @Override - public int size() - { - return isElementOfArray() ? 0 : 1; - } - - @Override - public Void getValue() - { - return null; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.NULL; - } - - @Override - public int encode(ByteBuffer b) - { - if(b.hasRemaining() && !isElementOfArray()) - { - b.put((byte)0x40); - return 1; - } - return 0; - } -}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ShortElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ShortElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ShortElement.java deleted file mode 100644 index 60ae295..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ShortElement.java +++ /dev/null @@ -1,79 +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.proton.codec.impl; - -import java.nio.ByteBuffer; - -import org.apache.qpid.proton.codec.Data; - -class ShortElement extends AtomicElement<Short> -{ - - private final short _value; - - ShortElement(Element parent, Element prev, short s) - { - super(parent, prev); - _value = s; - } - - @Override - public int size() - { - return isElementOfArray() ? 2 : 3; - } - - @Override - public Short getValue() - { - return _value; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.SHORT; - } - - @Override - public int encode(ByteBuffer b) - { - if(isElementOfArray()) - { - if(b.remaining() >= 2) - { - b.putShort(_value); - return 2; - } - } - else - { - if(b.remaining()>=3) - { - b.put((byte)0x61); - b.putShort(_value); - return 3; - } - } - return 0; - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/StringElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/StringElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/StringElement.java deleted file mode 100644 index e3be671..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/StringElement.java +++ /dev/null @@ -1,136 +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.proton.codec.impl; - -import java.nio.ByteBuffer; -import java.nio.charset.Charset; - -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.codec.Data; - -class StringElement extends AtomicElement<String> -{ - - private static final Charset UTF_8 = Charset.forName("UTF-8"); - private final String _value; - - StringElement(Element parent, Element prev, String s) - { - super(parent, prev); - _value = s; - } - - @Override - public int size() - { - final int length = _value.getBytes(UTF_8).length; - - return size(length); - } - - private int size(int length) - { - if(isElementOfArray()) - { - final ArrayElement parent = (ArrayElement) parent(); - - if(parent.constructorType() == ArrayElement.SMALL) - { - if(length > 255) - { - parent.setConstructorType(ArrayElement.LARGE); - return 4+length; - } - else - { - return 1+length; - } - } - else - { - return 4+length; - } - } - else - { - if(length >255) - { - return 5 + length; - } - else - { - return 2 + length; - } - } - } - - @Override - public String getValue() - { - return _value; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.STRING; - } - - @Override - public int encode(ByteBuffer b) - { - final byte[] bytes = _value.getBytes(UTF_8); - final int length = bytes.length; - - int size = size(length); - if(b.remaining()<size) - { - return 0; - } - if(isElementOfArray()) - { - final ArrayElement parent = (ArrayElement) parent(); - - if(parent.constructorType() == ArrayElement.SMALL) - { - b.put((byte)length); - } - else - { - b.putInt(length); - } - } - else if(length<=255) - { - b.put((byte)0xa1); - b.put((byte)length); - } - else - { - b.put((byte)0xb1); - b.put((byte)length); - } - b.put(bytes); - return size; - - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/SymbolElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/SymbolElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/SymbolElement.java deleted file mode 100644 index 4b75b1a..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/SymbolElement.java +++ /dev/null @@ -1,129 +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.proton.codec.impl; - -import java.nio.ByteBuffer; -import java.nio.charset.Charset; - -import org.apache.qpid.proton.amqp.Binary; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.codec.Data; - -class SymbolElement extends AtomicElement<Symbol> -{ - - private static final Charset ASCII = Charset.forName("US-ASCII"); - private final Symbol _value; - - SymbolElement(Element parent, Element prev, Symbol s) - { - super(parent, prev); - _value = s; - } - - @Override - public int size() - { - final int length = _value.length(); - - if(isElementOfArray()) - { - final ArrayElement parent = (ArrayElement) parent(); - - if(parent.constructorType() == ArrayElement.SMALL) - { - if(length > 255) - { - parent.setConstructorType(ArrayElement.LARGE); - return 4+length; - } - else - { - return 1+length; - } - } - else - { - return 4+length; - } - } - else - { - if(length >255) - { - return 5 + length; - } - else - { - return 2 + length; - } - } - } - - @Override - public Symbol getValue() - { - return _value; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.SYMBOL; - } - - @Override - public int encode(ByteBuffer b) - { - int size = size(); - if(b.remaining()<size) - { - return 0; - } - if(isElementOfArray()) - { - final ArrayElement parent = (ArrayElement) parent(); - - if(parent.constructorType() == ArrayElement.SMALL) - { - b.put((byte)_value.length()); - } - else - { - b.putInt(_value.length()); - } - } - else if(_value.length()<=255) - { - b.put((byte)0xa3); - b.put((byte)_value.length()); - } - else - { - b.put((byte)0xb3); - b.put((byte)_value.length()); - } - b.put(_value.toString().getBytes(ASCII)); - return size; - - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/TimestampElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/TimestampElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/TimestampElement.java deleted file mode 100644 index a7123d2..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/TimestampElement.java +++ /dev/null @@ -1,74 +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.proton.codec.impl; - -import java.nio.ByteBuffer; -import java.util.Date; - -import org.apache.qpid.proton.codec.Data; - -class TimestampElement extends AtomicElement<Date> -{ - - private final Date _value; - - TimestampElement(Element parent, Element prev, Date d) - { - super(parent, prev); - _value = d; - } - - @Override - public int size() - { - return isElementOfArray() ? 8 : 9; - } - - @Override - public Date getValue() - { - return _value; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.TIMESTAMP; - } - - @Override - public int encode(ByteBuffer b) - { - int size = size(); - if(size > b.remaining()) - { - return 0; - } - if(size == 9) - { - b.put((byte)0x83); - } - b.putLong(_value.getTime()); - - return size; - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UUIDElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UUIDElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UUIDElement.java deleted file mode 100644 index b2f7f1b..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UUIDElement.java +++ /dev/null @@ -1,77 +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.proton.codec.impl; - -import java.nio.ByteBuffer; -import java.util.UUID; - -import org.apache.qpid.proton.codec.Data; - -class UUIDElement extends AtomicElement<UUID> -{ - - private final UUID _value; - - UUIDElement(Element parent, Element prev, UUID u) - { - super(parent, prev); - _value = u; - } - - @Override - public int size() - { - return isElementOfArray() ? 16 : 17; - } - - @Override - public UUID getValue() - { - return _value; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.UUID; - } - - @Override - public int encode(ByteBuffer b) - { - int size = size(); - if(b.remaining()>=size) - { - if(size == 17) - { - b.put((byte)0x98); - } - b.putLong(_value.getMostSignificantBits()); - b.putLong(_value.getLeastSignificantBits()); - return size; - } - else - { - return 0; - } - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedByteElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedByteElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedByteElement.java deleted file mode 100644 index 86b7a0b..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedByteElement.java +++ /dev/null @@ -1,80 +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.proton.codec.impl; - -import java.nio.ByteBuffer; - -import org.apache.qpid.proton.amqp.UnsignedByte; -import org.apache.qpid.proton.codec.Data; - -class UnsignedByteElement extends AtomicElement<UnsignedByte> -{ - - private final UnsignedByte _value; - - UnsignedByteElement(Element parent, Element prev, UnsignedByte ub) - { - super(parent, prev); - _value = ub; - } - - @Override - public int size() - { - return isElementOfArray() ? 1 : 2; - } - - @Override - public UnsignedByte getValue() - { - return _value; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.UBYTE; - } - - @Override - public int encode(ByteBuffer b) - { - if(isElementOfArray()) - { - if(b.hasRemaining()) - { - b.put(_value.byteValue()); - return 1; - } - } - else - { - if(b.remaining()>=2) - { - b.put((byte)0x50); - b.put(_value.byteValue()); - return 2; - } - } - return 0; - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedIntegerElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedIntegerElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedIntegerElement.java deleted file mode 100644 index 5268b70..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedIntegerElement.java +++ /dev/null @@ -1,125 +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.proton.codec.impl; - -import java.nio.ByteBuffer; - -import org.apache.qpid.proton.amqp.UnsignedInteger; -import org.apache.qpid.proton.codec.Data; - -class UnsignedIntegerElement extends AtomicElement<UnsignedInteger> -{ - - private final UnsignedInteger _value; - - UnsignedIntegerElement(Element parent, Element prev, UnsignedInteger i) - { - super(parent, prev); - _value = i; - } - - @Override - public int size() - { - if(isElementOfArray()) - { - final ArrayElement parent = (ArrayElement) parent(); - if(parent.constructorType() == ArrayElement.TINY) - { - if(_value.intValue() == 0) - { - return 0; - } - else - { - parent.setConstructorType(ArrayElement.SMALL); - } - } - - if(parent.constructorType() == ArrayElement.SMALL) - { - if(0 <= _value.intValue() && _value.intValue() <= 255) - { - return 1; - } - else - { - parent.setConstructorType(ArrayElement.LARGE); - } - } - - return 4; - - } - else - { - return 0 == _value.intValue() ? 1 : (1 <= _value.intValue() && _value.intValue() <= 255) ? 2 : 5; - } - - } - - @Override - public UnsignedInteger getValue() - { - return _value; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.UINT; - } - - @Override - public int encode(ByteBuffer b) - { - int size = size(); - if(size > b.remaining()) - { - return 0; - } - switch(size) - { - case 1: - if(isElementOfArray()) - { - b.put((byte)_value.intValue()); - } - else - { - b.put((byte)0x43); - } - break; - case 2: - b.put((byte)0x52); - b.put((byte)_value.intValue()); - break; - case 5: - b.put((byte)0x70); - case 4: - b.putInt(_value.intValue()); - - } - - return size; - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedLongElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedLongElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedLongElement.java deleted file mode 100644 index 9e5e1cf..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedLongElement.java +++ /dev/null @@ -1,125 +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.proton.codec.impl; - -import java.nio.ByteBuffer; - -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.codec.Data; - -class UnsignedLongElement extends AtomicElement<UnsignedLong> -{ - - private final UnsignedLong _value; - - UnsignedLongElement(Element parent, Element prev, UnsignedLong ul) - { - super(parent, prev); - _value = ul; - } - - @Override - public int size() - { - if(isElementOfArray()) - { - final ArrayElement parent = (ArrayElement) parent(); - if(parent.constructorType() == ArrayElement.TINY) - { - if(_value.longValue() == 0l) - { - return 0; - } - else - { - parent.setConstructorType(ArrayElement.SMALL); - } - } - - if(parent.constructorType() == ArrayElement.SMALL) - { - if(0l <= _value.longValue() && _value.longValue() <= 255l) - { - return 1; - } - else - { - parent.setConstructorType(ArrayElement.LARGE); - } - } - - return 8; - - } - else - { - return 0l == _value.longValue() ? 1 : (1l <= _value.longValue() && _value.longValue() <= 255l) ? 2 : 9; - } - - } - - @Override - public UnsignedLong getValue() - { - return _value; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.ULONG; - } - - @Override - public int encode(ByteBuffer b) - { - int size = size(); - if(size > b.remaining()) - { - return 0; - } - switch(size) - { - case 1: - if(isElementOfArray()) - { - b.put((byte)_value.longValue()); - } - else - { - b.put((byte)0x44); - } - break; - case 2: - b.put((byte)0x53); - b.put((byte)_value.longValue()); - break; - case 9: - b.put((byte)0x80); - case 8: - b.putLong(_value.longValue()); - - } - - return size; - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedShortElement.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedShortElement.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedShortElement.java deleted file mode 100644 index e003827..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedShortElement.java +++ /dev/null @@ -1,80 +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.proton.codec.impl; - -import java.nio.ByteBuffer; - -import org.apache.qpid.proton.amqp.UnsignedShort; -import org.apache.qpid.proton.codec.Data; - -class UnsignedShortElement extends AtomicElement<UnsignedShort> -{ - - private final UnsignedShort _value; - - UnsignedShortElement(Element parent, Element prev, UnsignedShort ub) - { - super(parent, prev); - _value = ub; - } - - @Override - public int size() - { - return isElementOfArray() ? 2 : 3; - } - - @Override - public UnsignedShort getValue() - { - return _value; - } - - @Override - public Data.DataType getDataType() - { - return Data.DataType.USHORT; - } - - @Override - public int encode(ByteBuffer b) - { - if(isElementOfArray()) - { - if(b.remaining()>=2) - { - b.putShort(_value.shortValue()); - return 2; - } - } - else - { - if(b.remaining()>=3) - { - b.put((byte)0x60); - b.putShort(_value.shortValue()); - return 3; - } - } - return 0; - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AcceptedType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AcceptedType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AcceptedType.java deleted file mode 100644 index 2da2d2b..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AcceptedType.java +++ /dev/null @@ -1,81 +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.proton.codec.messaging; - -import java.util.Collections; -import java.util.List; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Accepted; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - -public final class AcceptedType extends AbstractDescribedType<Accepted,List> implements DescribedTypeConstructor<Accepted> -{ - - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000024L), Symbol.valueOf("amqp:accepted:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000024L); - - - private AcceptedType(EncoderImpl encoder) - { - super(encoder); - } - - @Override - protected UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Accepted val) - { - return Collections.EMPTY_LIST; - } - - @Override - public Class<Accepted> getTypeClass() - { - return Accepted.class; - } - - public Accepted newInstance(Object described) - { - return Accepted.getInstance(); - } - - public static void register(Decoder decoder, EncoderImpl encoder) - { - AcceptedType type = new AcceptedType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSequenceType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSequenceType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSequenceType.java deleted file mode 100644 index 8844893..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSequenceType.java +++ /dev/null @@ -1,83 +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.proton.codec.messaging; - -import java.util.List; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.AmqpSequence; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class AmqpSequenceType extends AbstractDescribedType<AmqpSequence,List> implements DescribedTypeConstructor<AmqpSequence> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000076L), Symbol.valueOf("amqp:amqp-sequence:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000076L); - - private AmqpSequenceType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(AmqpSequence val) - { - return val.getValue(); - } - - public AmqpSequence newInstance(Object described) - { - return new AmqpSequence( (List) described ); - } - - public Class<AmqpSequence> getTypeClass() - { - return AmqpSequence.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - AmqpSequenceType type = new AmqpSequenceType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpValueType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpValueType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpValueType.java deleted file mode 100644 index d2dc8e1..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpValueType.java +++ /dev/null @@ -1,83 +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.proton.codec.messaging; - - -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.AmqpValue; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class AmqpValueType extends AbstractDescribedType<AmqpValue,Object> implements DescribedTypeConstructor<AmqpValue> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000077L), Symbol.valueOf("amqp:amqp-value:*"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000077L); - - private AmqpValueType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected Object wrap(AmqpValue val) - { - return val.getValue(); - } - - public AmqpValue newInstance(Object described) - { - return new AmqpValue( described ); - } - - public Class<AmqpValue> getTypeClass() - { - return AmqpValue.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - AmqpValueType type = new AmqpValueType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ApplicationPropertiesType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ApplicationPropertiesType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ApplicationPropertiesType.java deleted file mode 100644 index 5d0164a..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ApplicationPropertiesType.java +++ /dev/null @@ -1,84 +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.proton.codec.messaging; - -import java.util.Map; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.ApplicationProperties; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class ApplicationPropertiesType extends AbstractDescribedType<ApplicationProperties,Map> implements DescribedTypeConstructor<ApplicationProperties> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000074L), Symbol.valueOf("amqp:application-properties:map"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000074L); - - public ApplicationPropertiesType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected Map wrap(ApplicationProperties val) - { - return val.getValue(); - } - - - public ApplicationProperties newInstance(Object described) - { - return new ApplicationProperties( (Map) described ); - } - - public Class<ApplicationProperties> getTypeClass() - { - return ApplicationProperties.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - ApplicationPropertiesType type = new ApplicationPropertiesType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DataType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DataType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DataType.java deleted file mode 100644 index d7435c2..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DataType.java +++ /dev/null @@ -1,84 +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.proton.codec.messaging; - - -import org.apache.qpid.proton.amqp.Binary; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Data; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class DataType extends AbstractDescribedType<Data,Binary> implements DescribedTypeConstructor<Data> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000075L), Symbol.valueOf("amqp:data:binary"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000075L); - - private DataType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected Binary wrap(Data val) - { - return val.getValue(); - } - - public Data newInstance(Object described) - { - return new Data( (Binary) described ); - } - - public Class<Data> getTypeClass() - { - return Data.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DataType type = new DataType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnCloseType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnCloseType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnCloseType.java deleted file mode 100644 index 72e8d89..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnCloseType.java +++ /dev/null @@ -1,84 +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.proton.codec.messaging; - -import java.util.Collections; -import java.util.List; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.DeleteOnClose; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class DeleteOnCloseType extends AbstractDescribedType<DeleteOnClose,List> implements DescribedTypeConstructor<DeleteOnClose> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x000000000000002bL), Symbol.valueOf("amqp:delete-on-close:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002bL); - - private DeleteOnCloseType(EncoderImpl encoder) - { - super(encoder); - } - - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(DeleteOnClose val) - { - return Collections.EMPTY_LIST; - } - - public DeleteOnClose newInstance(Object described) - { - return DeleteOnClose.getInstance(); - } - - public Class<DeleteOnClose> getTypeClass() - { - return DeleteOnClose.class; - } - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DeleteOnCloseType type = new DeleteOnCloseType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksOrMessagesType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksOrMessagesType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksOrMessagesType.java deleted file mode 100644 index 9e0b46d..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksOrMessagesType.java +++ /dev/null @@ -1,83 +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.proton.codec.messaging; - -import java.util.Collections; -import java.util.List; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.DeleteOnNoLinksOrMessages; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class DeleteOnNoLinksOrMessagesType extends AbstractDescribedType<DeleteOnNoLinksOrMessages,List> implements DescribedTypeConstructor<DeleteOnNoLinksOrMessages> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x000000000000002eL), Symbol.valueOf("amqp:delete-on-no-links-or-messages:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002eL); - - private DeleteOnNoLinksOrMessagesType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(DeleteOnNoLinksOrMessages val) - { - return Collections.EMPTY_LIST; - } - - public DeleteOnNoLinksOrMessages newInstance(Object described) - { - return DeleteOnNoLinksOrMessages.getInstance(); - } - - public Class<DeleteOnNoLinksOrMessages> getTypeClass() - { - return DeleteOnNoLinksOrMessages.class; - } - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DeleteOnNoLinksOrMessagesType type = new DeleteOnNoLinksOrMessagesType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksType.java deleted file mode 100644 index f39f30a..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksType.java +++ /dev/null @@ -1,85 +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.proton.codec.messaging; - -import java.util.Collections; -import java.util.List; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.DeleteOnNoLinks; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - -public class DeleteOnNoLinksType extends AbstractDescribedType<DeleteOnNoLinks,List> implements DescribedTypeConstructor<DeleteOnNoLinks> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x000000000000002cL), Symbol.valueOf("amqp:delete-on-no-links:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002cL); - - private DeleteOnNoLinksType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(DeleteOnNoLinks val) - { - return Collections.EMPTY_LIST; - } - - @Override - public DeleteOnNoLinks newInstance(Object described) - { - return DeleteOnNoLinks.getInstance(); - } - - @Override - public Class<DeleteOnNoLinks> getTypeClass() - { - return DeleteOnNoLinks.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DeleteOnNoLinksType type = new DeleteOnNoLinksType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoMessagesType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoMessagesType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoMessagesType.java deleted file mode 100644 index 3ac7039..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoMessagesType.java +++ /dev/null @@ -1,84 +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.proton.codec.messaging; - -import java.util.Collections; -import java.util.List; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.DeleteOnNoMessages; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class DeleteOnNoMessagesType extends AbstractDescribedType<DeleteOnNoMessages,List> implements DescribedTypeConstructor<DeleteOnNoMessages> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x000000000000002dL), Symbol.valueOf("amqp:delete-on-no-messages:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002dL); - - private DeleteOnNoMessagesType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(DeleteOnNoMessages val) - { - return Collections.EMPTY_LIST; - } - - @Override - public DeleteOnNoMessages newInstance(Object described) - { - return DeleteOnNoMessages.getInstance(); - } - - @Override - public Class<DeleteOnNoMessages> getTypeClass() - { - return DeleteOnNoMessages.class; - } - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DeleteOnNoMessagesType type = new DeleteOnNoMessagesType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeliveryAnnotationsType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeliveryAnnotationsType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeliveryAnnotationsType.java deleted file mode 100644 index abd422d..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeliveryAnnotationsType.java +++ /dev/null @@ -1,84 +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.proton.codec.messaging; - -import java.util.Map; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.DeliveryAnnotations; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class DeliveryAnnotationsType extends AbstractDescribedType<DeliveryAnnotations,Map> implements DescribedTypeConstructor<DeliveryAnnotations> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000071L), Symbol.valueOf("amqp:delivery-annotations:map"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000071L); - - public DeliveryAnnotationsType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected Map wrap(DeliveryAnnotations val) - { - return val.getValue(); - } - - - public DeliveryAnnotations newInstance(Object described) - { - return new DeliveryAnnotations( (Map) described ); - } - - public Class<DeliveryAnnotations> getTypeClass() - { - return DeliveryAnnotations.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DeliveryAnnotationsType type = new DeliveryAnnotationsType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FooterType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FooterType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FooterType.java deleted file mode 100644 index a7c3237..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FooterType.java +++ /dev/null @@ -1,82 +0,0 @@ - -/* -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ - - -package org.apache.qpid.proton.codec.messaging; - -import java.util.Map; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Footer; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class FooterType extends AbstractDescribedType<Footer,Map> implements DescribedTypeConstructor<Footer> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000078L), Symbol.valueOf("amqp:footer:map"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000078L); - - public FooterType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected Map wrap(Footer val) - { - return val.getValue(); - } - - public Footer newInstance(Object described) - { - return new Footer( (Map) described ); - } - - public Class<Footer> getTypeClass() - { - return Footer.class; - } - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - FooterType type = new FooterType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/HeaderType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/HeaderType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/HeaderType.java deleted file mode 100644 index b7f5a43..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/HeaderType.java +++ /dev/null @@ -1,158 +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.proton.codec.messaging; - -import java.util.AbstractList; -import java.util.List; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedByte; -import org.apache.qpid.proton.amqp.UnsignedInteger; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Header; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class HeaderType extends AbstractDescribedType<Header,List> implements DescribedTypeConstructor<Header> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000070L), Symbol.valueOf("amqp:header:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000070L); - - public HeaderType(EncoderImpl encoder) - { - super(encoder); - } - - @Override - protected UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Header val) - { - return new HeaderWrapper(val); - } - - - public static final class HeaderWrapper extends AbstractList - { - private final Header _impl; - - public HeaderWrapper(Header impl) - { - _impl = impl; - } - - - @Override - public Object get(final int index) - { - - switch(index) - { - case 0: - return _impl.getDurable(); - case 1: - return _impl.getPriority(); - case 2: - return _impl.getTtl(); - case 3: - return _impl.getFirstAcquirer(); - case 4: - return _impl.getDeliveryCount(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _impl.getDeliveryCount() != null - ? 5 - : _impl.getFirstAcquirer() != null - ? 4 - : _impl.getTtl() != null - ? 3 - : _impl.getPriority() != null - ? 2 - : _impl.getDurable() != null - ? 1 - : 0; - - } - - - } - - public Header newInstance(Object described) - { - List l = (List) described; - - Header o = new Header(); - - - switch(5 - l.size()) - { - - case 0: - o.setDeliveryCount( (UnsignedInteger) l.get( 4 ) ); - case 1: - o.setFirstAcquirer( (Boolean) l.get( 3 ) ); - case 2: - o.setTtl( (UnsignedInteger) l.get( 2 ) ); - case 3: - o.setPriority( (UnsignedByte) l.get( 1 ) ); - case 4: - o.setDurable( (Boolean) l.get( 0 ) ); - } - - - return o; - } - - public Class<Header> getTypeClass() - { - return Header.class; - } - - public static void register(Decoder decoder, EncoderImpl encoder) - { - HeaderType type = new HeaderType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/MessageAnnotationsType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/MessageAnnotationsType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/MessageAnnotationsType.java deleted file mode 100644 index 08fb632..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/MessageAnnotationsType.java +++ /dev/null @@ -1,86 +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.proton.codec.messaging; -import java.util.Map; - - -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.MessageAnnotations; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class MessageAnnotationsType extends AbstractDescribedType<MessageAnnotations,Map> implements DescribedTypeConstructor<MessageAnnotations> - -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000072L), Symbol.valueOf("amqp:message-annotations:map"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000072L); - - public MessageAnnotationsType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected Map wrap(MessageAnnotations val) - { - return val.getValue(); - } - - - public MessageAnnotations newInstance(Object described) - { - return new MessageAnnotations( (Map) described ); - } - - public Class<MessageAnnotations> getTypeClass() - { - return MessageAnnotations.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - MessageAnnotationsType constructor = new MessageAnnotationsType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, constructor); - } - encoder.register(constructor); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ModifiedType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ModifiedType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ModifiedType.java deleted file mode 100644 index fdcacc0..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ModifiedType.java +++ /dev/null @@ -1,143 +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.proton.codec.messaging; - -import java.util.AbstractList; -import java.util.List; -import java.util.Map; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Modified; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class ModifiedType extends AbstractDescribedType<Modified,List> implements DescribedTypeConstructor<Modified> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000027L), Symbol.valueOf("amqp:modified:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000027L); - - private ModifiedType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Modified val) - { - return new ModifiedWrapper(val); - } - - - public static final class ModifiedWrapper extends AbstractList - { - private final Modified _impl; - - public ModifiedWrapper(Modified impl) - { - _impl = impl; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _impl.getDeliveryFailed(); - case 1: - return _impl.getUndeliverableHere(); - case 2: - return _impl.getMessageAnnotations(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _impl.getMessageAnnotations() != null - ? 3 - : _impl.getUndeliverableHere() != null - ? 2 - : _impl.getDeliveryFailed() != null - ? 1 - : 0; - - } - - } - - public Modified newInstance(Object described) - { - List l = (List) described; - - Modified o = new Modified(); - - - switch(3 - l.size()) - { - - case 0: - o.setMessageAnnotations( (Map) l.get( 2 ) ); - case 1: - o.setUndeliverableHere( (Boolean) l.get( 1 ) ); - case 2: - o.setDeliveryFailed( (Boolean) l.get( 0 ) ); - } - - - return o; - } - - public Class<Modified> getTypeClass() - { - return Modified.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - ModifiedType type = new ModifiedType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/PropertiesType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/PropertiesType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/PropertiesType.java deleted file mode 100644 index 818aaa8..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/PropertiesType.java +++ /dev/null @@ -1,205 +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.proton.codec.messaging; - -import java.util.AbstractList; -import java.util.Date; -import java.util.List; -import org.apache.qpid.proton.amqp.Binary; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedInteger; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Properties; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class PropertiesType extends AbstractDescribedType<Properties,List> implements DescribedTypeConstructor<Properties> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000073L), Symbol.valueOf("amqp:properties:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000073L); - - private PropertiesType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Properties val) - { - return new PropertiesWrapper(val); - } - - private static final class PropertiesWrapper extends AbstractList - { - - private Properties _impl; - - public PropertiesWrapper(Properties propertiesType) - { - _impl = propertiesType; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _impl.getMessageId(); - case 1: - return _impl.getUserId(); - case 2: - return _impl.getTo(); - case 3: - return _impl.getSubject(); - case 4: - return _impl.getReplyTo(); - case 5: - return _impl.getCorrelationId(); - case 6: - return _impl.getContentType(); - case 7: - return _impl.getContentEncoding(); - case 8: - return _impl.getAbsoluteExpiryTime(); - case 9: - return _impl.getCreationTime(); - case 10: - return _impl.getGroupId(); - case 11: - return _impl.getGroupSequence(); - case 12: - return _impl.getReplyToGroupId(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _impl.getReplyToGroupId() != null - ? 13 - : _impl.getGroupSequence() != null - ? 12 - : _impl.getGroupId() != null - ? 11 - : _impl.getCreationTime() != null - ? 10 - : _impl.getAbsoluteExpiryTime() != null - ? 9 - : _impl.getContentEncoding() != null - ? 8 - : _impl.getContentType() != null - ? 7 - : _impl.getCorrelationId() != null - ? 6 - : _impl.getReplyTo() != null - ? 5 - : _impl.getSubject() != null - ? 4 - : _impl.getTo() != null - ? 3 - : _impl.getUserId() != null - ? 2 - : _impl.getMessageId() != null - ? 1 - : 0; - - } - - } - - public Properties newInstance(Object described) - { - List l = (List) described; - - Properties o = new Properties(); - - - switch(13 - l.size()) - { - - case 0: - o.setReplyToGroupId( (String) l.get( 12 ) ); - case 1: - o.setGroupSequence( (UnsignedInteger) l.get( 11 ) ); - case 2: - o.setGroupId( (String) l.get( 10 ) ); - case 3: - o.setCreationTime( (Date) l.get( 9 ) ); - case 4: - o.setAbsoluteExpiryTime( (Date) l.get( 8 ) ); - case 5: - o.setContentEncoding( (Symbol) l.get( 7 ) ); - case 6: - o.setContentType( (Symbol) l.get( 6 ) ); - case 7: - o.setCorrelationId( (Object) l.get( 5 ) ); - case 8: - o.setReplyTo( (String) l.get( 4 ) ); - case 9: - o.setSubject( (String) l.get( 3 ) ); - case 10: - o.setTo( (String) l.get( 2 ) ); - case 11: - o.setUserId( (Binary) l.get( 1 ) ); - case 12: - o.setMessageId( (Object) l.get( 0 ) ); - } - - - return o; - } - - public Class<Properties> getTypeClass() - { - return Properties.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - PropertiesType type = new PropertiesType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReceivedType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReceivedType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReceivedType.java deleted file mode 100644 index d10fed6..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReceivedType.java +++ /dev/null @@ -1,135 +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.proton.codec.messaging; - -import java.util.AbstractList; -import java.util.List; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedInteger; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Received; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public final class ReceivedType extends AbstractDescribedType<Received,List> implements DescribedTypeConstructor<Received> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000023L), Symbol.valueOf("amqp:received:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000023L); - - private ReceivedType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Received val) - { - return new ReceivedWrapper(val); - } - - - private static final class ReceivedWrapper extends AbstractList - { - private final Received _impl; - - private ReceivedWrapper(Received impl) - { - _impl = impl; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _impl.getSectionNumber(); - case 1: - return _impl.getSectionOffset(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _impl.getSectionOffset() != null - ? 2 - : _impl.getSectionOffset() != null - ? 1 - : 0; - - } - } - - public Received newInstance(Object described) - { - List l = (List) described; - - Received o = new Received(); - - - switch(2 - l.size()) - { - - case 0: - o.setSectionOffset( (UnsignedLong) l.get( 1 ) ); - case 1: - o.setSectionNumber( (UnsignedInteger) l.get( 0 ) ); - } - - - return o; - } - - public Class<Received> getTypeClass() - { - return Received.class; - } - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - ReceivedType type = new ReceivedType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } -} - \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
