Package org.apache.qpid.server.configuration

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


        Map<String, Object> merged = generateEffectiveAttributes(converted);

        String newName = (String) merged.get(NAME);
        if(!getName().equals(newName))
        {
            throw new IllegalConfigurationException("Changing the port name is not allowed");
        }

        Integer newPort = (Integer) merged.get(PORT);
        if(getPort() != newPort)
        {
            for(Port p : _broker.getPorts())
            {
                if(p.getPort() == newPort)
                {
                    throw new IllegalConfigurationException("Port number " + newPort + " is already in use by port " + p.getName());
                }
            }
        }

        @SuppressWarnings("unchecked")
        Collection<Transport> transports = (Collection<Transport>)merged.get(TRANSPORTS);
        @SuppressWarnings("unchecked")
        Collection<Protocol> protocols = (Collection<Protocol>)merged.get(PROTOCOLS);
        Boolean needClientCertificate = (Boolean)merged.get(NEED_CLIENT_AUTH);
        Boolean wantClientCertificate = (Boolean)merged.get(WANT_CLIENT_AUTH);
        boolean requiresCertificate = (needClientCertificate != null && needClientCertificate.booleanValue())
                || (wantClientCertificate != null && wantClientCertificate.booleanValue());

        String keyStoreName = (String) merged.get(KEY_STORE);
        if(keyStoreName != null)
        {
            if (_broker.findKeyStoreByName(keyStoreName) == null)
            {
                throw new IllegalConfigurationException("Can't find key store with name '" + keyStoreName + "' for port " + getName());
            }
        }

        Set<String> trustStoreNames = (Set<String>) merged.get(TRUST_STORES);
        boolean hasTrustStore = trustStoreNames != null && !trustStoreNames.isEmpty();
        if(hasTrustStore)
        {
            for (String trustStoreName : trustStoreNames)
            {
                if (_broker.findTrustStoreByName(trustStoreName) == null)
                {
                    throw new IllegalConfigurationException("Cannot find trust store with name '" + trustStoreName + "'");
                }
            }
        }

        boolean usesSsl = transports != null && transports.contains(Transport.SSL);
        if (usesSsl)
        {
            if (keyStoreName == null)
            {
                throw new IllegalConfigurationException("Can't create port which requires SSL but has no key store configured.");
            }

            if (!hasTrustStore && requiresCertificate)
            {
                throw new IllegalConfigurationException("Can't create port which requests SSL client certificates but has no trust store configured.");
            }
        }
        else
        {
            if (requiresCertificate)
            {
                throw new IllegalConfigurationException("Can't create port which requests SSL client certificates but doesn't use SSL transport.");
            }
        }

        if (protocols != null && protocols.contains(Protocol.RMI) && usesSsl)
        {
            throw new IllegalConfigurationException("Can't create RMI Registry port which requires SSL.");
        }

        String authenticationProviderName = (String)merged.get(AUTHENTICATION_PROVIDER);
        if (authenticationProviderName != null)
        {
            Collection<AuthenticationProvider> providers = _broker.getAuthenticationProviders();
            AuthenticationProvider provider = null;
            for (AuthenticationProvider p : providers)
            {
                if (p.getName().equals(authenticationProviderName))
                {
                    provider = p;
                    break;
                }
            }

            if (provider == null)
            {
                throw new IllegalConfigurationException("Cannot find authentication provider with name '"
                        + authenticationProviderName + "'");
            }
        }
        else
        {
            if (protocols != null && !protocols.contains(Protocol.RMI))
            {
                throw new IllegalConfigurationException("An authentication provider must be specified");
            }
        }

        super.changeAttributes(converted);
    }
View Full Code Here


        String keyStoreName = (String)getAttribute(Port.KEY_STORE);
        KeyStore keyStore = _broker.findKeyStoreByName(keyStoreName);

        if (keyStoreName != null && keyStore == null)
        {
            throw new IllegalConfigurationException("Can't find key store with name '" + keyStoreName + "' for port " + getName());
        }

        return keyStore;
    }
View Full Code Here

            for (String name : trustStoreNames)
            {
                TrustStore trustStore = _broker.findTrustStoreByName(name);
                if (trustStore == null)
                {
                    throw new IllegalConfigurationException("Can't find trust store with name '" + name + "' for port " + getName());
                }

                trustStores.add(trustStore);
            }
        }
View Full Code Here

            for(Port p : _portAdapters.values())
            {
                if(portNumber == p.getPort())
                {
                    throw new IllegalConfigurationException("Can't add port " + portName + " because port number " + portNumber + " is already configured for port " + p.getName());
                }

                if(portName == p.getName())
                {
                    throw new IllegalConfigurationException("Can't add Port because one with name " + portName + " already exists");
                }

                if(portId == p.getId())
                {
                    throw new IllegalConfigurationException("Can't add Port because one with id " + portId + " already exists");
                }
            }

            _portAdapters.put(port.getId(), port);
        }
View Full Code Here

        String name = accessControlProvider.getName();
        synchronized (_authenticationProviders)
        {
            if (_accessControlProviders.containsKey(accessControlProvider.getId()))
            {
                throw new IllegalConfigurationException("Can't add AccessControlProvider because one with id " + accessControlProvider.getId() + " already exists");
            }
            for (AccessControlProvider provider : _accessControlProviders.values())
            {
                if (provider.getName().equals(name))
                {
                    throw new IllegalConfigurationException("Can't add AccessControlProvider because one with name " + name + " already exists");
                }
            }
            _accessControlProviders.put(accessControlProvider.getId(), accessControlProvider);
        }
View Full Code Here

        String name = authenticationProvider.getName();
        synchronized (_authenticationProviders)
        {
            if (_authenticationProviders.containsKey(authenticationProvider.getId()))
            {
                throw new IllegalConfigurationException("Cannot add AuthenticationProvider because one with id " + authenticationProvider.getId() + " already exists");
            }
            for (AuthenticationProvider provider : _authenticationProviders.values())
            {
                if (provider.getName().equals(name))
                {
                    throw new IllegalConfigurationException("Cannot add AuthenticationProvider because one with name " + name + " already exists");
                }
            }
            _authenticationProviders.put(authenticationProvider.getId(), authenticationProvider);
        }
        authenticationProvider.addChangeListener(this);
View Full Code Here

        synchronized (_groupProviders)
        {
            String name = groupProvider.getName();
            if(_groupProviders.containsKey(name))
            {
                throw new IllegalConfigurationException("Cannot add GroupProvider because one with name " + name + " already exists");
            }
            _groupProviders.put(name, groupProvider);
        }
        groupProvider.addChangeListener(this);
    }
View Full Code Here

    {
        synchronized (_keyStores)
        {
            if(_keyStores.containsKey(keyStore.getName()))
            {
                throw new IllegalConfigurationException("Can't add KeyStore because one with name " + keyStore.getName() + " already exists");
            }
            _keyStores.put(keyStore.getName(), keyStore);
        }
        keyStore.addChangeListener(this);
    }
View Full Code Here

            {
                ConfigurationEntry entry = entries[i];
                UUID id = entry.getId();
                if (_cliEntries.containsKey(id))
                {
                    throw new IllegalConfigurationException("Cannot save configuration provided as command line argument:"
                            + entry);
                }
                else if (_quiescedEntries.containsKey(id))
                {
                    // save entry with the original state
View Full Code Here

        {
            for (UUID id : entryIds)
            {
                if (_cliEntries.containsKey(id))
                {
                    throw new IllegalConfigurationException("Cannot change configuration for command line entry:"
                            + _cliEntries.get(id));
                }
            }
            UUID[] result = _store.remove(entryIds);
            for (UUID id : entryIds)
View Full Code Here

TOP

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

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.