aboutsummaryrefslogtreecommitdiffstats
path: root/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/PathValidator.java
blob: 973525019accad06bdf283b04ea3422cef12c3b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package org.onap.ccsdk.sli.core.utils;
import java.util.regex.Pattern;

public class PathValidator {
    public static boolean isValidXmlPath(String path) {
        Pattern allowList = Pattern.compile("[-\\w/\\/]+\\.xml$");
        return (allowList.matcher(path).matches());
    }
    public static boolean isValidPropertiesPath(String path) {
        Pattern allowList = Pattern.compile("[-\\w/\\/]+\\.properties$");
        return (allowList.matcher(path).matches());
    }
    public static boolean isValidFilePath(String path) {
        Pattern allowList = Pattern.compile("[-\\w/\\/]+");
        return (allowList.matcher(path).matches());
    }
}