Magma seasideHelper and remote magma server
Miguel Enrique Cobá Martínez
m.coba.m at gmail.com
Tue Feb 24 09:44:40 UTC 2009
I am trying to use a remote server with the Magma seasideHelper.
Until now I can't.
This is the setup:
Magma Server Image
----------------------
Image: sq3.10.2-7179dev09.02.1.image from Damien Cassou
Installed from Universes: Magma with:
Installer squeaksource
project: 'Installer';
install: 'Installer-Core'.
Installer universe
install: 'Magma';
install.
Repository:
MagmaRepositoryController
create: '/home/miguel/magma/'
root: Dictionary new.
Server:
MagmaServerConsole new
open: '/home/miguel/magma/';
processOn: 51969.
I can conect with the magma cliente from the same image and from another
image and to add objects to the root without problem. I can also see the
changes in different sessions. Until this point, just like the normal
magma server. The important point is: In this setup the root is a
Dictionary.
Seaside Server image
-----------------------
Image: sq3.10.2-7179web09.02.1.image from Damien Cassou
Installed from Universes: Magma with:
Installer squeaksource
project: 'Installer';
install: 'Installer-Core'.
Installer universe
answer:'username' with:'admin';
answer:'password' with:'seaside';
install: 'Magma seasideHelper';
install.
My Seaside-app custom-session-class' initialize method:
initialize
super initialize.
self db: (self magma rootAs: AzDatabase)
My AzDatabase class definition:
MagmaDictionaryRoot subclass: #AzDatabase
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Az-Persistence'
My AzDatabase initialize method:
initialize
| users |
users := MagmaCollection new.
users addIndex: (MaSearchStringIndex attribute: #email) beAscii.
self at: #users put: users.
Now to the questions:
In my app the root is a subclass from MagmaDictionaryRoot that inherits
from IdentityDictionary
From WAMagma rootAs: method:
"obtain the actual database root, if the database does not exist create it"
root ifNil: [
[ root := self magmaSession root ] on: MagmaEnvironmentError do: [
:ex | self privateInitializeRoot ].
"we are at the first read of the actual db root"
self onFirstRead.
].
It tries to obtain a session to the location (in my case the remote
location) and if it can't initializes a new one if it is local.
The question is, can I use a remote magma server without Magma
seasideHelper loaded (the WAMagma, depends on WASessionHelper, part of
Seaside28Jetsam; MagmaDictionaryRoot comes with Magma seasideHelper,
etc. but I read in the documentation that magma compiles the classes on
the fly if they don't exist on the magma server. I suppose that this is
that is going to happen)
If I must use a Magma seasideHelper in my magma server image, should I
load seaside too? That is, should I use a web image from Damien Cassou,
but with WAKom stoped. This way both images would have the same classes
and I could use maybe other class than Dictionary for the repository
creation.
The code from WAMagma>> privateInitializeRoot says:
privateInitializeRoot
self location isLocal ifFalse: [ ^ self error: ' cannot create a non
local database' ].
root := self class defaultDatabaseRootClass new.
Does this means that I should create a repository on the magma server
image using the class that I use in my seaside image (this means that I
should load my application to the magma server image. even if it is an
image for storage)?
Can you please explain to me (us) what is the correct setup?
BTW, if I use a single image for seaside and magma servers, with the
WAMagmaSoloAuto, and a MagmaLocalLocation, all worked perfectly. A very
good job.
Thanks,
Miguel Cobá
More information about the Magma
mailing list