Changes between Version 9 and Version 10 of SERVER_DATABASE_PERSISTENCE
- Timestamp:
- 02/20/10 17:58:27 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SERVER_DATABASE_PERSISTENCE
v9 v10 61 61 * Tables that have unique data will be named in the following convention : T_TABLENAME (T comes from table) 62 62 * Tables that can be viewed with a series of joins on the other tables and are used mainly for ease when selecting will be names MV_TABLENAME (The V is from view, the M comes from multiple (tables)) 63 * TODO SCHEMA_AND_DESCRIPTION_HERE 63 * Tables 64 * T_RESOURCES 65 * Has three columns, unique DB id (autoincrement), parent id, that points to an unique id in the same DB and a resource name. 66 * The base table for the resources, it keeps the parent-child relations. 67 * From this table the ChildrenKey value can be calculated (all the rows that have specified parent id) 68 * The resourc enames here are the last part of their ResourceRefs (unique). 69 * MV_RESOURCE_PATHS - view used for easy listing of resources, contains id -> foreig key to an id in the T_RESOURCES table and a resource path, ztarting from the main dir on the server '/' 70 * This view is used for listing the paths of the resources, and retrieving paths, because using the T_RESOURCES table for constructing a path must iterate all the parents. 71 * The children key value can be retrieved from here too with query using LIKE path_to_parent% 72 * T_REVISIONS 73 * Has two columns, a unique db id (autoincrement) and RevisionId in the form of string. 74 * Used to store all the revisions of the resources on the server. 75 * T_RESOURCE_REVISIONS 76 * Has two columns, a foreign key to a resource db id in the T_RESOURCES and a foreign key to a revision db id in the T_REVISIONS. 77 * Shows which revisions are for which resources, some reosurces can have some of the revisions the same (for example the causing change of the revision updated a parent resource and two child resources). 78 * T_RESOURCE_LIFES 79 * Have four columns, a foreign key to a T_RESOURCES DB id, two foreign keys to T_REVISIONS db id (SET_REVISION_ID and CHANGE_REVISION_ID) and a boolean value. 80 * Shows if a resource is deleted or not, because all the history (even for the deleted resources) must be saved. 81 * The two revision ids have the following meaning. The SET_REVISION_ID is the id of the revision the resource is set to alive or deleted and the CHANGE_REVISION_ID is the id of the next revision there is a change in the status (can be null). 82 * When the resource 'life status' is changed the row with null for CHANGE_REVISION_ID should be set to the current revision and new row must be added for the resource with its new 'life status', current revision id as SET_REVISION_ID and null as CHANGE_REVISION_ID. 83 * This let the developers to track undo of deleting or creating resoures on the server. 84 * At this moment this table is not used optimally. 85 * T_CHANGES 86 * Has two columns, foreign key to a T_REVISIONS DB id, of the revision the change causes and the change stored to string. 87 * At the moment the string is XML created by the Sophie 2 Persistence API 88 * T_KEYS 89 * Has two columns unique DB id (autoincrement) and key path -> string 90 * The path is the last part of the key, for example title, page-size, background, color, etc... 91 * Something like all the possible keys in the DB model. 92 * Schema diagram: TODO!!! 64 93 === JDBC Template === 65 94 * For our purposes using JDBC is enough there is no need of ORM like Hibernate and bean model for it, because we will have small database. … … 91 120 * The SQLCallbacks retrieve and manage connections, and their doSQL method instantiates ConnectionCallbacks that use that connections. The execute methods of the JDBCTemplate deal with the SQLExceptions and if it is needed throw our JdbcException. 92 121 * class : [browser:branches/private/tsachev/paragraphs/modules/org.sophie2.server.core/src/main/java/org/sophie2/server/core/persistence/db/jdbc/JdbcException.java JDBCException] -> The exception thrown when something is wrong with the JDBCTemplate queries. It is unchecked and in general represents unchecked SQLException. 93 * class : [browser:branches/private/tsachev/paragraphs/modules/org.sophie2.server.core/src/main/java/org/sophie2/server/core/persistence/db/jdbc/ConnectionManager.java ConnectionManager]-> Manages the connections to the database, provides thread safe connections and provides methods for strating transactions and rollback of transactions.122 * class : ConnectionManager -> Manages the connections to the database, provides thread safe connections and provides methods for strating transactions and rollback of transactions. 94 123 * The manager is constructed by a DataSource (From the JDBC API, the data source can provide a connections from a pool, for reusing...) 95 124 * Public methods: … … 241 270 * [browser:branches/private/tsachev/paragraphs/modules/org.sophie2.server.core/src/test/java/org/sophie2/server/core/persistence/db/DBModelTest.java DBModelTest] -> Test parent for all the tests using the database with the S2S persistence schema, it creates the schema and deletes the DB after testing. 242 271 * [browser:branches/private/tsachev/paragraphs/modules/org.sophie2.server.core/src/test/java/org/sophie2/server/core/persistence/db/DBContextTest.java DBContextTest] -> Tests the DBChangeContext class and with it most of the ResourceDAO's methods. 243 * [browser:branches/private/tsachev/paragraphs/modules/org.sophie2.server.core/src/test/java/org/sophie2/server/core/persistence/db/ResourceDAOTest.java ResourceDAOTest] -> Tests the most important of the ResourceDAO's methods.272 * [browser:branches/private/tsachev/paragraphs/modules/org.sophie2.server.core/src/test/java/org/sophie2/server/core/persistence/db/ResourceDAOTest.java] -> Tests the most important of the ResourceDAO's methods. 244 273 * The web UI was tested manually. 245 274