- public static class TLSConfiguration {
- private final InetSocketAddress address;
- private final File keystoreFile;
- private final String keystorePassword;
- private final SSLContext sslContext;
-
- TLSConfiguration(InetSocketAddress address, File keystoreFile, String keystorePassword) {
- this.address = address;
- this.keystoreFile = keystoreFile;
- this.keystorePassword = keystorePassword;
- try {
- try (InputStream keyStoreIS = new FileInputStream(keystoreFile)) {
- try (InputStream trustStoreIS = new FileInputStream(keystoreFile)) {
- sslContext = SSLUtil.initializeSecureContext("password", keyStoreIS, trustStoreIS, KeyManagerFactory.getDefaultAlgorithm());
- }
- }
- } catch (Exception e) {
- throw new RuntimeException("Cannot initialize ssl context for netconf file " + keystoreFile, e);
- }
- }
-
- public SSLContext getSslContext() {
- return sslContext;
- }
-
- public InetSocketAddress getAddress() {
- return address;
- }
-
- public File getKeystoreFile() {
- return keystoreFile;
+ private static String getPropertyValue(BundleContext context, String propertyName){
+ String propertyValue = context.getProperty(propertyName);
+ if (propertyValue == null){
+ throw new IllegalStateException("Cannot find initial property with name '"+propertyName+"'");