author | Claus Gittinger <cg@exept.de> |
Thu, 30 Jul 1998 18:06:34 +0200 | |
changeset 3695 | 9ebf6de8a764 |
parent 3080 | e150501c9c60 |
permissions | -rw-r--r-- |
90 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
210 | 3 |
All Rights Reserved |
90 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
721 | 13 |
nil subclass:#ObsoleteObject |
1283 | 14 |
instanceVariableNames:'' |
15 |
classVariableNames:'ObsoleteObjectSignal' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'System-BinaryStorage' |
|
90 | 18 |
! |
19 |
||
1962
27bfab5c9c38
restore 2byte ID's via nextUnsignedShort.
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
20 |
!ObsoleteObject class methodsFor:'documentation'! |
90 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
210 | 25 |
All Rights Reserved |
90 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
This class is used for error handling during binary object restoration. |
|
39 |
Whenever an object whose class has changed (i.e. it was stored with a |
|
40 |
different layout/size) is about to be restored, it cannot be made an |
|
41 |
instance of the now existing class. |
|
42 |
In this case, the BinaryInputManager will create a dummy class for the |
|
3080 | 43 |
old (obsolete) object and make the restored object an instance of it. |
44 |
This dummy class will be a subclass of ObsoleteObject. |
|
45 |
Thus, the restored obsolete object will (at least) provide the data |
|
46 |
(i.e. the contents) of the original object - although it will obviously |
|
47 |
not be able to implement the original protocol. |
|
90 | 48 |
|
49 |
After the creation of the obsolete object, a signal will be raised (in |
|
3080 | 50 |
BinaryInputManager), which can be caught by the application to provide |
51 |
a replacement class and/or to try some automatic or semi-automatic object |
|
52 |
conversion. |
|
53 |
The signal gets the obsolete object and the new class as parameters, so |
|
54 |
a handler can extract instance values from the obsolete object and construct a |
|
55 |
replacement object from those. |
|
90 | 56 |
|
57 |
ObsoleteObject itself catches all messages, to avoid any use of the restored |
|
210 | 58 |
object (in case conversion failed or the signal was ignored). |
1301 | 59 |
|
3080 | 60 |
Read the documentatio on binary object storage for examples & code fragments, |
61 |
on obsolete object handling and object migration. |
|
62 |
||
1301 | 63 |
[author:] |
64 |
Claus Gittinger |
|
65 |
||
66 |
[see also:] |
|
67 |
BinaryObjectStorage |
|
68 |
BinaryIOManager |
|
69 |
PersistencyManager |
|
70 |
(binary object storage : programming/binaryStore.html ) |
|
90 | 71 |
" |
72 |
! ! |
|
73 |
||
1962
27bfab5c9c38
restore 2byte ID's via nextUnsignedShort.
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
74 |
!ObsoleteObject class methodsFor:'initialization'! |
90 | 75 |
|
76 |
initialize |
|
1320 | 77 |
|
210 | 78 |
ObsoleteObjectSignal isNil ifTrue:[ |
1320 | 79 |
ObsoleteObjectSignal := (Signal new) mayProceed:false. |
80 |
ObsoleteObjectSignal nameClass:self message:#obsoleteObjectSignal. |
|
81 |
ObsoleteObjectSignal notifierString:'use of obsolete object'. |
|
210 | 82 |
|
1320 | 83 |
self setSuperclass:nil |
210 | 84 |
] |
1320 | 85 |
|
86 |
"Modified: 30.4.1996 / 14:46:13 / cg" |
|
210 | 87 |
! ! |
88 |
||
1962
27bfab5c9c38
restore 2byte ID's via nextUnsignedShort.
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
89 |
!ObsoleteObject class methodsFor:'Signal constants'! |
210 | 90 |
|
91 |
obsoleteObjectSignal |
|
92 |
"return the signal raised when a message is sent to an Obsolete |
|
1320 | 93 |
signal." |
210 | 94 |
|
95 |
^ ObsoleteObjectSignal |
|
1320 | 96 |
|
97 |
"Modified: 30.4.1996 / 14:46:27 / cg" |
|
90 | 98 |
! ! |
99 |
||
715 | 100 |
!ObsoleteObject methodsFor:'message catching'! |
101 |
||
102 |
doesNotUnderstand: aMessage |
|
1677
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
103 |
"the only thing obsolete objects understand is that they dont understand |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
104 |
anything." |
715 | 105 |
|
1677
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
106 |
^ ObsoleteObjectSignal |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
107 |
raiseRequestWith:aMessage |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
108 |
|
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
109 |
"Modified: 23.9.1996 / 15:17:37 / cg" |
715 | 110 |
! ! |
111 |
||
1320 | 112 |
!ObsoleteObject methodsFor:'required protocol'! |
294 | 113 |
|
715 | 114 |
basicAt:index |
115 |
"this method is required to allow cloning of the object" |
|
294 | 116 |
|
715 | 117 |
^ (Object compiledMethodAt:#basicAt:) |
118 |
valueWithReceiver:self |
|
119 |
arguments:(Array with:index) |
|
120 |
selector:#basicAt: |
|
294 | 121 |
! |
122 |
||
123 |
basicAt:index put:something |
|
124 |
"this method is required to allow restore of the object" |
|
125 |
||
126 |
^ (Object compiledMethodAt:#basicAt:put:) |
|
127 |
valueWithReceiver:self |
|
128 |
arguments:(Array with:index with:something) |
|
129 |
selector:#basicAt:put: |
|
130 |
! |
|
131 |
||
715 | 132 |
basicInspect |
133 |
"this method is required to allow inspection of the object" |
|
134 |
||
3080 | 135 |
^ (Object compiledMethodAt:#basicInspect) |
136 |
valueWithReceiver:self |
|
137 |
arguments:nil |
|
138 |
selector:#basicInspect |
|
139 |
||
140 |
"Modified: / 30.10.1997 / 14:16:45 / cg" |
|
715 | 141 |
! |
142 |
||
143 |
basicSize |
|
144 |
"this method is required to allow restore of the object" |
|
145 |
||
146 |
^ (Object compiledMethodAt:#basicSize) |
|
147 |
valueWithReceiver:self |
|
148 |
arguments:nil |
|
149 |
selector:#basicSize |
|
150 |
! |
|
151 |
||
1677
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
152 |
become:index |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
153 |
"this method is required to allow cloning of the object" |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
154 |
|
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
155 |
^ (Object compiledMethodAt:#become:) |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
156 |
valueWithReceiver:self |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
157 |
arguments:(Array with:index) |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
158 |
selector:#become: |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
159 |
|
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
160 |
"Created: 23.9.1996 / 15:16:37 / cg" |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
161 |
! |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
162 |
|
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
163 |
becomeNil |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
164 |
"this method is required to allow restore of the object" |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
165 |
|
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
166 |
^ (Object compiledMethodAt:#becomeNil) |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
167 |
valueWithReceiver:self |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
168 |
arguments:nil |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
169 |
selector:#becomeNil |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
170 |
|
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
171 |
"Created: 23.9.1996 / 15:17:14 / cg" |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
172 |
! |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
173 |
|
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
174 |
becomeSameAs:index |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
175 |
"this method is required to allow cloning of the object" |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
176 |
|
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
177 |
^ (Object compiledMethodAt:#becomeSameAs:) |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
178 |
valueWithReceiver:self |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
179 |
arguments:(Array with:index) |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
180 |
selector:#becomeSameAs: |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
181 |
|
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
182 |
"Created: 23.9.1996 / 15:16:50 / cg" |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
183 |
! |
3661734c67d0
also needs #become:, #becomeSameAs: and #becomeNil
Claus Gittinger <cg@exept.de>
parents:
1320
diff
changeset
|
184 |
|
715 | 185 |
class |
186 |
"this method is required to allow restore of the object" |
|
309 | 187 |
|
715 | 188 |
^ (Object compiledMethodAt:#class) |
309 | 189 |
valueWithReceiver:self |
715 | 190 |
arguments:nil |
191 |
selector:#class |
|
192 |
! |
|
193 |
||
194 |
displayString |
|
2957 | 195 |
"return a printed representation of the receiver for displaying. |
196 |
This method is required to allow inspection of the object." |
|
715 | 197 |
|
198 |
^ (Object compiledMethodAt:#displayString ) |
|
2957 | 199 |
valueWithReceiver:self |
200 |
arguments:nil |
|
201 |
selector:#displayString |
|
202 |
||
203 |
"Modified: 20.9.1997 / 11:40:53 / cg" |
|
715 | 204 |
! |
205 |
||
206 |
inspect |
|
207 |
"this method is required to allow inspection of the object" |
|
208 |
||
3080 | 209 |
^ (Object compiledMethodAt:#inspect) |
210 |
valueWithReceiver:self |
|
211 |
arguments:nil |
|
212 |
selector:#inspect |
|
213 |
||
214 |
"Modified: / 30.10.1997 / 14:16:33 / cg" |
|
309 | 215 |
! |
216 |
||
294 | 217 |
instVarAt:index |
218 |
"this method is required to allow inspection of the object" |
|
219 |
||
220 |
^ (Object compiledMethodAt:#instVarAt:) |
|
221 |
valueWithReceiver:self |
|
222 |
arguments:(Array with:index) |
|
223 |
selector:#instVarAt: |
|
224 |
! |
|
225 |
||
226 |
instVarAt:index put:something |
|
227 |
"this method is required to allow restore of the object" |
|
228 |
||
229 |
^ (Object compiledMethodAt:#instVarAt:put:) |
|
230 |
valueWithReceiver:self |
|
231 |
arguments:(Array with:index with:something) |
|
232 |
selector:#instVarAt:put: |
|
233 |
! |
|
234 |
||
235 |
isKindOf:aClass |
|
236 |
"this method is required to allow restore of the object" |
|
237 |
||
238 |
aClass == Object ifTrue:[^ true]. |
|
239 |
^ (Object compiledMethodAt:#isKindOf:) |
|
240 |
valueWithReceiver:self |
|
241 |
arguments:(Array with:aClass) |
|
242 |
selector:#isKindOf: |
|
243 |
! |
|
244 |
||
245 |
readBinaryContentsFrom:stream manager:manager |
|
246 |
"this method is required to allow restore of the object" |
|
247 |
||
248 |
^ (Object compiledMethodAt:#readBinaryContentsFrom:manager:) |
|
249 |
valueWithReceiver:self |
|
250 |
arguments:(Array with:stream with:manager) |
|
251 |
selector:#readBinaryContentsFrom:manager: |
|
252 |
! ! |
|
253 |
||
1962
27bfab5c9c38
restore 2byte ID's via nextUnsignedShort.
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
254 |
!ObsoleteObject class methodsFor:'documentation'! |
90 | 255 |
|
715 | 256 |
version |
3080 | 257 |
^ '$Header: /cvs/stx/stx/libbasic/Attic/ObsoleteObject.st,v 1.17 1997-11-02 17:47:04 cg Exp $' |
90 | 258 |
! ! |
259 |
ObsoleteObject initialize! |