[app-wiring-refactor]: Define external configuration

This commit is contained in:
Francesco Burato 2020-10-30 13:37:01 +00:00
parent e3733dfae7
commit cf3dd2d94c
14 changed files with 1083 additions and 2 deletions

View file

@ -0,0 +1,20 @@
package mage.server.util;
import mage.server.util.config.Config;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import java.io.File;
public class ConfigFactory {
public static Config loadFromFile(final String filePath) {
try {
final JAXBContext jaxbContext = JAXBContext.newInstance("mage.server.util.config");
final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
return (Config) unmarshaller.unmarshal(new File(filePath));
} catch (Exception e) {
throw new ConfigurationException(e);
}
}
}