diff options
author | Jan Malkiewicz <jan.malkiewicz@nokia.com> | 2020-07-23 09:04:34 +0200 |
---|---|---|
committer | Jan Malkiewicz <jan.malkiewicz@nokia.com> | 2020-07-30 07:42:25 +0200 |
commit | f35b9cff9559bff870a703255c23698b31cb01be (patch) | |
tree | 73550dbd38dbfdf8489b769d2b4ffe56b5c157de /datafile-app-server/src/main | |
parent | 9be7af131a459607eebe0fe45c35abe6a41d49cc (diff) |
Removed support for FTPS protocol (from now only FTPeS and sFTP will be supported).
Issue-ID: DCAEGEN2-2367
Signed-off-by: Jan Malkiewicz <jan.malkiewicz@nokia.com>
Change-Id: Ifada2899431c56bdbfcf3aad73fdc9b376ae9c4f
Diffstat (limited to 'datafile-app-server/src/main')
-rw-r--r-- | datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpesClient.java (renamed from datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpsClient.java) | 15 | ||||
-rw-r--r-- | datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/Scheme.java | 9 | ||||
-rw-r--r-- | datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/SftpClientSettings.java | 4 | ||||
-rw-r--r-- | datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java | 13 |
4 files changed, 22 insertions, 19 deletions
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpsClient.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpesClient.java index fea578ba..a91d46ae 100644 --- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpsClient.java +++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpesClient.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START====================================================================== * Copyright (C) 2018-2019 Nordix Foundation. All rights reserved. + * Copyright (C) 2020 Nokia. All rights reserved. * =============================================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at @@ -51,10 +52,10 @@ import org.springframework.core.io.FileSystemResource; * * @author <a href="mailto:martin.c.yan@est.tech">Martin Yan</a> */ -public class FtpsClient implements FileCollectClient { - private static final Logger logger = LoggerFactory.getLogger(FtpsClient.class); +public class FtpesClient implements FileCollectClient { + private static final Logger logger = LoggerFactory.getLogger(FtpesClient.class); - private static final int FTPS_DEFAULT_PORT = 21; + private static final int DEFAULT_PORT = 21; FTPSClient realFtpsClient = new FTPSClient(); private final FileServerData fileServerData; @@ -75,7 +76,7 @@ public class FtpsClient implements FileCollectClient { * @param trustedCaPath path to the PNF's trusted keystore. * @param trustedCaPasswordPath path of file containing password for the PNF's trusted keystore. */ - public FtpsClient(FileServerData fileServerData, Path keyCertPath, String keyCertPasswordPath, Path trustedCaPath, + public FtpesClient(FileServerData fileServerData, Path keyCertPath, String keyCertPasswordPath, Path trustedCaPath, String trustedCaPasswordPath) { this.fileServerData = fileServerData; this.keyCertPath = keyCertPath; @@ -134,7 +135,7 @@ public class FtpsClient implements FileCollectClient { } private static int getPort(Optional<Integer> port) { - return port.isPresent() ? port.get() : FTPS_DEFAULT_PORT; + return port.isPresent() ? port.get() : DEFAULT_PORT; } private void setUpConnection() throws DatafileTaskException, IOException { @@ -198,7 +199,7 @@ public class FtpsClient implements FileCollectClient { logger.error("Truststore password file at path: {} cannot be opened ", trustedCaPasswordPath); e.printStackTrace(); } - synchronized (FtpsClient.class) { + synchronized (FtpesClient.class) { if (theTrustManager == null) { theTrustManager = createTrustManager(trustedCaPath, trustedCaPassword); } @@ -216,7 +217,7 @@ public class FtpsClient implements FileCollectClient { e.printStackTrace(); } - synchronized (FtpsClient.class) { + synchronized (FtpesClient.class) { if (theKeyManager == null) { theKeyManager = createKeyManager(keyCertPath, keyCertPassword); } diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/Scheme.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/Scheme.java index c10c0f1e..b20feb82 100644 --- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/Scheme.java +++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/Scheme.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. All rights reserved. + * Copyright (C) 2020 Nokia. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,10 +28,10 @@ import org.onap.dcaegen2.collectors.datafile.exceptions.DatafileTaskException; * */ public enum Scheme { - FTPS, SFTP; + FTPES, SFTP; public static final String DFC_DOES_NOT_SUPPORT_PROTOCOL_ERROR_MSG = "DFC does not support protocol "; - public static final String SUPPORTED_PROTOCOLS_ERROR_MESSAGE = ". Supported protocols are FTPES, FTPS, and SFTP"; + public static final String SUPPORTED_PROTOCOLS_ERROR_MESSAGE = ". Supported protocols are FTPeS and sFTP"; /** * Get a <code>Scheme</code> from a string. @@ -41,8 +42,8 @@ public enum Scheme { */ public static Scheme getSchemeFromString(String schemeString) throws DatafileTaskException { Scheme result; - if ("FTPS".equalsIgnoreCase(schemeString) || "FTPES".equalsIgnoreCase(schemeString)) { - result = Scheme.FTPS; + if ("FTPES".equalsIgnoreCase(schemeString)) { + result = Scheme.FTPES; } else if ("SFTP".equalsIgnoreCase(schemeString)) { result = Scheme.SFTP; } else { diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/SftpClientSettings.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/SftpClientSettings.java index 8cab4327..a4c5cb3f 100644 --- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/SftpClientSettings.java +++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/SftpClientSettings.java @@ -53,10 +53,10 @@ public class SftpClientSettings { private void logUsageOfStrictHostCheckingFlag(boolean strictHostKeyChecking, String filePath) { if (strictHostKeyChecking) { - logger.info("StrictHostKeyChecking will be enabled with KNOW_HOSTS_FILE_PATH [{}].", filePath); + logger.info("StrictHostKeyChecking will be enabled with KNOWN_HOSTS_FILE_PATH [{}].", filePath); } else { logger.warn( - "StrictHostKeyChecking is enabled but environment variable KNOW_HOSTS_FILE_PATH is not set or points to not existing file [{}] --> falling back to StrictHostKeyChecking='no'.", + "StrictHostKeyChecking is enabled but environment variable KNOWN_HOSTS_FILE_PATH is not set or points to not existing file [{}] --> falling back to StrictHostKeyChecking='no'.", filePath); } } diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java index e9c4aceb..b151b042 100644 --- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java +++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START====================================================================== * Copyright (C) 2018-2019 Nordix Foundation. All rights reserved. + * Copyright (C) 2020 Nokia. All rights reserved. * =============================================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at @@ -27,7 +28,7 @@ import org.onap.dcaegen2.collectors.datafile.configuration.FtpesConfig; import org.onap.dcaegen2.collectors.datafile.exceptions.DatafileTaskException; import org.onap.dcaegen2.collectors.datafile.exceptions.NonRetryableDatafileTaskException; import org.onap.dcaegen2.collectors.datafile.ftp.FileCollectClient; -import org.onap.dcaegen2.collectors.datafile.ftp.FtpsClient; +import org.onap.dcaegen2.collectors.datafile.ftp.FtpesClient; import org.onap.dcaegen2.collectors.datafile.ftp.SftpClient; import org.onap.dcaegen2.collectors.datafile.ftp.SftpClientSettings; import org.onap.dcaegen2.collectors.datafile.model.Counters; @@ -124,10 +125,10 @@ public class FileCollector { switch (fileData.scheme()) { case SFTP: return createSftpClient(fileData); - case FTPS: - return createFtpsClient(fileData); + case FTPES: + return createFtpesClient(fileData); default: - throw new DatafileTaskException("Unhandeled protocol: " + fileData.scheme()); + throw new DatafileTaskException("Unhandled protocol: " + fileData.scheme()); } } @@ -158,9 +159,9 @@ public class FileCollector { new SftpClientSettings(datafileAppConfig.getSftpConfiguration())); } - protected FtpsClient createFtpsClient(FileData fileData) { + protected FtpesClient createFtpesClient(FileData fileData) { FtpesConfig config = datafileAppConfig.getFtpesConfiguration(); - return new FtpsClient(fileData.fileServerData(), Paths.get(config.keyCert()), config.keyPasswordPath(), + return new FtpesClient(fileData.fileServerData(), Paths.get(config.keyCert()), config.keyPasswordPath(), Paths.get(config.trustedCa()), config.trustedCaPasswordPath()); } } |