/** * Add all options from a properties file. Finds all entries which start with a given prefix followed by '.'; * the remainder of the property key (after the prefix) is the option name, and the value is the option value. *<p>If the prefix does not end with '.' character, a '.' will be appended to it before parsing. * * @param props the properties to read * @param prefix the prefix * @return this builder */ public Builder parseAll(Properties props, String prefix) { if (! prefix.endsWith(".")) { prefix = prefix + "."; } for (String name : props.stringPropertyNames()) { if (name.startsWith(prefix)) { final String optionName = name.substring(prefix.length()); try { final Option<?> option = Option.fromString(optionName, getClass().getClassLoader()); parse(option, props.getProperty(name)); } catch (IllegalArgumentException e) { optionParseMsg.invalidOptionInProperty(optionName, name, e); } } } return this; }
private OptionMap getOptionMap(final Map<String, ?> environment, final String prefix, final ClassLoader classLoader) { OptionMap.Builder builder = OptionMap.builder(); builder.set(Options.SASL_POLICY_NOANONYMOUS, false); for (String name : environment.keySet()) { if (name.startsWith(prefix)) { final String optionName = name.substring(prefix.length()); final Option<?> option = Option.fromString(optionName, classLoader); final Object valueObj = environment.get(name); if (valueObj != null) builder.parse(option, valueObj.toString(), classLoader); } } return builder.getMap(); }
/** * Add all options from a properties file. Finds all entries which start with a given prefix followed by '.'; * the remainder of the property key (after the prefix) is the option name, and the value is the option value. * <p>If the prefix does not end with '.' character, a '.' will be appended to it before parsing. * * @param props the properties to read * @param prefix the prefix * @param optionClassLoader the class loader to use to resolve option names * @return this builder */ public Builder parseAll(Properties props, String prefix, ClassLoader optionClassLoader) { if (! prefix.endsWith(".")) { prefix = prefix + "."; } for (String name : props.stringPropertyNames()) { if (name.startsWith(prefix)) { final String optionName = name.substring(prefix.length()); try { final Option<?> option = Option.fromString(optionName, optionClassLoader); parse(option, props.getProperty(name), optionClassLoader); } catch (IllegalArgumentException e) { optionParseMsg.invalidOptionInProperty(optionName, name, e); } } } return this; }
/** * Add all options from a properties file. Finds all entries which start with a given prefix followed by '.'; * the remainder of the property key (after the prefix) is the option name, and the value is the option value. * <p>If the prefix does not end with '.' character, a '.' will be appended to it before parsing. * * @param props the properties to read * @param prefix the prefix * @param optionClassLoader the class loader to use to resolve option names * @return this builder */ public Builder parseAll(Properties props, String prefix, ClassLoader optionClassLoader) { if (! prefix.endsWith(".")) { prefix = prefix + "."; } for (String name : props.stringPropertyNames()) { if (name.startsWith(prefix)) { final String optionName = name.substring(prefix.length()); try { final Option<?> option = Option.fromString(optionName, optionClassLoader); parse(option, props.getProperty(name), optionClassLoader); } catch (IllegalArgumentException e) { optionParseMsg.invalidOptionInProperty(optionName, name, e); } } } return this; }
/** * Add all options from a properties file. Finds all entries which start with a given prefix followed by '.'; * the remainder of the property key (after the prefix) is the option name, and the value is the option value. *<p>If the prefix does not end with '.' character, a '.' will be appended to it before parsing. * * @param props the properties to read * @param prefix the prefix * @return this builder */ public Builder parseAll(Properties props, String prefix) { if (! prefix.endsWith(".")) { prefix = prefix + "."; } for (String name : props.stringPropertyNames()) { if (name.startsWith(prefix)) { final String optionName = name.substring(prefix.length()); try { final Option<?> option = Option.fromString(optionName, getClass().getClassLoader()); parse(option, props.getProperty(name)); } catch (IllegalArgumentException e) { optionParseMsg.invalidOptionInProperty(optionName, name, e); } } } return this; }
public UndertowXhrTransport() throws IOException { this(OptionMap.builder().parse(Options.WORKER_NAME, "SockJSClient").getMap()); }
public UndertowXhrTransport() throws IOException { this(OptionMap.builder().parse(Options.WORKER_NAME, "SockJSClient").getMap()); }
private OptionMap getOptionMap(final Map<String, ?> environment, final String prefix, final ClassLoader classLoader) { OptionMap.Builder builder = OptionMap.builder(); builder.set(Options.SASL_POLICY_NOANONYMOUS, false); for (String name : environment.keySet()) { if (name.startsWith(prefix)) { final String optionName = name.substring(prefix.length()); final Option<?> option = Option.fromString(optionName, classLoader); final Object valueObj = environment.get(name); if (valueObj != null) builder.parse(option, valueObj.toString(), classLoader); } } return builder.getMap(); }
private static OptionMap getOptionMapFromProperties(final Properties properties, final ClassLoader classLoader) { final OptionMap.Builder optionMapBuilder = OptionMap.builder(); for (final String propertyName : properties.stringPropertyNames()) { try { final Option<?> option = Option.fromString(propertyName, classLoader); optionMapBuilder.parse(option, properties.getProperty(propertyName), classLoader); } catch (IllegalArgumentException e) { EjbLogger.EJB3_LOGGER.failedToCreateOptionForProperty(propertyName, e.getMessage()); } } return optionMapBuilder.getMap(); } }
protected static OptionMap getOptionMapFromProperties(final Properties properties, final ClassLoader classLoader) { final OptionMap.Builder optionMapBuilder = OptionMap.builder(); for (final String propertyName : properties.stringPropertyNames()) { try { final Option<?> option = Option.fromString(propertyName, classLoader); optionMapBuilder.parse(option, properties.getProperty(propertyName), classLoader); } catch (IllegalArgumentException e) { EjbLogger.EJB3_LOGGER.failedToCreateOptionForProperty(propertyName, e.getMessage()); } } return optionMapBuilder.getMap(); }
private OptionMap getOptionMap(final Map<String, ?> environment, final String prefix, final ClassLoader classLoader) { OptionMap.Builder builder = OptionMap.builder(); builder.set(Options.SASL_POLICY_NOANONYMOUS, false); for (String name : environment.keySet()) { if (name.startsWith(prefix)) { final String optionName = name.substring(prefix.length()); final Option<?> option = Option.fromString(optionName, classLoader); final Object valueObj = environment.get(name); if (valueObj != null) builder.parse(option, valueObj.toString(), classLoader); } } return builder.getMap(); }
private OptionMap getOptionMapFromProperties(final Properties properties, final ClassLoader classLoader) { final OptionMap.Builder optionMapBuilder = OptionMap.builder(); if (properties != null) for (final String propertyName : properties.stringPropertyNames()) { try { final Option<?> option = Option.fromString(propertyName, classLoader); optionMapBuilder.parse(option, properties.getProperty(propertyName), classLoader); } catch (IllegalArgumentException e) { EjbLogger.DEPLOYMENT_LOGGER.failedToCreateOptionForProperty(propertyName, e.getMessage()); } } return optionMapBuilder.getMap(); }
public UndertowXhrTransport() throws IOException { this(OptionMap.builder().parse(Options.WORKER_NAME, "SockJSClient").getMap()); }