Aida and Magma

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Aida and Magma

Rob Rothwell
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?

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida and Magma

Nicolas Petton
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

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Aida and Magma

Janko Mivšek
In reply to this post by Rob Rothwell
Hi Rob,

Rob Rothwell wrote:

> 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?

This is actually done that way in Gemstone GLASS port of Aida.
Essentially you have a commit after every request, then a new
transaction auto begins. But for performance (and solving the problem of
parallel requests) Aida has its own WebTransactionMonitor, which
coordinates transactions among parallel requests. Actually there is only
one transaction context open at any moment and where we just
coordinating commits. By default simply by committing when there is a
time or at least every 10s. But an app can request an explicit commit to
be sure data is really saved to the database.

I could say that an existing WebTransactionMonitor can probably easily
be adapted for Magma as well, so if someone has a time ...

Janko


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida and Magma

Rob Rothwell
So there is a working Aida GLASS port as well?  If I could get that working, I'd take a look at WebTransactionMonitor.  I came back to Magma because my limitations are in my external data sources.  With a Magma Server, I can gain the power of Smalltalk "updaters" that crawl through my PatientEncouner's and update various parts of their model.  With GLASS (which would be fun to use, don't get me wrong!), I would have to produce files for it's consumption.

However...I will take a look at WebTransactionManager if I can find it!

The reason I was looking to do this is that all my apps are "the same," just a bit different--all centered around PatientEncounter's and collecting manual data that is not available any other way than chart review.

For that reason, I am also thinking of storing the "field description" for aspects of the PatientEncounter in class methods of the model that will return the proper Aida WebElement.  Beautiful, really.  Then any app I write will just need to know that I want to display that aspect, and it will know how to do it!

Then, even with Magma, I get to share PatientEncounter data across all my apps and display it correctly with Aida!

Thanks...I have a version of GLASS that runs; I'll look around again for the Swazoo & Aida port so I can take a look at this WebTransactionManager.

Rob

On Sun, Sep 28, 2008 at 10:05 AM, Janko Mivšek <[hidden email]> wrote:
Hi Rob,


Rob Rothwell wrote:
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?

This is actually done that way in Gemstone GLASS port of Aida. Essentially you have a commit after every request, then a new transaction auto begins. But for performance (and solving the problem of parallel requests) Aida has its own WebTransactionMonitor, which coordinates transactions among parallel requests. Actually there is only one transaction context open at any moment and where we just coordinating commits. By default simply by committing when there is a time or at least every 10s. But an app can request an explicit commit to be sure data is really saved to the database.

I could say that an existing WebTransactionMonitor can probably easily be adapted for Magma as well, so if someone has a time ...

Janko


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida