You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/07/13 18:39:38 UTC
svn commit: r216182 - in
/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2: attachments/
om/ om/impl/llom/ om/impl/llom/builder/ om/impl/llom/factory/
om/impl/llom/mtom/ om/xpath/
Author: dims
Date: Wed Jul 13 09:39:28 2005
New Revision: 216182
URL: http://svn.apache.org/viewcvs?rev=216182&view=rev
Log:
- Rewrote code from Jaya/Ashu/Venkat for full infoset support
- Add OMProcessingInstruction, OMPComment, OMDocType
- Cleanup some javadoc/comments/unused vars etc.
Added:
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMProcessingInstruction.java (with props)
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java (with props)
Modified:
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/Base64.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ImageIO.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/JDK13IO.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MimeBodyPartInputStream.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/Base64.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/Base64.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/Base64.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/Base64.java Wed Jul 13 09:39:28 2005
@@ -19,9 +19,6 @@
import java.io.OutputStream;
import java.io.Writer;
-/**
- * @author TAMURA Kent <kent@trl.ibm.co.jp>
- */
public class Base64 {
private static final char[] S_BASE64CHAR = {'A', 'B', 'C', 'D', 'E', 'F',
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java Wed Jul 13 09:39:28 2005
@@ -22,9 +22,6 @@
import java.io.InputStream;
import java.io.OutputStream;
-/**
- * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
- */
public class ByteArrayDataSource implements DataSource {
private byte[] data;
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ImageIO.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ImageIO.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ImageIO.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/ImageIO.java Wed Jul 13 09:39:28 2005
@@ -22,9 +22,6 @@
/**
* This interface defines a ImageIO modules functionality
- *
- * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
- * @since 2.0
*/
public interface ImageIO {
/**
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/JDK13IO.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/JDK13IO.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/JDK13IO.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/JDK13IO.java Wed Jul 13 09:39:28 2005
@@ -27,8 +27,6 @@
/**
* JDK1.3 based Image I/O
- *
- * @author <a href="mailto:butek@us.ibm.com">Russell Butek</a>
*/
public class JDK13IO extends Component implements ImageIO {
/**
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java Wed Jul 13 09:39:28 2005
@@ -29,9 +29,6 @@
import java.io.PushbackInputStream;
import java.util.HashMap;
-/**
- * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
- */
public class MIMEHelper {
/**
* if the Message is MTOM optimised then <code>MTOM_TYPE</code>
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MimeBodyPartInputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MimeBodyPartInputStream.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MimeBodyPartInputStream.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MimeBodyPartInputStream.java Wed Jul 13 09:39:28 2005
@@ -20,11 +20,6 @@
import java.io.InputStream;
import java.io.PushbackInputStream;
-/**
- * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
- * This class provides input streams delimited by the mime boundaries.
- */
-
public class MimeBodyPartInputStream extends InputStream {
PushbackInputStream inStream;
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java Wed Jul 13 09:39:28 2005
@@ -33,9 +33,6 @@
import java.util.Date;
import java.util.Enumeration;
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
public class PartOnFile implements Part {
String fileName;
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java Wed Jul 13 09:39:28 2005
@@ -25,9 +25,6 @@
import java.util.Iterator;
import java.util.LinkedList;
-/**
- * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
- */
public class MIMEOutputUtils {
private static byte[] CRLF = {13, 10};
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java Wed Jul 13 09:39:28 2005
@@ -15,6 +15,10 @@
*/
package org.apache.axis2.om;
+import org.apache.axis2.om.impl.llom.OMDocTypeImpl;
+import org.apache.axis2.om.impl.llom.OMProcessingInstructionImpl;
+import org.apache.axis2.om.impl.llom.OMCommentImpl;
+
import javax.activation.DataHandler;
import javax.xml.namespace.QName;
@@ -99,9 +103,28 @@
OMNamespace ns,
String value);
+ /**
+ * create DocType/DTD
+ * @param parent
+ * @param content
+ * @return doctype
+ */
+ public OMDocType createOMDocType(OMContainer parent, String content);
+ /**
+ * create a PI
+ * @param parent
+ * @param piTarget
+ * @param piData
+ * @return pi
+ */
+ public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData);
- // make the constructor protected
-
-
+ /**
+ * create a comment
+ * @param parent
+ * @param content
+ * @return comment
+ */
+ public OMComment createOMComment(OMContainer parent, String content);
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java Wed Jul 13 09:39:28 2005
@@ -88,7 +88,7 @@
* If somethings info are not available in the item, one has to check this attribute to make sure that, this
* item has been parsed completely or not.
*
- * @return
+ * @return boolean
*/
public boolean isComplete();
@@ -151,7 +151,7 @@
/**
* get the previous sibling
*
- * @return
+ * @return node
*/
public OMNode getPreviousSibling();
@@ -165,19 +165,19 @@
/**
* Serialize the node with caching
*
- * @param writer
+ * @param omOutput
* @throws XMLStreamException
- * @see #serializeWithCache(javax.xml.stream.XMLStreamWriter)
+ * @see #serializeWithCache(OMOutput)
*/
public void serializeWithCache(OMOutput omOutput)
throws XMLStreamException;
/**
- * Serilaize the node without caching
+ * Serialize the node without caching
*
- * @param writer
+ * @param omOutput
* @throws XMLStreamException
- * @see #serialize(javax.xml.stream.XMLStreamWriter)
+ * @see #serialize(OMOutput)
*/
public void serialize(OMOutput omOutput) throws XMLStreamException;
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java Wed Jul 13 09:39:28 2005
@@ -24,8 +24,7 @@
import java.util.LinkedList;
/**
- * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a> For
- * the moment this assumes that transport takes the decision of whether
+ * For the moment this assumes that transport takes the decision of whether
* to optimise or not by looking at whether the MTOM optimise is enabled &
* also looking at the OM tree whether it has any optimisable content
*/
Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMProcessingInstruction.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMProcessingInstruction.java?rev=216182&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMProcessingInstruction.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMProcessingInstruction.java Wed Jul 13 09:39:28 2005
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.om;
+
+/**
+ * Interface OMProcessingInstruction
+ */
+public interface OMProcessingInstruction extends OMNode {
+ /**
+ * set the target of this PI
+ * @param target
+ */
+ public void setTarget(String target);
+
+ /**
+ * get the target of this PI
+ * @return string
+ */
+ public String getTarget();
+
+ /**
+ * set the value of this PI
+ * @param value
+ */
+ public void setValue(String value);
+
+ /**
+ * get the value of this PI
+ * @return string
+ */
+ public String getValue();
+}
Propchange: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMProcessingInstruction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java Wed Jul 13 09:39:28 2005
@@ -24,10 +24,14 @@
/**
* Returns the text value of this node
*
- * @return
+ * @return string
*/
String getText();
+ /**
+ * get the datahandler
+ * @return datahandler
+ */
DataHandler getDataHandler();
/**
@@ -36,7 +40,15 @@
*/
boolean isOptimized();
- void doOptimize(boolean value);
+ /**
+ * set the optimize flag
+ * @param value
+ */
+ void setOptimize(boolean value);
+ /**
+ * get the content id
+ * @return string
+ */
String getContentID();
}
Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java?rev=216182&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java Wed Jul 13 09:39:28 2005
@@ -0,0 +1,109 @@
+/*
+* 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.
+*/
+package org.apache.axis2.om.impl.llom;
+
+import org.apache.axis2.om.OMContainer;
+import org.apache.axis2.om.OMDocType;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMOutput;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class OMDocTypeImpl extends OMNodeImpl implements OMDocType {
+ protected String value;
+
+ /**
+ * Constructor OMDocTypeImpl
+ *
+ * @param parentNode
+ * @param contentText
+ */
+ public OMDocTypeImpl(OMContainer parentNode, String contentText) {
+ super(parentNode);
+ this.value = contentText;
+ nodeType = OMNode.DTD_NODE;
+ }
+
+ /**
+ * Constructor OMDocTypeImpl
+ *
+ * @param parentNode
+ */
+ public OMDocTypeImpl(OMContainer parentNode) {
+ this(parentNode, null);
+ }
+
+ /**
+ * Serialize the node with caching
+ *
+ * @param omOutput
+ * @throws XMLStreamException
+ * @see #serializeWithCache(OMOutput)
+ */
+ public void serializeWithCache(OMOutput omOutput) throws XMLStreamException {
+ XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+ writer.writeCharacters(this.value);
+ OMNode nextSibling = this.getNextSibling();
+ if (nextSibling != null) {
+ nextSibling.serializeWithCache(omOutput);
+ }
+ }
+
+ /**
+ * Serialize the node without caching
+ *
+ * @param omOutput
+ * @throws XMLStreamException
+ * @see #serialize(OMOutput)
+ */
+ public void serialize(OMOutput omOutput) throws XMLStreamException {
+ serializeWithCache(omOutput);
+ }
+
+ /**
+ * get the value of this DocType
+ *
+ * @return string
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * set the value of this DocType
+ *
+ * @param text
+ */
+ public void setValue(String text) {
+ this.value = text;
+ }
+
+ /**
+ * discard this node
+ *
+ * @throws OMException
+ */
+ public void discard() throws OMException {
+ if (done) {
+ this.detach();
+ } else {
+ builder.discard((OMElement) this.parent);
+ }
+ }
+}
Propchange: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java Wed Jul 13 09:39:28 2005
@@ -65,11 +65,6 @@
* @param parent
*/
public OMNodeImpl(OMContainer parent) {
- //if ((parent != null) && (parent.getType() == OMNode.ELEMENT_NODE)) {
- //Comment by Jaya:
- //OMContainer is only implemented by OMElement and OMDocument which are
- //quite well deemed to act as parents, so checking the type of parent
- //is not necessary.
if ((parent != null)) {
this.parent = parent;
parent.addChild(this);
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java Wed Jul 13 09:39:28 2005
@@ -1022,9 +1022,6 @@
switch (nodeType) {
case OMNode.ELEMENT_NODE:
OMElement element = (OMElement) node;
-// log.info("Generating events from element {"
-// + element.getNamespace().getName() + '}'
-// + element.getLocalName() + " Generated OM tree");
returnEvent = generateElementEvents(element);
break;
case OMNode.TEXT_NODE:
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java Wed Jul 13 09:39:28 2005
@@ -37,45 +37,30 @@
import java.util.Date;
import java.util.Random;
-/**
- * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
- */
public class OMTextImpl extends OMNodeImpl implements OMText, OMConstants {
-
protected String value = null;
-
- protected short textType = TEXT_NODE;
-
protected String mimeType;
-
protected boolean optimize = false;
-
protected boolean isBinary = false;
-
private static Random rnd = new Random(new Date().getTime());
-
/**
* Field contentID for the mime part used when serialising Binary stuff as
* MTOM optimised
*/
private String contentID = null;
-
/**
* Field dataHandler
*/
private DataHandler dataHandler = null;
-
/**
* Field nameSpace used when serialising Binary stuff as MTOM optimised
*/
protected OMNamespace ns = new OMNamespaceImpl(
"http://www.w3.org/2004/08/xop/Include", "xop");
-
/**
* Field localName used when serialising Binary stuff as MTOM optimised
*/
protected String localName = "Include";
-
/**
* Field attributes used when serialising Binary stuff as MTOM optimised
*/
@@ -88,6 +73,7 @@
*/
public OMTextImpl(String s) {
this.value = s;
+ this.nodeType = TEXT_NODE;
}
/**
@@ -100,6 +86,7 @@
super(parent);
this.value = text;
done = true;
+ this.nodeType = TEXT_NODE;
}
/**
@@ -122,10 +109,11 @@
this(parent, s);
this.mimeType = mimeType;
this.optimize = optimize;
- if (this.contentID == null && optimize == true) {
+ if (this.contentID == null && optimize) {
createContentID();
}
done = true;
+ this.nodeType = TEXT_NODE;
}
/**
@@ -133,7 +121,6 @@
*/
public OMTextImpl(DataHandler dataHandler) {
this(dataHandler, true);
-
}
/**
@@ -144,11 +131,11 @@
this.dataHandler = dataHandler;
this.isBinary = true;
this.optimize = optimize;
- if (this.contentID == null && optimize == true) {
+ if (this.contentID == null && optimize) {
createContentID();
}
done = true;
-
+ this.nodeType = TEXT_NODE;
}
/**
@@ -165,46 +152,19 @@
this.optimize = true;
this.isBinary = true;
this.builder = builder;
-//done = true;
-
+ this.nodeType = TEXT_NODE;
}
/**
- * We use the OMText class to hold comments, text, characterData, CData,
- * etc., The codes are found in OMNode class
- *
- * @param type
- */
- public void setTextType(short type) {
- if ((type == TEXT_NODE) || (type == COMMENT_NODE)
- || (type == CDATA_SECTION_NODE
- || (type == PI_NODE))) {
- this.textType = type;
- } else {
- throw new UnsupportedOperationException(
- "Attempt to set wrong type");
- }
- }
-
- public int getType() throws OMException {
- int type = super.getType();
- if (type == COMMENT_NODE || type == CDATA_SECTION_NODE ||
- type == PI_NODE)
- return type;
- return textType;
- }
-
- /**
- * @param writer
+ * @param omOutput
* @throws XMLStreamException
*/
public void serializeWithCache(OMOutput omOutput) throws XMLStreamException {
XMLStreamWriter writer = omOutput.getXmlStreamWriter();
- if (textType == TEXT_NODE) {
+ int type = getType();
+ if (type == TEXT_NODE) {
writer.writeCharacters(this.value);
- } else if (textType == COMMENT_NODE) {
- writer.writeComment(this.value);
- } else if (textType == CDATA_SECTION_NODE) {
+ } else if (type == CDATA_SECTION_NODE) {
writer.writeCData(this.value);
}
OMNode nextSibling = this.getNextSibling();
@@ -232,16 +192,15 @@
+ e);
}
}
-
}
public boolean isOptimized() {
return optimize;
}
- public void doOptimize(boolean value) {
+ public void setOptimize(boolean value) {
this.optimize = value;
- if (this.contentID == null && value == true) {
+ if (this.contentID == null && value) {
getContentID();
}
}
@@ -253,11 +212,10 @@
* @throws OMException
*/
public DataHandler getDataHandler() {
-
/*
- * this should return a DataHandler containing the binary data
- * reperesented by the Base64 strings stored in OMText
- */
+ * this should return a DataHandler containing the binary data
+ * reperesented by the Base64 strings stored in OMText
+ */
if (value != null) {
ByteArrayDataSource dataSource;
byte[] data = Base64.decode(value);
@@ -267,8 +225,7 @@
// Assumes type as application/octet-stream
dataSource = new ByteArrayDataSource(data);
}
- DataHandler dataHandler = new DataHandler(dataSource);
- return dataHandler;
+ return new DataHandler(dataSource);
} else {
if (dataHandler == null) {
dataHandler = ((MTOMStAXSOAPModelBuilder) builder)
@@ -283,7 +240,7 @@
}
public java.io.InputStream getInputStream() throws OMException {
- if (isBinary == true) {
+ if (isBinary) {
if (dataHandler == null) {
getDataHandler();
}
@@ -309,8 +266,6 @@
}
public void serialize(OMOutput omOutput) throws XMLStreamException {
- boolean firstElement = false;
-
if (!this.isBinary) {
serializeWithCache(omOutput);
} else {
@@ -320,8 +275,7 @@
new OMAttributeImpl("href",
new OMNamespaceImpl("", ""),
"cid:"
- + this.contentID.trim());
-
+ + this.contentID.trim());
this.serializeStartpart(omOutput);
omOutput.writeOptimised(this);
omOutput.getXmlStreamWriter().writeEndElement();
@@ -335,43 +289,35 @@
nextSibling.serialize(omOutput);
} else {
// TODO : See whether following part is really needed
- if (parent == null) {
- return;
- } else if (parent.isComplete()) {
- return;
- } else {
+ if (parent != null && !parent.isComplete()) {
// do the special serialization
// Only the push serializer is left now
builder.next();
}
-
}
}
-
}
private void createContentID() {
-// We can use a UUID, taken using Apache commons id project.
+ // We can use a UUID, taken using Apache commons id project.
// TODO change to UUID
this.contentID = "2" + String.valueOf(rnd.nextLong()) +
"@schemas.xmlsoap.org";
}
-
/*
- * Methods to copy from OMSerialize utils
- */
+ * Methods to copy from OMSerialize utils
+ */
private void serializeStartpart(OMOutput omOutput)
throws XMLStreamException {
- String nameSpaceName = null;
- String writer_prefix = null;
- String prefix = null;
+ String nameSpaceName;
+ String writer_prefix;
+ String prefix;
XMLStreamWriter writer = omOutput.getXmlStreamWriter();
if (this.ns != null) {
nameSpaceName = this.ns.getName();
writer_prefix = writer.getPrefix(nameSpaceName);
prefix = this.ns.getPrefix();
-
if (nameSpaceName != null) {
if (writer_prefix != null) {
writer.writeStartElement(nameSpaceName,
@@ -380,8 +326,8 @@
if (prefix != null) {
writer.writeStartElement(prefix, this.getLocalName(),
nameSpaceName);
-//TODO FIX ME
-//writer.writeNamespace(prefix, nameSpaceName);
+ //TODO FIX ME
+ //writer.writeNamespace(prefix, nameSpaceName);
writer.setPrefix(prefix, nameSpaceName);
} else {
writer.writeStartElement(nameSpaceName,
@@ -392,39 +338,31 @@
}
} else {
writer.writeStartElement(this.getLocalName());
-
}
} else {
writer.writeStartElement(this.getLocalName());
-
}
-
// add the elements attribute "href"
-
serializeAttribute(this.attribute, omOutput);
-
// add the namespace
serializeNamespace(this.ns, omOutput);
-
}
/**
* Method serializeAttribute
*
* @param attr
- * @param writer
+ * @param omOutput
* @throws XMLStreamException
*/
static void serializeAttribute(OMAttribute attr, OMOutput omOutput)
throws XMLStreamException {
-
XMLStreamWriter writer = omOutput.getXmlStreamWriter();
// first check whether the attribute is associated with a namespace
OMNamespace ns = attr.getNamespace();
- String prefix = null;
- String namespaceName = null;
+ String prefix;
+ String namespaceName;
if (ns != null) {
-
// add the prefix if it's availble
prefix = ns.getPrefix();
namespaceName = ns.getName();
@@ -432,13 +370,13 @@
writer.writeAttribute(prefix,
namespaceName,
attr
- .getLocalName(),
+ .getLocalName(),
attr.getValue());
} else {
writer.writeAttribute(namespaceName,
attr.getLocalName(),
attr
- .getValue());
+ .getValue());
}
} else {
writer.writeAttribute(attr.getLocalName(), attr.getValue());
@@ -449,7 +387,7 @@
* Method serializeNamespace
*
* @param namespace
- * @param writer
+ * @param omOutput
* @throws XMLStreamException
*/
static void serializeNamespace(OMNamespace namespace, OMOutput omOutput)
@@ -457,12 +395,9 @@
XMLStreamWriter writer = omOutput.getXmlStreamWriter();
if (namespace != null) {
String uri = namespace.getName();
- //String prefix = writer.getPrefix(uri);
String ns_prefix = namespace.getPrefix();
- //if (prefix == null) {
writer.writeNamespace(ns_prefix, namespace.getName());
writer.setPrefix(ns_prefix, uri);
- //}
}
}
@@ -478,5 +413,4 @@
builder.discard((OMElement) this.parent);
}
}
-
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java Wed Jul 13 09:39:28 2005
@@ -16,6 +16,7 @@
package org.apache.axis2.om.impl.llom.builder;
import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMContainer;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMException;
import org.apache.axis2.om.OMFactory;
@@ -23,7 +24,6 @@
import org.apache.axis2.om.OMNode;
import org.apache.axis2.om.OMText;
import org.apache.axis2.om.impl.llom.OMDocument;
-import org.apache.axis2.soap.SOAPEnvelope;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
@@ -85,10 +85,8 @@
(OMElement) lastNode, this);
e.setFirstChild(node);
}
-
// create the namespaces
processNamespaceData(node, false);
-
// fill in the attributes
processAttributes(node);
return node;
@@ -103,17 +101,12 @@
protected OMNode createComment() throws OMException {
OMNode node;
if (lastNode == null) {
- node = omfactory.createText("<!--" + parser.getText() + "-->");
- document.addChild(node);
+ node = omfactory.createOMComment(document, parser.getText());
} else if (lastNode.isComplete()) {
- node =
- omfactory.createText((OMElement) lastNode.getParent(),
- "<!--" + parser.getText() + "-->");
+ node = omfactory.createOMComment(lastNode.getParent(), parser.getText());
} else {
- OMElement e = (OMElement) lastNode;
- node = omfactory.createText(e, "<!--" + parser.getText() + "-->");
+ node = omfactory.createOMComment((OMElement) lastNode, parser.getText());
}
- node.setType(OMNode.COMMENT_NODE);
return node;
}
@@ -126,48 +119,31 @@
protected OMNode createDTD() throws OMException {
if (!parser.hasText())
return null;
- OMNode node = omfactory.createText(parser.getText());
- document.addChild(node);
- node.setType(OMNode.DTD_NODE);
- return node;
+ return omfactory.createOMDocType(document, parser.getText());
}
+ /**
+ * Method createPI
+ * @return
+ * @throws OMException
+ */
protected OMNode createPI() throws OMException {
OMNode node;
String target = parser.getPITarget();
String data = parser.getPIData();
if (lastNode == null) {
- node = omfactory.createText("<?" + target + " " + data + "?>");
- node.setType(OMNode.PI_NODE);
- document.addChild(node);
+ node = omfactory.createOMProcessingInstruction(document, target, data);
} else if (lastNode.isComplete()) {
- node =
- omfactory.createText((OMElement) lastNode.getParent(),
- "<?" + target + " " + data + "?>");
- node.setType(OMNode.PI_NODE);
+ node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data);
} else if (lastNode instanceof OMText) {
- node = omfactory.createText("<?" + target + " " + data + "?>");
- node.setType(OMNode.PI_NODE);
- lastNode.getParent().addChild(node);
+ node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data);
} else {
- OMElement e = (OMElement) lastNode;
- node = omfactory.createText(e, "<?" + target + " " + data + "?>");
- node.setType(OMNode.PI_NODE);
+ node = omfactory.createOMProcessingInstruction((OMContainer) lastNode, target, data);
}
return node;
}
/**
- * Method getOMEnvelope
- *
- * @return
- * @throws OMException
- */
- public SOAPEnvelope getOMEnvelope() throws OMException {
- throw new UnsupportedOperationException(); // TODO implement this
- }
-
- /**
* Method next
*
* @return
@@ -178,10 +154,6 @@
if (done) {
throw new OMException();
}
- ///////////////////////////////////
-// int token = parser.getEventType();
- //////////////////////////////////
-
int token = parser.next();
if (!cache) {
return token;
@@ -193,7 +165,6 @@
case XMLStreamConstants.START_DOCUMENT:
//Don't do anything in the start document event
//We've already assumed that start document has passed!
- //document = new OMDocument(this);
break;
case XMLStreamConstants.CHARACTERS:
lastNode = createOMText();
@@ -226,9 +197,6 @@
default :
throw new OMException();
}
- ////////////////////
- // if (!done) parser.next();
- ///////////////////
return token;
} catch (OMException e) {
throw e;
@@ -240,7 +208,7 @@
/**
* Method getDocumentElement
*
- * @return
+ * @return root element
*/
public OMElement getDocumentElement() {
return document.getRootElement();
@@ -258,7 +226,6 @@
node.declareNamespace(parser.getNamespaceURI(i),
parser.getNamespacePrefix(i));
}
-
// set the own namespace
String namespaceURI = parser.getNamespaceURI();
String prefix = parser.getPrefix();
@@ -282,21 +249,6 @@
node.setNamespace(namespace);
}
}
-
- } else {
- // What to do if namespace URI is not available
}
}
-// int namespaceCount = parser.getNamespaceCount();
-// for (int i = 0; i < namespaceCount; i++) {
-// node.declareNamespace(parser.getNamespaceURI(i),
-// parser.getNamespacePrefix(i));
-// }
-//
-// // set the own namespace
-// OMNamespace namespace =
-// node.findNamespace(parser.getNamespaceURI(),
-// parser.getPrefix());
-// node.setNamespace(namespace);
-// }
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java Wed Jul 13 09:39:28 2005
@@ -16,16 +16,22 @@
package org.apache.axis2.om.impl.llom.factory;
import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMComment;
import org.apache.axis2.om.OMContainer;
+import org.apache.axis2.om.OMDocType;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMException;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMProcessingInstruction;
import org.apache.axis2.om.OMText;
import org.apache.axis2.om.OMXMLParserWrapper;
import org.apache.axis2.om.impl.llom.OMAttributeImpl;
+import org.apache.axis2.om.impl.llom.OMCommentImpl;
+import org.apache.axis2.om.impl.llom.OMDocTypeImpl;
import org.apache.axis2.om.impl.llom.OMElementImpl;
import org.apache.axis2.om.impl.llom.OMNamespaceImpl;
+import org.apache.axis2.om.impl.llom.OMProcessingInstructionImpl;
import org.apache.axis2.om.impl.llom.OMTextImpl;
import javax.activation.DataHandler;
@@ -45,11 +51,10 @@
*
* @param localName
* @param ns
- * @return
+ * @return element
*/
public OMElement createOMElement(String localName, OMNamespace ns) {
- OMElementImpl element = new OMElementImpl(localName, ns);
- return element;
+ return new OMElementImpl(localName, ns);
}
/**
@@ -59,14 +64,13 @@
* @param ns
* @param parent
* @param builder
- * @return
+ * @return element
*/
public OMElement createOMElement(String localName, OMNamespace ns,
OMContainer parent,
OMXMLParserWrapper builder) {
- OMElementImpl element = new OMElementImpl(localName, ns, parent,
+ return new OMElementImpl(localName, ns, parent,
builder);
- return element;
}
/**
@@ -75,7 +79,7 @@
* @param localName
* @param namespaceURI
* @param namespacePrefix
- * @return
+ * @return element
*/
public OMElement createOMElement(String localName, String namespaceURI,
String namespacePrefix) {
@@ -102,7 +106,7 @@
*
* @param uri
* @param prefix
- * @return
+ * @return namespace
*/
public OMNamespace createOMNamespace(String uri, String prefix) {
return new OMNamespaceImpl(uri, prefix);
@@ -113,33 +117,51 @@
*
* @param parent
* @param text
- * @return
+ * @return text
*/
public OMText createText(OMElement parent, String text) {
- OMTextImpl textNode = new OMTextImpl(parent, text);
- return textNode;
+ return new OMTextImpl(parent, text);
}
/**
* Method createText
*
* @param s
- * @return
+ * @return text
*/
public OMText createText(String s) {
- OMTextImpl textNode = new OMTextImpl(s);
- ;
- return textNode;
+ return new OMTextImpl(s);
}
+ /**
+ * create Text
+ * @param s
+ * @param mimeType
+ * @param optimize
+ * @return text
+ */
public OMText createText(String s, String mimeType, boolean optimize) {
return new OMTextImpl(s, mimeType, optimize);
}
+ /**
+ * create text
+ * @param dataHandler
+ * @param optimize
+ * @return text
+ */
public OMText createText(DataHandler dataHandler, boolean optimize) {
return new OMTextImpl(dataHandler, optimize);
}
+ /**
+ * create text
+ * @param parent
+ * @param s
+ * @param mimeType
+ * @param optimize
+ * @return text
+ */
public OMText createText(OMElement parent,
String s,
String mimeType,
@@ -147,11 +169,47 @@
return new OMTextImpl(parent, s, mimeType, optimize);
}
+ /**
+ * create attribute
+ * @param localName
+ * @param ns
+ * @param value
+ * @return attribute
+ */
public OMAttribute createOMAttribute(String localName,
OMNamespace ns,
String value) {
return new OMAttributeImpl(localName, ns, value);
}
+ /**
+ * create DocType/DTD
+ * @param parent
+ * @param content
+ * @return doctype
+ */
+ public OMDocType createOMDocType(OMContainer parent, String content) {
+ return new OMDocTypeImpl(parent, content);
+ }
+
+ /**
+ * create a PI
+ * @param parent
+ * @param piTarget
+ * @param piData
+ * @return pi
+ */
+ public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData) {
+ return new OMProcessingInstructionImpl(parent, piTarget, piData);
+ }
+ /**
+ * create a comment
+ * @param parent
+ * @param content
+ * @return comment
+ */
+ public OMComment createOMComment(OMContainer parent, String content) {
+ return new OMCommentImpl(parent, content);
+ }
}
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=216182&r1=216181&r2=216182&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 Wed Jul 13 09:39:28 2005
@@ -31,10 +31,6 @@
import javax.activation.DataHandler;
import javax.xml.stream.XMLStreamReader;
-/**
- * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
- */
-
public class MTOMStAXSOAPModelBuilder extends StAXSOAPModelBuilder {
private Log log = LogFactory.getLog(getClass());
@@ -55,7 +51,7 @@
/**
* @param reader
- * @param mimeHelper2
+ * @param mimeHelper
*/
public MTOMStAXSOAPModelBuilder(XMLStreamReader reader,
MIMEHelper mimeHelper) {
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java?rev=216182&r1=216181&r2=216182&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java Wed Jul 13 09:39:28 2005
@@ -6,6 +6,8 @@
import org.apache.axis2.om.OMNamespace;
import org.apache.axis2.om.OMNode;
import org.apache.axis2.om.OMText;
+import org.apache.axis2.om.OMProcessingInstruction;
+import org.apache.axis2.om.OMComment;
import org.apache.axis2.om.impl.llom.OMDocument;
import org.apache.axis2.om.impl.llom.OMNamespaceImpl;
import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
@@ -168,8 +170,7 @@
* else <code>false</code>
*/
public boolean isComment(Object object) {
- return (object instanceof OMNode) &&
- (((OMNode) object).getType() == OMNode.COMMENT_NODE);
+ return (object instanceof OMComment);
}
/**
@@ -180,8 +181,7 @@
* else <code>false</code>
*/
public boolean isText(Object object) {
- return (object instanceof OMNode) &&
- (((OMNode) object).getType() == OMNode.TEXT_NODE);
+ return (object instanceof OMText);
}
/**
@@ -192,8 +192,7 @@
* else <code>false</code>
*/
public boolean isProcessingInstruction(Object object) {
- return (object instanceof OMNode) &&
- (((OMNode) object).getType() == OMNode.PI_NODE);
+ return (object instanceof OMProcessingInstruction);
}
/**
@@ -205,7 +204,7 @@
* @return the string-value of the node
*/
public String getCommentStringValue(Object object) {
- return ((OMText) object).getText();
+ return ((OMComment) object).getValue();
}
/**
@@ -611,9 +610,7 @@
* @return the target of the processing-instruction node
*/
public String getProcessingInstructionTarget(Object object) {
- String data = ((OMText)object).getText().trim();
- int end = data.indexOf(' ');
- return data.substring(2,end);
+ return ((OMProcessingInstruction)object).getTarget();
}
/**
@@ -623,10 +620,7 @@
* @return the data of the processing-instruction node
*/
public String getProcessingInstructionData(Object object) {
- String data = ((OMText)object).getText().trim();
- int begin = data.indexOf(' ') + 1;
- int end = data.length()-2;
- return data.substring(begin,end);
+ return ((OMProcessingInstruction)object).getValue();
}
/**