This is a complex issue and I think it would be beneficial to discuss its design on before I make changes.
The tasks to be performed are as follows:
1. Create a new interface called "DatamodelStaticInterface" – Every datamodel implementation would have an implementation of this interface.
2. Currently atomic values are implemented as concrete classes. There is also a concrete implementation called AtomicValueFactory.
The idea here is to create an interface called AtomicValueFactory and have the current AtomicValueFactory be a class that implements that interface and generates the classes that it currently generates. Going forward, we should move away from requiring atomic values implement any particular interface. Instead, we would have an interface say "AtomicValueManipulator" that implemnents all the interfaces that the engine requires to work correctly.
For e.g., instead of o.getDMOKind(), we would call m.getDMOKind(o), where m is an implementation of the Manipulator interface. The instance of the manipulator interface would be obtained from the DatamodelStaticInterface. This allows datamodel implementers to use their own objects as long as they can discern them at the XQuery level.
I am looking for more comments on the issue.