Obsolete.st
author Claus Gittinger <cg@exept.de>
Sat, 22 Mar 1997 14:14:21 +0100
changeset 2481 bb9bc51ce5f6
parent 1962 27bfab5c9c38
child 2689 ada9b102abcf
permissions -rw-r--r--
hierarchy printing moved to superclass.

"
 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.
"

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 cought 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 
    "this method is required to allow inspection of the object"

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

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.14 1996-11-11 16:36:51 cg Exp $'
! !
ObsoleteObject initialize!