You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by nt...@apache.org on 2008/04/15 17:15:57 UTC
svn commit: r648278 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-api/src/main/java/org/apache/axiom/attachments/impl/
axiom-api/src/main/java/org/apache/axiom/om/
axiom-api/src/main/java/org/apache/axiom/om/impl/ axiom-impl/src/main/jav...
Author: nthaker
Date: Tue Apr 15 08:15:51 2008
New Revision: 648278
URL: http://svn.apache.org/viewvc?rev=648278&view=rev
Log:
WSCOMMONS-319
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java?rev=648278&r1=648277&r2=648278&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java Tue Apr 15 08:15:51 2008
@@ -203,7 +203,7 @@
* @return
* @throws IOException
*/
- public static int doesDataHandlerExceedLimit(DataHandler dh, long limit){
+ public static int doesDataHandlerExceedLimit(DataHandler dh, int limit){
if(log.isDebugEnabled()){
log.debug("start isEligibleForOptimization");
}
@@ -222,7 +222,7 @@
try{
in = getInputStream(dh);
if(in.markSupported()){
- in.mark((int)limit);
+ in.mark(limit);
}
if(in == null){
if(log.isDebugEnabled()){
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java?rev=648278&r1=648277&r2=648278&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java Tue Apr 15 08:15:51 2008
@@ -46,7 +46,7 @@
private boolean doOptimize = false;
private boolean doingSWA = false;
private boolean isSoap11 = true;
- private long optimizedThreshold = 0;
+ private int optimizedThreshold = 0;
/** Field DEFAULT_CHAR_SET_ENCODING. Specifies the default character encoding scheme to be used. */
public static final String DEFAULT_CHAR_SET_ENCODING = "utf-8";
@@ -347,11 +347,11 @@
}
- public void setOptimizedThreshold(long optimizedThreshold) {
+ public void setOptimizedThreshold(int optimizedThreshold) {
this.optimizedThreshold = optimizedThreshold;
}
- public long getOptimizedThreshold() {
+ public int getOptimizedThreshold() {
return optimizedThreshold;
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java?rev=648278&r1=648277&r2=648278&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java Tue Apr 15 08:15:51 2008
@@ -277,6 +277,21 @@
if(log.isDebugEnabled()){
log.debug("Start MTOMXMLStreamWriter.writeOptimized()");
}
+ binaryNodeList.add(node);
+ if(log.isDebugEnabled()){
+ log.debug("Exit MTOMXMLStreamWriter.writeOptimized()");
+ }
+ }
+ /*
+ * This method check if size of dataHandler exceeds the optimization Threshold
+ * set on OMOutputFormat.
+ * return true is size exceeds the threshold limit.
+ * return false otherwise.
+ */
+ public boolean isOptimizedThreshold(OMText node){
+ if(log.isDebugEnabled()){
+ log.debug("Start MTOMXMLStreamWriter.isOptimizedThreshold()");
+ }
DataHandler dh = (DataHandler)node.getDataHandler();
int optimized = UNSUPPORTED;
if(dh!=null){
@@ -287,22 +302,13 @@
}
if(optimized == UNSUPPORTED || optimized == EXCEED_LIMIT){
if(log.isDebugEnabled()){
- log.debug("node added to binart NodeList for optimization");
+ log.debug("node should be added to binart NodeList for optimization");
}
- binaryNodeList.add(node);
- }
- else{
- try{
- writeOutput(node);
- }catch(XMLStreamException e){
- throw new RuntimeException("XMLStreamException in writeOutput() call", e);
- }
- }
- if(log.isDebugEnabled()){
- log.debug("Exit MTOMXMLStreamWriter.writeOptimized()");
+ return true;
}
+ return false;
}
-
+
public void setXmlStreamWriter(XMLStreamWriter xmlWriter) {
this.xmlWriter = xmlWriter;
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java?rev=648278&r1=648277&r2=648278&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java Tue Apr 15 08:15:51 2008
@@ -417,7 +417,7 @@
//we can optimize the writing!
if (writer2 instanceof MTOMXMLStreamWriter) {
MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
- if (writer.isOptimized()) {
+ if (writer.isOptimized() && writer.isOptimizedThreshold(this)) {
if (contentID == null) {
contentID = writer.getNextContentId();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org