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 Thilina Gunarathne <cs...@gmail.com> on 2005/06/24 06:54:02 UTC

[Axis2] Introducing OMOutput

Hi all,
 We are using OMText (will be renamed to OMCharacters) class to handle both 
optimised and un-optimised data. So this class may contain some binary data 
as well. This will create a problem as the serialiser which writes using an 
StAXWriter can not handle binary. 
 So I will be introducing a new OMOutput class to handle all these. This 
will basically wrap the StAXWriter for XML outputting and will handle binary 
output of data.
  Usage of OMOutput is as follows. One can instantiate a OMOutput by giving 
an OutputStream and a boolean flag which will say whether the serialization 
is MTOM optimised or not. In the use cases which do'nt use MTOM optimisation 
it'll be like 
 OMOutput omOutput = new OMOutput(outStream,false);
In optimised case 
 OMOutput omOutput = new OMOutput(outstream,true);
 Then we can get the XMLStreamWriter by calling the methode 
getXmlStreamWriter();
eg; 
 XMLStreamWriter writer = omOutput.getXmlStreamWriter();
 For backward compatibility we even include a constructor which takes in an 
XMLStreamWriter. But the novice users are encourage not to use this, but to 
use above mentioned constructors, which takes in OutputStream. 
 So the typical XML outputting will be as follows.
  OMOutput out = new OMOutput(outputStream,false);
envelope.serialize(out);
out.flush();
 Thanks & Regards,
~Thilina
 

"May the SourcE be with u"

Re: [Axis2] Introducing OMOutput

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi Ajith Aiya,
 It's not the so famous "cache" flag :).
 This flag is "doOptimise". This will be set to "true" only if the other 
endpoint is MTOM enabled (till the policy stuff are introduced this is done 
by setting a parameter in service.xml, which will tell whether the service 
is MTOM enabled.) *AND* if the serializing Envelope contains Optimizable 
content. Optimiszable content means OMText (will be OMCharacters) nodes 
which contains Binary content qualified for optimize.
In the current impl we assume that we take the above decisions in the 
transport layer ( May be better to call it as "in the place where we say 
envelope.serlialize(omOutput) " ). 
 I think this will answer ur concerns..... :-)
 Thanks & Regards,
~Thilina

 On 6/24/05, Ajith Ranabahu <aj...@gmail.com> wrote: 
> 
> Hello Thilina,
> This OMOutput thing seems to be really cool but let me add a comment on 
> this.
> In the OmOutput constructor you are passing a flag, probably the
> 'cache' flag. This flag caused a lot of stir at the summit and we
> decided that the best option is to have two methods.
> So going with that mindset, would it be possible to have a
> OMOutput(outStream) constructor that sets the correct flag inside the
> OMoutput ?
> 
> On 6/24/05, Thilina Gunarathne <cs...@gmail.com> wrote:
> > Hi all,
> >
> > We are using OMText (will be renamed to OMCharacters) class to handle 
> both
> > optimised and un-optimised data. So this class may contain some binary 
> data
> > as well. This will create a problem as the serialiser which writes using 
> an
> > StAXWriter can not handle binary.
> >
> > So I will be introducing a new OMOutput class to handle all these. This 
> will
> > basically wrap the StAXWriter for XML outputting and will handle binary
> > output of data.
> >
> >
> > Usage of OMOutput is as follows. One can instantiate a OMOutput by 
> giving an
> > OutputStream and a boolean flag which will say whether the serialization 
> is
> > MTOM optimised or not. In the use cases which do'nt use MTOM 
> optimisation
> > it'll be like
> > OMOutput omOutput = new OMOutput(outStream,false);
> > In optimised case
> > OMOutput omOutput = new OMOutput(outstream,true);
> >
> > Then we can get the XMLStreamWriter by calling the methode
> > getXmlStreamWriter();
> > eg;
> > XMLStreamWriter writer = omOutput.getXmlStreamWriter();
> >
> > For backward compatibility we even include a constructor which takes in 
> an
> > XMLStreamWriter. But the novice users are encourage not to use this, but 
> to
> > use above mentioned constructors, which takes in OutputStream.
> >
> > So the typical XML outputting will be as follows.
> >
> >
> > OMOutput out = new OMOutput(outputStream,false);
> > envelope.serialize(out);
> > out.flush();
> >
> > Thanks & Regards,
> > ~Thilina
> >
> >
> > "May the SourcE be with u"
> 
> 
> --
> Ajith Ranabahu
> 



-- 

"May the SourcE be with u"

Re: [Axis2] Introducing OMOutput

Posted by Ajith Ranabahu <aj...@gmail.com>.
Hello Thilina,
This OMOutput thing seems to be really cool but let me add a comment on this.
In the OmOutput constructor you are passing a flag, probably the
'cache' flag. This flag caused a lot of stir at the summit and we
decided that the best option is to have two methods.
So going with that mindset, would it be possible to have a  
OMOutput(outStream) constructor that sets the correct flag inside the
OMoutput ?

On 6/24/05, Thilina Gunarathne <cs...@gmail.com> wrote:
> Hi all, 
>   
> We are using OMText (will be renamed to OMCharacters) class to handle both
> optimised and un-optimised data. So this class may contain some binary data
> as well. This will create a problem as the serialiser which writes using an
> StAXWriter can not handle binary. 
>   
> So I will be introducing a new OMOutput class to handle all these. This will
> basically wrap the StAXWriter for XML outputting and will handle binary
> output of data. 
>   
>   
> Usage of OMOutput is as follows. One can instantiate a OMOutput by giving an
> OutputStream and a boolean flag which will say whether the serialization is
> MTOM optimised or not. In the use cases which do'nt use MTOM optimisation
> it'll be like 
>      OMOutput omOutput = new OMOutput(outStream,false); 
> In optimised case 
>      OMOutput omOutput = new OMOutput(outstream,true); 
>   
> Then we can get the XMLStreamWriter by calling the methode
> getXmlStreamWriter(); 
> eg;  
>                  XMLStreamWriter writer = omOutput.getXmlStreamWriter(); 
>   
> For backward compatibility we even include a constructor which takes in an
> XMLStreamWriter. But the novice users are encourage not to use this, but to
> use above mentioned constructors, which takes in OutputStream.  
>   
> So the typical XML outputting will be as follows. 
>   
>   
> OMOutput out = new OMOutput(outputStream,false); 
> envelope.serialize(out); 
> out.flush();
>   
> Thanks & Regards,
> ~Thilina
>   
> 
> "May the SourcE be with u" 


-- 
Ajith Ranabahu