01: /*
02: * Copyright 2006-2007, Unitils.org
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.unitils.dbmaintainer.version;
17:
18: import org.unitils.dbmaintainer.util.DatabaseTask;
19:
20: /**
21: * Interface that gives access to the version of a database, and a means to increment this version. The version of
22: * a database is represented by a {@link Version} object. This interface can also be used to register / retrieve whether
23: * the lastest database update succeeded.
24: *
25: * @author Filip Neven
26: * @author Tim Ducheyne
27: */
28: public interface VersionSource extends DatabaseTask {
29:
30: /**
31: * @return The current version of the database
32: */
33: Version getDbVersion();
34:
35: /**
36: * Updates the version of the database to the given value
37: *
38: * @param version The new version that the database should be updated to
39: */
40: void setDbVersion(Version version);
41:
42: /**
43: * Tells us whether the last database version update succeeded or not
44: *
45: * @return True if the last database version update succeeded, false otherwise
46: */
47: boolean isLastUpdateSucceeded();
48:
49: /**
50: * Notifies the VersionSource of the fact that the lastest version update has succeeded or not
51: *
52: * @param succeeded True for success
53: */
54: void registerUpdateSucceeded(boolean succeeded);
55:
56: /**
57: * Tells us whether the last database code update succeeded or not
58: *
59: * @return true if the last database code update succeeded, false otherwise
60: */
61: boolean isLastCodeUpdateSucceeded();
62:
63: /**
64: * Notifies the VersionSource of the fact that the lastest code update has succeeded or not
65: *
66: * @param succeeded True for success
67: */
68: void registerCodeUpdateSucceeded(boolean succeeded);
69:
70: /**
71: * @return The current timestamp of the code scripts
72: */
73: long getCodeScriptsTimestamp();
74:
75: /**
76: * Stores the timestamp of the code scripts in the VersionSource
77: *
78: * @param codeScriptsTimestamp The timestamp, not null
79: */
80: void setCodeScriptsTimestamp(long codeScriptsTimestamp);
81:
82: }
|