is it possible to generateChangeLog diffTypes=data programatically?

hi all,

is it possible to “generateChangeLog diffTypes=data” programatically? Because the Liquibase facade does not provide any method for
that task.

im using liquibase-2.0-rc7.jar and derby

actually, im doing the following

    public class DatabaseExporterImpl implements DatabaseExporter {

        private static final String DIFF_TYPES = “data”;
        private ExceptionFactory exceptionFactory;
        private String username;
        private String password;
        private String driverClassName;
        private String author;
        private String connectionURL;

        public void exportTo(String filename) {
    try {

        ClassLoader classLoader = this.getClass().getClassLoader();
        Database database = CommandLineUtils.createDatabaseObject(
    	    classLoader, connectionURL, username, password,
    	    driverClassName, null, null);
        CommandLineUtils.doGenerateChangeLog(filename, database, null,
    	    DIFF_TYPES, author, null, null);
    } catch (LiquibaseException e) {
        throw cannotExportDatabaseTo(filename, e);
    } catch (IOException e) {
        throw cannotExportDatabaseTo(filename, e);
    } catch (ParserConfigurationException e) {
        throw cannotExportDatabaseTo(filename, e);


        private DataExporterException cannotExportDatabaseTo(String filename,
        Throwable cause) {
    Object[] args = new Object[] { filename };
    MessageCode code = MessageCode.CANNOT_EXPORT_DATABASE;
    return exceptionFactory.newInstanceFor(code, args, cause);

        public void setConnectionURL(String connectionURL) {
    this.connectionURL = connectionURL;

        public void setUsername(String username) {
    this.username = username;

        public void setPassword(String password) {
    this.password = password;

        public void setDriverClassName(String driverClassName) {
    this.driverClassName = driverClassName;

        public void setAuthor(String author) { = author;

        public void setExceptionFactory(ExceptionFactory factory) {
    this.exceptionFactory = factory;


but IMO it’s just a hack
because after that i’m having problems with the changelog file, because it remains open (basically a stream remains open somewhere).
and i cannot compress the file.
so, is there a correct way to “generateChangeLog diffTypes=data” programatically?

thanks in advance.

The main object for the diff/generateChangeLog support liquibase.diff.Diff.  I’ll add a placeholder call to it from the Liquibase object to make calling it easier.

The idea idea you call Diff diff = new Diff(refDatabase, targetDatabase).  YOu can then call DiffResult result = which will actually do the compare and generate an in-memory representation.  The DiffResult object has methods to read the diff information and/or output it in different formats.