ObsoleteObject.st
author Claus Gittinger <cg@exept.de>
Sat, 09 Dec 1995 15:41:23 +0100
changeset 715 59719be1d9d7
parent 553 791baaae5ece
child 721 bcd7823533e1
permissions -rw-r--r--
checkin from browser

"
 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 comment:'
COPYRIGHT (c) 1994 by Claus Gittinger
	      All Rights Reserved
'!

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

!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
    ]
! !

!ObsoleteObject class methodsFor:'Signal constants'!

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

    ^ ObsoleteObjectSignal
! !

!ObsoleteObject methodsFor:'message catching'!

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

	^ ObsoleteObjectSignal 
		 raiseRequestWith:aMessage
! !

!ObsoleteObject methodsFor:'private accessing '!

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
!

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/ObsoleteObject.st,v 1.7 1995-12-09 14:41:23 cg Exp $'
! !
ObsoleteObject initialize!