use of liquibase.integration.ant.type.ChangeLogOutputFile in project liquibase by liquibase.
the class DiffDatabaseToChangeLogTask method setOutputFile.
/**
* @deprecated Use {@link #addConfiguredXml(ChangeLogOutputFile)} instead.
* @param outputFile The file to write the change log to.
*/
@Deprecated
public void setOutputFile(FileResource outputFile) {
log("The outputFile attribute is deprecated. Use a nested <xml>, <json>, <yaml>, or <txt> element instead.", Project.MSG_WARN);
ChangeLogOutputFile changeLogOutputFile = new ChangeLogOutputFile();
changeLogOutputFile.setOutputFile(outputFile);
addConfiguredXml(changeLogOutputFile);
}
use of liquibase.integration.ant.type.ChangeLogOutputFile in project liquibase by liquibase.
the class DiffDatabaseToChangeLogTask method executeWithLiquibaseClassloader.
@Override
protected void executeWithLiquibaseClassloader() throws BuildException {
for (ChangeLogOutputFile changeLogOutputFile : changeLogOutputFiles) {
PrintStream printStream = null;
String encoding = getOutputEncoding(changeLogOutputFile);
try {
FileResource outputFile = changeLogOutputFile.getOutputFile();
ChangeLogSerializer changeLogSerializer = changeLogOutputFile.getChangeLogSerializer();
printStream = new PrintStream(outputFile.getOutputStream(), true, encoding);
DiffResult diffResult = getDiffResult();
DiffOutputControl diffOutputControl = getDiffOutputControl();
DiffToChangeLog diffToChangeLog = new DiffToChangeLog(diffResult, diffOutputControl);
diffToChangeLog.print(printStream, changeLogSerializer);
} catch (UnsupportedEncodingException e) {
throw new BuildException("Unable to diff databases to change log file. Encoding [" + encoding + "] is not supported.", e);
} catch (IOException e) {
throw new BuildException("Unable to diff databases to change log file. Error creating output stream.", e);
} catch (ParserConfigurationException e) {
throw new BuildException("Unable to diff databases to change log file. Error configuring parser.", e);
} catch (DatabaseException e) {
throw new BuildException("Unable to diff databases to change log file. " + e.toString(), e);
} finally {
FileUtils.close(printStream);
}
}
}
use of liquibase.integration.ant.type.ChangeLogOutputFile in project liquibase by liquibase.
the class GenerateChangeLogTask method setOutputFile.
/**
* @deprecated Use {@link #addConfiguredXml(ChangeLogOutputFile)} instead.
*/
@Deprecated
public void setOutputFile(FileResource outputFile) {
log("The outputFile attribute is deprecated. Use a nested <xml>, <json>, <yaml>, or <txt> element instead.", Project.MSG_WARN);
ChangeLogOutputFile changeLogOutputFile = new ChangeLogOutputFile();
changeLogOutputFile.setOutputFile(outputFile);
addConfiguredXml(changeLogOutputFile);
}
use of liquibase.integration.ant.type.ChangeLogOutputFile in project liquibase by liquibase.
the class GenerateChangeLogTask method executeWithLiquibaseClassloader.
@Override
public void executeWithLiquibaseClassloader() throws BuildException {
Liquibase liquibase = getLiquibase();
Database database = liquibase.getDatabase();
CatalogAndSchema catalogAndSchema = buildCatalogAndSchema(database);
DiffOutputControl diffOutputControl = getDiffOutputControl();
DiffToChangeLog diffToChangeLog = new DiffToChangeLog(diffOutputControl);
for (ChangeLogOutputFile changeLogOutputFile : changeLogOutputFiles) {
String encoding = getOutputEncoding(changeLogOutputFile);
PrintStream printStream = null;
try {
FileResource outputFile = changeLogOutputFile.getOutputFile();
ChangeLogSerializer changeLogSerializer = changeLogOutputFile.getChangeLogSerializer();
log("Writing change log file " + outputFile.toString(), Project.MSG_INFO);
printStream = new PrintStream(outputFile.getOutputStream(), true, encoding);
liquibase.generateChangeLog(catalogAndSchema, diffToChangeLog, printStream, changeLogSerializer);
} catch (UnsupportedEncodingException e) {
throw new BuildException("Unable to generate a change log. Encoding [" + encoding + "] is not supported.", e);
} catch (IOException e) {
throw new BuildException("Unable to generate a change log. Error creating output stream.", e);
} catch (ParserConfigurationException e) {
throw new BuildException("Unable to generate a change log. Error configuring parser.", e);
} catch (DatabaseException e) {
throw new BuildException("Unable to generate a change log. " + e.toString(), e);
} finally {
FileUtils.close(printStream);
}
}
}
Aggregations