Reviving VA Smalltalk’s AbtXmlObjectCache after lots of messing with it

Building XML mapping specifications in VA Smalltalk is not the kind of job that I’d call pleasant. At least not with my level of knowledge. I keep on messing the stuff and registering things in the Xml Object Cache that may or may not be in my way during development.

So there is a simple way to at least throw everything (Schemas, MappingSpecs, Serializers etc.) out of it. In fact there are two of them:

a) AbtXmlObjectCache current initialize
b) AbtXmlObjectCache reset

while a) sets all cache dictionaries to new empty Dictionaries or LookupTables, b) simply throws the Current instance away.

The effect, however, is not exactly what you may want. The reason is that VA Smalltalk also keeps all its information for parsing schemas and stuff in the very same cache instance in which your information was put.

One effect of this is that things that just worked a minute before just throw exceptions or simply return strange results.

AbtXmlSchema from: 'path/to/a/schema/file'

for example.

Before the reset, it imported a Schema and returned an AbtXmlSchema. After, it simply returns an AbtXmlMappedRootElement. Continuing work with that will very soon end in debuggers that you wish you’d never seen. (Note: watching an XML Parser in the debugger is no fun in any language – Smalltalk is no exception here)

So there must be some place in the code that fills the AbtXmlObjectCache with all that’s needed for VAST’s features. And it turns out there are two of them:

AbtXmlMappingParserApp class>>#startUp

AbtXmlSchemaSupportApp class>>#startUp

So if you messed your AbtXmlObjectCache and need a way out of that you can execute the following snippet and start from scratch:

AbtXmlObjectCache current initialize.
AbtXmlMappingParserApp startUp.
AbtXmlSchemaSupportApp startUp.

I haven’t really tried, but the fact that reinitialization of cache entries is in startUp methods implies that cleaning the cache and restarting the image should also work…. But who likes to restart an image in the middle of hacking and cursing 😉


One thought on “Reviving VA Smalltalk’s AbtXmlObjectCache after lots of messing with it

Comments are closed.