Te paso un snip del tutorial que esta en http://www.hpi.uni-potsdam.de/hirschfeld/seaside/tutorial
Basicamente crea un clase StGOODSDatabase que es la que se encarga de conectarse y abrir sesiones, y cuando hay modificaciones hace el commit. Saving All Data in an Object-Oriented Database: GOODS Another option to make your data persistent and share them with other applications is to use an object-oriented database like GOODS (Generic Object Oriented Database System). Installing the GOODS Database There are two ways to install GOODS: the first is to download a binary of the GOODS server, the second, to download the sources and compile the server on your own. A binary for Windows platforms can be found on the Squeak Wiki<http://wiki.squeak.org/squeak/3492/> . If you would like to compile the server yourself, download the sources from http://www.garret.ru/~knizhnik/goods.html<http://www.garret.ru/%7Eknizhnik/goods.html>, extract the sources and start compiling. The documentation can be found at the same page. To setup and start the server, you have to create a configuration file named #sttd.cfg in the directory where the server binary resides. Edit the file to make it look like this: 1 0:localhost:6100 This tells GOODS to start a single instance of the server listening on port 6100 of localhost. Open a command prompt, go to the GOODS directory and start the server with the command: goodsrv sttd To terminate the server later on, just type logout in the execution window. Installing the GOODS Framework The next step is to install the GOODS Client Framework in Squeak. So just open the SqueakMap Package Loader (WorldMenu -> open...) and install the package GOODS. Using GOODS First we need a new database class, e.g. StGOODSDatabase, which has an instance variable db. We also need some methods for connecting, disconnecting and saving data. Let us create them: connect self db: (KKDatabase onHost: self localhost port: self defaultPort). StGOODSDatabase>>#connect disconnect self db logout. StGOODSDatabase>>#disconnect initialize self connect. StGOODSDatabase>>#initialize We created and edited the #initialize method in the way shown above to allow us to be connected to the database every time we instantiate a new database object. Furthermore, we need to create a root object, from which all other objects to be made persistent in the database are referenced. Let us take a dictionary for that example: createRoot | users root | users := OrderedCollection new. root := Dictionary with: ('users' -> users). self db root: root; commit. StGOODSDatabase>>#createRoot What you see above is that we create a new root object (which is a Dictionary containing all users using the key users) and commit the changes to the database. There are several other database-related methods like #refresh or #rollback which can also be used. They can be found in the class KKDatabase, but for now the above code should be sufficient. Now we need a method to get all our users, users ^ self db root at: 'users' ifAbsent: [self error: 'Database root not initialized!'] StGOODSDatabase>>#users and a method to add users, do not forget to commit the changes! addUser: aUser self users add: aUser. self db commit. ^ aUser StGOODSDatabase>>#addUser: This works pretty well, but be aware of critical situations when two or more different database connections want to write their data. GOODS does not have a very good database management system. And all object structures are stored as they are, not in other database-internal structures. This means that, if, for example, you want to store a BTree and edit this tree at the same time with several connections, the database could crash. Please keep this in mind. 2009/2/7 Giuseppe Luigi Punzi Ruiz <[email protected]> > Gracias por los enlaces Ezequiel, pero la verdad, es que de momento me > gusta más Aida/Web. > > Por otro lado, no he conseguido compilar GOODS en mac, así que seguramente > intente juguetear con GLORP+PosrgreSQL o Magma > > Un saludo. > > El 07/02/2009, a las 16:56, Ezequiel S. Mc Govern escribió: > > Aca hay dos tutoriales en como enganchar GOODS como motor de persistencia > en Seaside: > > http://www.techgame.net/projects/Seaside/wiki/SetupSessionForGOODS > > Aca, ademas de eso tenes un tutorial completisimo de como desarrollar > aplicaciones con Seaside: > > > http://www.hpi.uni-potsdam.de/hirschfeld/seaside/tutorial?_k=VNMeWrrz&_s=oSFBofrZLeFDluwW#part4 > > > > -- > Saludos !! > Ezequiel ;) > > > > > > > > -- Saludos !! Ezequiel ;) --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] http://www.clubSmalltalk.org -~----------~----~----~----~------~----~------~--~---
