aboutsummaryrefslogtreecommitdiffstats
path: root/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/commons/Scheme.java
diff options
context:
space:
mode:
Diffstat (limited to 'datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/commons/Scheme.java')
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/commons/Scheme.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/commons/Scheme.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/commons/Scheme.java
index afa3aaea..b9aa6449 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/commons/Scheme.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/commons/Scheme.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation. All rights reserved.
- * Copyright (C) 2020 Nokia. All rights reserved.
+ * Copyright (C) 2020-2021 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.
@@ -28,10 +28,10 @@ import org.onap.dcaegen2.collectors.datafile.exceptions.DatafileTaskException;
*
*/
public enum Scheme {
- FTPES, SFTP, HTTP;
+ FTPES, SFTP, HTTP, HTTPS;
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, sFTP and HTTP";
+ public static final String SUPPORTED_PROTOCOLS_ERROR_MESSAGE = ". Supported protocols are FTPeS, sFTP, HTTP and HTTPS";
/**
* Get a <code>Scheme</code> from a string.
@@ -48,10 +48,22 @@ public enum Scheme {
result = Scheme.SFTP;
} else if ("HTTP".equalsIgnoreCase(schemeString)) {
result = Scheme.HTTP;
+ } else if ("HTTPS".equalsIgnoreCase(schemeString)) {
+ result = Scheme.HTTPS;
} else {
throw new DatafileTaskException(
DFC_DOES_NOT_SUPPORT_PROTOCOL_ERROR_MSG + schemeString + SUPPORTED_PROTOCOLS_ERROR_MESSAGE);
}
return result;
}
+
+ /**
+ * Check if <code>Scheme</code> is FTP type or HTTP type.
+ *
+ * @param scheme the <code>Scheme</code> which has to be checked.
+ * @return true if <code>Scheme</code> is FTP type or false if it is HTTP type
+ */
+ public static boolean isFtpScheme(Scheme scheme) {
+ return scheme == SFTP || scheme == FTPES;
+ }
}