summaryrefslogtreecommitdiffstats
path: root/src/com/iciql/Db.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2011-08-04 14:10:59 -0400
committerJames Moger <james.moger@gmail.com>2011-08-04 14:10:59 -0400
commit3d1e36c31e2a8354e03cdfe12565503190c2e957 (patch)
treec81ed9b643c7f787f983e6199d352cf11b26a32f /src/com/iciql/Db.java
parentd32c1f4d1eccbe0b9dd7c557d52879c8ec01069a (diff)
downloadiciql-3d1e36c31e2a8354e03cdfe12565503190c2e957.tar.gz
iciql-3d1e36c31e2a8354e03cdfe12565503190c2e957.zip
Overhauling annotations.
* @IQSchema(name="public") -> @IQSchema("public") * @IQDatabase(version=2) -> @IQVersion(2) * @IQTable(version=2) -> @IQVersion(2) * @IQIndex annotation simplified to be used for one index definition and expanded to specify index name * added @IQIndexes annotation to specify multiple IQIndex annotations
Diffstat (limited to 'src/com/iciql/Db.java')
-rw-r--r--src/com/iciql/Db.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/com/iciql/Db.java b/src/com/iciql/Db.java
index 3f86d15..f70a37e 100644
--- a/src/com/iciql/Db.java
+++ b/src/com/iciql/Db.java
@@ -34,7 +34,7 @@ import java.util.Set;
import javax.sql.DataSource;
import com.iciql.DbUpgrader.DefaultDbUpgrader;
-import com.iciql.Iciql.IQDatabase;
+import com.iciql.Iciql.IQVersion;
import com.iciql.Iciql.IQTable;
import com.iciql.SQLDialect.DefaultSQLDialect;
import com.iciql.SQLDialect.H2Dialect;
@@ -230,8 +230,8 @@ public class Db {
// flag as checked immediately because calls are nested.
upgradeChecked.add(dbUpgrader.getClass());
- IQDatabase model = dbUpgrader.getClass().getAnnotation(IQDatabase.class);
- if (model.version() > 0) {
+ IQVersion model = dbUpgrader.getClass().getAnnotation(IQVersion.class);
+ if (model.value() > 0) {
DbVersion v = new DbVersion();
DbVersion dbVersion =
// (SCHEMA="" && TABLE="") == DATABASE
@@ -239,17 +239,17 @@ public class Db {
if (dbVersion == null) {
// database has no version registration, but model specifies
// version: insert DbVersion entry and return.
- DbVersion newDb = new DbVersion(model.version());
+ DbVersion newDb = new DbVersion(model.value());
insert(newDb);
} else {
// database has a version registration:
// check to see if upgrade is required.
- if ((model.version() > dbVersion.version) && (dbUpgrader != null)) {
+ if ((model.value() > dbVersion.version) && (dbUpgrader != null)) {
// database is an older version than the model
boolean success = dbUpgrader
- .upgradeDatabase(this, dbVersion.version, model.version());
+ .upgradeDatabase(this, dbVersion.version, model.value());
if (success) {
- dbVersion.version = model.version();
+ dbVersion.version = model.value();
update(dbVersion);
}
}
@@ -316,8 +316,8 @@ public class Db {
}
public synchronized void setDbUpgrader(DbUpgrader upgrader) {
- if (!upgrader.getClass().isAnnotationPresent(IQDatabase.class)) {
- throw new IciqlException("DbUpgrader must be annotated with " + IQDatabase.class.getSimpleName());
+ if (!upgrader.getClass().isAnnotationPresent(IQVersion.class)) {
+ throw new IciqlException("DbUpgrader must be annotated with " + IQVersion.class.getSimpleName());
}
this.dbUpgrader = upgrader;
upgradeChecked.clear();