[aida] Aida and Magma

nico petton.nicolas at gmail.com
Sun Sep 28 13:26:53 CEST 2008


Le samedi 27 septembre 2008 à 18:40 -0400, Rob Rothwell a écrit :
> For a data entry application with Magma, you can simply create a
> session and #begin it, if you are willing to #commitAndBegin regularly
> when you change things, or #abort; #begin if you need to check for
> changes.
> 
> 
> In an Aida application, you could easily #abort and #begin at the top
> of every view method, and #commitAndBegin with all your action
> methods, but since Aida is already providing "persistency" with the
> domain model, it seems like you could pretty easily create a special
> "Magma Aware" Aida by adding some well placed commits, aborts, and
> begins in the right places within Aida and creating a "magmaSession"
> property for your application.
> 
> 
> Would it be hard to hook into the Aida code that reads and writes the
> domain model to provide such behavior?

Hi Rob,

No, it would be quite easy to do, but really tricky. There is another
way to do this, and actually, that's what I'm doing with the
MagmaPersister in Scribo. Look at the Persister class in the
ScriboPersistence package in http://scribo.aidaweb.si/repository/

The MagmaPersister is not committed yet but ImagePersister and
SIXXPersister are.

This is how it works:

Persister class>>activateOn: aSite
	aSite repository eventLog addDependent: self default.

Take a look at 
Object>>changed: anAspect with: anObject
self dependents do: [:aDependent | aDependent update: anAspect with:
anObject]

when a Document is modified, it calls #setModifiedBy:

Document>>setModifiedBy: aWebUser
	self modifiedBy: aWebUser.
	self setModifiedTimestamp.
	self repository eventLog logModified: self by: aWebUser "this will call
Persister>>update:with:"

And finally, in Persister:

Persister>>update: anAspect with: aDocument
	anAspect = #created ifTrue:[^self onCreated: aDocument].
	anAspect = #modified ifTrue:[^self onModified: aDocument].
	anAspect = #obsolete ifTrue:[^self onObsolete: aDocument].
	anAspect = #released ifTrue:[^self onReleased: aDocument].
	
You can then subclass Persister (Currently there is a SIXXPersister,
ImagePersister and MagmaPersister) do save your object as you wish.

You could easily copy some of those methods in your domain objects to
use a magma persistence.

Cheers!


Nico

-- 
Nicolas Petton
http://nico.bioskop.fr
            ___
          ooooooo
         OOOOOOOOO
        |Smalltalk|
         OOOOOOOOO
          ooooooo
           \   /
            [|]
--------------------------------
Ma clé PGP est disponible ici :
http://nico.bioskop.fr/pgp-key.html
-------------- section suivante --------------
Une pi�ce jointe non texte a �t� nettoy�e...
Nom: non disponible
Type: application/pgp-signature
Taille: 189 octets
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url: http://lists.aidaweb.si/pipermail/aida/attachments/20080928/91836a34/attachment.sig 


More information about the Aida mailing list