private void restoreState() { try { Map<String, String> props = IOUtil.readProperties(GUI_PROPERTIES_FILE_NAME); exclusionField.setText(props.get("exclusionPattern")); } catch (Exception e) { // no file defined yet, use default settings } }
public static Map<String, String> readProperties(String filename) throws IOException { return readProperties(filename, SystemInfo.getFileEncoding()); }
@SuppressWarnings("rawtypes") public static <V> Map<String, V> readProperties( String filename, Converter<Map.Entry, Map.Entry> converter) throws IOException { return readProperties(filename, converter, SystemInfo.getFileEncoding()); }
@SuppressWarnings("rawtypes") public static <V> Map<String, V> readProperties( String filename, Converter<Map.Entry, Map.Entry> converter, String encoding) throws IOException { return readProperties(new OrderedMap<String, V>(), filename, converter, encoding); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public static Map<String, String> readProperties(String filename, String encoding) throws IOException { return readProperties(new OrderedMap(), filename, null, encoding); }
public static Map<String, String> getEnvironmentData(String environment) throws IOException { return IOUtil.readProperties(environmentFileName(environment)); }
private void load() { if (IOUtil.isURIAvailable(fileName)) { try { Map<String, String> values = IOUtil.readProperties(fileName); for (Map.Entry<String, String> entry : values.entrySet()) counters.put(entry.getKey(), new AtomicLong(Long.parseLong(entry.getValue()))); } catch (Exception e) { throw new ConfigurationError(e); } } }
public static JDBCConnectData parseSingleDbProperties(String filename) throws IOException { Map<String, String> properties = IOUtil.readProperties(filename); String readOnlyConfig = properties.get("db_readonly"); boolean readOnly = (!StringUtil.isEmpty(readOnlyConfig) ? ParseUtil.parseBoolean(readOnlyConfig, true) : false); return new JDBCConnectData( properties.get("db_driver"), properties.get("db_url"), properties.get("db_user"), properties.get("db_password"), properties.get("db_catalog"), properties.get("db_schema"), readOnly); }
/** * Reads the config file org/databene/commons/special-letters.properties from the file system or the path * and initializes the internal specialLetters map. */ private static void readConfigFile() { try { specialLetters = new HashMap<Locale, Set<Character>>(); Map<String, String> properties = IOUtil.readProperties( "org/databene/commons/special-letters.properties", Encodings.UTF_8); for (Map.Entry<String, String> entry : properties.entrySet()) { Locale locale = getLocale(String.valueOf(entry.getKey())); String specialChars = String.valueOf(entry.getValue()); Set<Character> charSet = latinSet(); for (int i = 0; i < specialChars.length(); i++) charSet.add(specialChars.charAt(i)); specialLetters.put(locale, charSet); } } catch (IOException e) { throw new ConfigurationError("Setup file for locale-specific letters is missing", e); } }
private static boolean readVersionInfo(VersionInfo versionInfo, String versionFileName) throws IOException { if (IOUtil.isURIAvailable(versionFileName)) { Map<String, String> props = IOUtil.readProperties(versionFileName); for (Entry<String, String> dependency : props.entrySet()) { String dependencyName = dependency.getKey(); String dependencyVersion = dependency.getValue(); if ("build_number".equals(dependencyName)) versionInfo.buildNumber = dependencyVersion; else addDependency(dependencyName, dependencyVersion, versionInfo); } String versionKey = versionInfo.name.replace('.', '_') + VERSION_SUFFIX; versionInfo.version = props.get(versionKey); if (versionInfo.version == null) throw new ConfigurationError("No version number (" + versionKey + ") defined in file " + versionFileName); return true; } else return false; }
private static void init() { File file = new File(SystemInfo.getUserHome() + File.separator + "databene", DATABENE_TEST_PROPERTIES); if (file.exists()) { try { properties = IOUtil.readProperties(file.getAbsolutePath()); } catch (IOException e) { LOGGER.error("Error reading " + file.getAbsolutePath(), e); createDefaultProperties(); } } else { createDefaultProperties(); try { IOUtil.writeProperties(properties, file.getAbsolutePath()); } catch (Exception e) { LOGGER.error("Error writing " + file.getAbsolutePath(), e); } } }
Map<String, String> properties = IOUtil.readProperties(SETUP_FILE_NAME); for (Map.Entry<String, String> entry : properties.entrySet()) { className = entry.getValue().toString();
Map<String, String> properties = IOUtil.readProperties(SETUP_FILE_NAME); for (Map.Entry<String, String> entry : properties.entrySet()) { className = entry.getValue().toString();
private void readConfigFile(String configFileName) throws IOException { BeneratorContext context = new DefaultBeneratorContext(); Map<String, String> properties = IOUtil.readProperties(configFileName);