dev@jax-ws.java.net

Optimized JAXB encoding <was> Re: CVS update [rearch-2005]: /jax-ws-sources/jaxws-ri/rt/src/com/sun/xml/ws/sandbox/message/impl/jaxb/

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 20 Mar 2006 09:58:48 +0100

Hi Santiago,

There is a design issue here in that optimized encoding is being pushed
to the Message layer rather than implemented at the encoding layer
(which is why things will become a little more hacky to ascertain when
XOP is used).

IMHO this fix is OK to performance test but IMHO we need to do this
properly by writing an optimized Encoder implementation that can obtain
references to the JAXB beans given appropriate hints that these are the
most optimal representation to use. Then it may not be necessary to
support the Map concept in Zephyr because we can essentially turn things
inside out i.e. Zephyr does not have control of the OutputStream.

Paul.

spericas_at_dev.java.net wrote:
> Tag: rearch-2005
> User: spericas
> Date: 2006/03/17 16:17:16
>
> Modified:
> jax-ws-sources/jaxws-ri/rt/src/com/sun/xml/ws/sandbox/message/impl/jaxb/JAXBMessage.java
>
> Log:
> Optimization to use JAXB's UTF-8 output system when writing a message.
>
> File Changes:
>
> Directory: /jax-ws-sources/jaxws-ri/rt/src/com/sun/xml/ws/sandbox/message/impl/jaxb/
> ====================================================================================
>
> File [changed]: JAXBMessage.java
> Url: https://jax-ws-sources.dev.java.net/source/browse/jax-ws-sources/jaxws-ri/rt/src/com/sun/xml/ws/sandbox/message/impl/jaxb/JAXBMessage.java?r1=1.1.2.27&r2=1.1.2.28
> Delta lines: +16 -2
> --------------------
> --- JAXBMessage.java 17 Mar 2006 18:08:58 -0000 1.1.2.27
> +++ JAXBMessage.java 18 Mar 2006 00:17:14 -0000 1.1.2.28
> @@ -35,6 +35,8 @@
> import org.xml.sax.SAXException;
> import org.xml.sax.SAXParseException;
>
> +import java.io.OutputStream;
> +import java.util.Map;
> import javax.xml.bind.JAXBElement;
> import javax.xml.bind.JAXBException;
> import javax.xml.bind.Marshaller;
> @@ -236,8 +238,20 @@
> public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException {
> try {
> // TODO: XOP handling
> +
> + // If writing to Zephyr, get output stream and use JAXB UTF-8 writer
> + if (sw instanceof Map) {
> + OutputStream os = (OutputStream) ((Map) sw).get("sjsxp-outputstream");
> + if (os != null) {
> + sw.writeCharacters(""); // Force completion of open elems
> + bridge.marshal(context, jaxbObject, os, null);
> + }
> + return;
> + }
> +
> bridge.marshal(context,jaxbObject,sw);
> - } catch (JAXBException e) {
> + }
> + catch (JAXBException e) {
> throw new XMLStreamException2(e);
> }
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cvs-unsubscribe_at_jax-ws-sources.dev.java.net
> For additional commands, e-mail: cvs-help_at_jax-ws-sources.dev.java.net
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109