qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1776351 - in /qpid/java/trunk: bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ broker-codegen/src/main/java/org/apache/qpid/server/model/validation/ broker-core/src/main/java/org/apache/qpid/server/binding/ broker-cor...
Date Wed, 28 Dec 2016 22:35:18 GMT
Author: rgodfrey
Date: Wed Dec 28 22:35:18 2016
New Revision: 1776351

URL: http://svn.apache.org/viewvc?rev=1776351&view=rev
Log:
QPID-7601 : Allow annotations to define ManagedAttributeValueTypes as abstract, some methods as derived

Added:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueTypeDerivedMethod.java   (with props)
Modified:
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java
    qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/AttributeAnnotationValidator.java
    qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/ManagedAttributeValueTypeValidator.java
    qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/OperationAnnotationValidator.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/binding/BindingImpl.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/connection/AmqpConnectionMetaData.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AncestorAttributeResolver.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectCustomSerialization.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModule.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueType.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/OwnAttributeResolver.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/PublishingLink.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/SocketConnectionMetaData.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCConfigurationStore.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java
    qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModuleTest.java
    qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementOutputConverter.java
    qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java Wed Dec 28 22:35:18 2016
@@ -25,13 +25,13 @@ import java.io.StringWriter;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.qpid.server.model.ConfiguredObjectJacksonModule;
-import org.apache.qpid.server.store.ConfiguredObjectRecord;
-
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.sleepycat.bind.tuple.TupleBinding;
 import com.sleepycat.bind.tuple.TupleInput;
 import com.sleepycat.bind.tuple.TupleOutput;
+
+import org.apache.qpid.server.model.ConfiguredObjectJacksonModule;
+import org.apache.qpid.server.store.ConfiguredObjectRecord;
 import org.apache.qpid.server.store.StoreException;
 import org.apache.qpid.server.store.berkeleydb.BDBConfiguredObjectRecord;
 
@@ -75,7 +75,7 @@ public class ConfiguredObjectBinding ext
         try
         {
             StringWriter writer = new StringWriter();
-            final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper();
+            final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(true);
             objectMapper.writeValue(writer, object.getAttributes());
             tupleOutput.writeString(object.getType());
             tupleOutput.writeString(writer.toString());

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java Wed Dec 28 22:35:18 2016
@@ -44,7 +44,7 @@ public class MapBinding extends TupleBin
     public Map<String, Object> entryToObject(final TupleInput input)
     {
         String json = input.readString();
-        ObjectMapper mapper = ConfiguredObjectJacksonModule.newObjectMapper();
+        ObjectMapper mapper = ConfiguredObjectJacksonModule.newObjectMapper(true);
         try
         {
             Map<String, Object> value = mapper.readValue(json, Map.class);
@@ -63,7 +63,7 @@ public class MapBinding extends TupleBin
         try
         {
             StringWriter writer = new StringWriter();
-            final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper();
+            final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(true);
             objectMapper.writeValue(writer, map);
             output.writeString(writer.toString());
         }

Modified: qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/AttributeAnnotationValidator.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/AttributeAnnotationValidator.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/AttributeAnnotationValidator.java (original)
+++ qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/AttributeAnnotationValidator.java Wed Dec 28 22:35:18 2016
@@ -86,8 +86,8 @@ public class AttributeAnnotationValidato
         typeUtils = processingEnv.getTypeUtils();
         messager = processingEnv.getMessager();
 
-        processAttributes(roundEnv, MANAGED_ATTRIBUTE_CLASS_NAME, false);
-        processAttributes(roundEnv, DERIVED_ATTRIBUTE_CLASS_NAME, true);
+        processAttributes(roundEnv, MANAGED_ATTRIBUTE_CLASS_NAME, false, false);
+        processAttributes(roundEnv, DERIVED_ATTRIBUTE_CLASS_NAME, true, true);
 
         processStatistics(roundEnv, MANAGED_STATISTIC_CLASS_NAME);
 
@@ -95,7 +95,9 @@ public class AttributeAnnotationValidato
     }
 
     public void processAttributes(final RoundEnvironment roundEnv,
-                                  String elementName, final boolean allowedNamed)
+                                  String elementName,
+                                  final boolean allowedNamed,
+                                  final boolean allowAbstractManagedTypes)
     {
 
         TypeElement annotationElement = elementUtils.getTypeElement(elementName);
@@ -323,11 +325,11 @@ public class AttributeAnnotationValidato
 
     boolean isValidType(final TypeMirror type)
     {
-        return isValidType(processingEnv, type);
+        return isValidType(processingEnv, type, false);
     }
 
     static boolean isValidType(ProcessingEnvironment processingEnv,
-                               final TypeMirror type)
+                               final TypeMirror type, final boolean allowAbstractManagedTypes)
     {
         Types typeUtils = processingEnv.getTypeUtils();
         Elements elementUtils = processingEnv.getElementUtils();
@@ -365,7 +367,23 @@ public class AttributeAnnotationValidato
             {
                 if (annotation.getAnnotationType().asElement().equals(managedAttributeTypeValueElement))
                 {
-                    return true;
+                    if(allowAbstractManagedTypes)
+                    {
+                        return true;
+                    }
+                    else
+                    {
+                        final Map<? extends ExecutableElement, ? extends AnnotationValue> annotationValues =
+                                elementUtils.getElementValuesWithDefaults(annotation);
+                        for(Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> element : annotationValues.entrySet())
+                        {
+                            if("isAbstract".contentEquals(element.getKey().getSimpleName()))
+                            {
+                                return element.getValue().getValue().equals(Boolean.FALSE);
+                            }
+                        }
+                        return false;
+                    }
                 }
             }
         }
@@ -413,7 +431,7 @@ public class AttributeAnnotationValidato
         {
             for(TypeMirror paramType : ((DeclaredType)type).getTypeArguments())
             {
-                if(!isValidType(processingEnv, paramType))
+                if(!isValidType(processingEnv, paramType, allowAbstractManagedTypes))
                 {
                     return false;
                 }
@@ -428,8 +446,8 @@ public class AttributeAnnotationValidato
             {
                 throw new IllegalArgumentException("Map types " + type + " must have exactly two type arguments");
             }
-            return isValidType(processingEnv, args.get(0))
-                   && (isValidType(processingEnv, args.get(1))
+            return isValidType(processingEnv, args.get(0), false)
+                   && (isValidType(processingEnv, args.get(1), false)
                        || typeUtils.isSameType(args.get(1), getErasure(processingEnv, "java.lang.Object")));
         }
 

Modified: qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/ManagedAttributeValueTypeValidator.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/ManagedAttributeValueTypeValidator.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/ManagedAttributeValueTypeValidator.java (original)
+++ qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/ManagedAttributeValueTypeValidator.java Wed Dec 28 22:35:18 2016
@@ -90,7 +90,7 @@ public class ManagedAttributeValueTypeVa
             if(memberElement instanceof ExecutableElement)
             {
                 final ExecutableElement methodElement = (ExecutableElement) memberElement;
-                AttributeAnnotationValidator.isValidType(processingEnv, methodElement.getReturnType());
+                AttributeAnnotationValidator.isValidType(processingEnv, methodElement.getReturnType(), false);
                 String methodName = methodElement.getSimpleName().toString();
 
                 if (methodName.length() < 3

Modified: qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/OperationAnnotationValidator.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/OperationAnnotationValidator.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/OperationAnnotationValidator.java (original)
+++ qpid/java/trunk/broker-codegen/src/main/java/org/apache/qpid/server/model/validation/OperationAnnotationValidator.java Wed Dec 28 22:35:18 2016
@@ -93,7 +93,7 @@ public class OperationAnnotationValidato
     public void checkMethodReturnType(final TypeElement annotationElement, final ExecutableElement methodElement)
     {
         final TypeMirror returnType = methodElement.getReturnType();
-        if (!(returnType.getKind() == TypeKind.VOID || isValidType(returnType)))
+        if (!(returnType.getKind() == TypeKind.VOID || isValidType(returnType, true)))
         {
             processingEnv.getMessager()
                     .printMessage(Diagnostic.Kind.ERROR,
@@ -113,6 +113,17 @@ public class OperationAnnotationValidato
 
         for (VariableElement varElem : methodElement.getParameters())
         {
+            if(!isValidType(varElem.asType(), false))
+            {
+                processingEnv.getMessager()
+                             .printMessage(Diagnostic.Kind.ERROR,
+                                           "@"
+                                           + paramElement.getSimpleName()
+                                           + " cannot be applied to variables of type "
+                                           + varElem.asType().toString(),
+                                           methodElement
+                                          );
+            }
             String name = varElem.getSimpleName().toString();
             final List<? extends AnnotationMirror> annotationMirrors = varElem.getAnnotationMirrors();
             AnnotationMirror paramAnnotation = null;
@@ -204,9 +215,9 @@ public class OperationAnnotationValidato
         }
     }
 
-    boolean isValidType(final TypeMirror type)
+    boolean isValidType(final TypeMirror type, final boolean allowAbstractManagedTypes)
     {
-        return AttributeAnnotationValidator.isValidType(processingEnv, type);
+        return AttributeAnnotationValidator.isValidType(processingEnv, type, allowAbstractManagedTypes);
     }
 
     private TypeMirror getErasure(final String className)

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/binding/BindingImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/binding/BindingImpl.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/binding/BindingImpl.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/binding/BindingImpl.java Wed Dec 28 22:35:18 2016
@@ -40,6 +40,18 @@ public class BindingImpl implements Bind
     }
 
     @Override
+    public String getName()
+    {
+        return getBindingKey();
+    }
+
+    @Override
+    public String getType()
+    {
+        return TYPE;
+    }
+
+    @Override
     public String getBindingKey()
     {
         return _bindingKey;

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/connection/AmqpConnectionMetaData.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/connection/AmqpConnectionMetaData.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/connection/AmqpConnectionMetaData.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/connection/AmqpConnectionMetaData.java Wed Dec 28 22:35:18 2016
@@ -34,5 +34,4 @@ public interface AmqpConnectionMetaData
     String getClientId();
     String getClientVersion();
     String getClientProduct();
-
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java Wed Dec 28 22:35:18 2016
@@ -2024,7 +2024,7 @@ public abstract class AbstractConfigured
                 {
                     if(value instanceof Collection || value instanceof Map)
                     {
-                        ObjectMapper mapper = ConfiguredObjectJacksonModule.newObjectMapper();
+                        ObjectMapper mapper = ConfiguredObjectJacksonModule.newObjectMapper(false);
                         try(StringWriter stringWriter = new StringWriter())
                         {
                             mapper.writeValue(stringWriter, value);

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AncestorAttributeResolver.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AncestorAttributeResolver.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AncestorAttributeResolver.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AncestorAttributeResolver.java Wed Dec 28 22:35:18 2016
@@ -42,7 +42,7 @@ public class AncestorAttributeResolver i
     public AncestorAttributeResolver(final ConfiguredObject<?> object)
     {
         _object = object;
-        _objectMapper = ConfiguredObjectJacksonModule.newObjectMapper();
+        _objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(false);
     }
 
     @Override

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java Wed Dec 28 22:35:18 2016
@@ -23,6 +23,7 @@ package org.apache.qpid.server.model;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Proxy;
@@ -1125,10 +1126,85 @@ abstract class AttributeValueConverter<T
         throw new ServerScopedRuntimeException("Unable to process type when constructing configuration model: " + t);
     }
 
+    private interface ValueMethod<X extends ManagedAttributeValue>
+    {
+        Object getValue(X object);
+    }
+
+
+    private static class ConstantValueMethod<X extends ManagedAttributeValue> implements ValueMethod<X>
+    {
+
+        private final String _value;
+
+        public ConstantValueMethod(final String derivedMethodValue)
+        {
+            _value = derivedMethodValue;
+        }
+
+        @Override
+        public Object getValue(final X object)
+        {
+            return _value;
+        }
+    }
+
+
+    private static class ObjectMethodValueMethod<X extends ManagedAttributeValue> implements ValueMethod<X>
+    {
+        private final Method _sourceMethod;
+
+        public ObjectMethodValueMethod(final Method sourceMethod)
+        {
+            _sourceMethod = sourceMethod;
+        }
+
+        @Override
+        public Object getValue(final X object)
+        {
+            try
+            {
+                return _sourceMethod.invoke(object);
+            }
+            catch (IllegalAccessException | InvocationTargetException e)
+            {
+                throw new IllegalArgumentException(e);
+            }
+        }
+    }
+
+
+    private static class StaticMethodValueMethod<X extends ManagedAttributeValue> implements ValueMethod<X>
+    {
+        private final Method _sourceMethod;
+
+        public StaticMethodValueMethod(final Method sourceMethod)
+        {
+            _sourceMethod = sourceMethod;
+        }
+
+        @Override
+        public Object getValue(final X object)
+        {
+            try
+            {
+                return _sourceMethod.invoke(null, object);
+            }
+            catch (IllegalAccessException | InvocationTargetException e)
+            {
+                throw new IllegalArgumentException(e);
+            }
+        }
+    }
+
     static final class ManageableAttributeTypeConverter<X extends ManagedAttributeValue> extends AttributeValueConverter<X>
     {
+        private static final Pattern STATIC_METHOD_PATTERN = Pattern.compile("([\\w][\\w\\d_]+\\.)+[\\w][\\w\\d_\\$]*#[\\w\\d_]+\\s*\\(\\s*\\)");
+        private static final Pattern OBJECT_METHOD_PATTERN = Pattern.compile("#[\\w\\d_]+\\s*\\(\\s*\\)");
+
         private final Class<X> _klazz;
         private final Map<Method, AttributeValueConverter<?>> _propertyConverters = new HashMap<>();
+        private final Map<Method, ValueMethod<X>> _derivedValueMethod = new HashMap<>();
 
         private ManageableAttributeTypeConverter(final Class<X> klazz)
         {
@@ -1142,6 +1218,46 @@ abstract class AttributeValueConverter<T
                 {
                     _propertyConverters.put(method, AttributeValueConverter.getConverter(getTypeFromMethod(method), method.getGenericReturnType()));
                 }
+
+                final ManagedAttributeValueTypeDerivedMethod derivedMethodAnnotation =
+                        method.getAnnotation(ManagedAttributeValueTypeDerivedMethod.class);
+                if (derivedMethodAnnotation != null)
+                {
+                    String derivedMethodValue = derivedMethodAnnotation.value();
+                    if (STATIC_METHOD_PATTERN.matcher(derivedMethodValue).matches())
+                    {
+                        try
+                        {
+                            String className = derivedMethodValue.split("#")[0].trim();
+                            String sourceMethodName = derivedMethodValue.split("#")[1].split("\\(")[0].trim();
+                            Class<?> sourceMethodClass = Class.forName(className);
+                            Method sourceMethod = sourceMethodClass.getMethod(sourceMethodName, klazz);
+                            _derivedValueMethod.put(method, new StaticMethodValueMethod<X>(sourceMethod));
+
+                        }
+                        catch (ClassNotFoundException | NoSuchMethodException e)
+                        {
+                            throw new IllegalArgumentException(e);
+                        }
+                    }
+                    else if (OBJECT_METHOD_PATTERN.matcher(derivedMethodValue).matches())
+                    {
+                        try
+                        {
+                            final Method sourceMethod =
+                                    klazz.getMethod(derivedMethodValue.substring(1, derivedMethodValue.indexOf((int) '(')));
+                            _derivedValueMethod.put(method, new ObjectMethodValueMethod<X>(sourceMethod));
+                        }
+                        catch (NoSuchMethodException e)
+                        {
+                            throw new IllegalArgumentException(e);
+                        }
+                    }
+                    else
+                    {
+                        _derivedValueMethod.put(method, new ConstantValueMethod<X>(derivedMethodValue));
+                    }
+                }
             }
 
         }
@@ -1159,61 +1275,79 @@ abstract class AttributeValueConverter<T
             }
             else if(value instanceof Map)
             {
-                return (X) Proxy.newProxyInstance(_klazz.getClassLoader(), new Class[]{_klazz}, new InvocationHandler()
-                {
-                    @Override
-                    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable
-                    {
-                        AttributeValueConverter<?> converter = _propertyConverters.get(method);
-                        Map map = (Map) value;
-                        if(converter != null)
-                        {
-                            return convertValue(map, converter, method);
-                        }
-                        else if("toString".equals(method.getName()) && method.getParameterTypes().length == 0)
-                        {
-                            return _klazz.getSimpleName() + " : " + map.toString();
-                        }
-                        else if("hashCode".equals(method.getName()) && method.getParameterTypes().length == 0)
+                @SuppressWarnings("unchecked")
+                final X proxyObject =
+                        (X) Proxy.newProxyInstance(_klazz.getClassLoader(), new Class[]{_klazz}, new InvocationHandler()
                         {
-                            return map.hashCode();
-                        }
-                        else if("equals".equals(method.getName()) && method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == Object.class)
-                        {
-                            if(_klazz.isInstance(args[0]))
+                            @Override
+                            public Object invoke(final Object proxy, final Method method, final Object[] args)
+                                    throws Throwable
                             {
-                                for(Map.Entry<Method, AttributeValueConverter<?>> entry : _propertyConverters.entrySet())
+                                AttributeValueConverter<?> converter = _propertyConverters.get(method);
+                                Map map = (Map) value;
+                                if (converter != null)
                                 {
-                                    AttributeValueConverter<?> conv = entry.getValue();
-                                    Method meth = entry.getKey();
-
-                                    Object lvalue = convertValue(map, conv, meth);
-                                    Object rvalue = meth.invoke(args[0]);
-                                    if((lvalue == null && rvalue != null) || (lvalue != null && !lvalue.equals(rvalue)))
+                                    return convertValue(map, converter, method, proxy);
+                                }
+                                else if ("toString".equals(method.getName()) && method.getParameterTypes().length == 0)
+                                {
+                                    return _klazz.getSimpleName() + " : " + map.toString();
+                                }
+                                else if ("hashCode".equals(method.getName()) && method.getParameterTypes().length == 0)
+                                {
+                                    return map.hashCode();
+                                }
+                                else if ("equals".equals(method.getName())
+                                         && method.getParameterTypes().length == 1
+                                         && method.getParameterTypes()[0] == Object.class)
+                                {
+                                    if (_klazz.isInstance(args[0]))
+                                    {
+                                        for (Map.Entry<Method, AttributeValueConverter<?>> entry : _propertyConverters.entrySet())
+                                        {
+                                            AttributeValueConverter<?> conv = entry.getValue();
+                                            Method meth = entry.getKey();
+
+                                            Object lvalue = convertValue(map, conv, meth, proxy);
+                                            Object rvalue = meth.invoke(args[0]);
+                                            if ((lvalue == null && rvalue != null) || (lvalue != null && !lvalue.equals(
+                                                    rvalue)))
+                                            {
+                                                return false;
+                                            }
+                                        }
+                                        return true;
+                                    }
+                                    else
                                     {
                                         return false;
                                     }
                                 }
-                                return true;
+                                throw new UnsupportedOperationException(
+                                        "The proxy class implements only attribute getters and toString(), hashCode() and equals()");
                             }
-                            else
+
+                            private Object convertValue(final Map map,
+                                                        final AttributeValueConverter<?> converter,
+                                                        final Method method, final Object proxy)
                             {
-                                return false;
+                                String attributeName = getNameFromMethod(method, getTypeFromMethod(method));
+                                if (_derivedValueMethod.containsKey(method))
+                                {
+                                    return converter.convert(_derivedValueMethod.get(method).getValue((X) proxy),
+                                                             object);
+                                }
+                                else if (map.containsKey(attributeName))
+                                {
+                                    return converter.convert(map.get(attributeName), object);
+                                }
+                                else
+                                {
+                                    return Defaults.defaultValue(method.getReturnType());
+                                }
                             }
-                        }
-                        throw new UnsupportedOperationException("The proxy class implements only attribute getters and toString(), hashCode() and equals()");
-                    }
-
-                    private Object convertValue(final Map map,
-                                                final AttributeValueConverter<?> converter,
-                                                final Method method)
-                    {
-                        String attributeName = getNameFromMethod(method, getTypeFromMethod(method));
-                        return map.containsKey(attributeName)
-                                ? converter.convert(map.get(attributeName), object)
-                                : Defaults.defaultValue(method.getReturnType());
-                    }
-                });
+                        });
+                return proxyObject;
             }
             else if(value instanceof String)
             {
@@ -1231,6 +1365,7 @@ abstract class AttributeValueConverter<T
             }
             throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to a " + _klazz.getName());
         }
+
     }
 
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java Wed Dec 28 22:35:18 2016
@@ -25,6 +25,17 @@ import java.util.Map;
 @ManagedAttributeValueType
 public interface Binding extends PublishingLink
 {
+
+    String TYPE = "binding";
+
+    @Override
+    @ManagedAttributeValueTypeDerivedMethod("#getBindingKey()")
+    String getName();
+
+    @Override
+    @ManagedAttributeValueTypeDerivedMethod(TYPE)
+    String getType();
+
     String getBindingKey();
     Map<String,Object> getArguments();
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectCustomSerialization.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectCustomSerialization.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectCustomSerialization.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectCustomSerialization.java Wed Dec 28 22:35:18 2016
@@ -58,14 +58,28 @@ public class ConfiguredObjectCustomSeria
     }
 
     private static final Map<Class<?>, Converter<?>> REGISTERED_CONVERTERS = new ConcurrentHashMap<>();
+    private static final Map<Class<?>, Converter<?>> REGISTERED_PERSISTENCE_CONVERTERS = new ConcurrentHashMap<>();
 
     private abstract static class AbstractConverter<T> implements Converter<T>
     {
         private final Class<T> _conversionClass;
 
+
         public AbstractConverter(Class<T> conversionClass)
         {
-            REGISTERED_CONVERTERS.put(conversionClass, this);
+            this(conversionClass, true, true);
+        }
+
+        public AbstractConverter(Class<T> conversionClass, boolean nonPersistenceConverter, boolean persistenceConverted)
+        {
+            if(nonPersistenceConverter)
+            {
+                REGISTERED_CONVERTERS.put(conversionClass, this);
+            }
+            if(persistenceConverted)
+            {
+                REGISTERED_PERSISTENCE_CONVERTERS.put(conversionClass, this);
+            }
             _conversionClass = conversionClass;
         }
 
@@ -76,9 +90,9 @@ public class ConfiguredObjectCustomSeria
         }
     }
 
-    public static Collection<Converter<?>> getConverters()
+    public static Collection<Converter<?>> getConverters(final boolean forPersistence)
     {
-        return REGISTERED_CONVERTERS.values();
+        return forPersistence ? REGISTERED_PERSISTENCE_CONVERTERS.values() : REGISTERED_CONVERTERS.values();
     }
 
     @SuppressWarnings("unused")
@@ -137,41 +151,111 @@ public class ConfiguredObjectCustomSeria
 
     @SuppressWarnings("unused")
     private static final Converter<ManagedAttributeValue> MANAGED_ATTRIBUTE_VALUE_CONVERTER =
-            new AbstractConverter<ManagedAttributeValue>(ManagedAttributeValue.class)
+            new ManagedAttributeValueAbstractConverter(true);
+
+
+    @SuppressWarnings("unused")
+    private static final Converter<ManagedAttributeValue> MANAGED_ATTRIBUTE_VALUE_PERSISTENCE_CONVERTER =
+            new ManagedAttributeValueAbstractConverter(false);
+
+    private static class ManagedAttributeValueAbstractConverter extends AbstractConverter<ManagedAttributeValue>
+    {
+        private final boolean _includeDerivedAttributes;
+
+        public ManagedAttributeValueAbstractConverter(final boolean includeDerivedAttributes)
+        {
+            super(ManagedAttributeValue.class, includeDerivedAttributes, !includeDerivedAttributes);
+            _includeDerivedAttributes = includeDerivedAttributes;
+        }
+
+        @Override
+        public Object convert(final ManagedAttributeValue value)
+        {
+
+            Map<String, Object> valueAsMap = new LinkedHashMap<>();
+            for (Method method : value.getClass().getMethods())
             {
-                @Override
-                public Object convert(final ManagedAttributeValue value)
+                final String methodName = method.getName();
+                if (method.getParameterTypes().length == 0
+                    && !OBJECT_METHOD_NAMES.contains(methodName)
+                    && (methodName.startsWith("is")
+                        || methodName.startsWith("has")
+                        || methodName.startsWith("get")))
                 {
-
-                    Map<String, Object> valueAsMap = new LinkedHashMap<>();
-                    for (Method method : value.getClass().getMethods())
+                    if(_includeDerivedAttributes || !isDerivedMethod(method))
                     {
-                        final String methodName = method.getName();
-                        if (method.getParameterTypes().length == 0
-                            && !OBJECT_METHOD_NAMES.contains(methodName)
-                            && (methodName.startsWith("is")
-                                || methodName.startsWith("has")
-                                || methodName.startsWith("get")))
+                        String propertyName =
+                                methodName.startsWith("is") ? methodName.substring(2) : methodName.substring(3);
+                        propertyName = Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
+                        try
                         {
-                            String propertyName =
-                                    methodName.startsWith("is") ? methodName.substring(2) : methodName.substring(3);
-                            propertyName = Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
-                            try
+                            final Object attrValue = method.invoke(value);
+                            if (attrValue != null)
                             {
-                                final Object attrValue = method.invoke(value);
-                                if (attrValue != null)
-                                {
-                                    valueAsMap.put(propertyName, attrValue);
-                                }
-                            }
-                            catch (IllegalAccessException | InvocationTargetException e)
-                            {
-                                throw new ServerScopedRuntimeException(e);
+                                valueAsMap.put(propertyName, attrValue);
                             }
                         }
+                        catch (IllegalAccessException | InvocationTargetException e)
+                        {
+                            throw new ServerScopedRuntimeException(e);
+                        }
                     }
-                    return valueAsMap;
                 }
-            };
+            }
+            return valueAsMap;
+        }
 
+        private boolean isDerivedMethod(final Method method)
+        {
+            final boolean annotationPresent = method.isAnnotationPresent(ManagedAttributeValueTypeDerivedMethod.class);
+            if(!annotationPresent)
+            {
+
+                final Class<?> clazz = method.getDeclaringClass();
+                final String methodName = method.getName();
+                if (isDerivedMethod(clazz, methodName))
+                {
+                    return true;
+                }
+            }
+            return annotationPresent;
+        }
+
+        private boolean isDerivedMethod(final Class<?> clazz, final String methodName)
+        {
+            for(Method method : clazz.getDeclaredMethods())
+            {
+                if(method.getName().equals(methodName)
+                   && method.getParameterTypes().length==0)
+                {
+                    if(method.isAnnotationPresent(ManagedAttributeValueTypeDerivedMethod.class))
+                    {
+                        return true;
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+            }
+            for(Class<?> iface : clazz.getInterfaces())
+            {
+                if(ManagedAttributeValue.class.isAssignableFrom(iface))
+                {
+                    if(isDerivedMethod(iface, methodName))
+                    {
+                        return true;
+                    }
+                }
+            }
+            if(clazz.getSuperclass() != null && ManagedAttributeValue.class.isAssignableFrom(clazz.getSuperclass()))
+            {
+                if(isDerivedMethod(clazz.getSuperclass(), methodName))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModule.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModule.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModule.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModule.java Wed Dec 28 22:35:18 2016
@@ -38,7 +38,9 @@ public class ConfiguredObjectJacksonModu
 {
     private static final long serialVersionUID = 1L;
 
-    private static final ConfiguredObjectJacksonModule INSTANCE = new ConfiguredObjectJacksonModule();
+    private static final ConfiguredObjectJacksonModule INSTANCE = new ConfiguredObjectJacksonModule(false);
+    private static final ConfiguredObjectJacksonModule PERSISTENCE_INSTANCE = new ConfiguredObjectJacksonModule(true);
+
 
     private static final Set<String> OBJECT_METHOD_NAMES = Collections.synchronizedSet(new HashSet<String>());
 
@@ -50,10 +52,11 @@ public class ConfiguredObjectJacksonModu
         }
     }
 
-    private  ConfiguredObjectJacksonModule()
+    private  ConfiguredObjectJacksonModule(final boolean forPersistence)
     {
         super("ConfiguredObjectSerializer", new Version(1,0,0,null, "org.apache.qpid", "broker-core"));
-        for(final ConfiguredObjectCustomSerialization.Converter converter : ConfiguredObjectCustomSerialization.getConverters())
+        for(final ConfiguredObjectCustomSerialization.Converter converter :
+                ConfiguredObjectCustomSerialization.getConverters(forPersistence))
         {
             addSerializer(converter.getConversionClass(), new JsonSerializer()
             {
@@ -68,10 +71,10 @@ public class ConfiguredObjectJacksonModu
 
     }
 
-    public static ObjectMapper newObjectMapper()
+    public static ObjectMapper newObjectMapper(final boolean forPersistence)
     {
         final ObjectMapper objectMapper = new ObjectMapper();
-        objectMapper.registerModule(INSTANCE);
+        objectMapper.registerModule(forPersistence ? PERSISTENCE_INSTANCE : INSTANCE);
         return objectMapper;
     }
 

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java Wed Dec 28 22:35:18 2016
@@ -959,7 +959,7 @@ public class ConfiguredObjectTypeRegistr
                         {
                             try
                             {
-                                stringValue = ConfiguredObjectJacksonModule.newObjectMapper().writeValueAsString(value);
+                                stringValue = ConfiguredObjectJacksonModule.newObjectMapper(false).writeValueAsString(value);
                             }
                             catch (JsonProcessingException e)
                             {

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueType.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueType.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueType.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueType.java Wed Dec 28 22:35:18 2016
@@ -28,4 +28,5 @@ import java.lang.annotation.Target;
 @Target(ElementType.TYPE)
 public @interface ManagedAttributeValueType
 {
+    boolean isAbstract() default false;
 }

Added: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueTypeDerivedMethod.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueTypeDerivedMethod.java?rev=1776351&view=auto
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueTypeDerivedMethod.java (added)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueTypeDerivedMethod.java Wed Dec 28 22:35:18 2016
@@ -0,0 +1,32 @@
+package org.apache.qpid.server.model;/*
+ *
+ * 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.
+ *
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface ManagedAttributeValueTypeDerivedMethod
+{
+    String value();
+}

Propchange: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeValueTypeDerivedMethod.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/OwnAttributeResolver.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/OwnAttributeResolver.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/OwnAttributeResolver.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/OwnAttributeResolver.java Wed Dec 28 22:35:18 2016
@@ -42,7 +42,7 @@ public class OwnAttributeResolver implem
     public OwnAttributeResolver(final ConfiguredObject<?> object)
     {
         _object = object;
-        _objectMapper = ConfiguredObjectJacksonModule.newObjectMapper();
+        _objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(false);
     }
 
     @Override

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/PublishingLink.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/PublishingLink.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/PublishingLink.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/PublishingLink.java Wed Dec 28 22:35:18 2016
@@ -20,8 +20,10 @@
  */
 package org.apache.qpid.server.model;
 
-@ManagedAttributeValueType
+@ManagedAttributeValueType(isAbstract = true)
 public interface PublishingLink extends ManagedAttributeValue
 {
+    String getName();
+    String getType();
     String getDestination();
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/SocketConnectionMetaData.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/SocketConnectionMetaData.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/SocketConnectionMetaData.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/SocketConnectionMetaData.java Wed Dec 28 22:35:18 2016
@@ -24,7 +24,7 @@ import org.apache.qpid.server.model.Mana
 import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.Transport;
 
-@ManagedAttributeValueType
+@ManagedAttributeValueType(isAbstract = true)
 public interface SocketConnectionMetaData
 {
     String getLocalAddress();

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCConfigurationStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCConfigurationStore.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCConfigurationStore.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCConfigurationStore.java Wed Dec 28 22:35:18 2016
@@ -290,7 +290,7 @@ public abstract class AbstractJDBCConfig
 
             Map<UUID,Map<String,Object>> bindingsToUpdate = new HashMap<UUID, Map<String, Object>>();
             List<UUID> others = new ArrayList<UUID>();
-            final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper();
+            final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(true);
 
             PreparedStatement stmt = connection.prepareStatement("SELECT id, object_type, attributes FROM " + getConfiguredObjectsTableName());
             try
@@ -632,7 +632,7 @@ public abstract class AbstractJDBCConfig
                         else
                         {
                             final Map<String, Object> attributes = configuredObject.getAttributes();
-                            final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper();
+                            final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(true);
                             byte[] attributesAsBytes = objectMapper.writeValueAsBytes(attributes);
 
                             ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
@@ -742,7 +742,7 @@ public abstract class AbstractJDBCConfig
             try (ResultSet rs = stmt.executeQuery())
             {
 
-                final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper();
+                final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(true);
                 if (rs.next())
                 {
                     try (PreparedStatement stmt2 = conn.prepareStatement("UPDATE " + getConfiguredObjectsTableName()

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java Wed Dec 28 22:35:18 2016
@@ -29,7 +29,6 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -93,7 +92,7 @@ public class JsonFileConfigStore extends
     public JsonFileConfigStore(Class<? extends ConfiguredObject> rootClass)
     {
         super();
-        _objectMapper = ConfiguredObjectJacksonModule.newObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
+        _objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(true).enable(SerializationFeature.INDENT_OUTPUT);
         _rootClass = rootClass;
     }
 

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java Wed Dec 28 22:35:18 2016
@@ -350,7 +350,7 @@ public abstract class AbstractJDBCPrefer
                                      final Map<String, Object> attributes)
             throws JsonProcessingException, SQLException
     {
-        final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper();
+        final ObjectMapper objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(true);
         if (attributes != null)
         {
             byte[] attributesAsBytes = objectMapper.writeValueAsBytes(attributes);

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java Wed Dec 28 22:35:18 2016
@@ -50,7 +50,7 @@ public class JsonFilePreferenceStore ext
         super();
         _storePath = path;
         _posixFilePermissions = posixFilePermissions;
-        _objectMapper = ConfiguredObjectJacksonModule.newObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
+        _objectMapper = ConfiguredObjectJacksonModule.newObjectMapper(true).enable(SerializationFeature.INDENT_OUTPUT);
         _recordMap = new LinkedHashMap<>();
     }
 

Modified: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModuleTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModuleTest.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModuleTest.java (original)
+++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectJacksonModuleTest.java Wed Dec 28 22:35:18 2016
@@ -52,7 +52,7 @@ public class ConfiguredObjectJacksonModu
         when(authProvider.getType()).thenReturn(originType);
         when(authProvider.getName()).thenReturn(originName);
         Principal p = new UsernamePrincipal(username, authProvider);
-        ObjectMapper mapper = ConfiguredObjectJacksonModule.newObjectMapper();
+        ObjectMapper mapper = ConfiguredObjectJacksonModule.newObjectMapper(false);
         String json = mapper.writeValueAsString(p);
         assertEquals("unexpected principal serialisation", expectedSerialisation, json);
     }
@@ -61,7 +61,7 @@ public class ConfiguredObjectJacksonModu
     {
         ManagedAttributeValue testType = new TestManagedAttributeValue();
 
-        ObjectMapper encoder = ConfiguredObjectJacksonModule.newObjectMapper();
+        ObjectMapper encoder = ConfiguredObjectJacksonModule.newObjectMapper(false);
         String encodedValue = encoder.writeValueAsString(testType);
         ObjectMapper decoder = new ObjectMapper();
         Map decodedMap = decoder.readValue(encodedValue, Map.class);

Modified: qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementOutputConverter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementOutputConverter.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementOutputConverter.java (original)
+++ qpid/java/trunk/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementOutputConverter.java Wed Dec 28 22:35:18 2016
@@ -92,7 +92,8 @@ class ManagementOutputConverter
         }
         else
         {
-            for(ConfiguredObjectCustomSerialization.Converter converter : ConfiguredObjectCustomSerialization.getConverters())
+            for(ConfiguredObjectCustomSerialization.Converter converter : ConfiguredObjectCustomSerialization.getConverters(
+                    false))
             {
                 if(converter.getConversionClass().isAssignableFrom(value.getClass()))
                 {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java?rev=1776351&r1=1776350&r2=1776351&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java Wed Dec 28 22:35:18 2016
@@ -247,7 +247,7 @@ public abstract class AbstractServlet ex
     private void writeObjectToResponse(Object object, HttpServletRequest request,  HttpServletResponse response) throws IOException
     {
         OutputStream stream = getOutputStream(request, response);
-        ObjectMapper mapper = ConfiguredObjectJacksonModule.newObjectMapper();
+        ObjectMapper mapper = ConfiguredObjectJacksonModule.newObjectMapper(false);
         mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
         mapper.writeValue(stream, object);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message