use of org.apache.commons.text.StringTokenizer in project cuba by cuba-platform.
the class MetadataBuildSupport method init.
public List<XmlFile> init() {
List<XmlFile> metadataXmlList = new ArrayList<>();
StringTokenizer metadataFilesTokenizer = new StringTokenizer(getMetadataConfig());
for (String fileName : metadataFilesTokenizer.getTokenArray()) {
metadataXmlList.add(new XmlFile(fileName, readXml(fileName)));
}
return metadataXmlList;
}
use of org.apache.commons.text.StringTokenizer in project cuba by cuba-platform.
the class WindowConfig method loadScreensXml.
protected void loadScreensXml() {
String configName = AppContext.getProperty(WINDOW_CONFIG_XML_PROP);
StringTokenizer tokenizer = new StringTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
try (InputStream stream = resource.getInputStream()) {
loadConfig(dom4JTools.readDocument(stream).getRootElement());
} catch (IOException e) {
throw new RuntimeException("Unable to read window config from " + location, e);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
use of org.apache.commons.text.StringTokenizer in project cuba by cuba-platform.
the class MenuConfig method init.
protected void init() {
rootItems.clear();
String configName = AppContext.getProperty(MENU_CONFIG_XML_PROP);
StringTokenizer tokenizer = new StringTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
try (InputStream stream = resource.getInputStream()) {
Element rootElement = dom4JTools.readDocument(stream).getRootElement();
loadMenuItems(rootElement, null);
} catch (IOException e) {
throw new RuntimeException("Unable to read menu config", e);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
use of org.apache.commons.text.StringTokenizer 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<>();
StringTokenizer tokenizer = new StringTokenizer(configName);
for (String fileName : tokenizer.getTokenArray()) {
String themeName = parseThemeName(fileName);
if (StringUtils.isNotBlank(themeName)) {
Map<String, String> themeMap = themeProperties.computeIfAbsent(themeName, k -> new HashMap<>());
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();
}
}
use of org.apache.commons.text.StringTokenizer in project cuba by cuba-platform.
the class WebExternalUIComponentsSource method _registerAppComponents.
protected void _registerAppComponents() {
String configNames = AppContext.getProperty(WEB_COMPONENTS_CONFIG_XML_PROP);
if (Strings.isNullOrEmpty(configNames)) {
return;
}
log.debug("Loading UI components from {}", configNames);
StringTokenizer tokenizer = new StringTokenizer(configNames);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
_registerComponent(stream);
} catch (ClassNotFoundException | IOException e) {
throw new RuntimeException("Unable to load components config " + location, e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
Aggregations