Reorder methods in BitsquareEnvironment for clarity

This commit is contained in:
Chris Beams 2014-11-11 22:42:01 +01:00
parent 9adc41e23f
commit 14dde61832
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73

View File

@ -92,6 +92,21 @@ public class BitsquareEnvironment extends StandardEnvironment {
}
PropertySource<?> filesystemProperties() throws Exception {
String location = String.format("file:%s/bitsquare.properties", appDataDir);
Resource resource = resourceLoader.getResource(location);
if (!resource.exists())
return new PropertySource.StubPropertySource(BITSQUARE_FILESYSTEM_PROPERTY_SOURCE_NAME);
return new ResourcePropertySource(BITSQUARE_FILESYSTEM_PROPERTY_SOURCE_NAME, resource);
}
PropertySource<?> classpathProperties() throws Exception {
Resource resource = resourceLoader.getResource("classpath:bitsquare.properties");
return new ResourcePropertySource(BITSQUARE_CLASSPATH_PROPERTY_SOURCE_NAME, resource);
}
PropertySource<?> defaultProperties() throws Exception {
return new PropertiesPropertySource(BITSQUARE_DEFAULT_PROPERTY_SOURCE_NAME, new Properties() {{
setProperty(APP_DATA_DIR_KEY, appDataDir);
@ -110,21 +125,6 @@ public class BitsquareEnvironment extends StandardEnvironment {
}});
}
PropertySource<?> classpathProperties() throws Exception {
Resource resource = resourceLoader.getResource("classpath:bitsquare.properties");
return new ResourcePropertySource(BITSQUARE_CLASSPATH_PROPERTY_SOURCE_NAME, resource);
}
PropertySource<?> filesystemProperties() throws Exception {
String location = String.format("file:%s/bitsquare.properties", appDataDir);
Resource resource = resourceLoader.getResource(location);
if (!resource.exists())
return new PropertySource.StubPropertySource(BITSQUARE_FILESYSTEM_PROPERTY_SOURCE_NAME);
return new ResourcePropertySource(BITSQUARE_FILESYSTEM_PROPERTY_SOURCE_NAME, resource);
}
private static String defaultUserDataDir() {
String os = System.getProperty("os.name").toLowerCase();