forked from External/mage
[app-wiring-refactor]: Define external configuration
This commit is contained in:
parent
e3733dfae7
commit
cf3dd2d94c
14 changed files with 1083 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue