<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: Persisting 'applications'</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Chris</FONT>
</P>

<P><FONT SIZE=2>It didn't click I was talking to the author. Thanks for taking the time, much appreciated. I have managed to get myself a little confused. I'm not long with Squeak so I am still in discovery mode. I found I had hundreds of live objects in my image so thought it best to find out how to manage lifetimes in the image before tackling Magma. I have a new image and everything loaded back in. I think I understand how to delete morphs now, but it does take some effort to make them 'really' go. </FONT></P>

<P><FONT SIZE=2>However, when I make them persistent I get into some trouble. I just can't seem to delete them from the database I've tried:</FONT></P>

<P><FONT SIZE=2>sdrBackplane := myMagmaSession root at: 'SDRBackplane'</FONT>
</P>

<P><FONT SIZE=2>to get a reference and then</FONT>
</P>

<P><FONT SIZE=2>myMagmaSession root: sdrBackplane</FONT>
<BR><FONT SIZE=2>MagmaSession cleanup</FONT>
<BR><FONT SIZE=2>myMagmaSession root removeKey: 'SDRBackplane'</FONT>
</P>

<P><FONT SIZE=2>to remove it (and variations thereof)</FONT>
</P>

<P><FONT SIZE=2>If I do:</FONT>
</P>

<P><FONT SIZE=2>SDRBackplane allInstances</FONT>
</P>

<P><FONT SIZE=2>I can get rid of any instances showing by:</FONT>
</P>

<P><FONT SIZE=2>sdrBackplane := nil</FONT>
<BR><FONT SIZE=2>CommandHistory resetAllHistory</FONT>
<BR><FONT SIZE=2>Smalltalk garbageCollect</FONT>
</P>

<P><FONT SIZE=2>Here's the interesting part. Once there are no instances in the image I can get one from the db by: </FONT>
</P>

<P><FONT SIZE=2>sdrBackplane := myMagmaSession root at: 'SDRBackplane'</FONT>
<BR><FONT SIZE=2>sdrBackplane openInWorld</FONT>
</P>

<P><FONT SIZE=2>and lo and behold the connectors are still connected. It seems that if I get an instance or even close one (via the halo) and openInWorld again the connections are broken. It is the act of closing it and opening again that breaks the connections - NOT MAGMA. This happens even when it's not persistent.</FONT></P>

<P><FONT SIZE=2>So if you tell me how to delete objects reliably from Magma I think I might be there.</FONT>
</P>

<P><FONT SIZE=2>I tried this with the SystemWindow. Making sure it was gone from the image. What I get back is the SDRBackplane (which is just a PasteUpMorph) but it has the white background and border of the window rather than its own.</FONT></P>

<P><FONT SIZE=2>Sorry it's a bit rambling. I haven't won the lottery yet but if I do you will be the first to benefit !</FONT>
</P>

<P><FONT SIZE=2>Regards</FONT>
<BR><FONT SIZE=2>Bob</FONT>
<BR><FONT SIZE=2>--------------------------</FONT>
</P>

<P><FONT SIZE=2>Sorry for the delayed response Bob.</FONT>
</P>

<P><FONT SIZE=2>&gt; My connectors come</FONT>
<BR><FONT SIZE=2>&gt; back connected unless I</FONT>
<BR><FONT SIZE=2>&gt; close the morph. Then the next load from the</FONT>
<BR><FONT SIZE=2>&gt; database they are disconnected.</FONT>
<BR><FONT SIZE=2>&gt; Still in place but the ends floating. Do you know of</FONT>
<BR><FONT SIZE=2>&gt; any way to close the</FONT>
<BR><FONT SIZE=2>&gt; morph without this happening? </FONT>
</P>

<P><FONT SIZE=2>Its possible that the Connectors may need some</FONT>
<BR><FONT SIZE=2>initialization on rematerialization.&nbsp; Magma itself</FONT>
<BR><FONT SIZE=2>does not require connectors so I have not extended any</FONT>
<BR><FONT SIZE=2>of its classes with any pre or post serialization</FONT>
<BR><FONT SIZE=2>stuff.</FONT>
</P>

<P><FONT SIZE=2>Did you store the Morphs while they were opened and</FONT>
<BR><FONT SIZE=2>running in the world?&nbsp; I try to support both, but you</FONT>
<BR><FONT SIZE=2>might have better luck one way or the other.</FONT>
</P>

<P><FONT SIZE=2>Sorry I don't have a more definitive answer.&nbsp; If you</FONT>
<BR><FONT SIZE=2>want to get it working here is a suggested approach</FONT>
<BR><FONT SIZE=2>(and I can guide you if you wish).</FONT>
</P>

<P><FONT SIZE=2>Explore your Radio in the committing image just before</FONT>
<BR><FONT SIZE=2>you commit, getting ready to explore its full tree of</FONT>
<BR><FONT SIZE=2>state.</FONT>
</P>

<P><FONT SIZE=2>In the retrieving image, after opening up the Radio in</FONT>
<BR><FONT SIZE=2>the world, explore it.</FONT>
</P>

<P><FONT SIZE=2>Now place the two Squeak images side-by-side and work</FONT>
<BR><FONT SIZE=2>down through each tree to find what objects in the</FONT>
<BR><FONT SIZE=2>receiving image do not match the ones in the</FONT>
<BR><FONT SIZE=2>committing image.</FONT>
</P>

<P><FONT SIZE=2>These objects will probably need a pre or post</FONT>
<BR><FONT SIZE=2>serialization operation.&nbsp; You can see some examples of</FONT>
<BR><FONT SIZE=2>how I set up various pre/post-ops on some of Squeaks</FONT>
<BR><FONT SIZE=2>built-in classes (like Color, PasteUpMorph and</FONT>
<BR><FONT SIZE=2>Project) by looking at the method</FONT>
<BR><FONT SIZE=2>MaObjectSerializer&gt;&gt;#setUpPreAndPostProcessing.</FONT>
</P>

<P><FONT SIZE=2>If you get this far let me know, I can probably help</FONT>
<BR><FONT SIZE=2>you implement those methods.</FONT>
</P>

<P><FONT SIZE=2>&gt; Also if I put in a</FONT>
<BR><FONT SIZE=2>&gt; window it restores without</FONT>
<BR><FONT SIZE=2>&gt; the window. I think I understand this because the</FONT>
<BR><FONT SIZE=2>&gt; window is not the root</FONT>
<BR><FONT SIZE=2>&gt; object. If I could get a reference to the window</FONT>
<BR><FONT SIZE=2>&gt; somehow and commit that I'm</FONT>
<BR><FONT SIZE=2>&gt; sure it would work.</FONT>
</P>

<P><FONT SIZE=2>That's a good guess but I'm not sure..&nbsp; For Morphs</FONT>
<BR><FONT SIZE=2>directly in the World, Magma does not serialize their</FONT>
<BR><FONT SIZE=2>'owner' (the World).&nbsp; However, I would think since you</FONT>
<BR><FONT SIZE=2>put the RadioMorph into a window (a SystemWindow?)</FONT>
<BR><FONT SIZE=2>that its 'owner' would be changed the window, not the</FONT>
<BR><FONT SIZE=2>World, so it should have serialized its owner.</FONT>
</P>

<P><FONT SIZE=2>Sigh.&nbsp; I'm sure I could debug this and figure it out</FONT>
<BR><FONT SIZE=2>in person; do you have any money?&nbsp; :)</FONT>
</P>

<P><FONT SIZE=2>Otherwise, just email me private if you wish and I'll</FONT>
<BR><FONT SIZE=2>do my best to help you from afar.</FONT>
</P>

<P><FONT SIZE=2>Regards,</FONT>
<BR><FONT SIZE=2>&nbsp; Chris</FONT>
</P>


<P><STRONG>*** Confidentiality Notice ***</STRONG> 
Proprietary/Confidential<BR>Information belonging to CGI Group Inc. and its 
affiliates<BR>may be contained in this message. If you are not a 
recipient<BR>indicated or intended in this message (or responsible 
for<BR>delivery of this message to such person), or you think for<BR>any reason 
that this message may have been addressed to you<BR>in error, you may not use or 
copy or deliver this message<BR>to anyone else.&nbsp; In such case, you should 
destroy this<BR>message and are asked to notify the sender by reply 
email.</P>
</BODY>
</HTML>