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 ch...@apache.org on 2005/08/05 10:21:23 UTC

svn commit: r230411 - in /webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl: MTOMConstants.java llom/mtom/MTOMStAXSOAPModelBuilder.java

Author: chinthaka
Date: Fri Aug  5 01:21:07 2005
New Revision: 230411

URL: http://svn.apache.org/viewcvs?rev=230411&view=rev
Log:
- adding MTOMConstants to contain all the related constants
- refactoring some code in MTOMStAXSOAPModelBuilder

Added:
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MTOMConstants.java
Modified:
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java

Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MTOMConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MTOMConstants.java?rev=230411&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MTOMConstants.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MTOMConstants.java Fri Aug  5 01:21:07 2005
@@ -0,0 +1,25 @@
+package org.apache.axis2.om.impl;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public interface MTOMConstants {
+    public static final String XOP_INCLUDE = "Include";
+    public static final String XOP_NAMESPACE_URI = "http://www.w3.org/2004/08/xop/include";
+
+}

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java?rev=230411&r1=230410&r2=230411&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java Fri Aug  5 01:21:07 2005
@@ -23,6 +23,7 @@
 import org.apache.axis2.om.OMNode;
 import org.apache.axis2.om.OMText;
 import org.apache.axis2.om.impl.llom.OMTextImpl;
+import org.apache.axis2.om.impl.MTOMConstants;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
 import org.apache.commons.logging.Log;
@@ -31,8 +32,7 @@
 import javax.activation.DataHandler;
 import javax.xml.stream.XMLStreamReader;
 
-public class MTOMStAXSOAPModelBuilder extends StAXSOAPModelBuilder {
-    private Log log = LogFactory.getLog(getClass());
+public class MTOMStAXSOAPModelBuilder extends StAXSOAPModelBuilder implements MTOMConstants {
 
     /**
      * <code>mimeHelper</code> handles deffered parsing of incoming MIME
@@ -67,14 +67,16 @@
         String namespaceURI = parser.getNamespaceURI();
 
         // create an OMBlob if the element is an <xop:Include>
-        if (elementName.equalsIgnoreCase("Include")
-                & namespaceURI
-                .equalsIgnoreCase("http://www.w3.org/2004/08/xop/include")) {
+
+        if (XOP_INCLUDE.equalsIgnoreCase(elementName)
+                && XOP_NAMESPACE_URI
+                .equalsIgnoreCase(namespaceURI)) {
+            // do we need to check prfix as well. Meaning, should it be "XOP" ?
+
 
             OMText node;
             String contentID = null;
             String contentIDName = null;
-            OMAttribute Attr;
             if (lastNode == null) {
                 // Decide whether to ckeck the level >3 or not
                 throw new OMException(
@@ -88,7 +90,7 @@
                         & contentID.substring(0, 3).equalsIgnoreCase("cid")) {
                     contentID = contentID.substring(4);
                 } else if (!(contentIDName.equalsIgnoreCase("href")
-                       & (!contentID.equals("")))) {                    
+                       & (!contentID.equals("")))) {
                     throw new OMException(
                             "contentID not Found in XOP:Include element");
                 }