private ConfigSnapshotHolder fromXmlSnapshot(File file) {
try {
- JAXBContext jaxbContext = JAXBContext.newInstance(ConfigSnapshot.class);
- Unmarshaller um = jaxbContext.createUnmarshaller();
-
- return asHolder((ConfigSnapshot) um.unmarshal(file));
+ return loadLastConfig(file);
} catch (JAXBException e) {
logger.warn("Unable to restore configuration snapshot from {}", file, e);
throw new IllegalStateException("Unable to restore configuration snapshot from " + file, e);
}
}
- private ConfigSnapshotHolder asHolder(final ConfigSnapshot unmarshalled) {
+ public static ConfigSnapshotHolder loadLastConfig(File file) throws JAXBException {
+ JAXBContext jaxbContext = JAXBContext.newInstance(ConfigSnapshot.class);
+ Unmarshaller um = jaxbContext.createUnmarshaller();
+
+ return asHolder((ConfigSnapshot) um.unmarshal(file));
+ }
+
+ private static ConfigSnapshotHolder asHolder(final ConfigSnapshot unmarshalled) {
return new ConfigSnapshotHolder() {
@Override
public String getConfigSnapshot() {