private Map getPropertiesMap()

in src/main/java/org/apache/sling/jmx/provider/impl/AttributeResource.java [124:160]


    private Map<String, Object> getPropertiesMap() {
        final Map<String, Object> result = new HashMap<String, Object>();
        result.put(Constants.PROP_RESOURCE_TYPE, this.getResourceType());
        if ( this.getResourceSuperType() != null ) {
            result.put(Constants.PROP_RESOURCE_SUPER_TYPE, this.getResourceSuperType());
        }

        if ( info.getDescription() != null ) {
            result.put(Constants.PROP_DESCRIPTION, info.getDescription());
        }
        result.put(Constants.PROP_TYPE, info.getType());

        try {
            final Object value = attrValue;
            if ( value != null ) {
                if ( value.getClass().isArray() ) {
                    final int length = Array.getLength(value);
                    final Object[] values = new Object[length];
                    for (int i = 0; i < length; i ++) {
                        final Object o = Array.get(value, i);
                        values[i] = convert(o);
                    }
                    result.put(Constants.PROP_VALUE, values);
                } else if (value instanceof TabularData) {
                    // Nothing to do, value is child resource
                } else if (value instanceof CompositeData) {
                    // Nothing to do, value is child resource
                } else {
                    result.put(Constants.PROP_VALUE, convert(value));
                }
            }
        } catch (final Exception ignore) {
            // ignore, but put this as info
            result.put("mbean:exception", ignore.getMessage());
        }
        return result;
    }