GADriverManager

Object subclass: #'GADriverManager' 

Overview

I am a simple driver manager that handle the subscriptions of database drivers. You can also ask a driver manager which are the installed drivers and get a driver by id.

Drivers are handled in a weak way: unloading a driver will eventually garbage collect the driver and the manager will be cleaned up.

Instance Method Details

availableDrivers

Returns the available database drivers

availableDrivers

cleanUp

cleanUp
| toClean |
Smalltalk garbageCollect
toClean := drivers keys select: :key | (drivers at: key) isNil ].
toClean do: :key | drivers removeKey: key ]

driverAt:

Returns the available driver with the id given as argument. If no driver is available with such id, an exception is risen.

driverAt: aDriverId 
^drivers at: aDriverId ifAbsent: self error: ('No driver configured with id {1}' format: {aDriverId}) ]

initialize

isAvailable:

Tests if a driver is available with the id given as argument.

isAvailable: aDriverId 

subscribeDriver:

Subscribes weakly the driver given as argument in the current manager

subscribeDriver: aDriver 
drivers at: aDriver driverId asLowercase asSymbol put: aDriver