wiki:S2S_PERSISTENCE_COMMONS_R0
Last modified 12 years ago Last modified on 12/05/08 13:44:34

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=S2S_PERSISTENCE_COMMONS_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

New module of the sophie2 project, used as an API to access a database from the server module. Will provide interface to the "server core" layer to persist, save to the database, search for and delete data.

Task requirements

  • Write basic server persistence module to the extend needed by the other tasks in Revision 0.
    • the persistence API should communicate with the Database(to select and update information)
    • it should give the interface for easier manipulation with users and groups.
  • Write good JUnit test that test all of the logic written.
  • Write a flexible interface to the database API, that can be changed easily.
  • Write the basic schema of the database and think of a way to store the creation logic in a good place.

Task result

The result will be a database module in initial state, which will be able to store and retrieve the data needed by the server core's security services. JUnit tests. Initial schema of the database.

Implementation idea

The persistence module will contain Data Access managers with methods like :

void saveEntity(Entity myEntity) {...}
void getEntityByField(String field) {...}
void persistEntity(Entity myEntity)

etc.. The managers will query the database directly using Database Access provider written for the purpose, that will be changeable. The API will be work with the generated Database Schema to the extend it is written.

S2S_CORE_SECURITY_R0
S2S_DEPLOY_TECHNOLOGIES_R0
The schema must be useful for #1293

How to demo

See that the written logic connects to the database properly and creates the Database Schema. The module can successfully persist, update, delete and search for data in the chosen database.

Design

  • The DatabaseManager and Data Access Objects should be implemented using the Singleton pattern.

  • The DatabaseSchema statements should be implemented using the database diagram:

source:/trunk/sophie2-platform/modules/org.sophie2.server/doc/S2S_PERSISTENCE_SCHEMA.jpg


  • the implementation should be made using the basic persistence class diagram:

source:/trunk/sophie2-platform/modules/org.sophie2.server/doc/S2S_Class_Persistence_Schema.png

  • Here are the tests for the new persistence module created: 602

trunk/sophie2-platform/modules/org.sophie2.server.persistence/src/test/java/org/sophie2/server/persistence/EmbeddedDatabaseManagerTest.java
trunk/sophie2-platform/modules/org.sophie2.server.persistence/src/test/java/org/sophie2/server/persistence/dao/GroupDaoTest.java
trunk/sophie2-platform/modules/org.sophie2.server.persistence/src/test/java/org/sophie2/server/persistence/dao/UserDaoTest.java

  • This demo is for helping to get into the derby database:

trunk/sophie2-platform/modules/org.sophie2.server.persistence/src/test/java/org/sophie2/server/persistence/EmbeddedDerbyDriverDemo.java

Implementation

The implementation is in 602 and 609.

Testing

Comments

(Write comments for this or later revisions here.)