Changed the descriptor registry to use the renamed fields.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/2cadd869 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/2cadd869 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/2cadd869 Branch: refs/heads/rajith-codec Commit: 2cadd869508104963ee19b5d28046c0142b18a5b Parents: a94b401 Author: Rajith Attapattu <[email protected]> Authored: Fri May 15 09:19:04 2015 -0400 Committer: Rajith Attapattu <[email protected]> Committed: Fri May 15 09:19:04 2015 -0400 ---------------------------------------------------------------------- .../qpid/proton/codec2/DiscriptorRegistry.java | 40 ++++++++++---------- .../apache/qpid/proton/codec2/Performative.java | 26 ------------- 2 files changed, 20 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2cadd869/proton-j/src/main/java/org/apache/qpid/proton/codec2/DiscriptorRegistry.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec2/DiscriptorRegistry.java b/proton-j/src/main/java/org/apache/qpid/proton/codec2/DiscriptorRegistry.java index 697a89a..5720432 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec2/DiscriptorRegistry.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec2/DiscriptorRegistry.java @@ -58,9 +58,9 @@ import org.apache.qpid.proton.transport2.Transfer; public class DiscriptorRegistry { - private static Map<String, DescribedTypeFactory> _typeRegByStrCode = new HashMap<String, DescribedTypeFactory>(); + private static Map<String, DescribedTypeFactory> _typeRegByDescriptor = new HashMap<String, DescribedTypeFactory>(); - private static Map<Long, DescribedTypeFactory> _typeRegByLongCode = new HashMap<Long, DescribedTypeFactory>(); + private static Map<Long, DescribedTypeFactory> _typeRegByCode = new HashMap<Long, DescribedTypeFactory>(); // Register the standard types static @@ -70,23 +70,23 @@ public class DiscriptorRegistry registerSaslTypes(); } - public static void registerType(long longCode, String strCode, DescribedTypeFactory factory) + public static void registerType(long code, String descriptor, DescribedTypeFactory factory) { - _typeRegByStrCode.put(strCode, factory); - _typeRegByLongCode.put(longCode, factory); + _typeRegByDescriptor.put(descriptor, factory); + _typeRegByCode.put(code, factory); } private static void registerTransportTypes() { - registerType(Open.DESCRIPTOR_LONG, Open.DESCRIPTOR_STRING, Open.FACTORY); - registerType(Begin.DESCRIPTOR_LONG, Begin.DESCRIPTOR_STRING, Begin.FACTORY); - registerType(Attach.DESCRIPTOR_LONG, Attach.DESCRIPTOR_STRING, Attach.FACTORY); - registerType(Flow.DESCRIPTOR_LONG, Flow.DESCRIPTOR_STRING, Flow.FACTORY); - registerType(Transfer.DESCRIPTOR_LONG, Transfer.DESCRIPTOR_STRING, Transfer.FACTORY); - registerType(Disposition.DESCRIPTOR_LONG, Disposition.DESCRIPTOR_STRING, Disposition.FACTORY); - registerType(Detach.DESCRIPTOR_LONG, Detach.DESCRIPTOR_STRING, Detach.FACTORY); - registerType(End.DESCRIPTOR_LONG, End.DESCRIPTOR_STRING, End.FACTORY); - registerType(Close.DESCRIPTOR_LONG, Close.DESCRIPTOR_STRING, Close.FACTORY); + registerType(Open.CODE, Open.DESCRIPTOR, Open.FACTORY); + registerType(Begin.CODE, Begin.DESCRIPTOR, Begin.FACTORY); + registerType(Attach.CODE, Attach.DESCRIPTOR, Attach.FACTORY); + registerType(Flow.CODE, Flow.DESCRIPTOR, Flow.FACTORY); + registerType(Transfer.CODE, Transfer.DESCRIPTOR, Transfer.FACTORY); + registerType(Disposition.CODE, Disposition.DESCRIPTOR, Disposition.FACTORY); + registerType(Detach.CODE, Detach.DESCRIPTOR, Detach.FACTORY); + registerType(End.CODE, End.DESCRIPTOR, End.FACTORY); + registerType(Close.CODE, Close.DESCRIPTOR, Close.FACTORY); registerType(ErrorCondition.DESCRIPTOR_LONG, ErrorCondition.DESCRIPTOR_STRING, ErrorCondition.FACTORY); } @@ -136,11 +136,11 @@ public class DiscriptorRegistry { if (code instanceof Long) { - return lookupLongCode((Long) code); + return lookupByCode((Long) code); } else if (code instanceof String) { - return lookupStringCode((String) code); + return lookupByDescriptor((String) code); } else { @@ -148,13 +148,13 @@ public class DiscriptorRegistry } } - static DescribedTypeFactory lookupLongCode(long code) + static DescribedTypeFactory lookupByCode(long code) { - return _typeRegByLongCode.get(code); + return _typeRegByCode.get(code); } - static DescribedTypeFactory lookupStringCode(String code) + static DescribedTypeFactory lookupByDescriptor(String code) { - return _typeRegByStrCode.get(code); + return _typeRegByDescriptor.get(code); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2cadd869/proton-j/src/main/java/org/apache/qpid/proton/codec2/Performative.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec2/Performative.java b/proton-j/src/main/java/org/apache/qpid/proton/codec2/Performative.java deleted file mode 100644 index 9ce1fb6..0000000 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec2/Performative.java +++ /dev/null @@ -1,26 +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.codec2; - -public interface Performative -{ - boolean isValid(); -} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
