aboutsummaryrefslogtreecommitdiffstats
path: root/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PathValidator.java
blob: 511dbca7acd6eff1a2a3fa64bef768884e9df93a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package org.onap.ccsdk.sli.core.sli;

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());
    }
}