use of org.openkilda.wfm.error.ConfigurationException in project open-kilda by telstra.
the class AbstractTopology method handleLaunchException.
protected static int handleLaunchException(Exception error) {
final Logger log = LoggerFactory.getLogger(AbstractTopology.class);
int errorCode;
try {
throw error;
} catch (CmdLineException e) {
System.err.println(e.getMessage());
System.err.println();
System.err.println("Allowed options and arguments:");
e.getParser().printUsage(System.err);
errorCode = 2;
} catch (ConfigurationException e) {
System.err.println(e.getMessage());
errorCode = 3;
} catch (TException e) {
log.error("Unable to complete topology setup: {}", e.getMessage());
errorCode = 4;
} catch (Exception e) {
log.error("Unhandled exception", e);
errorCode = 1;
}
return errorCode;
}
use of org.openkilda.wfm.error.ConfigurationException in project open-kilda by telstra.
the class LaunchEnvironment method loadPropertiesAndOverlayWithExtra.
private Properties loadPropertiesAndOverlayWithExtra(File[] extraConfiguration) throws ConfigurationException {
Properties result = new Properties();
try (InputStream resource = this.getClass().getResourceAsStream(Topology.TOPOLOGY_PROPERTIES)) {
result.load(resource);
} catch (IOException e) {
throw new ConfigurationException("Unable to load default properties.", e);
}
for (File path : extraConfiguration) {
Properties override = new Properties(properties);
try (FileInputStream source = new FileInputStream(path)) {
override.load(source);
} catch (IOException e) {
throw new ConfigurationException(String.format("Unable to load properties from %s", path), e);
}
result.putAll(override);
}
result.setProperty(CLI_OVERLAY + ".local", cli.getIsLocal() ? "true" : "false");
if (cli.getLocalExecutionTime() != null) {
result.setProperty(CLI_OVERLAY + ".local.execution.time", cli.getLocalExecutionTime().toString());
}
return result;
}
Aggregations