use of org.apache.commons.lang.text.StrTokenizer in project cuba by cuba-platform.
the class DesktopExternalUIComponentsSource method _registerAppComponents.
protected void _registerAppComponents() {
String configName = AppContext.getProperty(DESKTOP_COMPONENTS_CONFIG_XML_PROP);
StrTokenizer tokenizer = new StrTokenizer(configName);
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(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
use of org.apache.commons.lang.text.StrTokenizer in project cuba by cuba-platform.
the class RemotingServlet 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 TestContainer method initAppContext.
protected void initAppContext() {
EclipseLinkCustomizer.initTransientCompatibleAnnotations();
String configProperty = AppContext.getProperty(AbstractAppContextLoader.SPRING_CONTEXT_CONFIG);
StrTokenizer tokenizer = new StrTokenizer(configProperty);
List<String> locations = tokenizer.getTokenList();
locations.add(getSpringConfig());
springAppContext = new CubaCoreApplicationContext(locations.toArray(new String[locations.size()]));
AppContext.Internals.setApplicationContext(springAppContext);
Events events = AppBeans.get(Events.NAME);
events.publish(new AppContextInitializedEvent(springAppContext));
}
use of org.apache.commons.lang.text.StrTokenizer in project cuba by cuba-platform.
the class CubaDispatcherServlet 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 WebExternalUIComponentsSource method _registerAppComponents.
protected void _registerAppComponents() {
String configName = AppContext.getProperty(WEB_COMPONENTS_CONFIG_XML_PROP);
StrTokenizer tokenizer = new StrTokenizer(configName);
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(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
Aggregations