package com.megatim.fdxcommons.model.camel;
|
|
import java.io.FileInputStream;
|
import java.io.FileNotFoundException;
|
import java.io.IOException;
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Properties;
|
|
/**
|
*
|
* @author Gabuntu
|
*/
|
public class FileProperties {
|
|
private final String configurationFilePath;
|
private final List<Properties> cachedProperties = new ArrayList<>(1);
|
|
public FileProperties(String configurationFilePath) {
|
this.configurationFilePath = configurationFilePath;
|
}
|
|
public Properties properties() throws FileNotFoundException, IOException {
|
if (cachedProperties.isEmpty()) {
|
try (FileInputStream fis = new FileInputStream(configurationFilePath)) {
|
Properties properties = new Properties();
|
properties.load(fis);
|
cachedProperties.add(properties);
|
}
|
}
|
return cachedProperties.get(0);
|
}
|
}
|