use of org.apache.commons.lang.text.StrTokenizer in project cuba by cuba-platform.
the class PortalDispatcherServlet method getContextConfigLocation.
@Override
public String getContextConfigLocation() {
String configProperty = AppContext.getProperty(SPRING_CONTEXT_CONFIG);
if (StringUtils.isBlank(configProperty)) {
throw new IllegalStateException("Missing " + SPRING_CONTEXT_CONFIG + " application property");
}
File baseDir = new File(AppContext.getProperty("cuba.confDir"));
StrTokenizer tokenizer = new StrTokenizer(configProperty);
String[] tokenArray = tokenizer.getTokenArray();
StringBuilder locations = new StringBuilder();
for (String token : tokenArray) {
String location;
if (ResourceUtils.isUrl(token)) {
location = token;
} else {
if (token.startsWith("/"))
token = token.substring(1);
File file = new File(baseDir, token);
if (file.exists()) {
location = file.toURI().toString();
} else {
location = "classpath:" + token;
}
}
locations.append(location).append(" ");
}
return locations.toString();
}
use of org.apache.commons.lang.text.StrTokenizer in project cuba by cuba-platform.
the class ThemeConstantsRepository method init.
protected void init() {
String configName = AppContext.getProperty("cuba.themeConfig");
if (!StringUtils.isBlank(configName)) {
Map<String, Map<String, String>> themeProperties = new HashMap<>();
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String fileName : tokenizer.getTokenArray()) {
String themeName = parseThemeName(fileName);
if (StringUtils.isNotBlank(themeName)) {
Map<String, String> themeMap = themeProperties.get(themeName);
if (themeMap == null) {
themeMap = new HashMap<>();
themeProperties.put(themeName, themeMap);
}
loadThemeProperties(fileName, themeMap);
}
}
Map<String, ThemeConstants> themes = new LinkedHashMap<>();
for (Map.Entry<String, Map<String, String>> entry : themeProperties.entrySet()) {
themes.put(entry.getKey(), new ThemeConstants(entry.getValue()));
}
this.themeConstantsMap = Collections.unmodifiableMap(themes);
} else {
this.themeConstantsMap = Collections.emptyMap();
}
}
Aggregations