- public static Optional<TLSConfiguration> extractTLSConfiguration(ConfigProvider configProvider) {
- Optional<InetSocketAddress> address = extractSomeNetconfAddress(configProvider, InfixProp.tls);
- if (address.isPresent()) {
- String keystoreFileName = configProvider.getProperty(NETCONF_TLS_KEYSTORE_PROP);
- File keystoreFile = new File(keystoreFileName);
- checkState(keystoreFile.exists() && keystoreFile.isFile() && keystoreFile.canRead(),
- "Keystore file %s does not exist or is not readable file", keystoreFileName);
- keystoreFile = keystoreFile.getAbsoluteFile();
- String keystorePassword = configProvider.getProperty(NETCONF_TLS_KEYSTORE_PASSWORD_PROP);
- checkNotNull(keystoreFileName, "Property %s must be defined for tls netconf server",
- NETCONF_TLS_KEYSTORE_PROP);
- keystorePassword = keystorePassword != null ? keystorePassword : "";
- return Optional.of(new TLSConfiguration(address.get(), keystoreFile, keystorePassword));
- } else {
- return Optional.absent();
+ public static long extractTimeoutMillis(final BundleContext bundleContext) {
+ final String key = PREFIX_PROP + CONNECTION_TIMEOUT_MILLIS_PROP;
+ final String timeoutString = bundleContext.getProperty(key);
+ if (timeoutString == null || timeoutString.length() == 0) {
+ return DEFAULT_TIMEOUT_MILLIS;