[Newbies] Re: Sharing a Singleton for read-only access to data

Stephan Eggermont stephan at stack.nl
Fri May 13 05:44:30 UTC 2016

Just a small flaw, easy to fix.

You can just subclass the session class and add the filter data to that,
or you can add user management.

In QcMagritte we use announcements and user management, so there
we have

WASession subclass: #QCSession
     instanceVariableNames: 'announcer user'
     classVariableNames: ''
     category: 'QC-Magritte-Session'

with methods like

     ^self user notNil

where the seaside application class (class side) does

#registerAt: anApplicationName
     ^(WAAdmin register: self asApplicationAt: anApplicationName)
         preferenceAt: #sessionClass put: self sessionClass;
         addLibrary: JQDeploymentLibrary;
         addLibrary: JQUiDeploymentLibrary;

and the seaside component does

     ^self session isLoggedIn

If you want the filters to be coupled to the user instead of the
session, your users can also be such a singleton collection.
Otherwise, just use a session class that holds onto your filter data.

Seaside itself (on Squeak and Pharo) is threadsafe


More information about the Beginners mailing list