use of org.springframework.core.io.Resource in project head by mifos.
the class BranchCashConfirmationConfigServiceTest method setUp.
@Override
protected void setUp() throws Exception {
Resource branchCashConfirmationReportConfig = new ClassPathResource(FilePaths.HO_CASH_CONFIRMATION_REPORT_CONFIG);
hOCashConfirmationConfigService = new HOCashConfirmationConfigService(branchCashConfirmationReportConfig);
}
use of org.springframework.core.io.Resource in project head by mifos.
the class PPISurveyLocatorImpl method getPPIUploadFileForCountry.
@Override
public String getPPIUploadFileForCountry(String country) {
try {
String fileName = getPPIXmlFileName(country);
Resource resource = this.resourceLoader.getResource(resolvePath());
return getPPIFilePath(fileName, resource.getFile());
} catch (IOException e) {
throw new SystemException(FETCH_PPI_COUNTRY_XML_FAILED, e);
}
}
use of org.springframework.core.io.Resource in project head by mifos.
the class MifosResourceUtilTest method testGetResources.
@Test
public void testGetResources() throws IOException {
Resource[] found = MifosResourceUtil.getClassPathResourcesAsResources("org/mifos/core/resources/included/**/*.xml");
assertEquals(2, found.length);
for (Resource resource : found) {
String f = resource.getFilename();
if (!"y.xml".equals(f) && !"z.xml".equals(f)) {
fail(resource + " should not have been returned");
}
}
}
use of org.springframework.core.io.Resource in project head by mifos.
the class ConfigurationLocator method getCustomFilePath.
/**
* Will not throw an exception if the file is not found. This method may be
* used to find files in cases where we don't care if the file cannot be
* found.
* @throws IOException
*/
@SuppressWarnings("PMD")
public // TODO It may be clearer if this returned an URI or URL instead of a String?
String getCustomFilePath(String filename) throws IOException {
String returnValue = filename;
LOGGER.info("Checking existance of : " + filename);
Resource configFile = getResource(filename);
if (configFile != null && configFile.exists()) {
returnValue = configFile.getURL().toExternalForm();
LOGGER.info("Custom configuration file exists : " + returnValue);
}
return returnValue;
}
use of org.springframework.core.io.Resource in project OpenMEAP by OpenMEAP.
the class Log4JConfiguratorListener method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent arg0) {
BasicConfigurator.configure();
ServletContext servletContext = arg0.getServletContext();
String xmlLoc = servletContext.getInitParameter("openmeap-log4j-xml");
if (xmlLoc == null) {
return;
}
try {
Resource res = new ClassPathResource(xmlLoc);
DOMConfigurator.configure(XmlUtils.getDocument(res.getInputStream()).getDocumentElement());
} catch (Exception ioe) {
servletContext.log("The configuration failed.", ioe);
}
}
Aggregations