Package org.apache.qpid.server.configuration

Examples of org.apache.qpid.server.configuration.ConfigurationEntry


        _entries.put(_rootId, brokerEntry);
    }

    private Map<String, Object> toTree(UUID rootId, Map<UUID, ConfigurationEntry> entries)
    {
        ConfigurationEntry entry = entries.get(rootId);
        if (entry == null || !entry.getId().equals(rootId))
        {
            throw new IllegalConfigurationException("Cannot find entry with id " + rootId + "!");
        }
        Map<String, Object> tree = new TreeMap<String, Object>();
        Map<String, Object> attributes = entry.getAttributes();
        if (attributes != null)
        {
            tree.putAll(attributes);
        }
        tree.put(ID, entry.getId());
        Set<UUID> childrenIds = entry.getChildrenIds();
        if (childrenIds != null && !childrenIds.isEmpty())
        {
            for (UUID relationship : childrenIds)
            {
                ConfigurationEntry child = entries.get(relationship);
                if (child != null)
                {
                    String relationshipName = child.getType().toLowerCase() + "s";

                    @SuppressWarnings("unchecked")
                    Collection<Map<String, Object>> children = (Collection<Map<String, Object>>) tree.get(relationshipName);
                    if (children == null)
                    {
View Full Code Here


        return relationships;
    }

    private boolean removeInternal(UUID entryId)
    {
        ConfigurationEntry oldEntry = _entries.remove(entryId);
        if (oldEntry != null)
        {
            Set<UUID> children = oldEntry.getChildrenIds();
            if (children != null && !children.isEmpty())
            {
                for (UUID childId : children)
                {
                    removeInternal(childId);
View Full Code Here

                    JsonNode element = elements.next();
                    if (element.isObject())
                    {
                        Class<? extends ConfiguredObject> expectedChildConfiguredObjectClass = _relationshipClasses.get(fieldName);
                        // assuming it is a child node
                        ConfigurationEntry entry = toEntry(element, expectedChildConfiguredObjectClass, entries);
                        childrenIds.add(entry.getId());
                    }
                    else
                    {
                        if (fieldValues == null)
                        {
                            fieldValues = new ArrayList<Object>();
                        }
                        fieldValues.add(toObject(element));
                    }
                }
                if (fieldValues != null)
                {
                    Object[] array = fieldValues.toArray(new Object[fieldValues.size()]);
                    if (attributes == null)
                    {
                        attributes = new HashMap<String, Object>();
                    }
                    attributes.put(fieldName, array);
                }
            }
            else if (fieldNode.isObject())
            {
                // ignore, in-line objects are not supported yet
            }
            else
            {
                // primitive attribute
                Object value = toObject(fieldNode);
                if (attributes == null)
                {
                    attributes = new HashMap<String, Object>();
                }
                attributes.put(fieldName, value);
            }
        }

        if (type == null)
        {
            if (expectedConfiguredObjectClass == null)
            {
                throw new IllegalConfigurationException("Type attribute is not provided for configuration entry " + parent);
            }
            else
            {
                type = expectedConfiguredObjectClass.getSimpleName();
            }
        }
        String name = null;
        if (attributes != null)
        {
            name = (String) attributes.get(ATTRIBUTE_NAME);
        }
        if ((name == null || "".equals(name)))
        {
            if (expectedConfiguredObjectClass == Broker.class)
            {
                name = DEFAULT_BROKER_NAME;
            }
            else
            {
                throw new IllegalConfigurationException("Name attribute is not provided for configuration entry " + parent);
            }
        }
        UUID id = null;
        if (idAsString == null)
        {
            id = UUIDGenerator.generateRandomUUID();

            _generatedObjectIdDuringLoad = true;
        }
        else
        {
            try
            {
                id = UUID.fromString(idAsString);
            }
            catch (Exception e)
            {
                throw new IllegalConfigurationException(
                        "ID attribute value does not conform to UUID format for configuration entry " + parent);
            }
        }
        ConfigurationEntry entry = new ConfigurationEntry(id, type, attributes, childrenIds, this);
        if (entries.containsKey(id))
        {
            throw new IllegalConfigurationException("Duplicate id is found: " + id
                    + "! The following configuration entries have the same id: " + entries.get(id) + ", " + entry);
        }
View Full Code Here

        return host;
    }

    private VirtualHost createHost(Map<String, Object> attributes)
    {
        ConfigurationEntry entry = new ConfigurationEntry(UUID.randomUUID(), VirtualHost.class.getSimpleName(), attributes,
                Collections.<UUID> emptySet(), null);

        return new VirtualHostRecoverer(_statisticsGatherer).create(_recovererProvider, entry, _broker);
    }
View Full Code Here

        }
    }

    public void testGroupProviderValidStateTransitions() throws Exception
    {
        ConfigurationEntry providerEntry = getGroupProviderConfigurationEntry();
        ConfiguredObject provider = createConfiguredObject(providerEntry);
        provider.setDesiredState(State.INITIALISING, State.QUIESCED);
        assertValidStateTransition(provider, State.QUIESCED, State.STOPPED);

        provider = createConfiguredObject(providerEntry);
View Full Code Here

        assertValidStateTransition(provider, State.ACTIVE, State.DELETED);
    }

    public void testGroupProviderInvalidStateTransitions() throws Exception
    {
        ConfigurationEntry providerEntry = getGroupProviderConfigurationEntry();
        assertAllInvalidStateTransitions(providerEntry);
    }
View Full Code Here

        assertAllInvalidStateTransitions(providerEntry);
    }

    public void testAuthenticationProviderValidStateTransitions()
    {
        ConfigurationEntry providerEntry = getAuthenticationProviderConfigurationEntry();
        assertAllValidStateTransitions(providerEntry);
    }
View Full Code Here

        assertAllValidStateTransitions(providerEntry);
    }

    public void testAuthenticationProviderInvalidStateTransitions()
    {
        ConfigurationEntry providerEntry = getAuthenticationProviderConfigurationEntry();
        assertAllInvalidStateTransitions(providerEntry);
    }
View Full Code Here

        assertAllInvalidStateTransitions(providerEntry);
    }

    public void testPortValidStateTransitions()
    {
        ConfigurationEntry providerEntry = getPortConfigurationEntry();
        assertAllValidStateTransitions(providerEntry);
    }
View Full Code Here

        assertAllValidStateTransitions(providerEntry);
    }

    public void testPortInvalidStateTransitions()
    {
        ConfigurationEntry providerEntry = getPortConfigurationEntry();
        assertAllInvalidStateTransitions(providerEntry);
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.configuration.ConfigurationEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.