Skip to content

Commit

Permalink
[ 1831241 ] add tasks for upgrade service
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Nov 13, 2007
1 parent 1d7ba27 commit 8aece50
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
@@ -0,0 +1,27 @@
/*
* SymmetricDS is an open source database synchronization solution.
*
* Copyright (C) Eric Long <erilong@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*/

package org.jumpmind.symmetric.upgrade;

public interface IUpgradeTask {

public void upgrade(int[] fromVersion);

}
@@ -0,0 +1,52 @@
/*
* SymmetricDS is an open source database synchronization solution.
*
* Copyright (C) Eric Long <erilong@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*/

package org.jumpmind.symmetric.upgrade;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jdbc.core.JdbcTemplate;

public class SqlUpgradeTask implements IUpgradeTask {

private static final Log logger = LogFactory.getLog(SqlUpgradeTask.class);

protected JdbcTemplate jdbcTemplate;

protected List<String> sqlList;

public void upgrade(int[] fromVersion) {
for (String sql : sqlList) {
logger.debug("upgrade->" + sql);
jdbcTemplate.update(sql);
}
}

public void setJdbcTemplate(JdbcTemplate jdbc) {
this.jdbcTemplate = jdbc;
}

public void setSqlList(List<String> sqlList) {
this.sqlList = sqlList;
}

}

0 comments on commit 8aece50

Please sign in to comment.