Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,28 @@ public String getString (String key) {
return (getString(key, null));
}

/**
*
* @param key property key
* @param defaultValue default value
* @return String value of the property, null if property is not present.
*/
public String getString (String key, String defaultValue) {
String fullName = prefix(myType) + key;
return (getString(myType, key, defaultValue));
}

/**
*
* @param key property key
* @param useSystemDefault use system variable with same name as default value
* @return String value of the property, null if property is not present.
*/
public String getString (String key, boolean useSystemDefault) {
String fullName = prefix(myType) + key;
return (getString(myType, key, useSystemDefault ? System.getProperty(fullName) : null));
}

public int getInt (String key, int defaultValue) {
return (getInt(myType, key, defaultValue));
}
Expand Down Expand Up @@ -330,11 +348,20 @@ public void setPropertySoft (Type type, String key, Object value
}
}

/** @return property bu full key */
public String getExactProperty (String key) {
return props.getProperty(key);
/**
* Return fully-qualified name of the property
* @param key property key
* @return fully-qualified property name
*/
public String getFullName(String key) {
return prefix (myType) + key;
}

// /** @return property by full key */
// public String getExactProperty (String key) {
// return props.getProperty(key);
// }

public String getString (Type type, String key, String defaultValue) {
return StringUtils.trim((props.getProperty (prefix (type) + key, defaultValue)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,45 @@ private String getPublicAddressForAeron(QuantServiceConfig config) {
return publicAddressForAeron;
}

static String getString(QuantServiceConfig config, String key, String defaultValue) {
String name = config.getFullName(key);

String value = System.getProperty(name, null);
if (value != null)
return value;

return config.getString(key, defaultValue);
}

static boolean getBoolean(QuantServiceConfig config, String key, boolean defaultValue) {
String name = config.getFullName(key);

String value = System.getProperty(name, null);
if (value == null) {
return config.getBoolean(key, defaultValue);
}

return Boolean.getBoolean(name);
}

static int getInteger(QuantServiceConfig config, String key, int defaultValue) {
String name = config.getFullName(key);

String value = System.getProperty(name, null);
if (value == null) {
return config.getInt(key, defaultValue);
}

return Integer.getInteger(name);
}

@Nonnull
public static FSOptions getFsOptionsFromConfig(QuantServiceConfig config) {
FSOptions options = new FSOptions();
options.compression = config.getString("fileSystem.compression", options.compression);
options.maxFolderSize = config.getInt("fileSystem.maxFolderSize", options.maxFolderSize);
options.maxFileSize = config.getInt("fileSystem.maxFileSize", options.maxFileSize);

options.compression = getString(config, "fileSystem.compression", options.compression);
options.maxFolderSize = getInteger(config, "fileSystem.maxFolderSize", options.maxFolderSize);
options.maxFileSize = getInteger(config, "fileSystem.maxFileSize", options.maxFileSize);

FSType fs = getFSType(config);
if (fs == FSType.HDFS) {
Expand Down
Loading