use of io.openems.core.Config in project openems by OpenEMS.
the class App method main.
// public final static String OPENEMS_VERSION = "2018.5.0-SNAPSHOT";
public static void main(String[] args) {
log.info("OpenEMS version [" + OPENEMS_VERSION + "] started");
// parse cli
Option helpOption = Option.builder("h").longOpt("help").required(false).desc("shows this message").build();
Option configFileOption = Option.builder("c").longOpt("configFile").numberOfArgs(1).required(false).type(String.class).desc("path for the configFile").build();
Options options = new Options();
options.addOption(helpOption);
options.addOption(configFileOption);
CommandLineParser parser = new DefaultParser();
CommandLine cmdLine;
String configPath = null;
try {
cmdLine = parser.parse(options, args);
if (cmdLine.hasOption("help")) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("openEMS", options);
System.exit(0);
} else {
configPath = cmdLine.hasOption("configFile") ? (String) cmdLine.getParsedOptionValue("configFile") : null;
}
} catch (ParseException e1) {
log.error("cli parsing failed!", e1);
}
// kick the watchdog: READY
SDNotify.sendNotify();
// configure Restlet logging
Engine.getInstance().setLoggerFacade(new Slf4jLoggerFacade());
// Get config
try {
Config config = Config.initialize(configPath);
config.readConfigFile();
} catch (Exception e) {
App.shutdownWithError("OpenEMS Edge start failed", e);
}
log.info("OpenEMS Edge started");
log.info("================================================================================");
}
use of io.openems.core.Config in project openems by OpenEMS.
the class FeneconPersistence method dispose.
@Override
protected void dispose() {
this.reconnectingWebsocket.dispose();
try {
Config config = Config.getInstance();
config.removeOnConfigUpdateListener(this.onConfigUpdate);
} catch (ConfigException e) {
log.error(e.getMessage());
}
}
Aggregations