[ https://issues.apache.org/jira/browse/AXIOM-330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15146175#comment-15146175 ]
Hudson commented on AXIOM-330: ------------------------------ FAILURE: Integrated in axiom-trunk #2522 (See [https://builds.apache.org/job/axiom-trunk/2522/]) Redesign the custom builder API introduced in AXIOM-330. (veithen: rev 1730260) * axiom/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java * axiom/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderListener.java * axiom/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/CustomBuilderManager.java * axiom/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/CustomBuilderRegistration.java * axiom/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PayloadSelector.java * axiom/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java * axiom/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java * axiom/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPPayloadSelector.java * axiom/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java * axiom/axiom-api/pom.xml * axiom/axiom-api/src/main/java/org/apache/axiom/ext/stax/DelegatingXMLStreamReader.java * axiom/axiom-api/src/main/java/org/apache/axiom/om/ds/custombuilder/ByteArrayCustomBuilder.java * axiom/axiom-api/src/main/java/org/apache/axiom/om/ds/custombuilder/CustomBuilder.java * axiom/axiom-api/src/main/java/org/apache/axiom/om/ds/custombuilder/CustomBuilderSupport.java * axiom/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/CustomBuilder.java * axiom/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/CustomBuilderSupport.java * axiom/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderUtils.java * axiom/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java * axiom/src/site/markdown/release-notes/1.3.0.md * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/JAXBCustomBuilder.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/RegisterCustomBuilderForPayloadJAXBTestCase.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestRegisterCustomBuilderForPayloadJAXBPlain.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestRegisterCustomBuilderForPayloadJAXBWithDataHandlerReaderExtension.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestRegisterCustomBuilderForPayloadJAXBWithXOP.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/body/FirstElementNameWithParserTestCase.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/TestRegisterCustomBuilder.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/TestRegisterCustomBuilderForPayload.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/TestRegisterCustomBuilderForPayloadAfterSOAPFaultCheck.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/misc/TestElementPullStreamAndOMExpansion.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/misc/TestElementPullStreamAndOMExpansion2.java * axiom/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/misc/TestElementPullStreamAndOMExpansion3.java > Provide OMSourcedElement Construction During StAXBuilder Processing > ------------------------------------------------------------------- > > Key: AXIOM-330 > URL: https://issues.apache.org/jira/browse/AXIOM-330 > Project: Axiom > Issue Type: Improvement > Reporter: Rich Scheuerle > Assignee: Rich Scheuerle > Attachments: patch.txt > > > Problem: > --------- > During outbound processing, an OMSourcedElement may be added to the Axiom > tree to represent part of the message. > An OMSourcedElement is efficient and performant. > During inbound processing, we don't have a symmetrical capability. Instead > of building an expensive > sub-tree for a header or payload, it would be nice to represent the xml as an > efficient OMSourcedElement. > Usage Scenario 1: > ----------------- > A message contains WS-A headers. These are expanded into Axiom sub-trees as > the message is parsed. > During Axis2 processing, this information is converted into > EndpointReferenceTypes (POJOs). > It would be more efficient to do this conversion when the message is parsed. > This would eliminate a translation step, excess garbage collection, etc. > Usage Scenario 2: > ----------------- > A message contains a payload. The payload is expanded into an Axiom sub-tree > as the message is parsed. > (For example, assume that a handler added trace to read the whole message). > During Axis2 processing, this information is converted into an ADB or JAXB > object. > It would be more efficient to do this conversion when the message is parsed. > This would eliminate a translation step, excess garbage collection, etc. > Solution: > --------- > Introduce a new interface to Axiom, CustomBuilder. > A CustomBuilder has one method. > /** > * Create an OMElement for this whole subtree. > * A null is returned if the default StAXBuilder behavior should be used. > * @param namespace > * @param localPart > * @param parent > * @param reader > * @return null or OMElement > */ > public OMElement create(String namespace, > String localPart, > OMContainer parent, > XMLStreamReader reader, > OMFactory factory) > throws OMException; > Introduce two methods on StAXBuilder. > /** > * Register a CustomBuilder for a payload. > * The payload is defined as the elements inside a SOAPBody or the > * document element of a REST message. > * @param customBuilder > * @return replaced CustomBuilder or null > */ > public CustomBuilder registerCustomBuilderForPayload(CustomBuilder > customBuilder); > /** > * Register a CustomBuilder associated with the indicated QName. > * The CustomBuilder will be used when an element of that qname is > encountered. > * @param qName > * @param maxDepth indicate the maximum depth that this qname will be > found. (root = 0) > * @param customBuilder > * @return replaced CustomBuilder or null > */ > public CustomBuilder registerCustomBuilder(QName qName, int maxDepth, > CustomBuilder customBuilder); > A consumer of Axiom (i.e. Axis2) can register a CustomBuilder on the > StAXBuilder. > For example, Axis2 could register a CustomBuilder for the WS-A headers > (Scenario 1). > For example, Axis2 JAX-WS could register a CustomBuilder for the JAXB payload > (Scenario 2). > Contribution > ------------ > The patch contains the interface changes defined above, plus the > implementation details. > I have also provided a conventient CustomBuilder implementation, > ByteArrayCustomBuilder. > The ByteArrayCustomBuilder will build an OMSourcedElement backed by a byte[]. > This is convenient > for compressing large nested trees to a single byte[]. This CustomBuilder > also is a useful pattern > for building other CustomBuilder classes. > I have also provided a validation test (CustomBuilderTest) that uses > ByteArrayCustomBuilder. > Caveats > ------- > When a CustomBuilder is used, the CustomBuilder must ONLY provide an > OMElement that represents the given > sub-tree. > The CustomBuilder is not permitted to alter information or do any work. This > would be a violation. > The expectation is that the CustomBuilder is an interface used by the direct > consumers of Axiom (i.e. Axis2) for > specific scenarios (i.e. JAX-WS JAXB) > There is no intention to expose the CustomBuilder to users of Axis2. > The lifecycle of a CustomBuilder is initially undefined. The thread-safety > of a CustomBuilder is initially undefined. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org For additional commands, e-mail: dev-h...@ws.apache.org