Where are "."''s escaped in DBObjectXStreamSerializer?

Hi, I’m using Axon with Scala. The scala compiler frequently creates internal JVM objects whose names contain dollar signs, which are reserved characters in MongoDB. I’m looking to create a new serializer to address this. The Javadoc for DBObjectXStreamSerializer says “It escapes BSON Node names to prevent them containing periods (”.")." so I was looking to simply extend/enhance this escaping of periods with the same for '$". In looking at the source for DBObjectHierarchicalStreamWriter, etc, it’s not clear to me where this escaping is taking place.

Hi Erich,

I know of others using Axon woth Scala, but don’t recall having seen the Axon-Scala-Mongo combination, yet. The XStream documentation does say something about a NameCoder mechanism. By default, it uses an XmlFiendlyNameCoder. You should be able to write a JsonFriendlyNameCoder yourself pretty easilly. However, I don’t know where it should be configured.
See the XStream FAQ: http://xstream.codehaus.org/faq.html#XML_double_underscores

Cheers,

Allard

Hi Allard, yeah I’d dug into that, thanks. Unfortunately the was the current DBObjectXStreamSerializer is written it doesn’t allow one to add the custom NameCoder. I’ve gotten around it in the meantime by extending the current one. Once I am over this push, I may try to create a project of Scala ‘hacks’ etc that make it easier to work with Axon.

Hi Erich,

feel free to send in a pull request that modifies the DBObjectXStreamSerializer. Since it’s used in the MongoEventStore, it should not include characters that cause problems.

There is already a project for Scala building blocks on github, called Scynapse (https://github.com/thenewmotion/scynapse), started by a company using Axon with Scala. There aren’t many building blocks yet, because they didn’t need much more than what’s there now. Maybe you could improve on that one.

Happy new year!
Cheers,

Allard

Great thanks will check scynapse out