Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.ConfigurationException


     */
    private void processTopic(String name, TopicConfig topic) throws ConfigurationException
    {
        if (_topics.containsKey(name))
        {
            throw new ConfigurationException("Topics section cannot contain two entries for the same topic.");
        }
        else
        {
            _topics.put(name, topic);
        }
View Full Code Here


        {
            topics = _subscriptions.get(name);

            if (topics.containsKey(topic.getName()))
            {
                throw new ConfigurationException("Subcription cannot contain two entries for the same topic.");
            }
        }
        else
        {
            topics = new HashMap<String,TopicConfig>();
View Full Code Here

        if (getListValue("security.jmx.access").size() > 0)
        {
            String message = "Validation error : security/jmx/access is no longer a supported element within the configuration xml."
                    + (_configFile == null ? "" : " Configuration file : " + _configFile);
            throw new ConfigurationException(message);
        }

        if (getListValue("security.jmx.principal-database").size() > 0)
        {
            String message = "Validation error : security/jmx/principal-database is no longer a supported element within the configuration xml."
                    + (_configFile == null ? "" : " Configuration file : " + _configFile);
            throw new ConfigurationException(message);
        }

        if (getListValue("security.principal-databases.principal-database(0).class").size() > 0)
        {
            String message = "Validation error : security/principal-databases is no longer supported within the configuration xml."
                    + (_configFile == null ? "" : " Configuration file : " + _configFile);
            throw new ConfigurationException(message);
        }

        // QPID-3266.  Tidy up housekeeping configuration option for scheduling frequency
        if (contains("housekeeping.expiredMessageCheckPeriod"))
        {
            String message = "Validation error : housekeeping/expiredMessageCheckPeriod must be replaced by housekeeping/checkPeriod."
                    + (_configFile == null ? "" : " Configuration file : " + _configFile);
            throw new ConfigurationException(message);
        }

        String[] ports = getConfig().getStringArray(SECURITY_PORT_MAPPINGS_PORT_MAPPING_PORT);
        String[] authManagers = getConfig().getStringArray(SECURITY_PORT_MAPPINGS_PORT_MAPPING_AUTH_MANAGER);
        if (ports.length != authManagers.length)
        {
            throw new ConfigurationException("Validation error: Each port-mapping must have exactly one port and exactly one auth-manager.");
        }

        // QPID-3517: Inconsistency in capitalisation in the SSL configuration keys used within the connector and management configuration
        // sections. For the moment, continue to understand both but generate a deprecated warning if the less preferred keystore is used.
        for (String key : new String[] {"management.ssl.keystorePath",
View Full Code Here

        Configuration vhostConfig = conf.subset("virtualhosts");

        // Only one configuration mechanism allowed
        if (!vhostFiles.isEmpty() && !vhostConfig.subset("virtualhost").isEmpty())
        {
            throw new ConfigurationException("Only one of external or embedded virtualhosts configuration allowed.");
        }

        // We can only have one vhosts XML file included
        if (vhostFiles.size() > 1)
        {
            throw new ConfigurationException("Only one external virtualhosts configuration file allowed, multiple filenames found.");
        }

        // Virtualhost configuration object
        Configuration vhostConfiguration = new HierarchicalConfiguration();

        // Load from embedded configuration if possible
        if (!vhostConfig.subset("virtualhost").isEmpty())
        {
            vhostConfiguration = vhostConfig;
        }
        else
        {
        // Load from the external configuration if possible
        for (String fileName : vhostFiles)
          {
              // Open the vhosts XML file and copy values from it to our config
                _vhostsFile = new File(fileName);
                if (!_vhostsFile.exists())
                {
                    throw new ConfigurationException("Virtualhosts file does not exist");
                }
            vhostConfiguration = parseConfig(new File(fileName));

                // save the default virtualhost name
                String defaultVirtualHost = vhostConfiguration.getString("default");
View Full Code Here

        String exchangeName = queueConfiguration.getExchange();

        Exchange exchange = _exchangeRegistry.getExchange(exchangeName);
        if (exchange == null)
        {
            throw new ConfigurationException("Attempt to bind queue '" + queueName + "' to unknown exchange:" + exchangeName);
        }

        Exchange defaultExchange = _exchangeRegistry.getDefaultExchange();

        //get routing keys in configuration (returns empty list if none are defined)
        List<?> routingKeys = queueConfiguration.getRoutingKeys();

        for (Object routingKeyNameObj : routingKeys)
        {
            String routingKey = String.valueOf(routingKeyNameObj);

            if (exchange.equals(defaultExchange) && !queueName.equals(routingKey))
            {
                throw new ConfigurationException("Illegal attempt to bind queue '" + queueName +
                        "' to the default exchange with a key other than the queue name: " + routingKey);
            }

            configureBinding(queue, exchange, routingKey);
        }
View Full Code Here

        {
            new InitialDirContext(env);
        }
        catch (NamingException e)
        {
            throw new ConfigurationException("Unable to establish anonymous connection to the ldap server at " + _providerSearchURL, e);
        }
    }
View Full Code Here

        {
            return (PrincipalDatabase) Class.forName(pdClazz).newInstance();
        }
        catch (InstantiationException ie)
        {
            throw new ConfigurationException("Cannot instantiate " + pdClazz, ie);
        }
        catch (IllegalAccessException iae)
        {
            throw new ConfigurationException("Cannot access " + pdClazz, iae);
        }
        catch (ClassNotFoundException cnfe)
        {
            throw new ConfigurationException("Cannot load " + pdClazz + " implementation", cnfe);
        }
        catch (ClassCastException cce)
        {
            throw new ConfigurationException("Expecting a " + PrincipalDatabase.class + " implementation", cce);
        }
    }
View Full Code Here

            {
                method = principalDatabase.getClass().getMethod(methodName, String.class);
            }
            catch (Exception e)
            {
                throw new ConfigurationException("No method " + methodName + " found in class "
                        + principalDatabase.getClass()
                        + " hence unable to configure principal database. The method must be public and "
                        + "have a single String argument with a void return type", e);
            }
            try
            {
                method.invoke(principalDatabase, PropertyUtils.replaceProperties(nameValuePair.getValue()));
            }
            catch (IllegalArgumentException e)
            {
                throw new ConfigurationException(e.getMessage(), e);
            }
            catch (PropertyException e)
            {
                throw new ConfigurationException(e.getMessage(), e);
            }
            catch (IllegalAccessException e)
            {
                throw new ConfigurationException(e.getMessage(), e);
            }
            catch (InvocationTargetException e)
            {
                // QPID-1347..  InvocationTargetException wraps the checked exception thrown from the reflective
                // method call.  Pull out the underlying message and cause to make these more apparent to the user.
                throw new ConfigurationException(e.getCause().getMessage(), e.getCause());
            }
        }
    }
View Full Code Here

    private String generateSetterName(String argName) throws ConfigurationException
    {
        if ((argName == null) || (argName.length() == 0))
        {
            throw new ConfigurationException("Argument names must have length >= 1 character");
        }

        if (Character.isLowerCase(argName.charAt(0)))
        {
            argName = Character.toUpperCase(argName.charAt(0)) + argName.substring(1);
View Full Code Here

    {
        final Collection<AuthenticationManagerPluginFactory<? extends Plugin>> factories = _pluginManager.getAuthenticationManagerPlugins().values();

        if (factories.size() == 0)
        {
            throw new ConfigurationException("No authentication manager factory plugins found. Check the desired authentication" +
                    " manager plugin has been placed in the plugins directory.");
        }

        final SecurityConfiguration securityConfiguration = serverConfiguration.getConfiguration(SecurityConfiguration.class.getName());

        boolean willClose = true;
        try
        {
            createAuthenticationManagersRejectingDuplicates(factories, securityConfiguration);

            if(_classToAuthManagerMap.isEmpty())
            {
                throw new ConfigurationException("No authentication managers configured within the configuration file.");
            }

            _defaultAuthenticationManager = getDefaultAuthenticationManager(serverConfiguration);

            _portToAuthenticationManagerMap = getPortToAuthenticationManagerMap(serverConfiguration);
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.ConfigurationException

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.