PackageDescription: Seaside-Glorp
Seaside - GlorpLast published: June 25, 2010 by 'dwallen'
Defines 10 Classes
Extends 13 Classes
This package provides glue to connect Seaside and Glorp, as well as transparent support for database connection pooling.
Description
Provides class GlorpFilter to automatically associate a database session (Glorp) with a Seaside session, for the duration of the Seaside session. This, combined with the GlorpActiveRecord and WriteBarriers (which are automatically loaded as prerequisites) adds an easy-to-use persistence facility for Seaside applications. To better manage database resources, this package also includes class VWPoolingDatabaseAccessor, which provides support for connection pooling.
Usage
YourSeasideComponent class>>initialize
"self initialize"
| application |
application := self registerAsApplication: 'GlorpExample'.
application configuration addParent: GlorpConfiguration instance
YourSeasideComponent>>renderOn: html
| glorpSession |
(glorpSession := self session glorpSession)
ifNil: [html text: 'Database not configured for use']
ifNotNil: [html text: 'Database ready to go!']
...
The connection pooling feature may also be used with any Glorp application, simply by instantiating VWPoolingDatabaseAccessor to create an accessor object. The accessor is intended to be maintained as application state, and used when new sessions are created. In this case, rather than using #sessionForLogin: to create a session, you should build the session object like this:
(session := GlorpSession new) accessor: poolingAccessor.
session system: MyDescriptorSystem
...
Implementation
The functionality in ths package is based on work by Ramon Leon. For details, see the class comments for GlorpResource and VWPoolingDatabaseAccessor.