You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Eric Johnson <er...@tibco.com> on 2005/09/30 19:52:31 UTC

[Axis2] Two OM questions - serialize with cache and "optimize".

I've got two OM questions at the moment:

1) What the heck does "OMNode.serializeWithCache()" mean?  How is it 
different from "OMNode.serialize()"?  I was hoping to put some Javadoc 
on the function(s) but couldn't figure out from inspection what the 
substantive difference was.

2) What is the OMText "optimized" property?  It is never set via 
"setOptimized", and never inspected via "isOptimized."  I'm guessing 
that this was meant to be the "optimized" part of MTOM, but since it is 
never set or used, is it worth keeping?

-Eric.


Re: [Axis2] Two OM questions - serialize with cache and "optimize".

Posted by Eric Johnson <er...@tibco.com>.
Ruchith Fernando wrote:

>On 9/30/05, Eric Johnson <er...@tibco.com> wrote:
>  
>
>>2) What is the OMText "optimized" property?  It is never set via
>>"setOptimized", and never inspected via "isOptimized."  I'm guessing
>>that this was meant to be the "optimized" part of MTOM, but since it is
>>never set or used, is it worth keeping?
>>    
>>
>I don't think this is true. The 'setOptimize' method is used in 7
>instances in the Axis2 project (including test cases). For example we
>are using it in enabling the MTOM-Optimizing of certain parts of a
>secured message in the security module. Please see:
>org.apache.axis2.security.util.MessageOptimizer
>And isoptimized is used in figuring out whether a message is an MTOM
>message  (E.g. org.apache.axis2.transport.http.HTTPTransportUtils)
>So I guess we'll have to keep them ;-)
>  
>
Indeed.  It looks like IntelliJ was misleading me.  I've found uses via 
other means.  I've not had that problem with IntelliJ before.  Now 
trying to figure out what I'm doing wrong on that front.

-Eric.

Re: [Axis2] Two OM questions - serialize with cache and "optimize".

Posted by Ruchith Fernando <ru...@gmail.com>.
Hi,

Please see my comments below:

On 9/30/05, Eric Johnson <er...@tibco.com> wrote:
> I've got two OM questions at the moment:
>
> 1) What the heck does "OMNode.serializeWithCache()" mean?  How is it
> different from "OMNode.serialize()"?  I was hoping to put some Javadoc
> on the function(s) but couldn't figure out from inspection what the
> substantive difference was.
>
> 2) What is the OMText "optimized" property?  It is never set via
> "setOptimized", and never inspected via "isOptimized."  I'm guessing
> that this was meant to be the "optimized" part of MTOM, but since it is
> never set or used, is it worth keeping?
>

I don't think this is true. The 'setOptimize' method is used in 7
instances in the Axis2 project (including test cases). For example we
are using it in enabling the MTOM-Optimizing of certain parts of a
secured message in the security module. Please see:
org.apache.axis2.security.util.MessageOptimizer
And isoptimized is used in figuring out whether a message is an MTOM
message  (E.g. org.apache.axis2.transport.http.HTTPTransportUtils)
So I guess we'll have to keep them ;-)

> -Eric.
>
>


--
Ruchith

Re: [Axis2] Two OM questions - serialize with cache and "optimize".

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi,
I'm not the best person to answer 1. So I'll be leaving it out.

Regarding 2....
An OMText can be used to hold binary data. (isBinary flag is used to track
this). A MTOM message can contain Base64 encoded strings together with MTOM
optimised parts.Binary data stored in OMText can be serialised either as
Base64encoded Strings or as MTOM optimised parts. "optimized" property is
used to track whether this binary OMText node will be serialized as Base64
or MTOM. "isOptimized" and "setOptimized" are for the users. Users can use
them to decide on the fly whether to optimize or not. Axis2 gives user the
full flexibility in choosing :).
 You can see the usage of the above methodes in
integration/test/o.a.a.mtom.EchoService.
 Regards,
~Thilina
  On 9/30/05, Eric Johnson <er...@tibco.com> wrote:
>
> I've got two OM questions at the moment:
>
> 1) What the heck does "OMNode.serializeWithCache()" mean? How is it
> different from "OMNode.serialize()"? I was hoping to put some Javadoc
> on the function(s) but couldn't figure out from inspection what the
> substantive difference was.
>
> 2) What is the OMText "optimized" property? It is never set via
> "setOptimized", and never inspected via "isOptimized." I'm guessing
> that this was meant to be the "optimized" part of MTOM, but since it is
> never set or used, is it worth keeping?
>
> -Eric.
>
>


--
"May the SourcE be with u"
http://www.bloglines.com/blog/thilina
http://webservices.apache.org/~thilina/

Re: [Axis2] Two OM questions - serialize with cache and "optimize".

Posted by Eric Johnson <er...@tibco.com>.
I created http://issues.apache.org/jira/browse/AXIS2-256 so that we 
don't lose track of these points.

Thanks for the feedback.

-Eric.

Sanjiva Weerawarana wrote:

>On Fri, 2005-09-30 at 13:16 -0700, Eric Johnson wrote:
>  
>
>>Thanks for the response.
>>
>>That seems weird, though.  That means if you call the serialize function 
>>(without the cache), the OMDocument can effectively be corrupted.
>>    
>>
>
>Its a necessary feature .. that allows one to process headers and then
>realize you need to forward the message on and go ahead and do that with
>very little overhead.
>
>  
>
>>I found myself putting this comment on OMDocument.serialize()
>>
>>     * <p>Caution: Serializing without caching means that any portion of 
>>the document
>>     * that has not been read will no longer be available for further 
>>reading.
>>     * In other words, this function can corrupt the remainder of your 
>><code>OMDocument</code>.
>>     * Only use it when you're sure you know longer need the contents of 
>>the document.</p>
>>    
>>
>
>Maybe a simple fix could be to s/serialize/serializeConsuming/ and
>s/serializeWithCache/serialize/. 
>
>  
>
>>Should the function also somehow mark the document then, so that 
>>OMDocumentImpl.buildNext() throws an exception?
>>    
>>
>
>+1.
>
>Sanjiva.
>
>
>  
>

Re: [Axis2] Two OM questions - serialize with cache and "optimize".

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
On Fri, 2005-09-30 at 13:16 -0700, Eric Johnson wrote:
> Thanks for the response.
> 
> That seems weird, though.  That means if you call the serialize function 
> (without the cache), the OMDocument can effectively be corrupted.

Its a necessary feature .. that allows one to process headers and then
realize you need to forward the message on and go ahead and do that with
very little overhead.

> I found myself putting this comment on OMDocument.serialize()
> 
>      * <p>Caution: Serializing without caching means that any portion of 
> the document
>      * that has not been read will no longer be available for further 
> reading.
>      * In other words, this function can corrupt the remainder of your 
> <code>OMDocument</code>.
>      * Only use it when you're sure you know longer need the contents of 
> the document.</p>

Maybe a simple fix could be to s/serialize/serializeConsuming/ and
s/serializeWithCache/serialize/. 

> Should the function also somehow mark the document then, so that 
> OMDocumentImpl.buildNext() throws an exception?

+1.

Sanjiva.


Re: [Axis2] Two OM questions - serialize with cache and "optimize".

Posted by Eric Johnson <er...@tibco.com>.
Thanks for the response.

That seems weird, though.  That means if you call the serialize function 
(without the cache), the OMDocument can effectively be corrupted.

I found myself putting this comment on OMDocument.serialize()

     * <p>Caution: Serializing without caching means that any portion of 
the document
     * that has not been read will no longer be available for further 
reading.
     * In other words, this function can corrupt the remainder of your 
<code>OMDocument</code>.
     * Only use it when you're sure you know longer need the contents of 
the document.</p>

Should the function also somehow mark the document then, so that 
OMDocumentImpl.buildNext() throws an exception?

-Eric.

Davanum Srinivas wrote:

>Hehehe...i asked the same question #1 last week when i met Eran in
>Synapse F2F. Eran, Please check if my understanding below is correct.
>
>Suppose you are building an om structure by reading stuff from a
>stream and you are half-way through it you want to serialize
>everything (including the stuff for which OM has not been built in
>memory) then you can call serialize. So AFTER you serialize you lose
>the info for which om was not built already. So if you want to build
>the OM *AND* serialize the input to output, then you call
>serializeWithCache.
>
>Need to check on #2
>
>-- dims
>
>On 9/30/05, Eric Johnson <er...@tibco.com> wrote:
>  
>
>>I've got two OM questions at the moment:
>>
>>1) What the heck does "OMNode.serializeWithCache()" mean?  How is it
>>different from "OMNode.serialize()"?  I was hoping to put some Javadoc
>>on the function(s) but couldn't figure out from inspection what the
>>substantive difference was.
>>
>>2) What is the OMText "optimized" property?  It is never set via
>>"setOptimized", and never inspected via "isOptimized."  I'm guessing
>>that this was meant to be the "optimized" part of MTOM, but since it is
>>never set or used, is it worth keeping?
>>
>>-Eric.
>>
>>
>>    
>>
>
>
>--
>Davanum Srinivas : http://wso2.com/ - Oxygenating The Web Service Platform
>
>  
>

Re: [Axis2] Two OM questions - serialize with cache and "optimize".

Posted by Davanum Srinivas <da...@gmail.com>.
Hehehe...i asked the same question #1 last week when i met Eran in
Synapse F2F. Eran, Please check if my understanding below is correct.

Suppose you are building an om structure by reading stuff from a
stream and you are half-way through it you want to serialize
everything (including the stuff for which OM has not been built in
memory) then you can call serialize. So AFTER you serialize you lose
the info for which om was not built already. So if you want to build
the OM *AND* serialize the input to output, then you call
serializeWithCache.

Need to check on #2

-- dims

On 9/30/05, Eric Johnson <er...@tibco.com> wrote:
> I've got two OM questions at the moment:
>
> 1) What the heck does "OMNode.serializeWithCache()" mean?  How is it
> different from "OMNode.serialize()"?  I was hoping to put some Javadoc
> on the function(s) but couldn't figure out from inspection what the
> substantive difference was.
>
> 2) What is the OMText "optimized" property?  It is never set via
> "setOptimized", and never inspected via "isOptimized."  I'm guessing
> that this was meant to be the "optimized" part of MTOM, but since it is
> never set or used, is it worth keeping?
>
> -Eric.
>
>


--
Davanum Srinivas : http://wso2.com/ - Oxygenating The Web Service Platform