[aida] Aida application instance data

Rob Rothwell r.j.rothwell at gmail.com
Tue Feb 5 21:28:37 CET 2008


On Feb 5, 2008 2:06 PM, Janko Mivšek <janko.mivsek at eranova.si> wrote:

> Hi Rob,
>
> Besides domain objects which are accessible by any user, any session (if
> security allows) you have the instances of an App, one per each session
> per domain object. You can put session specific (temporary!) data here.
> Temporary because this state is usually cleared, each night for
> instance. But you can use WebSession userValues or WebUser userValues
> for permanent session/user specific data.


Maybe a more concrete example will help, because I am obviously missing
something!

Using Squeak, if I create domain object:

Object subclass: #MyObject
    instanceVariableNames: 'textInput'
    classVariableNames: ''
    poolDictionaries: ''
    category: 'FMC-Model'

And a WebApplication:

WebApplication subclass: #MyObjectApp
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''
    category: 'FMC-View'

with a main view:

viewMain
    |e|
    e := WebElement new.
    e addTextH1: 'My Application'. e addBreak.
    e addText: self observee textInput. e addBreak.
    e addInputFieldAspect: #textInput for: self observee.
    self add: e.

and create the site in a workspace with:

SwazooAida startOn: 8890.
obj := MyObject new.
(AIDASite named: 'aidaOn8890') urlResolver defaultURL: '/myapplication.html'
forObject: obj.

And then open the site (http://localhost:8890/myapplication.html), I will
see "nil" displayed on the screen the first time I enter the site right
below the header.  Once I enter "some text" into the input field, I will see
"some text," and if I go to another computer and enter the site (
http://mynetworkaddress:8890/myapplication.html), I will ALSO see "some
text" displayed at the top of the screen.

Furthermore, if I enter the site from the same computer in two different
browsers and add "self inspect" at the top of MyObjectApp>>viewMain, I the
app instance seems to be the same.

Does it matter that I have "logged in" as admin in both cases?

Where can I store data (and what methods do I use to access it) so that
entering text on one computer does NOT affect what displays on another
computer?

Sorry...there is something fundamental I don't understand yet.


Session is shared only among App instances for different domain objects.
> But you have never more than one app instance for the same domain object
> per session. That's obvious if you know the rule: a new App instances
> for every new session, per domain object. So if you have say 10 domain
> objects and 10 session, you have up to 100 App objects, one for each
> session:domain object combination.


So Sessions let different applications share objects?


>
> Let we look at Aida tutorial: AddressBook with Addresses. That's a
> domain model with anAddressBook as root domain object. Is your question
> (translated to a tutorial case) how to add a new address to address book?
>

No...it would be more like, how can two users have two DIFFERENT address
books?  Or, for something even more temporary (to use a common web analogy),
how can two sessions have two different shopping carts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.aidaweb.si/pipermail/aida/attachments/20080205/e2ac79b0/attachment.htm 


More information about the Aida mailing list