<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Error: Magma helper not selected in application configuration.</div><div>When I add the WAMagmaConfiguration I see the Magma configuration group but I didn't found any drop down menu where I can select WAMagma.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>How can I configure my application for the Magma helper?</div><div><br class="webkit-block-placeholder"></div><div>Robert</div><br><div><div>Am 28.10.2007 um 06:57 schrieb Keith Hodges:</div><br class="Apple-interchange-newline"><blockquote type="cite"> <div bgcolor="#ffffff" text="#000000"> There have been calls for a Magma tutorial to go into the Seaside tutorial in the persistency chapter. This chapter already includes Glorp and GOODS.<br> <br> Just in case someone is already, or thinking of doing this, I have already written such a mini tutorial.<br> <br> In order to make Magma even easier to use, I have begun rewriting "Magma seaside" to take advantage of my new Seaside Session Helpers interface, which I released yesterday.<br> <br> The idea being that you can now use Magma, without a specialized Seaside Session class. This should make it easier for users to adopt Magma for their existing applications.<br> <br> I am a little unsure as to how you are supposed to obtain an exact match of a unique item from the database. <br> This is how I would do it (althought I know MagmaCollections dont actually implement #firstOrNil)<br> <br> ^ (self users where: [ :each | each email = anEmail ]) firstOrNil<br> <br> Is there a better way to obtain a unique value?<br> <br> cheers<br> <br> Keith<br> <br> p.s. the wiki page that I refer to on MagmaCollections is a bit out of date.<br> ----<br> <br> so far... <br> <br> <b>Saving all data in an object-oriented database: Magma</b><br> <br> Another option to make your data persistent is to use an object-oriented database like Magma.<br> <br> <b>Installing the Magma Database</b><br> <br> Magma is written entirely in Squeak, so there is no need to install a separate server application. Both Magma and Seaside can run in the same image. To install (into a 3.10 based image) just execute the following. (This may take a while)<br> <br> <tt>Installer universes install: 'Magma seasideHelper'.</tt><br> <b><br> Configuring your application to use Magma</b><br> <br> In the configuration for the 'todo' application you will need to add WAMagmaConfiguration to the configuration "ancestry". Select it from the drop down menu and click "Add". As soon as you do this, a new group of configuration options will appear. You will need to select the "WAMagma", helper class from the drop down menu.<br> <br> The WAMagma class provides the basic interface between Magma Sessions and Seaside Sessions. Subclasses provide specialised session management such as shared or pooled sessions. <br> <br> <b>Using Magma</b><br> <br> Magma is very easy to use with seaside. To obtain and use a database session helper, simply send <tt>#magma</tt> to the current session. For example the code "<tt>self session magma"</tt> will work within all seaside components.<br> <br> To use Magma in this application in a similar manner to the way we have connected to databases in other examples we need to create an interfacing class, to which we can add our specialized querying methods.<br> <br> <tt>Dictionary subclass: #StMagmaDatabase<br> &nbsp;&nbsp;&nbsp; instanceVariableNames: ''<br> &nbsp;&nbsp;&nbsp; classVariableNames: ''<br> &nbsp;&nbsp;&nbsp; poolDictionaries: ''<br> &nbsp;&nbsp;&nbsp; category: 'STTutTodoApp'<br> <br> StSession-#initialize<br> &nbsp;&nbsp;&nbsp; super initialize.<br> &nbsp;&nbsp;&nbsp; self db: (self magma rootAs: StMagmaDatabase)<br> </tt><br> The tutorial application accesses the database via the <tt>#db </tt>accessor. Here we define this using the <tt>#rootAs: </tt>helper method, which does everything we need, both to initialize the database, and to provide us the interface that we want to it.<br> <br> To initialize our users collection we define the initialization on our root object, and we need a method to return the users from the database, to add a new user, and to find a user.<br> <br> <tt>StMagmaDatabase-#initialize<br> &nbsp;&nbsp;&nbsp; | users |<br> &nbsp;&nbsp;&nbsp; users := OrderedCollection new.<br> &nbsp;&nbsp;&nbsp; self at: #users put: users.<br> <br> StMagmaDatabase-#users<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ^ self at: #users&nbsp; <br> <br> StMagmaDatabase-#addUser: newUser<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ^ self users add: newUser<br> <br> StMagmaDatabase-#findUserByEmail: anEmail<br> &nbsp;&nbsp;&nbsp; ^ self users <br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; detect: [:each | each email = anEmail] <br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifNone:[]<br> </tt><br> Notice how for basic usage we have not needed any database specific code! If our userbase is going to grow to a significant size it makes sense to re implement the above using some database features, so we introduce a MagmaCollection which you can read about in detail here: <a class="moz-txt-link-freetext" href="http://wiki.squeak.org/squeak/2639">http://wiki.squeak.org/squeak/2639</a><br> <br> <tt>initialize<br> &nbsp;&nbsp;&nbsp; | users |<br> &nbsp;&nbsp;&nbsp; users := MagmaCollection new.<br> &nbsp;&nbsp;&nbsp; users addIndex: (MaSearchStringIndex attribute: #userName) beAscii.<br> &nbsp;&nbsp;&nbsp; users addIndex: (MaSearchStringIndex attribute: #email) beAscii.<br> &nbsp;&nbsp;&nbsp; self at: #users put: users<br> <br> StMagmaDatabase-#users<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ^ self at: #users&nbsp; <br> <br> StMagmaDatabase-#addUser: newUser<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ^ self users add: newUser<br> <br> StMagmaDatabase-#findUserByEmail: anEmail<br> &nbsp;&nbsp;&nbsp; ^ (self users where: [ :each | each email = anEmail ]) firstOrNil</tt><br> <br> ... need to explain how committing works... etc<br> <br> <br> <br> <br> &nbsp;<br> </div>  _______________________________________________<br>Magma mailing list<br><a href="mailto:Magma@lists.squeakfoundation.org">Magma@lists.squeakfoundation.org</a><br>http://lists.squeakfoundation.org/mailman/listinfo/magma<br></blockquote></div><br></body></html>