Story #7832
migrate from JibX to JAXB for XML binding / codegen
30%
Description
JibX is losing support in the community - not finding willing partners for maintainance - while JAXB has become the standard XML binding framework for Java. We plan to migrate / switch to JAXB for object un/marshalling and most likely datatype code generation.
Subtasks
Related issues
Associated revisions
refs: #7832: Removed jibx and BCEL dependencies, now that JAXB has been benchmarked against JiBX favorably. Refactored TypeSmaplesTestCase to use the TypeMarshaller, instead of JiBX classes.
refs #7832: removed outdated JiBX configurations files. Added 2.0.1 schema files and configurations for schema validation in the TypeMarshaller. Added validateAgainstSchema method for efficient validation (used in Sync)
History
#1 Updated by Rob Nahf over 8 years ago
- Related to Bug #7282: Can't build d1_common_java under java 1.8 added
#2 Updated by Rob Nahf over 8 years ago
basic marshalling will create an empty type (no values set) that we've determined is problematic when unmarshalling, for example:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
if using schema code generation, we would have to add special handling to get desired behavior (throwing an exception).
(see #7745)
#3 Updated by Rob Nahf over 8 years ago
standard xjc annotations are not getting all of the properties in our classes from the schema, for example, Checksum is only catching the "value" field, not the "algorithm" field.
#4 Updated by Rob Nahf over 8 years ago
xjc did not generate classes for 4 types in dataoneTypes.xsd:
1) ObjectFormatIdentifier
2) MonitorInfo
3) MonitorList
4) DescribeResponse
Were these ever JiBX code generated?
ObjectFormatIDentifier could probably be because it was declared a simpleType instead of a complexType. (Or could it be that the class name is so looooooooong. :-) )
#5 Updated by Rob Nahf over 8 years ago
Was able to get the TypeMarshallerTestCase to pass on a JAXB-based TypeMarshaller class (refactored from the JiBX-based on in d1_common_java), and with JAXB annotated copies of existing service.type classes.
- need to make sure package-info.java is in the types package
- need to make sure the @XMLRootElement(name = "lowerCaseClassName")
- make sure the List element properties use the un-list name for the property, i.e.: List subject, instead of List<Subject subjectList
Still need to adapt all of the types with XMLAnnotations...
Still need to verify that Dates marshall correctly
Still need to verify that lists become lists...
#6 Updated by Rob Nahf over 8 years ago
Finished conversion from JibX to JAXB, using only a cache for the marshalling contexts as recommended. Caching the Marshallers and unmarsahllers themselves was tested, but didn't lead to a performance gain, so that code was removed. (The complication of adding ThreadLocals to make the TypeMarshaller thread safe was the primary consideration against leaving it in.
Removed JibX and BCEL configurations from pom.xml, as well as d1-jibx-extensions as a project dependency.
#7 Updated by Dave Vieglais almost 7 years ago
- Sprint set to CCI-2.3.8
#8 Updated by Dave Vieglais almost 7 years ago
- % Done changed from 0 to 30
- Status changed from New to In Progress