+ }
+
+ private String getDeobfuscatedValue(String property) {
+ if (property != null && property.startsWith("OBF:")) {
+ return Password.deobfuscate(property);
+ }
+ return property;
+ }
+
+ private String get(String key) {
+ String value = modelLoaderProperties.getProperty(key);
+
+ if (value != null && value.startsWith("ENV:")) {
+ value = System.getenv(StringUtils.removeStart(value, "ENV:"));
+ }
+ return value;
+ }
+
+ public String getPropertyOrNull(String propertyName) {
+ String value = modelLoaderProperties.getProperty(propertyName);
+ if (value == null || "NULL".equals(value) || value.isEmpty()) {
+ return null;
+ } else {
+ return value;
+ }
+ }
+
+ public int getIntegerPropertyOrZero(String propertyName) {
+ String property = modelLoaderProperties.getProperty(propertyName);
+ if (property == null || "NULL".equals(property) || property.isEmpty()) {
+ return 0;
+ } else {
+ try {
+ return Integer.parseInt(property);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+ }
+
+ public int getClientConnectTimeoutMs() {
+ String connectTimeout = Optional.ofNullable(get(PROP_AAI_CLIENT_CONNECT_TIMEOUT_MS)).orElse("120000");
+ return Integer.parseInt(connectTimeout);
+ }
+
+ public int getClientReadTimeoutMs() {
+ String connectTimeout = Optional.ofNullable(get(PROP_AAI_CLIENT_READ_TIMEOUT_MS)).orElse("120000");
+ return Integer.parseInt(connectTimeout);
+ }
+
+ @Override
+ public String getKafkaSaslJaasConfig() {
+ String saslJaasConfFromEnv = System.getenv("SASL_JAAS_CONFIG");
+ if(saslJaasConfFromEnv != null) {
+ return saslJaasConfFromEnv;
+ }
+ if(get(PROP_ML_DISTRIBUTION_SASL_JAAS_CONFIG) != null) {
+ return get(PROP_ML_DISTRIBUTION_SASL_JAAS_CONFIG);
+ }
+ return null;
+ }
+
+ @Override
+ public String getKafkaSaslMechanism() {
+ if(get(PROP_ML_DISTRIBUTION_SASL_MECHANISM) != null) {
+ return get(PROP_ML_DISTRIBUTION_SASL_MECHANISM);
+ }
+ return System.getenv().getOrDefault("SASL_MECHANISM", "SCRAM-SHA-512");
+ }