aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src
diff options
context:
space:
mode:
authorshrek2000 <orenkle@amdocs.com>2017-09-11 15:45:37 +0300
committershrek2000 <orenkle@amdocs.com>2017-09-12 10:38:35 +0300
commitc8a540b3c234449163f6fb1899807bba951113b4 (patch)
treea8aae0dd0f6a0feb27369914e9e3fa321740e7ed /openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src
parent82d454fd3e8c9fdf66517d01a99019a379dbfdb6 (diff)
Create new VSP, onboard from TOSCA file - UI
Change-Id: I018c6d07a4b9ec7e6b1507ab37e2550865423cfe Issue-ID: SDC-230 Signed-off-by: shrek2000 <orenkle@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java14
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java32
2 files changed, 46 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java
index e04f02cce5..0fb587cc68 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java
@@ -20,6 +20,7 @@
package org.openecomp.core.utilities.file;
+import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.tosca.services.YamlUtil;
@@ -195,6 +196,19 @@ public class FileUtils {
return fileName.substring(0, fileName.lastIndexOf("."));
}
+ public static String getFileExtension(String filename) {
+ return FilenameUtils.getExtension(filename);
+ }
+
+ public static String getNetworkPackageName(String filename){
+ String[] split = filename.split("\\.");
+ String name = null;
+ if (split != null && split.length > 1){
+ name = split[0];
+ }
+ return name;
+ }
+
/**
* Gets file content map from zip.
*
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java
new file mode 100644
index 0000000000..04e64c33a9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java
@@ -0,0 +1,32 @@
+package org.openecomp.core.utilities.orchestration;
+
+import java.util.Optional;
+
+import static java.util.Arrays.asList;
+public enum OnboardingTypesEnum {
+ CSAR("csar"), ZIP("zip"), NONE("none");
+ private String type;
+
+ OnboardingTypesEnum(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return type;
+ }
+
+ public static final OnboardingTypesEnum getOnboardingTypesEnum(final String inStr) {
+ if (inStr == null) {
+ return null;
+ }
+ Optional<OnboardingTypesEnum> onboardingTypesOptional = asList(OnboardingTypesEnum.values()).stream()
+ .filter(onboardingTypesEnum -> onboardingTypesEnum.toString().equals(inStr)).findAny();
+ if( onboardingTypesOptional.isPresent()){
+ return onboardingTypesOptional.get();
+ }else {
+ return null;
+ }
+ }
+
+}