PackageDescription: StoreUnloading


Store Unloading

Last published: October 9, 2007 by 'NiallRoss'

Defines 0 Classes
Extends 4 Classes


This package does two things. (The text following this summary describes in detail the first and then the second.)
- 1) It supports clean unloading of Store from the image (for reloading, see the Appendix at the end of this comment)
- 2) It fixes two Store bugs in VW7.5 and earlier:
* 2a) mispackaged #dbTrace method causes unloading problems
* 2b) bug in updating bundle information when switching Store logins
Hopefully the two bugfixes will become part of the base image and this package can be slimmed to the VisualLauncher extension method.

1) Loading this adds an 'Unload Store' menupick to the Launcher's Store menu, active only when not logged-in to Store. Invoking it will
- ask user to confirm
- prompt user to save repository settings
- prompt user to discard database links
- remove all StoreFor* parcels and all their prereqs recursively
* unloadStore method has exemptedNames temp user can populate; confirmer lists these
* Other store-using packages e.g. RBStoreExtensions, must be removed beforehand or added to #unloadStore's list
- cleanse and unload StoreBase bundle (StoreBase parcel has bundle structure, so unloading parcel does not unload all)
- condense changes (to remove store refs from changes, thence remove all Undeclareds)
* (if image has other Undeclareds matching Store's, e.g. undeclared Packages or whatever, then Undeclareds may remain)
To get a reverse 'Reload Store' menupick, add the #reloadStore method in the Appendix below. As appropriate, edit it, and #unloadStore, to suit your application and Store usage.

2a) The DatabaseConnectionInformation>>dbTrace method should be in PackageCategories as it can be required even when Store is unloaded, since Bundles insist on having a nonce DatabaseConectionBundleInformation to manage their contents and file descriptors even when Store is absent. This has nil dbTrace of course but the accessor used to verify that has been unloaded with Store! (The distribution image gets away with it by leaving its database links in, but that means that when you reattach, you see pundles marked as unchanged which have in fact been changed while you were unattached; such changes are not known to Store until you choose to rereconcile. This is not a safe UI strategy.)

2b) This package also has fixes for a Store bug which users of this operation may encounter: logically, a store bundle contains a single set of subpundles in a given image at a given time, regardless of which database it is connected to; in practice, this data is stored in the database informations of each database connection, and was only being updated in that for the current database - Store did not upgrade the list for one database when that for another was loaded. Hence an image with a bundle for which it had multiple database informations could have different contents lists and orders in each, causing the extra packages to jump from the bundle to the Registry's top-level list in the following scenario
a) Bundle loaded from one database, or created with Store unloaded, with certain pundles.
b) Bundle reconciled to other database and version with additional pundles loaded and/or changed order
c) Reconnect to first database or unload store (i.e. 'reconnect' to 'no database')
The fixes in this package ensure that the additional pundles. and their order, are applied to all database informations.

Appendix: Reloading Store
===================
Users of this utility may want to repeatedly unload and reload Store with a specific interface(s), resetting repositories. The following method can be editted to speed reloading:

VisualLauncher>>reloadStore
nameKey: #reloadStore
enablement: #isStoreNotLoaded
indication: nil
menu: #(#menuBar tools)
position: 100.01>
"This method, edited to suit your app, can be a useful addition to your local copy of StoreUnloading. If you are doing a lot of unloading and reloading (to check packaging, non-dependency or whatever), this speeds reloading of your chosen Store interface(s)."

"A) (In VW 7.5 or earlier) Get current StoreUnloading overrides (i.e. overrides of me) to see what new ones appear.
storeUnloadingPackage := #{Store.Registry} value packageNamed: 'StoreUnloading'.
currentOverrides := storeUnloadingPackage overrides.
"1) Load all the StoreFor* parcels you require, either via a hard-coded list, e.g.
Parcel loadParcelByName: 'StoreForPostgreSQL'.
Parcel loadParcelByName: 'StoreForInterBase'.
or by capturing storeParcels in #unloadStore to some shared var and using its contents."
"2) Suppress any unwanted load side-effects, e.g. the Interbase installer
#{Store.InterBaseDatabaseInstaller} value allInstances first closeRequest."
"3) Prompt to reload your repository settings."
(SettingsManager open: VisualWorksSettings selectPage: #(#store #repositories))
importSettingsIntoPage okPressed.
"B) (In VW 7.5 or earlier) Restore any overrides lost by reloading Store on top of StoreUnloading
storeUnloadingPackage overrides do:
[:each | (currentOverrides includes: each) ifFalse: [each reinstall]]."