uri-resolver/src/main/java/org/gcube/datatransfer/resolver/util/ScopeUtil.java

30 lines
581 B
Java

/**
*
*/
package org.gcube.datatransfer.resolver.util;
/**
* The Class ScopeUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Nov 5, 2018
*/
public class ScopeUtil {
public static final String SCOPE_SEPARATOR = "|";
/**
* Normalize scope.
* Add the '/' as prefix and remove all '|'
* @param scope the scope
* @return the normalized scope
*/
public static String normalizeScope(String scope){
if(!scope.startsWith("/"))
scope="/"+scope;
scope = scope.replaceAll("\\"+SCOPE_SEPARATOR, "/");
return scope;
}
}