[squeak-dev] Upgrading serialized Morphs to new Paragraph stuff

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Oct 3 21:22:23 UTC 2013


The become is not absolutely necessary, it's just future proof
In Morphics-nice.687

Item was added:
+ ----- Method: MultiNewParagraph class>>initialize (in category 'class
initialization') -----
+ initialize
+       "Prepare our own funeral"
+
+       MultiNewParagraph allInstancesDo:[:mnp| mnp becomeForward: (mnp as:
NewParagraph)]!


2013/10/3 Chris Muller <asqueaker at gmail.com>

> Actually, Nicolas' advice is what I was looking for.  Of course I use
> Ma-Serializer but regardless of serializer I am trying to figure out
> my process for upgrade.  To do that I want to be clear about the
> actual before-and-after state of the domain, which parts needing
> upgraded and what that upgrade is.  And also how it would integrate
> into an upgrade process.
>
> Nicolas seems to be saying the domain change is that any persistent
> MultiNewParagraphs need to become equivalent instances of
> NewParagraph.  I like the idea of moving MultiNewParagraph to
> 45Deprecated for one release until 4.6.
>
> What I'm a little unclear about still, how can I create the equivalent
> NewParagraph instance to become to?
>
> On Thu, Oct 3, 2013 at 1:01 PM, Bob Arning <arning315 at comcast.net> wrote:
> > Since Chris has not responded with the particular serialization method
> > employed, there's not much real advice to be given. The particular method
> > may well have a way to deal with this.
> >
> > Cheers,
> > Bob
> >
> >
> > On 10/3/13 1:48 PM, Nicolas Cellier wrote:
> >
> > We could as well restore an empty MultiNewParagraph in *45Deprecated,
> then
> > let you becomeForward: each MultiNewParagraph into a NewParagraph
> >
> >
> > 2013/10/3 Bob Arning <arning315 at comcast.net>
> >>
> >> That's one way. Another is 'save morph in file' from the metamenu.
> >> Question is which Chris used.
> >>
> >> On 10/3/13 6:33 AM, Edgar De Cleene wrote:
> >>
> >> On 10/3/13 6:55 AM, "Bob Arning" <arning315 at comcast.net> wrote:
> >>
> >>    One questions is: how were they serialized?
> >>
> >>  Cheers,
> >>  Bob
> >>
> >>
> >> Here you have how to exchange serialized objects between Squeak, Pharo
> and
> >> Cuis.
> >>
> >> For Pharo 2.0 you need fileIn ReferenceStream logic first.
> >> Drag any .obj into World and you got a Inspector of on it.
> >>
> >> !Object methodsFor: 'objects from disk' stamp: 'edc 9/6/2008 19:40'!
> >> fileOutCompressed
> >>
> >> | unzipped zipped buffer aFileName |
> >> aFileName := self class name asFileName.    "do better?"
> >>     aFileName := UIManager default
> >>                 request: 'File name?' translated initialAnswer:
> aFileName.
> >>     aFileName size == 0 ifTrue: [^ Beeper beep].
> >> Cursor write
> >> showWhile: [unzipped := RWBinaryOrTextStream on: ''.
> >> unzipped fileOutClass: nil andObject: self.
> >> unzipped reset.
> >> zipped := FileDirectory default newFileNamed: aFileName , 'obz'.
> >> zipped binary.
> >> zipped := GZipWriteStream on: zipped.
> >> buffer := ByteArray new: 50000.
> >> 'Compressing ' , self name
> >> displayProgressAt: Sensor cursorPoint
> >> from: 0
> >> to: unzipped size
> >> during: [:bar |
> >> [unzipped atEnd]
> >> whileFalse: [bar value: unzipped position.
> >> zipped
> >> nextPutAll: (unzipped nextInto: buffer)].
> >> zipped close.
> >> unzipped close]]! !
> >>
> >> !Object methodsFor: 'objects from disk' stamp: 'edc 6/20/2011 11:41'!
> >> saveOnFileNamed: aString
> >>     "Ask the user for a filename and save myself on a
> >>     ReferenceStream file. Writes out the version and class structure.
> >>     The file is fileIn-able. UniClasses will be filed out.
> >>     This save objects as .obj"
> >>     | aFileName fileStream |
> >>     aString isEmpty
> >>         ifTrue: [^ self error: 'name is missing'].
> >>     aFileName := aString , '.obj'.
> >>     fileStream := ReferenceStream fileNamed: aFileName .
> >>     fileStream nextPut: self.
> >>     fileStream close.
> >>     ! !
> >>
> >>
> >> !Object class methodsFor: 'objects from disk' stamp: 'edc 6/20/2011
> >> 12:16'!
> >> readAndInspect: inputStream
> >> | o rr |
> >>     rr _ ReferenceStream on: inputStream.
> >>     o _ rr next.
> >>     rr close.
> >>     o inspect! !
> >>
> >> !Object class methodsFor: '*services-extras' stamp: 'edc 2/14/2008
> 08:24'!
> >> fileReaderServicesForFile: fullName suffix: suffix
> >>     | services |
> >>     services _ OrderedCollection new.
> >>
> >>     (fullName asLowercase endsWith: '.obj')
> >>         ifTrue: [ services add: self serviceLoadObject ].
> >>     ^services! !
> >>
> >> !Object class methodsFor: '*services-extras' stamp: 'edc 7/27/2008
> 08:11'!
> >> readCompressedObject: aFileStream
> >>
> >>     self readAndInspect: (MultiByteBinaryOrTextStream with:
> >> (GZipReadStream
> >> on: aFileStream) upToEnd) reset! !
> >>
> >> !Object class methodsFor: '*services-extras' stamp: 'edc 7/27/2008
> 07:40'!
> >> serviceCompressedObject
> >>     "Answer a service for opening a saved Object"
> >>     ^ (SimpleServiceEntry
> >>         provider: Object
> >>         label: 'gz saved Object'
> >>         selector: #readCompressedObject:
> >>         description: 'open a gz Object'
> >>         buttonLabel: 'object')
> >>         argumentGetter: [:fileList |
> >>
> >>             fileList readOnlyStream]! !
> >>
> >> !Object class methodsFor: '*services-extras' stamp: 'edc 2/14/2008
> 08:26'!
> >> serviceLoadObject
> >> "Answer a service for opening a saved Object"
> >>
> >>     ^ (SimpleServiceEntry
> >>         provider: self
> >>         label: 'saved Object'
> >>         selector: #readAndInspect:
> >>         description: 'open a Object'
> >>         buttonLabel: 'object')
> >>         argumentGetter: [:fileList | fileList readOnlyStream]! !
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20131003/29bd2013/attachment.htm


More information about the Squeak-dev mailing list