diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib')
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; + } + } + +} |