Package liquibase

Examples of liquibase.Liquibase


        if (getExecutionConfiguration().getBooleanParameter("deletePrevious", Boolean.FALSE)) {
            String database = InjectHelper.instanceWithName(String.class, "org.socialmusicdiscovery.server.database");
            DatabaseProvider provider = InjectHelper.instanceWithName(DatabaseProvider.class, database);
            try {
                Connection connection = provider.getConnection();
                Liquibase liquibase = new Liquibase("org/socialmusicdiscovery/server/database/smd-database-drop.xml", new
                        ClassLoaderResourceAccessor(),
                        new JdbcConnection(connection));
                liquibase.update("");
                liquibase = new Liquibase("org/socialmusicdiscovery/server/database/smd-database.changelog.xml", new
                        ClassLoaderResourceAccessor(),
                        new JdbcConnection(connection));
                liquibase.update("");
            } catch (LiquibaseException e) {
                e.printStackTrace();
                progressHandler.failed(getId(), e.getLocalizedMessage());
                return;
            } catch (SQLException e) {
View Full Code Here


            } else {
                throw new RuntimeException("No database provider configured");
            }
            provider.start();
            Connection connection = provider.getConnection();
            Liquibase liquibase = new Liquibase("org/socialmusicdiscovery/server/database/smd-database.changelog.xml", new
                    ClassLoaderResourceAccessor(),
                    new JdbcConnection(connection));
            if (System.getProperty("liquibase") == null || !System.getProperty("liquibase").equals("false")) {
                // If database is locked, retry 10 times before we give up and force the lock to be released
                for(int i=0;i<10 && liquibase.listLocks().length>0;i++) {
                    Thread.sleep(1000);
                }
                if(liquibase.listLocks().length>0) {
                    liquibase.forceReleaseLocks();
                }
                liquibase.update("");
            }

            InjectHelper.injectMembers(this);

            // Add shutdown hook to exit cleanly after receiving a CTRL-C
View Full Code Here

        return false;
    }

    void execute(Connection connection) throws PluginException {
        try {
            Liquibase liquibase = new Liquibase("org/socialmusicdiscovery/server/database/sampledata/smd-database.sampledata.xml", new
                    ClassLoaderResourceAccessor(),
                    new JdbcConnection(connection));
            liquibase.update("");
        } catch (LiquibaseException e) {
            e.printStackTrace();
            throw new PluginException(getClass().getSimpleName() + " failure", e);
        }
    }
View Full Code Here

        String database = InjectHelper.instanceWithName(String.class, "org.socialmusicdiscovery.server.database");
        DatabaseProvider provider = InjectHelper.instanceWithName(DatabaseProvider.class, database);
        try {
            progressHandler.progress(getId(),"Deleting database contents",1L,2L);
            Connection connection = provider.getConnection();
            Liquibase liquibase = new Liquibase("org/socialmusicdiscovery/server/database/smd-database-drop.xml", new
                    ClassLoaderResourceAccessor(),
                    new JdbcConnection(connection));
            liquibase.update("");
            progressHandler.progress(getId(), "Creating fresh database", 2L, 2L);
            liquibase = new Liquibase("org/socialmusicdiscovery/server/database/smd-database.changelog.xml", new
                    ClassLoaderResourceAccessor(),
                    new JdbcConnection(connection));
            liquibase.update("");
            progressHandler.finished(getId());
        } catch (LiquibaseException e) {
            progressHandler.failed(getId(),e.getMessage());
        } catch (SQLException e) {
            e.printStackTrace();
View Full Code Here

            } else {
                throw new RuntimeException("No database provider configured");
            }
            provider.start();
            Connection connection = provider.getConnection();
            Liquibase liquibase = new Liquibase("org/socialmusicdiscovery/server/database/smd-database.changelog.xml", new
                    ClassLoaderResourceAccessor(),
                    new JdbcConnection(connection));
            if (System.getProperty("liquibase") == null || !System.getProperty("liquibase").equals("false")) {
                liquibase.update("");
            }
            liquibase = new Liquibase("org/socialmusicdiscovery/server/database/sampledata/large/large.xml", new
                    ClassLoaderResourceAccessor(),
                    new JdbcConnection(connection));
            liquibase.update("");

            // Ensure that we don't delete the database contents
            System.setProperty("hibernate.hbm2ddl.auto", "validate");
            System.out.println("Starting to update search relations...");
            SearchRelationPostProcessor searchRelationPostProcessor = new SearchRelationPostProcessor();
View Full Code Here

        String dbDriver = DatabaseFactory.getInstance().findDefaultDriver(testDs.connectionUrl);
        Database database = CommandLineUtils.createDatabaseObject(DbSetupUtility.class.getClassLoader(),
            testDs.connectionUrl, testDs.userName, testDs.password, dbDriver, null, null, null);
        //Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(
        //    new JdbcConnection(AbstractEJB3Test.getConnection()));
        Liquibase liquibase = new Liquibase(null, new ClassLoaderResourceAccessor(), database);
        liquibase.dropAll();
        dropRhqCalltimeDataKeyTable(database);
    }
View Full Code Here

          ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();
          if (dbType == DbType.DERBY || dbType == DbType.H2) {
            resourceAccessor = new ResourceAccessorFilter(resourceAccessor);
          }
         
          Liquibase liquibase = new Liquibase(changeLogResourceName, resourceAccessor, db);
          liquibase.update(null);
        } catch (Exception ex) {
          throw new JuRuntimeException("Couldn't run Liquibase change log " + changeLogResourceName, ex);
        }
      }
    });
View Full Code Here

          ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();
          if (dbType == DbType.DERBY || dbType == DbType.H2) {
            resourceAccessor = new ResourceAccessorFilter(resourceAccessor);
          }
         
          Liquibase liquibase = new Liquibase(changeLogResourceName, resourceAccessor, db);

          // Set parameters (if any)
          if (parameters != null) {
            for (String key : parameters.keySet()) {
              liquibase.setChangeLogParameter(key, parameters.get(key));
            }
          }

          // Run update
          liquibase.update((String)null);
        } catch (Exception ex) {
          throw new JuRuntimeException("Couldn't run Liquibase Update %s", ex, changeLogResourceName);
        }
      }
    });
View Full Code Here

            Connection connection = null;
            try {

                connection = dataSource.get().getConnection();
                DatabaseConnection dc = new JdbcConnection( connection );
                Liquibase liquibase = new Liquibase( config.get().changeLog().get(), new ClassLoaderResourceAccessor(), dc );
                liquibase.update( config.get().contexts().get() );

            } catch ( SQLException e ) {

                Throwable ex = e;
                while ( ex.getCause() != null ) {
View Full Code Here

        return (String) ejbConf.getProperties().get("hibernate.connection.url");
    }

    @Override
    protected void before() throws Throwable {
        liquibase = new Liquibase(changelogFile, accessor, database);
        liquibase.update("test");
    }
View Full Code Here

TOP

Related Classes of liquibase.Liquibase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.