stevedlawrence opened a new pull request, #908:
URL: https://github.com/apache/daffodil/pull/908
- Move classes/traits out of the .api namespace since that aren't really
part of the internal API. The DaffodilUnparseContentHandler and
SAXInfosetInputter don't necessarily need to be implemented as coroutines, so
the Producer/Consumer coroutine classes are removed from .api. Likewise, the
SAXInfosetEvent is an implementation detail about how we send SAX events from
the DaffodilUnparseContentHandler to the SAXInfosetInputter and also isn't part
of the API. These classes are now modified to directly mixin
Coroutine/MainCoroutine.
- Modify SAXInfosetEvent so it no longer stores unparse result or a cause
exception when unparse completes. Instead, the SAXInfosetInputter is changed to
return the unparse result/exception directly to the DaffodilContentHandler
coroutine--it no longer reuses a SAXInfosetEvent from the batch array. Making
this change simplifies the logic in some places:
* We no longer need to copy the last SAX event to the beginning of the
batch event, which was needed to carry back the unparse result/error
* We no longer need the returnedInfosetEvent variable since we return
unparse result/failure causes directly
* The size of the batch can be exactly the same of the
saxUnparseEventBatchSize instead of needed to add one
- The hasNext() function really just needs to check if current element is
EndDocument or not, and the next() function handles actually getting events
from the main coroutine. This allows removal of the endDocumentRecived variable
- The DaffodilUnparseContentHandler is now fully responsible for creating
SAXExceptions based on the results of the SAXInfosetInputter. The
SAXInfosetInputter now knows nothing about SAX, and theoretically could be used
for anything that can convert an infoset to a batch of the SAXInfosetEvent
objects
- Add an inline function called currentEvent to make it more succinct to
access the event at the right index in the batched infosets array
- Change the resolveRelativeInfosetBlobURIs variable so that it is passed
into the creation of the SAXInfosetInputter instead of mutating state
- Add many comments to describe the SAX logic in detail. The interaction
between the ContentHandler and InfosetInputter coroutines is not obvious and
needs thorough documentation
- Add SAX unparse test cases to improve code coverage
- Modify the InfosetInputter events to directly get event information
instead of using orNull. These values will always be set for each event by the
ContentHandler
- Rename maybeSendToInputter() to currentEventIsFinished() since that
function does more than just send to the inputter. This more generic name means
it can also do more logic if needed in the future.
DAFFODIL-2770
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]