use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.
the class ViewOrganizationSettingsServiceFacadeWebTier method getGeneralConfig.
private Properties getGeneralConfig() {
Properties configContent = new Properties();
MifosConfigurationManager configuration = MifosConfigurationManager.getInstance();
String maxPointsPerPPISurvey = configuration.getString("GeneralConfig.MaxPointsPerPPISurvey");
String batchSizeForBatchJobs = configuration.getString("GeneralConfig.BatchSizeForBatchJobs");
String recordCommittingSizeForBatchJobs = configuration.getString("GeneralConfig.RecordCommittingSizeForBatchJobs");
String outputIntervalForBatchJobs = configuration.getString("GeneralConfig.OutputIntervalForBatchJobs");
String allowDataPrefetchingWhenSavingCollectionSheets = configuration.getString("GeneralConfig.allowDataPrefetchingWhenSavingCollectionSheets");
String shutdownCountdownNotificationThreshold = configuration.getString("GeneralConfig.ShutdownCountdownNotificationThreshold");
String imageStorageType = configuration.getString("GeneralConfig.ImageStorageType");
String uploadStorageDirectory = getUploadStorageDirectory();
String uploadQGDirectory = new ConfigurationLocator().resolvePath(getUploadQGDirectory());
String imageStorageDirectory = ImageStorageManager.getStorageLocation();
configContent.put("maxPointsPerPPISurvey", maxPointsPerPPISurvey);
configContent.put("batchSizeForBatchJobs", batchSizeForBatchJobs);
configContent.put("recordCommittingSizeForBatchJobs", recordCommittingSizeForBatchJobs);
configContent.put("outputIntervalForBatchJobs", outputIntervalForBatchJobs);
configContent.put("allowDataPrefetchingWhenSavingCollectionSheets", allowDataPrefetchingWhenSavingCollectionSheets);
configContent.put("shutdownCountdownNotificationThreshold", shutdownCountdownNotificationThreshold);
configContent.put("imageStorageType", imageStorageType);
configContent.put("uploadStorageDirectory", uploadStorageDirectory);
configContent.put("uploadQGDirectory", uploadQGDirectory);
configContent.put("imageStorageDirectory", imageStorageDirectory);
return configContent;
}
use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.
the class ViewOrganizationSettingsServiceFacadeWebTier method getUploadStorageDirectory.
public String getUploadStorageDirectory() {
ConfigurationLocator configurationLocator = new ConfigurationLocator();
String reportPath = configurationLocator.getConfigurationDirectory() + "/uploads";
String uploadsDir = reportPath;
if (File.separatorChar == '\\') {
// windows platform
uploadsDir = uploadsDir.replaceAll("/", "\\\\");
}
return uploadsDir;
}
use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.
the class Log4jConfigListener method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent event) {
Resource location;
try {
location = new ConfigurationLocator().getResource(NAME);
} catch (IOException e) {
throw new IllegalArgumentException("Unable to start logging, because " + NAME + " look-up failed: " + e.getMessage(), e);
}
// following code due to https://jira.springsource.org/browse/SPR-8254
try {
File locationFile = location.getFile();
// can use refreshInterval here (as opposed to below)
Log4jConfigurer.initLogging(locationFile.getAbsolutePath(), refreshInterval);
return;
} catch (IOException e) {
try {
URL locationURL = location.getURL();
// use method w.o. refreshInterval here (@see https://jira.springsource.org/browse/SPR-707)
Log4jConfigurer.initLogging(locationURL.toString());
} catch (IOException e1) {
throw new IllegalArgumentException("Unable to start logging, because non-File resource " + location.getDescription() + " toURL() failed: " + e.getMessage(), e);
}
}
}
use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.
the class AccountingDataCacheManager method getAccoutingDataCachePath.
private String getAccoutingDataCachePath() {
if (accountingDataPath == null) {
ConfigurationLocator configurationLocator = new ConfigurationLocator();
accountingDataPath = configurationLocator.getConfigurationDirectory() + "/accounting/data/";
}
File path = new File(accountingDataPath);
if (!(path.exists() && path.isDirectory())) {
path.mkdirs();
}
return accountingDataPath;
}
use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.
the class AccountingDataCacheManager method getDigitsAfterDecimal.
private int getDigitsAfterDecimal() {
if (digitsAfterDecimal != null) {
// Already read, avoid reading again to reduce processing
return digitsAfterDecimal;
}
ConfigurationLocator configurationLocator = new ConfigurationLocator();
String customApplicationPropertyFile = configurationLocator.getConfigurationDirectory() + "/applicationConfiguration.custom.properties";
File appConfigFile = new File(customApplicationPropertyFile);
Properties properties = new Properties();
if (appConfigFile.exists() && appConfigFile.isFile()) {
try {
properties.load(new FileReader(appConfigFile));
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
} else {
// FIXME hardcoded default value, using property file only for custom value
// There should be a way to read application properties across modules
digitsAfterDecimal = 1;
}
digitsAfterDecimal = Integer.parseInt(properties.getProperty("AccountingRules.DigitsAfterDecimal", "1"));
return digitsAfterDecimal;
}
Aggregations