use of org.apache.commons.text.StringTokenizer in project jmix by jmix-framework.
the class RestJsonTransformations method init.
protected void init() {
String configName = environment.getProperty(JMIX_REST_JSON_TRANSFORMATION_CONFIG_PROP_NAME);
StringTokenizer tokenizer = new StringTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
loadConfig(Dom4j.readDocument(stream).getRootElement());
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource " + location + " not found, ignore it");
}
}
}
use of org.apache.commons.text.StringTokenizer in project jmix by jmix-framework.
the class RestQueriesConfiguration method init.
protected void init() {
String configName = environment.getProperty(JMIX_REST_QUERIES_CONFIG_PROP_NAME);
StringTokenizer tokenizer = new StringTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
loadConfig(Dom4j.readDocument(stream).getRootElement());
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
use of org.apache.commons.text.StringTokenizer in project jmix by jmix-framework.
the class RestServicesConfiguration method init.
protected void init() {
String configName = environment.getProperty(JMIX_REST_SERVICES_CONFIG_PROP_NAME);
StringTokenizer tokenizer = new StringTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
try (InputStream stream = resource.getInputStream()) {
loadConfig(Dom4j.readDocument(stream).getRootElement());
} catch (IOException e) {
throw new RuntimeException("Error on parsing rest services config", e);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
use of org.apache.commons.text.StringTokenizer in project jmix by jmix-framework.
the class CubaMessages method searchMessage.
@Nullable
protected String searchMessage(String packs, String key, Locale locale, Locale truncatedLocale, Set<String> passedPacks) {
StringTokenizer tokenizer = new StringTokenizer(packs);
// noinspection unchecked
List<String> list = tokenizer.getTokenList();
Collections.reverse(list);
for (String pack : list) {
if (!enterPack(pack, locale, truncatedLocale, passedPacks))
continue;
String msg = searchOnePack(pack, key, locale, truncatedLocale, passedPacks);
if (msg != null)
return msg;
Locale tmpLocale = truncatedLocale;
while (tmpLocale != null) {
tmpLocale = truncateLocale(tmpLocale);
msg = searchOnePack(pack, key, locale, tmpLocale, passedPacks);
if (msg != null)
return msg;
}
}
if (log.isTraceEnabled()) {
String packName = new TextStringBuilder().appendWithSeparators(list, ",").toString();
log.trace("Resource '{}' not found", makeCacheKey(packName, key, locale, locale));
}
return null;
}
use of org.apache.commons.text.StringTokenizer in project cuba by cuba-platform.
the class DesktopThemeImpl method applyStyle.
@Override
public void applyStyle(Object component, String styleNameString, Set<String> state) {
// split string into individual style names
StringTokenizer tokenizer = new StringTokenizer(styleNameString);
String[] styleNames = tokenizer.getTokenArray();
for (String styleName : styleNames) {
applyStyleName(component, state, styleName);
}
}
Aggregations