use of com.developmentontheedge.be5.metadata.exception.ProcessInterruptedException in project be5 by DevelopmentOnTheEdge.
the class AppSync method execute.
// /////////////////////////////////////////////////////////////////
@Override
public void execute() throws MojoFailureException {
init();
PrintStream ps = null;
try {
if (logPath != null) {
logPath.mkdirs();
ps = new PrintStream(new File(logPath, be5Project.getName() + "_sync_ddl.sql"), "UTF-8");
}
sqlExecutor = new BeSqlExecutor(connector, ps);
if (be5Project.getDebugStream() != null) {
be5Project.getDebugStream().println("Modules and extras for " + be5Project.getName() + ":");
be5Project.allModules().map(m -> "- " + m.getName() + ": " + (m.getExtras() == null ? "" : String.join(", ", m.getExtras()))).forEach(be5Project.getDebugStream()::println);
}
readSchema();
createEntities();
String ddlString = getDdlStatements(false);
ddlString = MultiSqlParser.normalize(be5Project.getDatabaseSystem().getType(), ddlString);
if (ddlString.isEmpty()) {
getLog().info("Database scheme is up-to-date");
return;
}
if (forceUpdate) {
sqlExecutor.startSection("Sync schema");
logger.setOperationName("[>] Schema");
sqlExecutor.executeMultiple(ddlString);
sqlExecutor.startSection(null);
} else {
System.err.println("The following statements should be executed to update database scheme:");
System.err.println(ddlString);
System.err.println("Use -DBE5_FORCE_UPDATE=true, for apply");
}
checkSynchronizationStatus();
logger.setOperationName("Finished");
} catch (// ReadException | ProjectLoadException | SQLException e )
FreemarkerSqlException | ExtendedSqlException | SQLException e) {
if (debug)
throw new MojoFailureException("Synchronisation error: " + e.getMessage(), e);
throw new MojoFailureException("Synchronisation error: " + e.getMessage());
} catch (IOException | ProcessInterruptedException e) {
throw new MojoFailureException("Synchronisation error: " + e.getMessage(), e);
} catch (Throwable t) {
t.printStackTrace();
throw new MojoFailureException("Synchronisation error: " + t.getMessage(), t);
} finally {
if (ps != null) {
ps.close();
}
}
}
Aggregations