/** * Gets the value of a property as a string. * * @param propertyName * Property name * @param defaultValue * Default value * @return String value */ public String getStringValue(final String propertyName, final String defaultValue) { String value = get(propertyName); if (value == null) { value = defaultValue; } return value; }
/** * Gets the value of a property as a string. * * @param propertyName * Property name * @param defaultValue * Default value * @return String value */ public String getStringValue(final String propertyName, final String defaultValue) { String value = get(propertyName); if (value == null) { value = defaultValue; } return value; }
private Path getDatabaseDumpFile(final Config config) { final String database = config.get("database"); final Path databaseFile; if (!isBlank(database)) { if (isFileReadable(Paths.get(database))) { databaseFile = Paths.get(database); } else { databaseFile = null; } } else { databaseFile = null; } return databaseFile; }
protected final void normalizeOptionName(final String primaryOptionName, final String... alternateOptionName) { requireNonNull(primaryOptionName, "No option name provided"); final List<String> optionNames = new ArrayList<>(); optionNames.add(primaryOptionName); if (alternateOptionName != null) { optionNames.addAll(Arrays.asList(alternateOptionName)); } Collections.reverse(optionNames); String value = null; boolean foundValue = false; for (final String optionName: optionNames) { if (config.hasValue(optionName)) { value = config.get(optionName); foundValue = true; } config.remove(optionName); } if (foundValue) { config.put(primaryOptionName, value); } }
protected final void normalizeOptionName(final String primaryOptionName, final String... alternateOptionName) { requireNonNull(primaryOptionName, "No option name provided"); final List<String> optionNames = new ArrayList<>(); optionNames.add(primaryOptionName); if (alternateOptionName != null) { optionNames.addAll(Arrays.asList(alternateOptionName)); } Collections.reverse(optionNames); String value = null; boolean foundValue = false; for (final String optionName: optionNames) { if (config.hasValue(optionName)) { value = config.get(optionName); foundValue = true; } config.remove(optionName); } if (foundValue) { config.put(primaryOptionName, value); } }
private Query getQuery() { final Operation operation = getOperation(); final Query query; if (operation == null) { final String queryName = command; final String queryString; if (additionalConfiguration != null) { queryString = additionalConfiguration.get(queryName); } else { queryString = null; } query = new Query(queryName, queryString); } else { query = operation.getQuery(); } return query; }
/** * Information schema views from a map. * * @param informationSchemaViewsSql * Map of information schema view definitions. */ @Override public InformationSchemaViewsBuilder fromConfig(final Config informationSchemaViewsSql) { if (informationSchemaViewsSql == null) { return this; } for (final InformationSchemaKey key: InformationSchemaKey.values()) { if (informationSchemaViewsSql.containsKey(key.getLookupKey())) { try { informationSchemaQueries .put(key, informationSchemaViewsSql.get(key.getLookupKey())); } catch (final IllegalArgumentException e) { // Ignore } } } return this; }
/** * Information schema views from a map. * * @param informationSchemaViewsSql * Map of information schema view definitions. */ @Override public InformationSchemaViewsBuilder fromConfig(final Config informationSchemaViewsSql) { if (informationSchemaViewsSql == null) { return this; } for (final InformationSchemaKey key: InformationSchemaKey.values()) { if (informationSchemaViewsSql.containsKey(key.getLookupKey())) { try { informationSchemaQueries .put(key, informationSchemaViewsSql.get(key.getLookupKey())); } catch (final IllegalArgumentException e) { // Ignore } } } return this; }
/** * Gets the value of a property as a string. * * @param propertyName * Property name * @param defaultValue * Default value * @return String value */ public String getStringValue(final String propertyName, final String defaultValue) { String value = get(propertyName); if (value == null) { value = defaultValue; } return value; }
/** * Gets the value of a property as a string. * * @param propertyName * Property name * @param defaultValue * Default value * @return String value */ public String getStringValue(final String propertyName, final String defaultValue) { String value = get(propertyName); if (value == null) { value = defaultValue; } return value; }
/** * Gets the value of a property as a string. * * @param propertyName * Property name * @param defaultValue * Default value * @return String value */ public String getStringValue(final String propertyName, final String defaultValue) { String value = get(propertyName); if (value == null) { value = defaultValue; } return value; }
protected final void normalizeOptionName(final String primaryOptionName, final String... alternateOptionName) { requireNonNull(primaryOptionName, "No option name provided"); final List<String> optionNames = new ArrayList<>(); optionNames.add(primaryOptionName); if (alternateOptionName != null) { optionNames.addAll(Arrays.asList(alternateOptionName)); } Collections.reverse(optionNames); String value = null; boolean foundValue = false; for (final String optionName: optionNames) { if (config.hasValue(optionName)) { value = config.get(optionName); foundValue = true; } config.remove(optionName); } if (foundValue) { config.put(primaryOptionName, value); } }
protected final void normalizeOptionName(final String primaryOptionName, final String... alternateOptionName) { requireNonNull(primaryOptionName, "No option name provided"); final List<String> optionNames = new ArrayList<>(); optionNames.add(primaryOptionName); if (alternateOptionName != null) { optionNames.addAll(Arrays.asList(alternateOptionName)); } Collections.reverse(optionNames); String value = null; boolean foundValue = false; for (final String optionName: optionNames) { if (config.hasValue(optionName)) { value = config.get(optionName); foundValue = true; } config.remove(optionName); } if (foundValue) { config.put(primaryOptionName, value); } }
private Query getQuery() { final Operation operation = getOperation(); final Query query; if (operation == null) { final String queryName = command; final String queryString; if (additionalConfiguration != null) { queryString = additionalConfiguration.get(queryName); } else { queryString = null; } query = new Query(queryName, queryString); } else { query = operation.getQuery(); } return query; }
private Query getQuery() { final Operation operation = getOperation(); final Query query; if (operation == null) { final String queryName = command; final String queryString; if (additionalConfiguration != null) { queryString = additionalConfiguration.get(queryName); } else { queryString = null; } query = new Query(queryName, queryString); } else { query = operation.getQuery(); } return query; }
private Query getQuery() { final Operation operation = getOperation(); final Query query; if (operation == null) { final String queryName = command; final String queryString; if (additionalConfiguration != null) { queryString = additionalConfiguration.get(queryName); } else { queryString = null; } query = new Query(queryName, queryString); } else { query = operation.getQuery(); } return query; }
/** * Information schema views from a map. * * @param informationSchemaViewsSql * Map of information schema view definitions. */ @Override public InformationSchemaViewsBuilder fromConfig(final Config informationSchemaViewsSql) { if (informationSchemaViewsSql == null) { return this; } for (final InformationSchemaKey key: InformationSchemaKey.values()) { if (informationSchemaViewsSql.containsKey(key.getLookupKey())) { try { informationSchemaQueries .put(key, informationSchemaViewsSql.get(key.getLookupKey())); } catch (final IllegalArgumentException e) { // Ignore } } } return this; }
/** * Information schema views from a map. * * @param informationSchemaViewsSql * Map of information schema view definitions. */ @Override public InformationSchemaViewsBuilder fromConfig(final Config informationSchemaViewsSql) { if (informationSchemaViewsSql == null) { return this; } for (final InformationSchemaKey key: InformationSchemaKey.values()) { if (informationSchemaViewsSql.containsKey(key.getLookupKey())) { try { informationSchemaQueries .put(key, informationSchemaViewsSql.get(key.getLookupKey())); } catch (final IllegalArgumentException e) { // Ignore } } } return this; }