From 95577b823c6a5a1ba9ed82e2ad3a92834c6cea9b Mon Sep 17 00:00:00 2001 From: Alex Karpovich Date: Wed, 24 Jun 2026 13:38:33 +0300 Subject: [PATCH] [*] Add support for system properties to configure TimeBase file system options --- .../qsrv/config/QuantServiceConfig.java | 33 ++++++++++++++-- .../qsrv/config/TimebaseServiceExecutor.java | 39 +++++++++++++++++-- 2 files changed, 66 insertions(+), 6 deletions(-) diff --git a/java/timebase/commons/src/main/java/com/epam/deltix/qsrv/config/QuantServiceConfig.java b/java/timebase/commons/src/main/java/com/epam/deltix/qsrv/config/QuantServiceConfig.java index 3f3641b7..def6478e 100644 --- a/java/timebase/commons/src/main/java/com/epam/deltix/qsrv/config/QuantServiceConfig.java +++ b/java/timebase/commons/src/main/java/com/epam/deltix/qsrv/config/QuantServiceConfig.java @@ -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)); } @@ -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))); } diff --git a/java/timebase/server/src/main/java/com/epam/deltix/qsrv/config/TimebaseServiceExecutor.java b/java/timebase/server/src/main/java/com/epam/deltix/qsrv/config/TimebaseServiceExecutor.java index 16b60dc7..6cd42b1e 100644 --- a/java/timebase/server/src/main/java/com/epam/deltix/qsrv/config/TimebaseServiceExecutor.java +++ b/java/timebase/server/src/main/java/com/epam/deltix/qsrv/config/TimebaseServiceExecutor.java @@ -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) {