From 63887e9ffebaa10f33f4afdfe6f88c359d844a8d Mon Sep 17 00:00:00 2001 From: Robert Godfrey Date: Tue, 29 Jul 2014 14:54:36 +0000 Subject: QPID-5940 : [Java Broker] Add meta-data servlet git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1614370 13f79535-47bb-0310-9956-ffa450edef68 --- .../server/model/ConfiguredObjectTypeRegistry.java | 29 ++++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'qpid/java/broker-core') diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java index 950638cd63..d692e663df 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java @@ -99,6 +99,10 @@ public class ConfiguredObjectTypeRegistry { categories.add(configuredObjectClass); } + else + { + categories.add(getCategory(configuredObjectClass)); + } if (!"".equals(annotation.type())) { types.add(configuredObjectClass); @@ -188,13 +192,16 @@ public class ConfiguredObjectTypeRegistry { Class category = getCategory(clazz); Set> types = _knownTypes.get(category); - for(Class type : types) + if(types != null) { - ManagedObject annotation = type.getAnnotation(ManagedObject.class); - if(typeName.equals(annotation.type())) + for (Class type : types) { - typeClass = type; - break; + ManagedObject annotation = type.getAnnotation(ManagedObject.class); + if (typeName.equals(annotation.type())) + { + typeClass = type; + break; + } } } if(typeClass == null && typeName.equals(category.getSimpleName())) @@ -214,7 +221,12 @@ public class ConfiguredObjectTypeRegistry { throw new IllegalArgumentException("Cannot locate ManagedObject information for " + clazz.getName()); } - return Collections.unmodifiableCollection(_knownTypes.get(categoryClass)); + Set> classes = _knownTypes.get(categoryClass); + if(classes == null) + { + classes = (Set>) ((Set)Collections.singleton(clazz)); + } + return Collections.unmodifiableCollection(classes); } @@ -225,7 +237,8 @@ public class ConfiguredObjectTypeRegistry { throw new IllegalArgumentException("Cannot locate ManagedObject information for " + clazz.getName()); } - return Collections.unmodifiableCollection(_typeSpecificAttributes.get(typeClass)); + Collection> typeAttrs = _typeSpecificAttributes.get(typeClass); + return Collections.unmodifiableCollection(typeAttrs == null ? Collections.>emptySet() : typeAttrs); } public static String getType(final Class clazz) @@ -711,7 +724,7 @@ public class ConfiguredObjectTypeRegistry } - static Map> getAttributeTypes(final Class clazz) + public static Map> getAttributeTypes(final Class clazz) { if(!_allAttributes.containsKey(clazz)) { -- cgit v1.2.1