http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/RejectedType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/RejectedType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/RejectedType.java deleted file mode 100644 index 3b7d87e..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/RejectedType.java +++ /dev/null @@ -1,127 +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.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Rejected; -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; -import org.apache.qpid.proton.amqp.transport.ErrorCondition; - - -public class RejectedType extends AbstractDescribedType<Rejected,List> implements DescribedTypeConstructor<Rejected> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000025L), Symbol.valueOf("amqp:rejected:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000025L); - - private RejectedType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Rejected val) - { - return new RejectedWrapper(val); - } - - - private static final class RejectedWrapper extends AbstractList - { - private final Rejected _impl; - - private RejectedWrapper(Rejected impl) - { - _impl = impl; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _impl.getError(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _impl.getError() != null - ? 1 - : 0; - - } - } - - public Rejected newInstance(Object described) - { - List l = (List) described; - - Rejected o = new Rejected(); - - switch(1 - l.size()) - { - case 0: - o.setError( (ErrorCondition) l.get( 0 ) ); - } - - - return o; - } - - public Class<Rejected> getTypeClass() - { - return Rejected.class; - } - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - RejectedType type = new RejectedType(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/ReleasedType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReleasedType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReleasedType.java deleted file mode 100644 index 1e34ca4..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReleasedType.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.Released; -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 ReleasedType extends AbstractDescribedType<Released,List> implements DescribedTypeConstructor<Released> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000026L), Symbol.valueOf("amqp:released:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000026L); - - public ReleasedType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Released val) - { - return Collections.EMPTY_LIST; - } - - - public Released newInstance(Object described) - { - return Released.getInstance(); - } - - public Class<Released> getTypeClass() - { - return Released.class; - } - - public static void register(Decoder decoder, EncoderImpl encoder) - { - ReleasedType type = new ReleasedType(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/SourceType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/SourceType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/SourceType.java deleted file mode 100644 index 0239e6e..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/SourceType.java +++ /dev/null @@ -1,217 +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.UnsignedInteger; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Outcome; -import org.apache.qpid.proton.amqp.messaging.Source; -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; -import org.apache.qpid.proton.amqp.messaging.TerminusDurability; -import org.apache.qpid.proton.amqp.messaging.TerminusExpiryPolicy; - - -public class SourceType extends AbstractDescribedType<Source,List> implements DescribedTypeConstructor<Source> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000028L), Symbol.valueOf("amqp:source:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000028L); - - public SourceType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Source val) - { - return new SourceWrapper(val); - } - - - private static final class SourceWrapper extends AbstractList - { - private final Source _impl; - - public SourceWrapper(Source impl) - { - _impl = impl; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _impl.getAddress(); - case 1: - return _impl.getDurable().getValue(); - case 2: - return _impl.getExpiryPolicy().getPolicy(); - case 3: - return _impl.getTimeout(); - case 4: - return _impl.getDynamic(); - case 5: - return _impl.getDynamicNodeProperties(); - case 6: - return _impl.getDistributionMode(); - case 7: - return _impl.getFilter(); - case 8: - return _impl.getDefaultOutcome(); - case 9: - return _impl.getOutcomes(); - case 10: - return _impl.getCapabilities(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _impl.getCapabilities() != null - ? 11 - : _impl.getOutcomes() != null - ? 10 - : _impl.getDefaultOutcome() != null - ? 9 - : _impl.getFilter() != null - ? 8 - : _impl.getDistributionMode() != null - ? 7 - : _impl.getDynamicNodeProperties() != null - ? 6 - : _impl.getDynamic() - ? 5 - : (_impl.getTimeout() != null && !_impl.getTimeout().equals(UnsignedInteger.ZERO)) - ? 4 - : _impl.getExpiryPolicy() != TerminusExpiryPolicy.SESSION_END - ? 3 - : _impl.getDurable() != TerminusDurability.NONE - ? 2 - : _impl.getAddress() != null - ? 1 - : 0; - - } - - } - - public Source newInstance(Object described) - { - List l = (List) described; - - Source o = new Source(); - - - switch(11 - l.size()) - { - - case 0: - Object val0 = l.get( 10 ); - if( val0 == null || val0.getClass().isArray() ) - { - o.setCapabilities( (Symbol[]) val0 ); - } - else - { - o.setCapabilities( (Symbol) val0 ); - } - case 1: - Object val1 = l.get( 9 ); - if( val1 == null || val1.getClass().isArray() ) - { - o.setOutcomes( (Symbol[]) val1 ); - } - else - { - o.setOutcomes( (Symbol) val1 ); - } - case 2: - o.setDefaultOutcome( (Outcome) l.get( 8 ) ); - case 3: - o.setFilter( (Map) l.get( 7 ) ); - case 4: - o.setDistributionMode( (Symbol) l.get( 6 ) ); - case 5: - o.setDynamicNodeProperties( (Map) l.get( 5 ) ); - case 6: - Boolean dynamic = (Boolean) l.get(4); - o.setDynamic(dynamic == null ? false : dynamic); - case 7: - UnsignedInteger timeout = (UnsignedInteger) l.get(3); - o.setTimeout(timeout == null ? UnsignedInteger.ZERO : timeout); - case 8: - Symbol expiryPolicy = (Symbol) l.get(2); - o.setExpiryPolicy(expiryPolicy == null ? TerminusExpiryPolicy.SESSION_END : TerminusExpiryPolicy.valueOf(expiryPolicy)); - case 9: - UnsignedInteger durable = (UnsignedInteger) l.get(1); - o.setDurable(durable == null ? TerminusDurability.NONE : TerminusDurability.get(durable)); - case 10: - o.setAddress( (String) l.get( 0 ) ); - } - - - return o; - } - - public Class<Source> getTypeClass() - { - return Source.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - SourceType type = new SourceType(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/TargetType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/TargetType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/TargetType.java deleted file mode 100644 index d8ab043..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/TargetType.java +++ /dev/null @@ -1,182 +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.UnsignedInteger; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.messaging.Target; -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; -import org.apache.qpid.proton.amqp.messaging.TerminusDurability; -import org.apache.qpid.proton.amqp.messaging.TerminusExpiryPolicy; - - -public class TargetType extends AbstractDescribedType<Target,List> implements DescribedTypeConstructor<Target> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000029L), Symbol.valueOf("amqp:target:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000029L); - - public TargetType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Target val) - { - return new TargetWrapper(val); - } - - - private static final class TargetWrapper extends AbstractList - { - private final Target _impl; - - public TargetWrapper(Target impl) - { - _impl = impl; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _impl.getAddress(); - case 1: - return _impl.getDurable().getValue(); - case 2: - return _impl.getExpiryPolicy().getPolicy(); - case 3: - return _impl.getTimeout(); - case 4: - return _impl.getDynamic(); - case 5: - return _impl.getDynamicNodeProperties(); - case 6: - return _impl.getCapabilities(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _impl.getCapabilities() != null - ? 7 - : _impl.getDynamicNodeProperties() != null - ? 6 - : _impl.getDynamic() - ? 5 - : (_impl.getTimeout() != null && !_impl.getTimeout().equals(UnsignedInteger.ZERO)) - ? 4 - : !_impl.getExpiryPolicy().equals(TerminusExpiryPolicy.SESSION_END) - ? 3 - : !_impl.getDurable().equals(TerminusDurability.NONE) - ? 2 - : _impl.getAddress() != null - ? 1 - : 0; - - } - } - - public Target newInstance(Object described) - { - List l = (List) described; - - Target o = new Target(); - - - switch(7 - l.size()) - { - - case 0: - Object val0 = l.get( 6 ); - if( val0 == null || val0.getClass().isArray() ) - { - o.setCapabilities( (Symbol[]) val0 ); - } - else - { - o.setCapabilities( (Symbol) val0 ); - } - case 1: - o.setDynamicNodeProperties( (Map) l.get( 5 ) ); - case 2: - Boolean dynamic = (Boolean) l.get(4); - o.setDynamic(dynamic == null ? false : dynamic); - case 3: - UnsignedInteger timeout = (UnsignedInteger) l.get(3); - o.setTimeout(timeout == null ? UnsignedInteger.ZERO : timeout); - case 4: - Symbol expiryPolicy = (Symbol) l.get(2); - o.setExpiryPolicy(expiryPolicy == null ? TerminusExpiryPolicy.SESSION_END : TerminusExpiryPolicy.valueOf(expiryPolicy)); - case 5: - UnsignedInteger durable = (UnsignedInteger) l.get(1); - o.setDurable(durable == null ? TerminusDurability.NONE : TerminusDurability.get(durable)); - case 6: - o.setAddress( (String) l.get( 0 ) ); - } - - - return o; - } - - public Class<Target> getTypeClass() - { - return Target.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - TargetType type = new TargetType(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/security/SaslChallengeType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslChallengeType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslChallengeType.java deleted file mode 100644 index 9c2c74f..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslChallengeType.java +++ /dev/null @@ -1,102 +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.security; - -import java.util.Collections; -import java.util.List; -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.security.SaslChallenge; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class SaslChallengeType extends AbstractDescribedType<SaslChallenge,List> implements DescribedTypeConstructor<SaslChallenge> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000042L), Symbol.valueOf("amqp:sasl-challenge:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000042L); - - private SaslChallengeType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(SaslChallenge val) - { - return Collections.singletonList(val.getChallenge()); - } - - - - public SaslChallenge newInstance(Object described) - { - List l = (List) described; - - SaslChallenge o = new SaslChallenge(); - - if(l.isEmpty()) - { - throw new DecodeException("The challenge field cannot be omitted"); - } - - o.setChallenge( (Binary) l.get( 0 ) ); - - - - return o; - } - - public Class<SaslChallenge> getTypeClass() - { - return SaslChallenge.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - SaslChallengeType type = new SaslChallengeType(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/security/SaslInitType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslInitType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslInitType.java deleted file mode 100644 index 345b875..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslInitType.java +++ /dev/null @@ -1,145 +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.security; - -import java.util.AbstractList; -import java.util.List; -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.security.SaslInit; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class SaslInitType extends AbstractDescribedType<SaslInit,List> implements DescribedTypeConstructor<SaslInit> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000041L), Symbol.valueOf("amqp:sasl-init:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000041L); - - private SaslInitType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(SaslInit val) - { - return new SaslInitWrapper(val); - } - - - public static class SaslInitWrapper extends AbstractList - { - - private SaslInit _saslInit; - - public SaslInitWrapper(SaslInit saslInit) - { - _saslInit = saslInit; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _saslInit.getMechanism(); - case 1: - return _saslInit.getInitialResponse(); - case 2: - return _saslInit.getHostname(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _saslInit.getHostname() != null - ? 3 - : _saslInit.getInitialResponse() != null - ? 2 - : 1; - - } - } - - public SaslInit newInstance(Object described) - { - List l = (List) described; - - SaslInit o = new SaslInit(); - - if(l.size() <= 0) - { - throw new DecodeException("The mechanism field cannot be omitted"); - } - - switch(3 - l.size()) - { - - case 0: - o.setHostname( (String) l.get( 2 ) ); - case 1: - o.setInitialResponse( (Binary) l.get( 1 ) ); - case 2: - o.setMechanism( (Symbol) l.get( 0 ) ); - } - - - return o; - } - - public Class<SaslInit> getTypeClass() - { - return SaslInit.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - SaslInitType type = new SaslInitType(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/security/SaslMechanismsType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslMechanismsType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslMechanismsType.java deleted file mode 100644 index d964792..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslMechanismsType.java +++ /dev/null @@ -1,105 +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.security; - -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.security.SaslMechanisms; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class SaslMechanismsType extends AbstractDescribedType<SaslMechanisms,List> implements DescribedTypeConstructor<SaslMechanisms> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000040L), Symbol.valueOf("amqp:sasl-mechanisms:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000040L); - - private SaslMechanismsType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(SaslMechanisms val) - { - return Collections.singletonList(val.getSaslServerMechanisms()); - } - - public SaslMechanisms newInstance(Object described) - { - List l = (List) described; - - SaslMechanisms o = new SaslMechanisms(); - - if(l.isEmpty()) - { - throw new DecodeException("The sasl-server-mechanisms field cannot be omitted"); - } - - Object val0 = l.get( 0 ); - if( val0 == null || val0.getClass().isArray() ) - { - o.setSaslServerMechanisms( (Symbol[]) val0 ); - } - else - { - o.setSaslServerMechanisms( (Symbol) val0 ); - } - - return o; - } - - public Class<SaslMechanisms> getTypeClass() - { - return SaslMechanisms.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - SaslMechanismsType type = new SaslMechanismsType(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/security/SaslOutcomeType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslOutcomeType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslOutcomeType.java deleted file mode 100644 index 3c7d906..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslOutcomeType.java +++ /dev/null @@ -1,140 +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.security; - -import java.util.AbstractList; -import java.util.List; -import org.apache.qpid.proton.amqp.Binary; -import org.apache.qpid.proton.amqp.Symbol; -import org.apache.qpid.proton.amqp.UnsignedByte; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.security.SaslCode; -import org.apache.qpid.proton.amqp.security.SaslOutcome; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class SaslOutcomeType extends AbstractDescribedType<SaslOutcome,List> implements DescribedTypeConstructor<SaslOutcome> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000044L), Symbol.valueOf("amqp:sasl-outcome:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000044L); - - private SaslOutcomeType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(SaslOutcome val) - { - return new SaslOutcomeWrapper(val); - } - - - public static final class SaslOutcomeWrapper extends AbstractList - { - private final SaslOutcome _impl; - - public SaslOutcomeWrapper(SaslOutcome impl) - { - _impl = impl; - } - - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _impl.getCode().getValue(); - case 1: - return _impl.getAdditionalData(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _impl.getAdditionalData() != null - ? 2 - : 1; - } - } - - public SaslOutcome newInstance(Object described) - { - List l = (List) described; - - SaslOutcome o = new SaslOutcome(); - - if(l.isEmpty()) - { - throw new DecodeException("The code field cannot be omitted"); - } - - switch(2 - l.size()) - { - - case 0: - o.setAdditionalData( (Binary) l.get( 1 ) ); - case 1: - o.setCode(SaslCode.valueOf((UnsignedByte) l.get(0))); - } - - - return o; - } - - public Class<SaslOutcome> getTypeClass() - { - return SaslOutcome.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - SaslOutcomeType type = new SaslOutcomeType(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/security/SaslResponseType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslResponseType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslResponseType.java deleted file mode 100644 index cd2d61f..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/security/SaslResponseType.java +++ /dev/null @@ -1,103 +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.security; - -import java.util.Collections; -import java.util.List; -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.security.SaslResponse; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class SaslResponseType extends AbstractDescribedType<SaslResponse,List> implements DescribedTypeConstructor<SaslResponse> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000043L), Symbol.valueOf("amqp:sasl-response:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000043L); - - private SaslResponseType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(SaslResponse val) - { - return Collections.singletonList(val.getResponse()); - } - - - public SaslResponse newInstance(Object described) - { - List l = (List) described; - - SaslResponse o = new SaslResponse(); - - if(l.isEmpty()) - { - throw new DecodeException("The response field cannot be omitted"); - } - - switch(1 - l.size()) - { - - case 0: - o.setResponse( (Binary) l.get( 0 ) ); - } - - - return o; - } - - public Class<SaslResponse> getTypeClass() - { - return SaslResponse.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - SaslResponseType type = new SaslResponseType(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/transaction/CoordinatorType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/CoordinatorType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/CoordinatorType.java deleted file mode 100644 index 47321ef..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/CoordinatorType.java +++ /dev/null @@ -1,109 +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.transaction; - -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.transaction.Coordinator; -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 CoordinatorType extends AbstractDescribedType<Coordinator,List> implements DescribedTypeConstructor<Coordinator> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000030L), Symbol.valueOf("amqp:coordinator:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000030L); - - private CoordinatorType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Coordinator val) - { - Symbol[] capabilities = val.getCapabilities(); - return capabilities == null || capabilities.length == 0 - ? Collections.EMPTY_LIST - : Collections.singletonList(capabilities); - } - - - public Coordinator newInstance(Object described) - { - List l = (List) described; - - Coordinator o = new Coordinator(); - - - switch(1 - l.size()) - { - - case 0: - Object val0 = l.get( 0 ); - if( val0 == null || val0.getClass().isArray() ) - { - o.setCapabilities( (Symbol[]) val0 ); - } - else - { - o.setCapabilities( (Symbol) val0 ); - } - } - - - return o; - } - - public Class<Coordinator> getTypeClass() - { - return Coordinator.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - CoordinatorType type = new CoordinatorType(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/transaction/DeclareType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/DeclareType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/DeclareType.java deleted file mode 100644 index 45130e0..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/DeclareType.java +++ /dev/null @@ -1,95 +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.transaction; - -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.transaction.Declare; -import org.apache.qpid.proton.amqp.transaction.GlobalTxId; -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 DeclareType extends AbstractDescribedType<Declare,List> implements DescribedTypeConstructor<Declare> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000031L), Symbol.valueOf("amqp:declare:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000031L); - - private DeclareType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Declare val) - { - GlobalTxId globalId = val.getGlobalId(); - return globalId == null ? Collections.EMPTY_LIST : Collections.singletonList(globalId); - } - - public Declare newInstance(Object described) - { - List l = (List) described; - - Declare o = new Declare(); - - if(!l.isEmpty()) - { - o.setGlobalId( (GlobalTxId) l.get( 0 ) ); - } - - return o; - } - - public Class<Declare> getTypeClass() - { - return Declare.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DeclareType type = new DeclareType(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/transaction/DeclaredType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/DeclaredType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/DeclaredType.java deleted file mode 100644 index ccba51a..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/DeclaredType.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.proton.codec.transaction; - -import java.util.Collections; -import java.util.List; -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.transaction.Declared; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class DeclaredType extends AbstractDescribedType<Declared,List> implements DescribedTypeConstructor<Declared> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000033L), Symbol.valueOf("amqp:declared:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000033L); - - private DeclaredType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Declared val) - { - return Collections.singletonList(val.getTxnId()); - } - - public Declared newInstance(Object described) - { - List l = (List) described; - - Declared o = new Declared(); - - if(l.isEmpty()) - { - throw new DecodeException("The txn-id field cannot be omitted"); - } - - o.setTxnId( (Binary) l.get( 0 ) ); - - - - return o; - } - - public Class<Declared> getTypeClass() - { - return Declared.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DeclaredType type = new DeclaredType(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/transaction/DischargeType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/DischargeType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/DischargeType.java deleted file mode 100644 index 8ec382f..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/DischargeType.java +++ /dev/null @@ -1,141 +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.transaction; - -import java.util.AbstractList; -import java.util.List; -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.transaction.Discharge; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public class DischargeType extends AbstractDescribedType<Discharge,List> implements DescribedTypeConstructor<Discharge> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000032L), Symbol.valueOf("amqp:discharge:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000032L); - - private DischargeType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Discharge val) - { - return new DischargeWrapper(val); - } - - - public static class DischargeWrapper extends AbstractList - { - - private Discharge _discharge; - - public DischargeWrapper(Discharge discharge) - { - _discharge = discharge; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _discharge.getTxnId(); - case 1: - return _discharge.getFail(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _discharge.getFail() != null - ? 2 - : 1; - - } - - } - - public Discharge newInstance(Object described) - { - List l = (List) described; - - Discharge o = new Discharge(); - - if(l.isEmpty()) - { - throw new DecodeException("The txn-id field cannot be omitted"); - } - - switch(2 - l.size()) - { - - case 0: - o.setFail( (Boolean) l.get( 1 ) ); - case 1: - o.setTxnId( (Binary) l.get( 0 ) ); - } - - - return o; - } - - public Class<Discharge> getTypeClass() - { - return Discharge.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DischargeType type = new DischargeType(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/transaction/TransactionalStateType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/TransactionalStateType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/TransactionalStateType.java deleted file mode 100644 index 74731ef..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/TransactionalStateType.java +++ /dev/null @@ -1,141 +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.transaction; - -import java.util.AbstractList; -import java.util.List; -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.Outcome; -import org.apache.qpid.proton.amqp.transaction.TransactionalState; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - -public class TransactionalStateType extends AbstractDescribedType<TransactionalState,List> implements DescribedTypeConstructor<TransactionalState> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000034L), Symbol.valueOf("amqp:transactional-state:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000034L); - - private TransactionalStateType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(TransactionalState val) - { - return new TransactionalStateWrapper(val); - } - - public static class TransactionalStateWrapper extends AbstractList - { - - private TransactionalState _transactionalState; - - public TransactionalStateWrapper(TransactionalState transactionalState) - { - _transactionalState = transactionalState; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _transactionalState.getTxnId(); - case 1: - return _transactionalState.getOutcome(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _transactionalState.getOutcome() != null - ? 2 - : 1; - - } - - - } - - public TransactionalState newInstance(Object described) - { - List l = (List) described; - - TransactionalState o = new TransactionalState(); - - if(l.isEmpty()) - { - throw new DecodeException("The txn-id field cannot be omitted"); - } - - switch(2 - l.size()) - { - - case 0: - o.setOutcome( (Outcome) l.get( 1 ) ); - case 1: - o.setTxnId( (Binary) l.get( 0 ) ); - } - - - return o; - } - - public Class<TransactionalState> getTypeClass() - { - return TransactionalState.class; - } - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - TransactionalStateType type = new TransactionalStateType(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/transport/AttachType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/AttachType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/AttachType.java deleted file mode 100644 index 533dbc8..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/AttachType.java +++ /dev/null @@ -1,233 +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.transport; - -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.UnsignedByte; -import org.apache.qpid.proton.amqp.UnsignedInteger; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.transport.Attach; -import org.apache.qpid.proton.amqp.transport.ReceiverSettleMode; -import org.apache.qpid.proton.amqp.transport.Role; -import org.apache.qpid.proton.amqp.transport.SenderSettleMode; -import org.apache.qpid.proton.amqp.transport.Source; -import org.apache.qpid.proton.amqp.transport.Target; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public final class AttachType extends AbstractDescribedType<Attach,List> implements DescribedTypeConstructor<Attach> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000012L), Symbol.valueOf("amqp:attach:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000012L); - - private AttachType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Attach val) - { - return new AttachWrapper(val); - } - - - public static class AttachWrapper extends AbstractList - { - - private Attach _attach; - - public AttachWrapper(Attach attach) - { - _attach = attach; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _attach.getName(); - case 1: - return _attach.getHandle(); - case 2: - return _attach.getRole().getValue(); - case 3: - return _attach.getSndSettleMode().getValue(); - case 4: - return _attach.getRcvSettleMode().getValue(); - case 5: - return _attach.getSource(); - case 6: - return _attach.getTarget(); - case 7: - return _attach.getUnsettled(); - case 8: - return _attach.getIncompleteUnsettled(); - case 9: - return _attach.getInitialDeliveryCount(); - case 10: - return _attach.getMaxMessageSize(); - case 11: - return _attach.getOfferedCapabilities(); - case 12: - return _attach.getDesiredCapabilities(); - case 13: - return _attach.getProperties(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _attach.getProperties() != null - ? 14 - : _attach.getDesiredCapabilities() != null - ? 13 - : _attach.getOfferedCapabilities() != null - ? 12 - : _attach.getMaxMessageSize() != null - ? 11 - : _attach.getInitialDeliveryCount() != null - ? 10 - : _attach.getIncompleteUnsettled() - ? 9 - : _attach.getUnsettled() != null - ? 8 - : _attach.getTarget() != null - ? 7 - : _attach.getSource() != null - ? 6 - : (_attach.getRcvSettleMode() != null && !_attach.getRcvSettleMode().equals(ReceiverSettleMode.FIRST)) - ? 5 - : (_attach.getSndSettleMode() != null && !_attach.getSndSettleMode().equals(SenderSettleMode.MIXED)) - ? 4 - : 3; - - } - - } - - public Attach newInstance(Object described) - { - List l = (List) described; - - Attach o = new Attach(); - - if(l.size() <= 2) - { - throw new DecodeException("The role field cannot be omitted"); - } - - switch(14 - l.size()) - { - - case 0: - o.setProperties( (Map) l.get( 13 ) ); - case 1: - Object val1 = l.get( 12 ); - if( val1 == null || val1.getClass().isArray() ) - { - o.setDesiredCapabilities( (Symbol[]) val1 ); - } - else - { - o.setDesiredCapabilities( (Symbol) val1 ); - } - case 2: - Object val2 = l.get( 11 ); - if( val2 == null || val2.getClass().isArray() ) - { - o.setOfferedCapabilities( (Symbol[]) val2 ); - } - else - { - o.setOfferedCapabilities( (Symbol) val2 ); - } - case 3: - o.setMaxMessageSize( (UnsignedLong) l.get( 10 ) ); - case 4: - o.setInitialDeliveryCount( (UnsignedInteger) l.get( 9 ) ); - case 5: - Boolean incompleteUnsettled = (Boolean) l.get(8); - o.setIncompleteUnsettled(incompleteUnsettled == null ? false : incompleteUnsettled); - case 6: - o.setUnsettled( (Map) l.get( 7 ) ); - case 7: - o.setTarget( (Target) l.get( 6 ) ); - case 8: - o.setSource( (Source) l.get( 5 ) ); - case 9: - UnsignedByte rcvSettleMode = (UnsignedByte) l.get(4); - o.setRcvSettleMode(rcvSettleMode == null ? ReceiverSettleMode.FIRST : ReceiverSettleMode.values()[rcvSettleMode.intValue()]); - case 10: - UnsignedByte sndSettleMode = (UnsignedByte) l.get(3); - o.setSndSettleMode(sndSettleMode == null ? SenderSettleMode.MIXED : SenderSettleMode.values()[sndSettleMode.intValue()]); - case 11: - o.setRole( Boolean.TRUE.equals( l.get( 2 ) ) ? Role.RECEIVER : Role.SENDER); - case 12: - o.setHandle( (UnsignedInteger) l.get( 1 ) ); - case 13: - o.setName( (String) l.get( 0 ) ); - } - - - return o; - } - - public Class<Attach> getTypeClass() - { - return Attach.class; - } - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - AttachType type = new AttachType(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/transport/BeginType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/BeginType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/BeginType.java deleted file mode 100644 index a01ad51..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/BeginType.java +++ /dev/null @@ -1,188 +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.transport; - -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.UnsignedInteger; -import org.apache.qpid.proton.amqp.UnsignedLong; -import org.apache.qpid.proton.amqp.UnsignedShort; -import org.apache.qpid.proton.amqp.transport.Begin; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public final class BeginType extends AbstractDescribedType<Begin,List> implements DescribedTypeConstructor<Begin> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000011L), Symbol.valueOf("amqp:begin:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000011L); - - private BeginType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Begin val) - { - return new BeginWrapper(val); - } - - private static class BeginWrapper extends AbstractList - { - - private Begin _begin; - - public BeginWrapper(Begin begin) - { - _begin = begin; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _begin.getRemoteChannel(); - case 1: - return _begin.getNextOutgoingId(); - case 2: - return _begin.getIncomingWindow(); - case 3: - return _begin.getOutgoingWindow(); - case 4: - return _begin.getHandleMax(); - case 5: - return _begin.getOfferedCapabilities(); - case 6: - return _begin.getDesiredCapabilities(); - case 7: - return _begin.getProperties(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _begin.getProperties() != null - ? 8 - : _begin.getDesiredCapabilities() != null - ? 7 - : _begin.getOfferedCapabilities() != null - ? 6 - : (_begin.getHandleMax() != null && !_begin.getHandleMax().equals(UnsignedInteger.MAX_VALUE)) - ? 5 - : 4; - - } - } - - public Begin newInstance(Object described) - { - List l = (List) described; - - Begin o = new Begin(); - - if(l.size() <= 3) - { - throw new DecodeException("The outgoing-window field cannot be omitted"); - } - - switch(8 - l.size()) - { - - case 0: - o.setProperties( (Map) l.get( 7 ) ); - case 1: - Object val1 = l.get( 6 ); - if( val1 == null || val1.getClass().isArray() ) - { - o.setDesiredCapabilities( (Symbol[]) val1 ); - } - else - { - o.setDesiredCapabilities( (Symbol) val1 ); - } - case 2: - Object val2 = l.get( 5 ); - if( val2 == null || val2.getClass().isArray() ) - { - o.setOfferedCapabilities( (Symbol[]) val2 ); - } - else - { - o.setOfferedCapabilities( (Symbol) val2 ); - } - case 3: - UnsignedInteger handleMax = (UnsignedInteger) l.get(4); - o.setHandleMax(handleMax == null ? UnsignedInteger.MAX_VALUE : handleMax); - case 4: - o.setOutgoingWindow( (UnsignedInteger) l.get( 3 ) ); - case 5: - o.setIncomingWindow( (UnsignedInteger) l.get( 2 ) ); - case 6: - o.setNextOutgoingId( (UnsignedInteger) l.get( 1 ) ); - case 7: - o.setRemoteChannel( (UnsignedShort) l.get( 0 ) ); - } - - - return o; - } - - public Class<Begin> getTypeClass() - { - return Begin.class; - } - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - BeginType type = new BeginType(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/transport/CloseType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/CloseType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/CloseType.java deleted file mode 100644 index 832ea6b..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/CloseType.java +++ /dev/null @@ -1,94 +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.transport; - -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.transport.Close; -import org.apache.qpid.proton.amqp.transport.ErrorCondition; -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 CloseType extends AbstractDescribedType<Close,List> implements DescribedTypeConstructor<Close> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000018L), Symbol.valueOf("amqp:close:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000018L); - - private CloseType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Close val) - { - ErrorCondition error = val.getError(); - return error == null ? Collections.EMPTY_LIST : Collections.singletonList(error); - } - - public Close newInstance(Object described) - { - List l = (List) described; - - Close o = new Close(); - - if(!l.isEmpty()) - { - o.setError( (ErrorCondition) l.get( 0 ) ); - } - - return o; - } - - public Class<Close> getTypeClass() - { - return Close.class; - } - - public static void register(Decoder decoder, EncoderImpl encoder) - { - CloseType type = new CloseType(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/transport/DetachType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/DetachType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/DetachType.java deleted file mode 100644 index 62dd068..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/DetachType.java +++ /dev/null @@ -1,147 +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.transport; - -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.transport.Detach; -import org.apache.qpid.proton.amqp.transport.ErrorCondition; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public final class DetachType extends AbstractDescribedType<Detach,List> implements DescribedTypeConstructor<Detach> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000016L), Symbol.valueOf("amqp:detach:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000016L); - - private DetachType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Detach val) - { - return new DetachWrapper(val); - } - - public static class DetachWrapper extends AbstractList - { - - private Detach _detach; - - public DetachWrapper(Detach detach) - { - _detach = detach; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _detach.getHandle(); - case 1: - return _detach.getClosed(); - case 2: - return _detach.getError(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _detach.getError() != null - ? 3 - : _detach.getClosed() - ? 2 - : 1; - - } - } - - public Detach newInstance(Object described) - { - List l = (List) described; - - Detach o = new Detach(); - - if(l.isEmpty()) - { - throw new DecodeException("The handle field cannot be omitted"); - } - - switch(3 - l.size()) - { - - case 0: - o.setError( (ErrorCondition) l.get( 2 ) ); - case 1: - Boolean closed = (Boolean) l.get(1); - o.setClosed(closed == null ? false : closed); - case 2: - o.setHandle( (UnsignedInteger) l.get( 0 ) ); - } - - - return o; - } - - public Class<Detach> getTypeClass() - { - return Detach.class; - } - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DetachType type = new DetachType(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/transport/DispositionType.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/DispositionType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/DispositionType.java deleted file mode 100644 index b833613..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/DispositionType.java +++ /dev/null @@ -1,168 +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.transport; - -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.transport.DeliveryState; -import org.apache.qpid.proton.amqp.transport.Disposition; -import org.apache.qpid.proton.amqp.transport.Role; -import org.apache.qpid.proton.codec.AbstractDescribedType; -import org.apache.qpid.proton.codec.DecodeException; -import org.apache.qpid.proton.codec.Decoder; -import org.apache.qpid.proton.codec.DescribedTypeConstructor; -import org.apache.qpid.proton.codec.EncoderImpl; - - -public final class DispositionType extends AbstractDescribedType<Disposition,List> implements DescribedTypeConstructor<Disposition> -{ - private static final Object[] DESCRIPTORS = - { - UnsignedLong.valueOf(0x0000000000000015L), Symbol.valueOf("amqp:disposition:list"), - }; - - private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000015L); - - private DispositionType(EncoderImpl encoder) - { - super(encoder); - } - - public UnsignedLong getDescriptor() - { - return DESCRIPTOR; - } - - @Override - protected List wrap(Disposition val) - { - return new DispositionWrapper(val); - } - - - private static final class DispositionWrapper extends AbstractList - { - - private Disposition _disposition; - - public DispositionWrapper(Disposition disposition) - { - _disposition = disposition; - } - - public Object get(final int index) - { - - switch(index) - { - case 0: - return _disposition.getRole().getValue(); - case 1: - return _disposition.getFirst(); - case 2: - return _disposition.getLast(); - case 3: - return _disposition.getSettled(); - case 4: - return _disposition.getState(); - case 5: - return _disposition.getBatchable(); - } - - throw new IllegalStateException("Unknown index " + index); - - } - - public int size() - { - return _disposition.getBatchable() - ? 6 - : _disposition.getState() != null - ? 5 - : _disposition.getSettled() - ? 4 - : _disposition.getLast() != null - ? 3 - : 2; - - } - } - - public Disposition newInstance(Object described) - { - List l = (List) described; - - Disposition o = new Disposition(); - - if(l.isEmpty()) - { - throw new DecodeException("The first field cannot be omitted"); - } - - switch(6 - l.size()) - { - - case 0: - Boolean batchable = (Boolean) l.get(5); - o.setBatchable(batchable == null ? false : batchable); - case 1: - o.setState( (DeliveryState) l.get( 4 ) ); - case 2: - Boolean settled = (Boolean) l.get(3); - o.setSettled(settled == null ? false : settled); - case 3: - o.setLast( (UnsignedInteger) l.get( 2 ) ); - case 4: - o.setFirst( (UnsignedInteger) l.get( 1 ) ); - case 5: - o.setRole( Boolean.TRUE.equals(l.get( 0 )) ? Role.RECEIVER : Role.SENDER ); - } - - - return o; - } - - public Class<Disposition> getTypeClass() - { - return Disposition.class; - } - - - - - public static void register(Decoder decoder, EncoderImpl encoder) - { - DispositionType type = new DispositionType(encoder); - for(Object descriptor : DESCRIPTORS) - { - decoder.register(descriptor, type); - } - encoder.register(type); - } - - -} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org