List of usage examples for org.apache.commons.configuration ConfigurationException ConfigurationException
public ConfigurationException(Throwable cause)
ConfigurationException
with specified nested Throwable
. From source file:org.wso2.andes.server.security.access.config.PlainConfiguration.java
private void parseConfig(List<String> args) throws ConfigurationException { if (args.size() < 3) { throw new ConfigurationException(String.format(NOT_ENOUGH_CONFIG_MSG, getLine())); }/*from w ww.j av a 2 s . c o m*/ Map<String, Boolean> properties = toPluginProperties(args); getConfiguration().configure(properties); }
From source file:org.wso2.andes.server.security.access.config.PlainConfiguration.java
/** Converts a {@link List} of "name", "=", "value" tokens into a {@link Map}. */ protected ObjectProperties toObjectProperties(List<String> args) throws ConfigurationException { ObjectProperties properties = new ObjectProperties(); Iterator<String> i = args.iterator(); while (i.hasNext()) { String key = i.next();//w w w . j a v a 2s . co m if (!i.hasNext()) { throw new ConfigurationException(String.format(PROPERTY_KEY_ONLY_MSG, getLine())); } if (!"=".equals(i.next())) { throw new ConfigurationException(String.format(PROPERTY_NO_EQUALS_MSG, getLine())); } if (!i.hasNext()) { throw new ConfigurationException(String.format(PROPERTY_NO_VALUE_MSG, getLine())); } String value = i.next(); // parse property key ObjectProperties.Property property = ObjectProperties.Property.parse(key); properties.put(property, value); } return properties; }
From source file:org.wso2.andes.server.security.access.config.PlainConfiguration.java
/** Converts a {@link List} of "name", "=", "value" tokens into a {@link Map}. */ protected Map<String, Boolean> toPluginProperties(List<String> args) throws ConfigurationException { Map<String, Boolean> properties = new HashMap<String, Boolean>(); Iterator<String> i = args.iterator(); while (i.hasNext()) { String key = i.next().toLowerCase(); if (!i.hasNext()) { throw new ConfigurationException(String.format(PROPERTY_KEY_ONLY_MSG, getLine())); }/*from w w w . j a v a 2s .c o m*/ if (!"=".equals(i.next())) { throw new ConfigurationException(String.format(PROPERTY_NO_EQUALS_MSG, getLine())); } if (!i.hasNext()) { throw new ConfigurationException(String.format(PROPERTY_NO_VALUE_MSG, getLine())); } // parse property value and save Boolean value = Boolean.valueOf(i.next()); properties.put(key, value); } return properties; }
From source file:org.wso2.andes.server.security.access.plugins.AccessControlConfiguration.java
public void validateConfiguration() throws ConfigurationException { String filename = getFileName(); if (filename == null) { throw new ConfigurationException("No ACL file name specified"); }//from www . j a va 2s . c o m File aclFile = new File(filename); ConfigurationFile configFile = new PlainConfiguration(aclFile); _ruleSet = configFile.load(); }
From source file:org.wso2.andes.server.security.access.plugins.FirewallConfiguration.java
@Override public void validateConfiguration() throws ConfigurationException { // Valid Configuration either has xml links to new files _finalConfig = new CompositeConfiguration(_configuration); List subFiles = _configuration.getList("xml[@fileName]"); for (Object subFile : subFiles) { _finalConfig.addConfiguration(new XMLConfiguration((String) subFile)); }//from w w w . j av a2 s.c o m // all rules must have an access attribute or a default value if (_finalConfig.getList("rule[@access]").size() == 0 && _configuration.getString("[@default-action]") == null) { throw new ConfigurationException("No rules or default-action found in firewall configuration."); } }
From source file:org.wso2.andes.server.security.auth.manager.PrincipalDatabaseAuthenticationManager.java
private String generateSetterName(String argName) throws ConfigurationException { if ((argName == null) || (argName.length() == 0)) { throw new ConfigurationException("Argument names must have length >= 1 character"); }/*from ww w . j av a2 s .c o m*/ if (Character.isLowerCase(argName.charAt(0))) { argName = Character.toUpperCase(argName.charAt(0)) + argName.substring(1); } final String methodName = "set" + argName; return methodName; }
From source file:org.wso2.andes.server.virtualhost.VirtualHostImpl.java
private void configureQueue(QueueConfiguration queueConfiguration) throws AMQException, ConfigurationException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(queueConfiguration, this); if (queue.isDurable()) { getDurableConfigurationStore().createQueue(queue); }// w w w . ja v a 2 s . c om //tell Andes kernel to create queue QpidAndesBridge.createQueue(queue); String exchangeName = queueConfiguration.getExchange(); Exchange exchange = exchangeRegistry .getExchange(exchangeName == null ? null : new AMQShortString(exchangeName)); if (exchange == null) { exchange = exchangeRegistry.getDefaultExchange(); } if (exchange == null) { throw new ConfigurationException("Attempt to bind queue to unknown exchange:" + exchangeName); } List routingKeys = queueConfiguration.getRoutingKeys(); if (routingKeys == null || routingKeys.isEmpty()) { routingKeys = Collections.singletonList(queue.getNameShortString()); } for (Object routingKeyNameObj : routingKeys) { AMQShortString routingKey = new AMQShortString(String.valueOf(routingKeyNameObj)); if (log.isInfoEnabled()) { log.info("Binding queue:" + queue + " with routing key '" + routingKey + "' to exchange:" + this); } bindingFactory.addBinding(routingKey.toString(), queue, exchange, null); } if (exchange != exchangeRegistry.getDefaultExchange()) { bindingFactory.addBinding(queue.getNameShortString().toString(), queue, exchange, null); } }
From source file:org.wso2.carbon.device.mgt.iot.agent.kura.display.resource.IFrameResource.java
private String getNavigationUrl() throws ConfigurationException { String url;/* w w w. ja v a 2 s . c o m*/ if (configArgs.get("url") != null) { url = configArgs.get("url"); } else if (configArgs.get("app") != null) { url = "http://localhost:8000/" + configArgs.get("app"); } else { throw new ConfigurationException("No valid `url` or `app` attribute found on the Resource"); } return url; }
From source file:org.xmlactions.action.config.PropertyContainer.java
/** * Add a list of configuration files to the CompositeConfiguration. * <p>/*from w w w .j a va 2 s .c o m*/ * The extension of the file names determines the type of configuration to * create for the file. * </p> * <p> * Supports .properties and .xml configuration files. * </p> * TODO add handlers for additional property files. * * @param fileName * the file name of the configuration file in url format * @return * @throws ConfigurationException * @throws ConfigurationException */ public CompositeConfiguration addFileList(List<String> fileNames) throws ConfigurationException { Validate.notNull(fileNames, "Null list of file names"); for (String fileName : fileNames) { // don't permanently change case of fileName, may not work on UNIX. if (fileName.toLowerCase().endsWith(".xml")) { addXmlFile(fileName); } else if (fileName.toLowerCase().endsWith(".properties")) { addPropertyFile(fileName); } else { throw new ConfigurationException("Invalid file name {" + fileName + "]"); } } return compositeConfiguration; }
From source file:org.zaproxy.zap.authentication.FormBasedAuthenticationMethodType.java
@Override public void importData(Configuration config, AuthenticationMethod authMethod) throws ConfigurationException { if (!(authMethod instanceof FormBasedAuthenticationMethod)) { throw new UnsupportedAuthenticationMethodException("Form based authentication type only supports: " + FormBasedAuthenticationMethod.class.getName()); }/*from w w w.j a v a2 s . c o m*/ FormBasedAuthenticationMethod method = (FormBasedAuthenticationMethod) authMethod; try { method.setLoginRequest(config.getString(CONTEXT_CONFIG_AUTH_FORM_LOGINURL), config.getString(CONTEXT_CONFIG_AUTH_FORM_LOGINBODY)); } catch (Exception e) { throw new ConfigurationException(e); } }