diff options
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/preprocess')
-rw-r--r-- | src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java b/src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java index a3329cd..056f6dc 100644 --- a/src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java +++ b/src/main/java/at/gv/egiz/moazs/preprocess/ConfigUtil.java @@ -31,7 +31,7 @@ public class ConfigUtil { public static final String FILENAME_KEY = "filename"; public static final String FILETYPE_KEY = "filetype"; public static final String PASSWORD_KEY = "password"; - public static final String RECEIVE_TIMEOUT = "receive-timeout"; + public static final String RECEIVE_TIMEOUT_KEY = "receive-timeout"; public static final String CONNECTION_TIMEOUT_KEY = "connection-timeout"; public static final String MSG_RESPONSE_SINKS_KEY = "msg-response-sinks"; public static final String LOG_RESPONSE_KEY = "log-response"; @@ -40,6 +40,7 @@ public class ConfigUtil { public static final String SAVE_RESPONSE_TO_FILE_PATH_KEY = "path"; public static final String FORWARD_RESPONSE_TO_SERVICE_KEY = "forward-response-to-service"; public static final String MZS_CLIENT_KEY = "mzs-client"; + public static final String SERVICE_TIMEOUT_KEY = "service-timeout"; /** @@ -64,11 +65,14 @@ public class ConfigUtil { MsgResponseSinksType sinks = msgResponseSinksParams.isEmpty() ? null : buildMsgResponseSinks(msgResponseSinksParams); + var serviceTimeout = bigIntOrNull(values.get(SERVICE_TIMEOUT_KEY)); + return ConfigType.configTypeBuilder() .withPerformQueryPersonRequest(performQueryPersonRequest) .withMSGClient(msgClient) .withTNVZClient(tnvzClient) .withMsgResponseSinks(sinks) + .withServiceTimeout(serviceTimeout) .build(); } @@ -83,13 +87,9 @@ public class ConfigUtil { var url = clientParams.get(URL_KEY); - BigInteger connectionTimeout = clientParams.containsKey(CONNECTION_TIMEOUT_KEY) - ? new BigInteger(clientParams.get(CONNECTION_TIMEOUT_KEY)) - : null; + var connectionTimeout = bigIntOrNull(clientParams.get(CONNECTION_TIMEOUT_KEY)); - BigInteger receiveTimeout = clientParams.containsKey(RECEIVE_TIMEOUT) - ? new BigInteger(clientParams.get(RECEIVE_TIMEOUT)) - : null; + var receiveTimeout = bigIntOrNull(clientParams.get(RECEIVE_TIMEOUT_KEY)); var sslParams = filterMapByPrefix(clientParams, SSL_KEY); SSLType ssl = sslParams.isEmpty() @@ -179,6 +179,11 @@ public class ConfigUtil { return value == null ? null : Boolean.getBoolean(value); } + private BigInteger bigIntOrNull(String value) { + return value == null + ? null + : new BigInteger(value); + } /** * Combine properties of two Configs; {@code primary} overrides {@code fallback}. @@ -207,6 +212,10 @@ public class ConfigUtil { builder.withMsgResponseSinks(merge(primary.getMsgResponseSinks(), fallback.getMsgResponseSinks())); } + if (primary.getServiceTimeout() != null) { + builder.withServiceTimeout(primary.getServiceTimeout()); + } + return builder.build(); } |