Opened 9 years ago

Closed 9 years ago

#1892 closed task (fixed)

Implement support for extensions to add their own tables the BASE database

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: major Milestone: BASE 3.4
Component: core Version:
Keywords: Cc:

Description

Main use case so far is the LabEnv extension (http://baseplugins.thep.lu.se/wiki/net.sf.basedb.labenv) which currently uses an SQLLite database. The problems with this is that it is using native code which doesn't work well with classloaders that re-load new versions without restarting the server.

Also, in the future it is possible that other extensions may need this feature.

The basic idea is that the Services extension point is extended with functionality for an extension to specify a database schema (separate from the BASE default schema) and tables that it needs. Note that we only support this as a standalone feature. Relations and links to BASE items are not implemented.

Change History (6)

comment:1 by Nicklas Nordborg, 9 years ago

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:2 by Nicklas Nordborg, 9 years ago

(In [6630]) References #1892: Implement support for extensions to add their own tables the BASE database

The basic framework is in place. Service extensions now get a ServiceSessionControl instance in the ClientContext.getSessionControl(). It provides buildSessionFactory() method for generating a Hibernate session factory that can be either piggy-backed on BASE transactions (via DbControl) and/or use standalone transactions.

The buildSessionFactory() method also makes sure that the configured database tables are created/updated.

comment:3 by Nicklas Nordborg, 9 years ago

(In [6631]) References #1892: Implement support for extensions to add their own tables the BASE database

Adding support for extensions to specify a schema version of their own part of the database. This allows the BASE core to only do the database schema update when the schema version changes resulting in faster startup time for extensions.

The support is implemented by adding an 'app_id' column to the SchemaVersion table and adding more entries to it. The BASE core schema version got an id of 'net.sf.basedb.core'.

comment:4 by Nicklas Nordborg, 9 years ago

(In [6650]) References #1892: Implement support for extensions to add their own tables the BASE database

Breaking out functionality to create index on database columns to DbIndexWork so that it is possible to use this functionality with other schemas than the default.

comment:5 by Nicklas Nordborg, 9 years ago

(In [6651]) References #1892: Implement support for extensions to add their own tables the BASE database

Clarified the behaviour of the piggy-backed session and added a check before closing since re-closing causes an exception.

comment:6 by Nicklas Nordborg, 9 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.