public boolean getBooleanValue(final String propertyName, final boolean defaultValue) { return Boolean.parseBoolean(getStringValue(propertyName, Boolean.toString(defaultValue))); }
public boolean getBooleanValue(final String propertyName, final boolean defaultValue) { return Boolean.parseBoolean(getStringValue(propertyName, Boolean.toString(defaultValue))); }
private String getUser() { final String user = config.getStringValue(USER, null); config.remove(USER); return user; }
private String getUser() { final String user = config.getStringValue(USER, null); config.remove(USER); return user; }
public boolean hasOptions() { final String command = config.getStringValue(COMMAND, null); return !isBlank(command); }
public boolean hasOptions() { final String command = config.getStringValue(COMMAND, null); return !isBlank(command); }
/** * Gets the value of a property as an enum. * * @param propertyName * Property name * @return Enum value */ public <E extends Enum<E>> E getEnumValue(final String propertyName, final E defaultValue) { requireNonNull(defaultValue, "No default value provided"); final String value = getStringValue(propertyName, defaultValue.name()); return enumValue(value, defaultValue); }
/** * Gets the value of a property as an enum. * * @param propertyName * Property name * @return Enum value */ public <E extends Enum<E>> E getEnumValue(final String propertyName, final E defaultValue) { requireNonNull(defaultValue, "No default value provided"); final String value = getStringValue(propertyName, defaultValue.name()); return enumValue(value, defaultValue); }
public Optional<InclusionRule> getOptionalInclusionRule(final String includePatternProperty, final String excludePatternProperty) { final String includePattern = getStringValue(includePatternProperty, null); final String excludePattern = getStringValue(excludePatternProperty, null); if (isBlank(includePattern) && isBlank(excludePattern)) { return Optional.empty(); } else { return Optional .of(new RegularExpressionRule(includePattern, excludePattern)); } }
public Optional<InclusionRule> getOptionalInclusionRule(final String includePatternProperty, final String excludePatternProperty) { final String includePattern = getStringValue(includePatternProperty, null); final String excludePattern = getStringValue(excludePatternProperty, null); if (isBlank(includePattern) && isBlank(excludePattern)) { return Optional.empty(); } else { return Optional .of(new RegularExpressionRule(includePattern, excludePattern)); } }
@Override public OutputOptionsBuilder fromConfig(final Config config) { final Config configProperties; if (config == null) { configProperties = new Config(); } else { configProperties = config; } this .withInputEncoding(configProperties.getStringValue(SC_INPUT_ENCODING, UTF_8.name())) .withOutputEncoding(configProperties.getStringValue(SC_OUTPUT_ENCODING, UTF_8.name())); return this; }
@Override public void loadConfig() throws SchemaCrawlerException { super.loadConfig(); if (config.hasValue(URL)) { config.put(URL, config.getStringValue(URL, null)); } final String connectionUrl = config.getStringValue(URL, null); if (isBlank(connectionUrl)) { throw new SchemaCrawlerCommandLineException("Please provde a database connection URL"); } }
@Override public void loadConfig() throws SchemaCrawlerException { super.loadConfig(); if (config.hasValue(URL)) { config.put(URL, config.getStringValue(URL, null)); } final String connectionUrl = config.getStringValue(URL, null); if (isBlank(connectionUrl)) { throw new SchemaCrawlerCommandLineException("Please provde a database connection URL"); } }
@Override public void loadConfig() throws SchemaCrawlerException { try { final String configfile = config .getStringValue(CONFIG_FILE, "schemacrawler.config.properties"); final Path configFilePath = Paths.get(configfile).normalize() .toAbsolutePath(); config.putAll(PropertiesUtility .loadConfig(new FileInputResource(configFilePath))); } catch (final IOException e) { LOGGER .log(Level.CONFIG, "schemacrawler.config.properties not found in the current directory"); } }
private String getPassword() { final String password; if (config.hasValue(PASSWORD)) { password = config.getStringValue(PASSWORD, null); } else { password = promptForPassword(); } config.remove(PASSWORD); return password; }
private String getPassword() { final String password; if (config.hasValue(PASSWORD)) { password = config.getStringValue(PASSWORD, null); } else { password = promptForPassword(); } config.remove(PASSWORD); return password; }
@Override public OutputOptions getOptions() { final String outputFileName = config.getStringValue(OUTPUT_FILE, null); consumeOption(OUTPUT_FILE); if (!isBlank(outputFileName)) { final Path outputFile = Paths.get(outputFileName).toAbsolutePath(); outputOptionsBuilder.withOutputFile(outputFile); } final String outputFormatValue = config.getStringValue(OUTPUT_FORMAT, null); consumeOption(OUTPUT_FORMAT); if (!isBlank(outputFormatValue)) { outputOptionsBuilder.withOutputFormatValue(outputFormatValue); } return outputOptionsBuilder.toOptions(); }
@Override public OutputOptions getOptions() { final String outputFileName = config.getStringValue(OUTPUT_FILE, null); consumeOption(OUTPUT_FILE); if (!isBlank(outputFileName)) { final Path outputFile = Paths.get(outputFileName).toAbsolutePath(); outputOptionsBuilder.withOutputFile(outputFile); } final String outputFormatValue = config.getStringValue(OUTPUT_FORMAT, null); consumeOption(OUTPUT_FORMAT); if (!isBlank(outputFormatValue)) { outputOptionsBuilder.withOutputFormatValue(outputFormatValue); } return outputOptionsBuilder.toOptions(); }
@Override public Command getOptions() { final String command = config.getStringValue(COMMAND, null); if (!isBlank(command)) { final Command commandOption = new Command(command); consumeOption(COMMAND); return commandOption; } else { throw new SchemaCrawlerCommandLineException("Please specify a command"); } }
@Override public Command getOptions() { final String command = config.getStringValue(COMMAND, null); if (!isBlank(command)) { final Command commandOption = new Command(command); consumeOption(COMMAND); return commandOption; } else { throw new SchemaCrawlerCommandLineException("Please specify a command"); } }