Obsolete.st
author Claus Gittinger <cg@exept.de>
Sat, 04 Oct 1997 19:01:30 +0200
changeset 2998 930360fb3f12
parent 2957 46015145c398
child 3080 e150501c9c60
permissions -rw-r--r--
#size is not really obsolete

"
 COPYRIGHT (c) 1994 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

'From Smalltalk/X, Version:3.1.10 on 20-sep-1997 at 11:57:37 pm'                !

nil subclass:#ObsoleteObject
	instanceVariableNames:''
	classVariableNames:'ObsoleteObjectSignal'
	poolDictionaries:''
	category:'System-BinaryStorage'
!

!ObsoleteObject class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1994 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    This class is used for error handling during binary object restoration. 
    Whenever an object whose class has changed (i.e. it was stored with a 
    different layout/size) is about to be restored, it cannot be made an 
    instance of the now existing class.
    In this case, the BinaryInputManager will create a dummy class for the 
    old (obsolete) object. This dummy class will be a subclass of ObsoleteObject.

    After the creation of the obsolete object, a signal will be raised (in 
    BinaryInputManager), which can be caught by the application to try some 
    automatic or semi-automatic object conversion.
    The signal gets the obsolete object and the new class as parameters.

    ObsoleteObject itself catches all messages, to avoid any use of the restored
    object (in case conversion failed or the signal was ignored).

    [author:]
        Claus Gittinger

    [see also:]
        BinaryObjectStorage
        BinaryIOManager
        PersistencyManager
        (binary object storage : programming/binaryStore.html )
"
! !

!ObsoleteObject class methodsFor:'initialization'!

initialize

    ObsoleteObjectSignal isNil ifTrue:[
        ObsoleteObjectSignal := (Signal new) mayProceed:false.
        ObsoleteObjectSignal nameClass:self message:#obsoleteObjectSignal.
        ObsoleteObjectSignal notifierString:'use of obsolete object'.

        self setSuperclass:nil
    ]

    "Modified: 30.4.1996 / 14:46:13 / cg"
! !

!ObsoleteObject class methodsFor:'Signal constants'!

obsoleteObjectSignal
    "return the signal raised when a message is sent to an Obsolete
     signal."

    ^ ObsoleteObjectSignal

    "Modified: 30.4.1996 / 14:46:27 / cg"
! !

!ObsoleteObject methodsFor:'message catching'!

doesNotUnderstand: aMessage
    "the only thing obsolete objects understand is that they dont understand
     anything."

    ^ ObsoleteObjectSignal 
             raiseRequestWith:aMessage

    "Modified: 23.9.1996 / 15:17:37 / cg"
! !

!ObsoleteObject methodsFor:'required protocol'!

basicAt:index
    "this method is required to allow cloning of the object"

    ^ (Object compiledMethodAt:#basicAt:)
	valueWithReceiver:self
	arguments:(Array with:index)
	selector:#basicAt:
!

basicAt:index put:something
    "this method is required to allow restore of the object"

    ^ (Object compiledMethodAt:#basicAt:put:)
	valueWithReceiver:self
	arguments:(Array with:index with:something)
	selector:#basicAt:put:
!

basicInspect
    "this method is required to allow inspection of the object"

    ^ Inspector openOn:self
!

basicSize
    "this method is required to allow restore of the object"

    ^ (Object compiledMethodAt:#basicSize)
	valueWithReceiver:self
	arguments:nil
	selector:#basicSize
!

become:index
    "this method is required to allow cloning of the object"

    ^ (Object compiledMethodAt:#become:)
        valueWithReceiver:self
        arguments:(Array with:index)
        selector:#become:

    "Created: 23.9.1996 / 15:16:37 / cg"
!

becomeNil
    "this method is required to allow restore of the object"

    ^ (Object compiledMethodAt:#becomeNil)
        valueWithReceiver:self
        arguments:nil
        selector:#becomeNil

    "Created: 23.9.1996 / 15:17:14 / cg"
!

becomeSameAs:index
    "this method is required to allow cloning of the object"

    ^ (Object compiledMethodAt:#becomeSameAs:)
        valueWithReceiver:self
        arguments:(Array with:index)
        selector:#becomeSameAs:

    "Created: 23.9.1996 / 15:16:50 / cg"
!

class
    "this method is required to allow restore of the object"

    ^ (Object compiledMethodAt:#class)
	valueWithReceiver:self
	arguments:nil
	selector:#class
!

displayString 
    "return a printed representation of the receiver for displaying.
     This method is required to allow inspection of the object."

    ^ (Object compiledMethodAt:#displayString )
        valueWithReceiver:self
        arguments:nil
        selector:#displayString

    "Modified: 20.9.1997 / 11:40:53 / cg"
!

inspect
    "this method is required to allow inspection of the object"

    ^ Inspector openOn:self
!

instVarAt:index
    "this method is required to allow inspection of the object"

    ^ (Object compiledMethodAt:#instVarAt:)
	valueWithReceiver:self
	arguments:(Array with:index)
	selector:#instVarAt:
!

instVarAt:index put:something
    "this method is required to allow restore of the object"

    ^ (Object compiledMethodAt:#instVarAt:put:)
	valueWithReceiver:self
	arguments:(Array with:index with:something)
	selector:#instVarAt:put:
!

isKindOf:aClass
    "this method is required to allow restore of the object"

    aClass == Object ifTrue:[^ true].
    ^ (Object compiledMethodAt:#isKindOf:)
	valueWithReceiver:self
	arguments:(Array with:aClass)
	selector:#isKindOf:
!

readBinaryContentsFrom:stream manager:manager
    "this method is required to allow restore of the object"

    ^ (Object compiledMethodAt:#readBinaryContentsFrom:manager:)
	valueWithReceiver:self
	arguments:(Array with:stream with:manager)
	selector:#readBinaryContentsFrom:manager:
! !

!ObsoleteObject class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/Attic/Obsolete.st,v 1.16 1997-09-20 21:06:34 cg Exp $'
! !
ObsoleteObject initialize!