Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ 1831241 ] add tasks for upgrade service
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
symmetric/src/main/java/org/jumpmind/symmetric/upgrade/IUpgradeTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
symmetric/src/main/java/org/jumpmind/symmetric/upgrade/SqlUpgradeTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
} |