Excellent Martin...I like the ObjectResolver class and I think that the ObjectConverters class is always going to be sorely needed as we often think about metadata as a second class citizen.
Adam On Dec 2, 2012, at 4:21 AM, Martin Desruisseaux wrote: > Hello all > > Continuing the work on the XML side of things (ISO 19139), there is two > classes worth to note: > > ObjectResolver [1] > --------------- > ISO 19139 XML documents sometime contain an empty element with only a > "xlink:href", "idref" ou "uuidref" attribute. The full object definition > shall be fetched from the reference. When such attribute is found at > unmarshalling time, the proposed mechanism is to invoke the corresponding > "resolve" method from the ObjectResolver class. The user can provide its own > ObjectResolver instance as a Marshaller property. > > The "idref" attributes are local to the current XML document and can be > partially handled by the standard @XmlID JAXB annotation. But "uuidref" is a > UUID to a document that may be defined anywhere. It could be a primary key in > a database internal to an agency. With the proposed ObjectResolver class, > user can override the resolve(MarshalContext, UUID) method for returning the > metadata object for the given UUID using whatever method is appropriate for > his application. I'm hesitant about whether the default implementation should > unconditionally returns null, or use a UUID list of objects previously > created in the currently running JVM (using weak references). > > > ObjectConverters [2] > ----------------- > By default, JAXB parses URL, URI, UUID etc. using the standard methods (e.g. > new URI(String)). However in practice, we are often facing badly formatted > metadata documents with invalid URL (a very common case is users putting a > file path in Windows syntax instead of URL). ObjectConverters is a proposed > hook for giving developers a chance to catch those situations and handle the > errors as appropriate for their application. By default, the conversions are > strict: invalid URL or URI or UUID cause the parsing to fail. But users can > override the methods and, for example, replace some URL on-the-fly. > > Comments are always welcome, > > Martin > > > [1] > https://builds.apache.org/job/sis-jdk7/site/apidocs/org/apache/sis/xml/ObjectResolver.html > [2] > https://builds.apache.org/job/sis-jdk7/site/apidocs/org/apache/sis/xml/ObjectConverters.html >
