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 gd...@apache.org on 2007/03/07 15:59:13 UTC
svn commit: r515594 [3/19] - in
/webservices/commons/trunk/modules/axiom/modules:
axiom-api/src/main/java/org/apache/axiom/attachments/
axiom-api/src/main/java/org/apache/axiom/attachments/utils/
axiom-api/src/main/java/org/apache/axiom/om/ axiom-api/s...
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLParserWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLParserWrapper.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLParserWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLParserWrapper.java Wed Mar 7 06:59:00 2007
@@ -16,9 +16,7 @@
package org.apache.axiom.om;
-/**
- * Interface OMXMLParserWrapper
- */
+/** Interface OMXMLParserWrapper */
public interface OMXMLParserWrapper {
/**
* Proceed the parser one step and return the event value.
@@ -31,11 +29,10 @@
int next() throws OMException;
/**
- * Discards the current element.
- * This will remove the given element and its decendants.
+ * Discards the current element. This will remove the given element and its decendants.
*
* @param el
- * @throws org.apache.axiom.om.OMException
+ * @throws OMException
*
* @throws OMException
*/
@@ -50,37 +47,30 @@
void setCache(boolean b) throws OMException;
/**
- * Allows to access the underlying parser. Since the parser
- * depends on the underlying implementation, an Object is returned.
- * However the implementations may have restrictions in letting access to
- * the parser.
+ * Allows to access the underlying parser. Since the parser depends on the underlying
+ * implementation, an Object is returned. However the implementations may have restrictions in
+ * letting access to the parser.
*
* @return Returns Object.
*/
Object getParser();
- /**
- * @return Returns the complete status.
- */
+ /** @return Returns the complete status. */
boolean isCompleted();
- /**
- * @return Returns the document element.
- */
+ /** @return Returns the document element. */
OMElement getDocumentElement();
/**
- * Returns the type of the builder.
- * Can be either PUSH_TYPE_BUILDER or PULL_TYPE_BUILDER.
+ * Returns the type of the builder. Can be either PUSH_TYPE_BUILDER or PULL_TYPE_BUILDER.
*
* @return Returns short.
*/
short getBuilderType();
/**
- * Registers an external content handler. Especially useful for
- * push type builders. Throws an unsupportedOperationException if
- * such handler registration is not supported.
+ * Registers an external content handler. Especially useful for push type builders. Throws an
+ * unsupportedOperationException if such handler registration is not supported.
*
* @param obj
*/
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java Wed Mar 7 06:59:00 2007
@@ -16,16 +16,6 @@
package org.apache.axiom.om.impl;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import javax.activation.DataHandler;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeBodyPart;
-
import org.apache.axiom.attachments.Attachments;
import org.apache.axiom.attachments.ConfigurableDataHandler;
import org.apache.axiom.om.OMException;
@@ -34,38 +24,49 @@
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP12Constants;
+import javax.activation.DataHandler;
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeBodyPart;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.LinkedList;
+
public class MIMEOutputUtils {
- private static byte[] CRLF = { 13, 10 };
+ private static byte[] CRLF = { 13, 10 };
public static void complete(OutputStream outStream,
StringWriter writer, LinkedList binaryNodeList,
- String boundary, String contentId, String charSetEncoding,String SOAPContentType) {
+ String boundary, String contentId, String charSetEncoding,
+ String SOAPContentType) {
try {
startWritingMime(outStream, boundary);
javax.activation.DataHandler dh = new javax.activation.DataHandler(writer.toString(),
- "text/xml; charset=" + charSetEncoding);
+ "text/xml; charset=" +
+ charSetEncoding);
MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
rootMimeBodyPart.setDataHandler(dh);
rootMimeBodyPart.addHeader("content-type",
- "application/xop+xml; charset=" + charSetEncoding +
- "; type=\""+SOAPContentType+"\"");
+ "application/xop+xml; charset=" + charSetEncoding +
+ "; type=\"" + SOAPContentType + "\"");
rootMimeBodyPart.addHeader("content-transfer-encoding", "binary");
- rootMimeBodyPart.addHeader("content-id","<"+contentId+">");
+ rootMimeBodyPart.addHeader("content-id", "<" + contentId + ">");
writeBodyPart(outStream, rootMimeBodyPart, boundary);
Iterator binaryNodeIterator = binaryNodeList.iterator();
while (binaryNodeIterator.hasNext()) {
- OMText binaryNode = (OMText) binaryNodeIterator.next();
- writeBodyPart(outStream, createMimeBodyPart(binaryNode
- .getContentID(), (DataHandler) binaryNode
- .getDataHandler()), boundary);
- }
- finishWritingMime(outStream);
- outStream.flush();
+ OMText binaryNode = (OMText) binaryNodeIterator.next();
+ writeBodyPart(outStream, createMimeBodyPart(binaryNode
+ .getContentID(), (DataHandler) binaryNode
+ .getDataHandler()), boundary);
+ }
+ finishWritingMime(outStream);
+ outStream.flush();
} catch (IOException e) {
throw new OMException("Error while writing to the OutputStream.", e);
} catch (MessagingException e) {
@@ -74,40 +75,36 @@
}
public static MimeBodyPart createMimeBodyPart(String contentID,
- DataHandler dataHandler) throws MessagingException {
- String encoding = null;
- MimeBodyPart mimeBodyPart = new MimeBodyPart();
- mimeBodyPart.setDataHandler(dataHandler);
- mimeBodyPart.addHeader("content-id", "<" + contentID + ">");
- mimeBodyPart.addHeader("content-type", dataHandler.getContentType());
- if (dataHandler instanceof ConfigurableDataHandler) {
- ConfigurableDataHandler configurableDataHandler = (ConfigurableDataHandler) dataHandler;
- encoding = configurableDataHandler.getTransferEncoding();
- }
- if (encoding == null) {
- encoding = "binary";
- }
- mimeBodyPart.addHeader("content-transfer-encoding", encoding);
- return mimeBodyPart;
- }
+ DataHandler dataHandler)
+ throws MessagingException {
+ String encoding = null;
+ MimeBodyPart mimeBodyPart = new MimeBodyPart();
+ mimeBodyPart.setDataHandler(dataHandler);
+ mimeBodyPart.addHeader("content-id", "<" + contentID + ">");
+ mimeBodyPart.addHeader("content-type", dataHandler.getContentType());
+ if (dataHandler instanceof ConfigurableDataHandler) {
+ ConfigurableDataHandler configurableDataHandler = (ConfigurableDataHandler) dataHandler;
+ encoding = configurableDataHandler.getTransferEncoding();
+ }
+ if (encoding == null) {
+ encoding = "binary";
+ }
+ mimeBodyPart.addHeader("content-transfer-encoding", encoding);
+ return mimeBodyPart;
+ }
- /**
- * @throws IOException
- * This will write the boundary to output Stream
- */
+ /** @throws IOException This will write the boundary to output Stream */
public static void writeMimeBoundary(OutputStream outStream,
String boundary) throws IOException {
// REVIEW: This conversion is hard-coded to UTF-8.
// The complete solution is to respect the charset setting of the message.
// However this may cause problems in BoundaryDelimittedStream and other
// lower level classes.
- outStream.write(new byte[]{45, 45});
+ outStream.write(new byte[] { 45, 45 });
outStream.write(boundary.getBytes("UTF-8"));
}
- /**
- * @throws IOException This will write the boundary with CRLF
- */
+ /** @throws IOException This will write the boundary with CRLF */
public static void startWritingMime(OutputStream outStream,
String boundary)
throws IOException {
@@ -116,9 +113,8 @@
}
/**
- * Writes a CRLF for the earlier boundary then the BodyPart data
- * with headers followed by boundary. Writes only the boundary. No more
- * CRLF's are written after that.
+ * Writes a CRLF for the earlier boundary then the BodyPart data with headers followed by
+ * boundary. Writes only the boundary. No more CRLF's are written after that.
*
* @throws IOException
* @throws MessagingException
@@ -134,130 +130,134 @@
outStream.flush();
}
- /**
- * @throws IOException This will write "--" to the end of last boundary
- */
+ /** @throws IOException This will write "--" to the end of last boundary */
public static void finishWritingMime(OutputStream outStream)
throws IOException {
- outStream.write(new byte[]{45, 45});
+ outStream.write(new byte[] { 45, 45 });
}
public static void writeSOAPWithAttachmentsMessage(StringWriter writer,
- OutputStream outputStream, Attachments attachments, OMOutputFormat format) {
- String SOAPContentType;
- try {
- if (format.isSOAP11()) {
- SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
- } else {
- SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
- }
- startWritingMime(outputStream, format.getMimeBoundary());
-
- javax.activation.DataHandler dh = new javax.activation.DataHandler(
- writer.toString(), "text/xml; charset="
- + format.getCharSetEncoding());
- MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
- rootMimeBodyPart.setDataHandler(dh);
-
- rootMimeBodyPart.addHeader("content-type",
- SOAPContentType+"; charset="
- + format.getCharSetEncoding());
- rootMimeBodyPart.addHeader("content-transfer-encoding", "8bit");
- rootMimeBodyPart.addHeader("content-id", "<"
- + format.getRootContentId() + ">");
-
- writeBodyPart(outputStream, rootMimeBodyPart, format
- .getMimeBoundary());
-
- Iterator attachmentIDIterator = attachments.getContentIDSet().iterator();
- while (attachmentIDIterator.hasNext()) {
- String contentID = (String) attachmentIDIterator.next();
- DataHandler dataHandler = attachments.getDataHandler(contentID);
- writeBodyPart(outputStream, createMimeBodyPart(contentID,
- dataHandler), format.getMimeBoundary());
- }
- finishWritingMime(outputStream);
- outputStream.flush();
- } catch (IOException e) {
- throw new OMException("Error while writing to the OutputStream.", e);
- } catch (MessagingException e) {
- throw new OMException("Problem writing Mime Parts.", e);
- }
- }
-
+ OutputStream outputStream,
+ Attachments attachments,
+ OMOutputFormat format) {
+ String SOAPContentType;
+ try {
+ if (format.isSOAP11()) {
+ SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
+ } else {
+ SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+ }
+ startWritingMime(outputStream, format.getMimeBoundary());
+
+ javax.activation.DataHandler dh = new javax.activation.DataHandler(
+ writer.toString(), "text/xml; charset="
+ + format.getCharSetEncoding());
+ MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
+ rootMimeBodyPart.setDataHandler(dh);
+
+ rootMimeBodyPart.addHeader("content-type",
+ SOAPContentType + "; charset="
+ + format.getCharSetEncoding());
+ rootMimeBodyPart.addHeader("content-transfer-encoding", "8bit");
+ rootMimeBodyPart.addHeader("content-id", "<"
+ + format.getRootContentId() + ">");
+
+ writeBodyPart(outputStream, rootMimeBodyPart, format
+ .getMimeBoundary());
+
+ Iterator attachmentIDIterator = attachments.getContentIDSet().iterator();
+ while (attachmentIDIterator.hasNext()) {
+ String contentID = (String) attachmentIDIterator.next();
+ DataHandler dataHandler = attachments.getDataHandler(contentID);
+ writeBodyPart(outputStream, createMimeBodyPart(contentID,
+ dataHandler),
+ format.getMimeBoundary());
+ }
+ finishWritingMime(outputStream);
+ outputStream.flush();
+ } catch (IOException e) {
+ throw new OMException("Error while writing to the OutputStream.", e);
+ } catch (MessagingException e) {
+ throw new OMException("Problem writing Mime Parts.", e);
+ }
+ }
+
/**
- * Pack all the attachments in to a multipart/related MIME part and attachs
- * it as the second MIME Part of MIME message
- *
- * @param writer
- * @param outputStream
- * @param attachments
- * @param format
- * @param innerBoundary
- */
+ * Pack all the attachments in to a multipart/related MIME part and attachs it as the second
+ * MIME Part of MIME message
+ *
+ * @param writer
+ * @param outputStream
+ * @param attachments
+ * @param format
+ * @param innerBoundary
+ */
public static void writeMM7Message(StringWriter writer,
- OutputStream outputStream, Attachments attachments, OMOutputFormat format, String innerPartCID,String innerBoundary) {
- String SOAPContentType;
- try {
- if (format.isSOAP11()) {
- SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
- } else {
- SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
- }
- startWritingMime(outputStream, format.getMimeBoundary());
-
- javax.activation.DataHandler dh = new javax.activation.DataHandler(
- writer.toString(), "text/xml; charset="
- + format.getCharSetEncoding());
- MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
- rootMimeBodyPart.setDataHandler(dh);
+ OutputStream outputStream, Attachments attachments,
+ OMOutputFormat format, String innerPartCID,
+ String innerBoundary) {
+ String SOAPContentType;
+ try {
+ if (format.isSOAP11()) {
+ SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
+ } else {
+ SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+ }
+ startWritingMime(outputStream, format.getMimeBoundary());
+
+ javax.activation.DataHandler dh = new javax.activation.DataHandler(
+ writer.toString(), "text/xml; charset="
+ + format.getCharSetEncoding());
+ MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
+ rootMimeBodyPart.setDataHandler(dh);
- rootMimeBodyPart.addHeader("Content-Type",
- SOAPContentType+"; charset="+ format.getCharSetEncoding());
+ rootMimeBodyPart.addHeader("Content-Type",
+ SOAPContentType + "; charset=" +
+ format.getCharSetEncoding());
// rootMimeBodyPart.addHeader("content-transfer-encoding", "quoted-printable");
- rootMimeBodyPart.addHeader("content-id", "<"
- + format.getRootContentId() + ">");
+ rootMimeBodyPart.addHeader("content-id", "<"
+ + format.getRootContentId() + ">");
- writeBodyPart(outputStream, rootMimeBodyPart, format
- .getMimeBoundary());
+ writeBodyPart(outputStream, rootMimeBodyPart, format
+ .getMimeBoundary());
- if (attachments.getContentIDSet().size()!=0){
- outputStream.write(CRLF);
- StringBuffer sb = new StringBuffer();
- sb.append("Content-Type: multipart/related");
- sb.append("; ");
- sb.append("boundary=");
- sb.append("\""+innerBoundary+"\"");
- // REVIEW Should this be getBytes("UTF-8") or getBytes(charset)
- outputStream.write(sb.toString().getBytes());
- outputStream.write(CRLF);
- StringBuffer sb1 = new StringBuffer();
- sb1.append("content-id: ");
- sb1.append("<");
- sb1.append(innerPartCID);
- sb1.append(">");
- // REVIEW Should this be getBytes("UTF-8") or getBytes(charset)
- outputStream.write(sb1.toString().getBytes());
- outputStream.write(CRLF);
- outputStream.write(CRLF);
- startWritingMime(outputStream, innerBoundary);
- Iterator attachmentIDIterator = attachments.getContentIDSet().iterator();
- while (attachmentIDIterator.hasNext()) {
- String contentID = (String) attachmentIDIterator.next();
- DataHandler dataHandler = attachments.getDataHandler(contentID);
- writeBodyPart(outputStream, createMimeBodyPart(contentID,
- dataHandler), innerBoundary);
- }
- finishWritingMime(outputStream);
- outputStream.write(CRLF);
- writeMimeBoundary(outputStream, format.getMimeBoundary());
- }
- finishWritingMime(outputStream);
- outputStream.flush();
- } catch (IOException e) {
- throw new OMException("Error while writing to the OutputStream.", e);
- } catch (MessagingException e) {
- throw new OMException("Problem writing Mime Parts.", e);
- }
- }
+ if (attachments.getContentIDSet().size() != 0) {
+ outputStream.write(CRLF);
+ StringBuffer sb = new StringBuffer();
+ sb.append("Content-Type: multipart/related");
+ sb.append("; ");
+ sb.append("boundary=");
+ sb.append("\"" + innerBoundary + "\"");
+ // REVIEW Should this be getBytes("UTF-8") or getBytes(charset)
+ outputStream.write(sb.toString().getBytes());
+ outputStream.write(CRLF);
+ StringBuffer sb1 = new StringBuffer();
+ sb1.append("content-id: ");
+ sb1.append("<");
+ sb1.append(innerPartCID);
+ sb1.append(">");
+ // REVIEW Should this be getBytes("UTF-8") or getBytes(charset)
+ outputStream.write(sb1.toString().getBytes());
+ outputStream.write(CRLF);
+ outputStream.write(CRLF);
+ startWritingMime(outputStream, innerBoundary);
+ Iterator attachmentIDIterator = attachments.getContentIDSet().iterator();
+ while (attachmentIDIterator.hasNext()) {
+ String contentID = (String) attachmentIDIterator.next();
+ DataHandler dataHandler = attachments.getDataHandler(contentID);
+ writeBodyPart(outputStream, createMimeBodyPart(contentID,
+ dataHandler), innerBoundary);
+ }
+ finishWritingMime(outputStream);
+ outputStream.write(CRLF);
+ writeMimeBoundary(outputStream, format.getMimeBoundary());
+ }
+ finishWritingMime(outputStream);
+ outputStream.flush();
+ } catch (IOException e) {
+ throw new OMException("Error while writing to the OutputStream.", e);
+ } catch (MessagingException e) {
+ throw new OMException("Problem writing Mime Parts.", e);
+ }
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMConstants.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMConstants.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMConstants.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMConstants.java Wed Mar 7 06:59:00 2007
@@ -20,20 +20,13 @@
public static final String XOP_INCLUDE = "Include";
public static final String XOP_NAMESPACE_URI = "http://www.w3.org/2004/08/xop/include";
- /**
- * If the Message is MTOM optimised then <code>MTOM_TYPE</code>
- */
+ /** If the Message is MTOM optimised then <code>MTOM_TYPE</code> */
String MTOM_TYPE = "application/xop+xml";
- /**
- * If the message is Soap with Attachments <code>SWA_TYPE</code>
- */
+ /** If the message is Soap with Attachments <code>SWA_TYPE</code> */
String SWA_TYPE = "text/xml";
String SWA_TYPE_12 = "application/soap+xml";
-
- /**
- * <code>rootPart</code> is used as the key for the root BodyPart in the
- * Parts HashMap
- */
+
+ /** <code>rootPart</code> is used as the key for the root BodyPart in the Parts HashMap */
String ROOT_PART = "SoapPart";
String ATTACHMENTS = "Attachments";
}
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?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- 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 Wed Mar 7 06:59:00 2007
@@ -27,16 +27,14 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.io.OutputStream;
-import java.io.OutputStreamWriter;
import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
import java.util.LinkedList;
/**
- * For the moment this assumes that transport takes the decision of whether
- * to optimize or not by looking at whether the MTOM optimize is enabled &
- * also looking at the OM tree whether it has any optimizable content.
+ * For the moment this assumes that transport takes the decision of whether to optimize or not by
+ * looking at whether the MTOM optimize is enabled & also looking at the OM tree whether it has any
+ * optimizable content.
*/
public class MTOMXMLStreamWriter implements XMLStreamWriter {
private XMLStreamWriter xmlWriter;
@@ -71,7 +69,7 @@
xmlWriter = StAXUtils.createXMLStreamWriter(bufferedSOAPBody);
} else {
xmlWriter = StAXUtils.createXMLStreamWriter(outStream,
- format.getCharSetEncoding());
+ format.getCharSetEncoding());
}
}
@@ -83,7 +81,8 @@
xmlWriter.writeStartElement(string, string1);
}
- public void writeStartElement(String string, String string1, String string2) throws XMLStreamException {
+ public void writeStartElement(String string, String string1, String string2)
+ throws XMLStreamException {
xmlWriter.writeStartElement(string, string1, string2);
}
@@ -91,7 +90,8 @@
xmlWriter.writeStartElement(string, string1);
}
- public void writeEmptyElement(String string, String string1, String string2) throws XMLStreamException {
+ public void writeEmptyElement(String string, String string1, String string2)
+ throws XMLStreamException {
xmlWriter.writeStartElement(string, string1, string2);
}
@@ -134,11 +134,13 @@
xmlWriter.writeAttribute(string, string1);
}
- public void writeAttribute(String string, String string1, String string2, String string3) throws XMLStreamException {
+ public void writeAttribute(String string, String string1, String string2, String string3)
+ throws XMLStreamException {
xmlWriter.writeAttribute(string, string1, string2, string3);
}
- public void writeAttribute(String string, String string1, String string2) throws XMLStreamException {
+ public void writeAttribute(String string, String string1, String string2)
+ throws XMLStreamException {
xmlWriter.writeAttribute(string, string1, string2);
}
@@ -158,7 +160,8 @@
xmlWriter.writeProcessingInstruction(string);
}
- public void writeProcessingInstruction(String string, String string1) throws XMLStreamException {
+ public void writeProcessingInstruction(String string, String string1)
+ throws XMLStreamException {
xmlWriter.writeProcessingInstruction(string, string1);
}
@@ -251,8 +254,8 @@
}
/**
- * Returns the character set encoding scheme. If the value of the
- * charSetEncoding is not set then the default will be returned.
+ * Returns the character set encoding scheme. If the value of the charSetEncoding is not set
+ * then the default will be returned.
*
* @return Returns encoding.
*/
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMContainerEx.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMContainerEx.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMContainerEx.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMContainerEx.java Wed Mar 7 06:59:00 2007
@@ -21,9 +21,9 @@
/**
* Interface OMContainerEx
- *
- * Internal Implementation detail. Adding special interface to stop folks from accidently using OMContainer.
- * Please use at your own risk. May corrupt the data integrity.
+ * <p/>
+ * Internal Implementation detail. Adding special interface to stop folks from accidently using
+ * OMContainer. Please use at your own risk. May corrupt the data integrity.
*/
public interface OMContainerEx extends OMContainer {
public void setComplete(boolean state);
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNamespaceImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNamespaceImpl.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNamespaceImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNamespaceImpl.java Wed Mar 7 06:59:00 2007
@@ -18,18 +18,12 @@
import org.apache.axiom.om.OMNamespace;
-/**
- * Class OMNamespaceImpl
- */
+/** Class OMNamespaceImpl */
public class OMNamespaceImpl implements OMNamespace {
- /**
- * Field prefix
- */
+ /** Field prefix */
private String prefix;
- /**
- * Field uri
- */
+ /** Field uri */
private String uri;
/**
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java Wed Mar 7 06:59:00 2007
@@ -25,9 +25,9 @@
/**
* Interface OMNodeEx
- *
- * Internal Implementation detail. Adding special interface to stop folks from accidently using OMNode.
- * Please use at your own risk. May corrupt the data integrity.
+ * <p/>
+ * Internal Implementation detail. Adding special interface to stop folks from accidently using
+ * OMNode. Please use at your own risk. May corrupt the data integrity.
*/
public interface OMNodeEx extends OMNode {
public void setNextOMSibling(OMNode node);
@@ -45,6 +45,7 @@
*
* @param writer
* @throws javax.xml.stream.XMLStreamException
+ *
*/
public void internalSerialize(XMLStreamWriter writer)
throws XMLStreamException;
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java Wed Mar 7 06:59:00 2007
@@ -22,8 +22,8 @@
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.OMNodeEx;
import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.OMNodeEx;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
@@ -59,13 +59,13 @@
root = e = factory.createOMElement(localName, null, null, null);
} else if (lastNode.isComplete()) {
e = factory.createOMElement(localName, null, lastNode.getParent(),
- null);
- ((OMNodeEx)lastNode).setNextOMSibling(e);
- ((OMNodeEx)e).setPreviousOMSibling(lastNode);
+ null);
+ ((OMNodeEx) lastNode).setNextOMSibling(e);
+ ((OMNodeEx) e).setPreviousOMSibling(lastNode);
} else {
OMContainerEx parent = (OMContainerEx) lastNode;
e = factory.createOMElement(localName, null, (OMElement) lastNode,
- null);
+ null);
parent.setFirstChild(e);
}
return e;
@@ -106,7 +106,7 @@
int j = atts.getLength();
for (int i = 0; i < j; i++)
nextElem.addAttribute(atts.getLocalName(i), atts.getValue(i),
- nextElem.findNamespace(atts.getURI(i), null));
+ nextElem.findNamespace(atts.getURI(i), null));
lastNode = nextElem;
nextElem = null;
}
@@ -121,11 +121,11 @@
throws SAXException {
if (lastNode.isComplete()) {
OMContainer parent = lastNode.getParent();
- ((OMNodeEx)parent).setComplete(true);
+ ((OMNodeEx) parent).setComplete(true);
lastNode = (OMNode) parent;
} else {
OMElement e = (OMElement) lastNode;
- ((OMNodeEx)e).setComplete(true);
+ ((OMNodeEx) e).setComplete(true);
}
}
@@ -143,10 +143,10 @@
if (lastNode.isComplete()) {
node =
factory.createOMText(lastNode.getParent(),
- new String(ch,
- start, length));
- ((OMNodeEx)lastNode).setNextOMSibling(node);
- ((OMNodeEx)node).setPreviousOMSibling(lastNode);
+ new String(ch,
+ start, length));
+ ((OMNodeEx) lastNode).setNextOMSibling(node);
+ ((OMNodeEx) node).setPreviousOMSibling(lastNode);
} else {
OMContainerEx e = (OMContainerEx) lastNode;
node = factory.createOMText(e, new String(ch, start, length));
@@ -166,9 +166,7 @@
public void skippedEntity(String arg0) throws SAXException {
}
- /**
- * @return Returns the root.
- */
+ /** @return Returns the root. */
public OMElement getRootElement() {
return root;
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java Wed Mar 7 06:59:00 2007
@@ -16,60 +16,57 @@
package org.apache.axiom.om.impl.builder;
-import java.io.InputStream;
-
-import org.apache.axiom.om.*;
-import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMConstants;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.OMNodeEx;
import org.apache.axiom.om.impl.util.OMSerializerUtil;
import org.apache.axiom.om.util.StAXUtils;
import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.InputStream;
/**
- * OM should be able to be built from any data source. And the model it builds
- * may be a SOAP specific one or just an XML model. This class will give
- * some common functionality of OM Building from StAX.
+ * OM should be able to be built from any data source. And the model it builds may be a SOAP
+ * specific one or just an XML model. This class will give some common functionality of OM Building
+ * from StAX.
*/
public abstract class StAXBuilder implements OMXMLParserWrapper {
- /**
- * Field parser
- */
+ /** Field parser */
protected XMLStreamReader parser;
- /**
- * Field omfactory
- */
+ /** Field omfactory */
protected OMFactory omfactory;
- /**
- * Field lastNode
- */
+ /** Field lastNode */
protected OMNode lastNode;
// returns the state of completion
- /**
- * Field done
- */
+ /** Field done */
protected boolean done = false;
// keeps the state of the cache
- /**
- * Field cache
- */
+ /** Field cache */
protected boolean cache = true;
// keeps the state of the parser access. if the parser is
// accessed atleast once,this flag will be set
- /**
- * Field parserAccessed
- */
+ /** Field parserAccessed */
protected boolean parserAccessed = false;
protected OMDocument document;
@@ -83,7 +80,7 @@
this.parser = parser;
omfactory = ombuilderFactory;
- if(parser instanceof BuilderAwareReader) {
+ if (parser instanceof BuilderAwareReader) {
((BuilderAwareReader) parser).setBuilder(this);
}
}
@@ -96,21 +93,18 @@
protected StAXBuilder(XMLStreamReader parser) {
this(OMAbstractFactory.getOMFactory(), parser);
}
-
- /**
- * Init() *must* be called after creating the builder using this constructor.
- */
- protected StAXBuilder()
- {
+
+ /** Init() *must* be called after creating the builder using this constructor. */
+ protected StAXBuilder() {
}
-
- public void init (InputStream inputStream, String charSetEncoding, String url, String contentType) throws OMException
- {
+
+ public void init(InputStream inputStream, String charSetEncoding, String url,
+ String contentType) throws OMException {
try {
- this.parser = StAXUtils.createXMLStreamReader(inputStream);
- } catch (XMLStreamException e1) {
- throw new OMException(e1);
- }
+ this.parser = StAXUtils.createXMLStreamReader(inputStream);
+ } catch (XMLStreamException e1) {
+ throw new OMException(e1);
+ }
omfactory = OMAbstractFactory.getOMFactory();
}
@@ -163,7 +157,7 @@
// todo then this should throw an exception here
node.addAttribute(parser.getAttributeLocalName(i),
- parser.getAttributeValue(i), namespace);
+ parser.getAttributeValue(i), namespace);
}
}
@@ -186,8 +180,8 @@
}
/**
- * This method will check whether the text can be optimizable using IS_BINARY flag.
- * If that is set then we try to get the data handler.
+ * This method will check whether the text can be optimizable using IS_BINARY flag. If that is
+ * set then we try to get the data handler.
*
* @param omContainer
* @param textType
@@ -195,7 +189,8 @@
*/
private OMNode createOMText(OMContainer omContainer, int textType) {
try {
- if (isDataHandlerAware(parser) && Boolean.TRUE == parser.getProperty(OMConstants.IS_BINARY)) {
+ if (isDataHandlerAware(parser) &&
+ Boolean.TRUE == parser.getProperty(OMConstants.IS_BINARY)) {
Object dataHandler = parser.getProperty(OMConstants.DATA_HANDLER);
OMText text = omfactory.createOMText(dataHandler, true);
omContainer.addChild(text);
@@ -433,20 +428,17 @@
protected abstract OMNode createOMElement() throws OMException;
/**
- * Forwards the parser one step further, if parser is not completed yet.
- * If this is called after parser is done, then throw an OMException.
- * If the cache is set to false, then returns the event, *without* building the OM tree.
- * If the cache is set to true, then handles all the events within this, and
- * builds the object structure appropriately and returns the event.
+ * Forwards the parser one step further, if parser is not completed yet. If this is called after
+ * parser is done, then throw an OMException. If the cache is set to false, then returns the
+ * event, *without* building the OM tree. If the cache is set to true, then handles all the
+ * events within this, and builds the object structure appropriately and returns the event.
*
* @return Returns int.
* @throws OMException
*/
public abstract int next() throws OMException;
- /**
- * @return Returns short.
- */
+ /** @return Returns short. */
public short getBuilderType() {
return OMConstants.PULL_TYPE_BUILDER;
}
@@ -472,9 +464,9 @@
public OMDocument getDocument() {
return document;
}
-
- public String getCharsetEncoding(){
- return document.getCharsetEncoding();
+
+ public String getCharsetEncoding() {
+ return document.getCharsetEncoding();
}
public OMNode getLastNode() {
@@ -491,25 +483,26 @@
/**
* Get the value of a feature/property from the underlying XMLStreamReader implementation
- * without accessing the XMLStreamReader.
- * https://issues.apache.org/jira/browse/WSCOMMONS-155
+ * without accessing the XMLStreamReader. https://issues.apache.org/jira/browse/WSCOMMONS-155
+ *
* @param name
- * @return
+ * @return
*/
public Object getReaderProperty(String name) throws IllegalArgumentException {
- return parser.getProperty(name);
+ return parser.getProperty(name);
}
/**
* Check if the underlying parse is aware of data handlers. (example ADB generated code)
- *
+ *
* @param parser
* @return
*/
private boolean isDataHandlerAware(XMLStreamReader parser) {
// check whether data handlers are treated seperately
try {
- if (parser != null && (Boolean.TRUE == parser.getProperty(OMConstants.IS_DATA_HANDLERS_AWARE))) {
+ if (parser != null &&
+ (Boolean.TRUE == parser.getProperty(OMConstants.IS_DATA_HANDLERS_AWARE))) {
return true;
}
} catch (IllegalArgumentException e) {
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java Wed Mar 7 06:59:00 2007
@@ -16,7 +16,14 @@
package org.apache.axiom.om.impl.builder;
-import org.apache.axiom.om.*;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.OMContainerEx;
import org.apache.axiom.om.impl.OMNodeEx;
import org.apache.axiom.om.util.StAXUtils;
@@ -32,13 +39,11 @@
/**
- * Constructs an OM without using SOAP specific classes like SOAPEnvelope,
- * SOAPHeader, SOAPHeaderBlock and SOAPBody. This has the document concept also.
+ * Constructs an OM without using SOAP specific classes like SOAPEnvelope, SOAPHeader,
+ * SOAPHeaderBlock and SOAPBody. This has the document concept also.
*/
public class StAXOMBuilder extends StAXBuilder {
- /**
- * Field document
- */
+ /** Field document */
private static final Log log = LogFactory.getLog(StAXOMBuilder.class);
private boolean doTrace = log.isDebugEnabled();
@@ -96,9 +101,10 @@
public StAXOMBuilder(InputStream inStream) throws XMLStreamException {
this(StAXUtils.createXMLStreamReader(inStream));
}
-
+
/**
* Init() *must* be called after creating the builder using this constructor.
+ *
* @param inStream - instream which contains the XML
* @throws XMLStreamException
*/
@@ -124,7 +130,8 @@
switch (token) {
case XMLStreamConstants.START_ELEMENT:
if (doTrace) {
- log.trace("START_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
+ log.trace(
+ "START_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
}
lastNode = createOMElement();
break;
@@ -183,13 +190,15 @@
break;
case XMLStreamConstants.PROCESSING_INSTRUCTION:
if (doTrace) {
- log.trace("PROCESSING_INSTRUCTION: [" + parser.getPITarget() + "][" + parser.getPIData() + "]");
+ log.trace("PROCESSING_INSTRUCTION: [" + parser.getPITarget() + "][" +
+ parser.getPIData() + "]");
}
createPI();
break;
case XMLStreamConstants.ENTITY_REFERENCE:
if (doTrace) {
- log.trace("ENTITY_REFERENCE: " + parser.getLocalName() + "[" + parser.getText() + "]");
+ log.trace("ENTITY_REFERENCE: " + parser.getLocalName() + "[" +
+ parser.getText() + "]");
}
lastNode = createOMText(XMLStreamConstants.ENTITY_REFERENCE);
break;
@@ -205,9 +214,9 @@
}
/**
- * Populate element with data from parser START_ELEMENT event. This is used
- * when the source of data for an element needs to be parsed on demand. The
- * supplied element must already be set to the proper name and namespace.
+ * Populate element with data from parser START_ELEMENT event. This is used when the source of
+ * data for an element needs to be parsed on demand. The supplied element must already be set to
+ * the proper name and namespace.
*
* @param node element to be populated
*/
@@ -232,13 +241,13 @@
node = omfactory.createOMElement(elementName, null, document, this);
} else if (lastNode.isComplete()) {
node = omfactory.createOMElement(elementName, null,
- lastNode.getParent(), this);
+ lastNode.getParent(), this);
((OMNodeEx) lastNode).setNextOMSibling(node);
((OMNodeEx) node).setPreviousOMSibling(lastNode);
} else {
OMContainerEx e = (OMContainerEx) lastNode;
node = omfactory.createOMElement(elementName, null,
- (OMElement) lastNode, this);
+ (OMElement) lastNode, this);
e.setFirstChild(node);
}
populateOMElement(node);
@@ -361,8 +370,8 @@
}
/**
- * @deprecated
* @param doDebug
+ * @deprecated
*/
public void setDoDebug(boolean doDebug) {
this.doTrace = doDebug;
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java Wed Mar 7 06:59:00 2007
@@ -16,13 +16,6 @@
package org.apache.axiom.om.impl.builder;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-import javax.activation.DataHandler;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
import org.apache.axiom.attachments.Attachments;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
@@ -30,118 +23,116 @@
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.MTOMConstants;
-import org.apache.axiom.om.impl.OMNodeEx;
import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.OMNodeEx;
import org.apache.axiom.om.util.ElementHelper;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import sun.misc.GC.LatencyRequest;
+import javax.activation.DataHandler;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+public class XOPAwareStAXOMBuilder extends StAXOMBuilder implements XOPBuilder {
-public class XOPAwareStAXOMBuilder extends StAXOMBuilder implements XOPBuilder{
+ /** <code>Attachments</code> handles deferred parsing of incoming MIME Messages. */
+ Attachments attachments;
- /**
- * <code>Attachments</code> handles deferred parsing of incoming MIME
- * Messages.
- */
- Attachments attachments;
-
- /**
- * Constructor StAXOMBuilder.
- *
- * @param ombuilderFactory
- * @param parser
- */
- public XOPAwareStAXOMBuilder(OMFactory ombuilderFactory,
- XMLStreamReader parser, Attachments attachments) {
- super(ombuilderFactory, parser);
- this.attachments = attachments;
- }
-
- /**
- * Constructor linked to existing element.
- *
- * @param factory
- * @param parser
- * @param element
- */
- public XOPAwareStAXOMBuilder(OMFactory factory, XMLStreamReader parser,
- OMElement element,Attachments attachments) {
- super(factory, parser, element);
- this.attachments = attachments;
- }
-
- /**
- * @param filePath -
- * Path to the XML file
- * @throws XMLStreamException
- * @throws FileNotFoundException
- */
- public XOPAwareStAXOMBuilder(String filePath,Attachments attachments) throws XMLStreamException,
- FileNotFoundException {
- super(filePath);
- this.attachments = attachments;
- }
-
- /**
- * @param inStream -
- * instream which contains the XML
- * @throws XMLStreamException
- */
- public XOPAwareStAXOMBuilder(InputStream inStream,Attachments attachments)
- throws XMLStreamException {
- super(inStream);
- this.attachments = attachments;
- }
-
- /**
- * Constructor StAXXOPAwareOMBuilder.
- *
- * @param parser
- */
- public XOPAwareStAXOMBuilder(XMLStreamReader parser,Attachments attachments) {
- super(parser);
- this.attachments = attachments;
- }
-
- /**
- * Method createOMElement. Overriding the createOMElement of StAXOMBuilder
- * to to XOP aware building
- *
- * @return Returns OMNode.
- * @throws OMException
- */
- protected OMNode createOMElement() throws OMException {
-
- String elementName = parser.getLocalName();
- String namespaceURI = parser.getNamespaceURI();
- if (MTOMConstants.XOP_INCLUDE.equalsIgnoreCase(elementName)
- && MTOMConstants.XOP_NAMESPACE_URI
- .equalsIgnoreCase(namespaceURI)) {
- OMText node;
- String contentID = ElementHelper.getContentID(parser, getDocument()
- .getCharsetEncoding());
-
- if (lastNode == null) {
- throw new OMException(
- "XOP:Include element is not supported here");
- } else if (lastNode.isComplete() & lastNode.getParent() != null) {
- node = omfactory.createOMText(contentID, (OMElement) lastNode
- .getParent(), this);
- ((OMNodeEx) lastNode).setNextOMSibling(node);
- ((OMNodeEx) node).setPreviousOMSibling(lastNode);
- } else {
- OMContainerEx e = (OMContainerEx) lastNode;
- node = omfactory.createOMText(contentID, (OMElement) lastNode,this);
+ /**
+ * Constructor StAXOMBuilder.
+ *
+ * @param ombuilderFactory
+ * @param parser
+ */
+ public XOPAwareStAXOMBuilder(OMFactory ombuilderFactory,
+ XMLStreamReader parser, Attachments attachments) {
+ super(ombuilderFactory, parser);
+ this.attachments = attachments;
+ }
+
+ /**
+ * Constructor linked to existing element.
+ *
+ * @param factory
+ * @param parser
+ * @param element
+ */
+ public XOPAwareStAXOMBuilder(OMFactory factory, XMLStreamReader parser,
+ OMElement element, Attachments attachments) {
+ super(factory, parser, element);
+ this.attachments = attachments;
+ }
+
+ /**
+ * @param filePath - Path to the XML file
+ * @throws XMLStreamException
+ * @throws FileNotFoundException
+ */
+ public XOPAwareStAXOMBuilder(String filePath, Attachments attachments)
+ throws XMLStreamException,
+ FileNotFoundException {
+ super(filePath);
+ this.attachments = attachments;
+ }
+
+ /**
+ * @param inStream - instream which contains the XML
+ * @throws XMLStreamException
+ */
+ public XOPAwareStAXOMBuilder(InputStream inStream, Attachments attachments)
+ throws XMLStreamException {
+ super(inStream);
+ this.attachments = attachments;
+ }
+
+ /**
+ * Constructor StAXXOPAwareOMBuilder.
+ *
+ * @param parser
+ */
+ public XOPAwareStAXOMBuilder(XMLStreamReader parser, Attachments attachments) {
+ super(parser);
+ this.attachments = attachments;
+ }
+
+ /**
+ * Method createOMElement. Overriding the createOMElement of StAXOMBuilder to to XOP aware
+ * building
+ *
+ * @return Returns OMNode.
+ * @throws OMException
+ */
+ protected OMNode createOMElement() throws OMException {
+
+ String elementName = parser.getLocalName();
+ String namespaceURI = parser.getNamespaceURI();
+ if (MTOMConstants.XOP_INCLUDE.equalsIgnoreCase(elementName)
+ && MTOMConstants.XOP_NAMESPACE_URI
+ .equalsIgnoreCase(namespaceURI)) {
+ OMText node;
+ String contentID = ElementHelper.getContentID(parser, getDocument()
+ .getCharsetEncoding());
+
+ if (lastNode == null) {
+ throw new OMException(
+ "XOP:Include element is not supported here");
+ } else if (lastNode.isComplete() & lastNode.getParent() != null) {
+ node = omfactory.createOMText(contentID, (OMElement) lastNode
+ .getParent(), this);
+ ((OMNodeEx) lastNode).setNextOMSibling(node);
+ ((OMNodeEx) node).setPreviousOMSibling(lastNode);
+ } else {
+ OMContainerEx e = (OMContainerEx) lastNode;
+ node = omfactory.createOMText(contentID, (OMElement) lastNode, this);
e.setFirstChild(node);
- }
- return node;
- } else {
- return super.createOMElement();
- }
- }
-
- public DataHandler getDataHandler(String blobContentID) throws OMException {
- return attachments.getDataHandler(blobContentID);
+ }
+ return node;
+ } else {
+ return super.createOMElement();
+ }
+ }
+
+ public DataHandler getDataHandler(String blobContentID) throws OMException {
+ return attachments.getDataHandler(blobContentID);
}
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPBuilder.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPBuilder.java Wed Mar 7 06:59:00 2007
@@ -1,12 +1,12 @@
package org.apache.axiom.om.impl.builder;
-import javax.activation.DataHandler;
-
import org.apache.axiom.om.OMException;
+import javax.activation.DataHandler;
+
public interface XOPBuilder {
- public abstract DataHandler getDataHandler(String blobContentID)
- throws OMException;
+ public abstract DataHandler getDataHandler(String blobContentID)
+ throws OMException;
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMBuilderException.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMBuilderException.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMBuilderException.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMBuilderException.java Wed Mar 7 06:59:00 2007
@@ -18,14 +18,12 @@
import org.apache.axiom.om.OMException;
-/**
- * Class OMBuilderException
- */
+/** Class OMBuilderException */
public class OMBuilderException extends OMException {
-
+
private static final long serialVersionUID = -7447667411291193889L;
- /**
+ /**
* Constructor OMBuilderException
*
* @param s
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMStreamingException.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMStreamingException.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMStreamingException.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMStreamingException.java Wed Mar 7 06:59:00 2007
@@ -18,16 +18,12 @@
import org.apache.axiom.om.OMException;
-/**
- * Class OMStreamingException
- */
+/** Class OMStreamingException */
public class OMStreamingException extends OMException {
-
+
private static final long serialVersionUID = 8108888406034145092L;
- /**
- * Constructor OMStreamingException
- */
+ /** Constructor OMStreamingException */
public OMStreamingException() {
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/XMLComparisonException.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/XMLComparisonException.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/XMLComparisonException.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/XMLComparisonException.java Wed Mar 7 06:59:00 2007
@@ -17,10 +17,8 @@
package org.apache.axiom.om.impl.exception;
public class XMLComparisonException extends Exception {
- /**
- * Eran Chinthaka (chinthaka@apache.org)
- */
-
+ /** Eran Chinthaka (chinthaka@apache.org) */
+
private static final long serialVersionUID = -7918497983548520994L;
public XMLComparisonException(String message) {
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamWriterToContentHandlerConverter.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamWriterToContentHandlerConverter.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamWriterToContentHandlerConverter.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamWriterToContentHandlerConverter.java Wed Mar 7 06:59:00 2007
@@ -26,18 +26,12 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
-/**
- * Class StreamWriterToContentHandlerConverter
- */
+/** Class StreamWriterToContentHandlerConverter */
public class StreamWriterToContentHandlerConverter implements ContentHandler {
- /**
- * Field log
- */
+ /** Field log */
private Log log = LogFactory.getLog(getClass());
- /**
- * Field writer
- */
+ /** Field writer */
private XMLStreamWriter writer;
/**
@@ -224,7 +218,7 @@
int attCount = atts.getLength();
for (int i = 0; i < attCount; i++) {
writer.writeAttribute(atts.getURI(i), localName,
- atts.getValue(i));
+ atts.getValue(i));
}
}
} catch (XMLStreamException e) {
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java Wed Mar 7 06:59:00 2007
@@ -16,8 +16,6 @@
package org.apache.axiom.om.impl.serialize;
-import java.util.ArrayList;
-
import org.apache.axiom.om.OMSerializer;
import org.apache.axiom.om.impl.util.OMSerializerUtil;
@@ -26,10 +24,9 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
+import java.util.ArrayList;
-/**
- * Class StreamingOMSerializer
- */
+/** Class StreamingOMSerializer */
public class StreamingOMSerializer implements XMLStreamConstants, OMSerializer {
private static int namespaceSuffix = 0;
@@ -42,9 +39,7 @@
* Note that it is assumed that this serialization starts on an Element.
*/
- /**
- * Field depth
- */
+ /** Field depth */
private int depth = 0;
/**
@@ -86,10 +81,10 @@
} else if (event == END_ELEMENT) {
serializeEndElement(writer);
depth--;
- }else if (event == START_DOCUMENT) {
+ } else if (event == START_DOCUMENT) {
depth++; //if a start document is found then increment the depth
} else if (event == END_DOCUMENT) {
- if (depth!=0) depth--; //for the end document - reduce the depth
+ if (depth != 0) depth--; //for the end document - reduce the depth
try {
serializeEndElement(writer);
} catch (Exception e) {
@@ -110,85 +105,84 @@
protected void serializeElement(XMLStreamReader reader,
XMLStreamWriter writer)
throws XMLStreamException {
-
- // Note: To serialize the start tag, we must follow the order dictated by the JSR-173 (StAX) specification.
- // Please keep this code in sync with the code in OMSerializerUtil.serializeStartpart
-
- // The algorithm is:
+
+ // Note: To serialize the start tag, we must follow the order dictated by the JSR-173 (StAX) specification.
+ // Please keep this code in sync with the code in OMSerializerUtil.serializeStartpart
+
+ // The algorithm is:
// ... generate setPrefix/setDefaultNamespace for each namespace declaration if the prefix is unassociated.
- // ... generate setPrefix/setDefaultNamespace if the prefix of the element is unassociated
- // ... generate setPrefix/setDefaultNamespace for each unassociated prefix of the attributes.
- //
- // ... generate writeStartElement (See NOTE_A)
- //
- // ... generate writeNamespace/writerDefaultNamespace for the new namespace declarations determine during the "set" processing
- // ... generate writeAttribute for each attribute
-
- // NOTE_A: To confuse matters, some StAX vendors (including woodstox), believe that the setPrefix bindings
- // should occur after the writeStartElement. If this is the case, the writeStartElement is generated first.
-
- ArrayList writePrefixList = null;
- ArrayList writeNSList = null;
-
+ // ... generate setPrefix/setDefaultNamespace if the prefix of the element is unassociated
+ // ... generate setPrefix/setDefaultNamespace for each unassociated prefix of the attributes.
+ //
+ // ... generate writeStartElement (See NOTE_A)
+ //
+ // ... generate writeNamespace/writerDefaultNamespace for the new namespace declarations determine during the "set" processing
+ // ... generate writeAttribute for each attribute
+
+ // NOTE_A: To confuse matters, some StAX vendors (including woodstox), believe that the setPrefix bindings
+ // should occur after the writeStartElement. If this is the case, the writeStartElement is generated first.
+
+ ArrayList writePrefixList = null;
+ ArrayList writeNSList = null;
- // Get the prefix and namespace of the element. "" and null are identical.
+ // Get the prefix and namespace of the element. "" and null are identical.
String ePrefix = reader.getPrefix();
- ePrefix = (ePrefix != null && ePrefix.length() == 0) ? null : ePrefix;
- String eNamespace = reader.getNamespaceURI();
- eNamespace = (eNamespace != null && eNamespace.length() == 0) ? null : eNamespace;
-
- // Write the startElement if required
- boolean setPrefixFirst = OMSerializerUtil.isSetPrefixBeforeStartElement(writer);
+ ePrefix = (ePrefix != null && ePrefix.length() == 0) ? null : ePrefix;
+ String eNamespace = reader.getNamespaceURI();
+ eNamespace = (eNamespace != null && eNamespace.length() == 0) ? null : eNamespace;
+
+ // Write the startElement if required
+ boolean setPrefixFirst = OMSerializerUtil.isSetPrefixBeforeStartElement(writer);
if (!setPrefixFirst) {
- if (eNamespace != null) {
- if (ePrefix == null) {
- writer.writeStartElement("", reader.getLocalName(), eNamespace);
- } else {
- writer.writeStartElement(ePrefix, reader.getLocalName(), eNamespace);
- }
- } else {
- writer.writeStartElement(reader.getLocalName());
- }
+ if (eNamespace != null) {
+ if (ePrefix == null) {
+ writer.writeStartElement("", reader.getLocalName(), eNamespace);
+ } else {
+ writer.writeStartElement(ePrefix, reader.getLocalName(), eNamespace);
+ }
+ } else {
+ writer.writeStartElement(reader.getLocalName());
+ }
}
-
+
// Generate setPrefix for the namespace declarations
int count = reader.getNamespaceCount();
for (int i = 0; i < count; i++) {
- String prefix = reader.getNamespacePrefix(i);
- prefix = (prefix != null && prefix.length() == 0) ? null : prefix;
- String namespace = reader.getNamespaceURI(i);
- namespace = (namespace != null && namespace.length() == 0) ? null : namespace;
-
- String newPrefix = OMSerializerUtil.generateSetPrefix(prefix, namespace, writer, false);
- // If this is a new association, remember it so that it can written out later
- if (newPrefix != null) {
- if (writePrefixList == null) {
- writePrefixList= new ArrayList();
- writeNSList = new ArrayList();
- }
- if (!writePrefixList.contains(newPrefix)) {
- writePrefixList.add(newPrefix);
- writeNSList.add(namespace);
- }
- }
+ String prefix = reader.getNamespacePrefix(i);
+ prefix = (prefix != null && prefix.length() == 0) ? null : prefix;
+ String namespace = reader.getNamespaceURI(i);
+ namespace = (namespace != null && namespace.length() == 0) ? null : namespace;
+
+ String newPrefix = OMSerializerUtil.generateSetPrefix(prefix, namespace, writer, false);
+ // If this is a new association, remember it so that it can written out later
+ if (newPrefix != null) {
+ if (writePrefixList == null) {
+ writePrefixList = new ArrayList();
+ writeNSList = new ArrayList();
+ }
+ if (!writePrefixList.contains(newPrefix)) {
+ writePrefixList.add(newPrefix);
+ writeNSList.add(namespace);
+ }
+ }
}
-
+
// Generate setPrefix for the element
// If the prefix is not associated with a namespace yet, remember it so that we can
- // write out a namespace declaration
- String newPrefix = OMSerializerUtil.generateSetPrefix(ePrefix, eNamespace, writer, false);
- // If this is a new association, remember it so that it can written out later
- if (newPrefix != null) {
- if (writePrefixList == null) {
- writePrefixList= new ArrayList();
- writeNSList = new ArrayList();
- }
- if (!writePrefixList.contains(newPrefix)) {
- writePrefixList.add(newPrefix);
- writeNSList.add(eNamespace);
- }
- }
-
+ // write out a namespace declaration
+ String newPrefix = OMSerializerUtil.generateSetPrefix(ePrefix, eNamespace, writer, false);
+ // If this is a new association, remember it so that it can written out later
+ if (newPrefix != null) {
+ if (writePrefixList == null) {
+ writePrefixList = new ArrayList();
+ writeNSList = new ArrayList();
+ }
+ if (!writePrefixList.contains(newPrefix)) {
+ writePrefixList.add(newPrefix);
+ writeNSList.add(eNamespace);
+ }
+ }
+
// Now Generate setPrefix for each attribute
count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
@@ -196,57 +190,58 @@
prefix = (prefix != null && prefix.length() == 0) ? null : prefix;
String namespace = reader.getAttributeNamespace(i);
namespace = (namespace != null && namespace.length() == 0) ? null : namespace;
-
+
// Default prefix referencing is not allowed on an attribute
if (prefix == null && namespace != null) {
- String writerPrefix = writer.getPrefix(namespace);
- writerPrefix = (writerPrefix != null && writerPrefix.length() == 0) ? null : writerPrefix;
- prefix = (writerPrefix != null) ?
- writerPrefix :
- generateUniquePrefix(writer.getNamespaceContext());
+ String writerPrefix = writer.getPrefix(namespace);
+ writerPrefix =
+ (writerPrefix != null && writerPrefix.length() == 0) ? null : writerPrefix;
+ prefix = (writerPrefix != null) ?
+ writerPrefix :
+ generateUniquePrefix(writer.getNamespaceContext());
}
newPrefix = OMSerializerUtil.generateSetPrefix(prefix, namespace, writer, true);
// If the prefix is not associated with a namespace yet, remember it so that we can
- // write out a namespace declaration
- if (newPrefix != null) {
- if (writePrefixList == null) {
- writePrefixList= new ArrayList();
- writeNSList = new ArrayList();
- }
- if (!writePrefixList.contains(newPrefix)) {
- writePrefixList.add(newPrefix);
- writeNSList.add(namespace);
- }
- }
+ // write out a namespace declaration
+ if (newPrefix != null) {
+ if (writePrefixList == null) {
+ writePrefixList = new ArrayList();
+ writeNSList = new ArrayList();
+ }
+ if (!writePrefixList.contains(newPrefix)) {
+ writePrefixList.add(newPrefix);
+ writeNSList.add(namespace);
+ }
+ }
}
-
+
// Now write the startElement
if (setPrefixFirst) {
- if (eNamespace != null) {
- if (ePrefix == null) {
- writer.writeStartElement("", reader.getLocalName(), eNamespace);
- } else {
- writer.writeStartElement(ePrefix, reader.getLocalName(), eNamespace);
- }
- } else {
- writer.writeStartElement(reader.getLocalName());
- }
+ if (eNamespace != null) {
+ if (ePrefix == null) {
+ writer.writeStartElement("", reader.getLocalName(), eNamespace);
+ } else {
+ writer.writeStartElement(ePrefix, reader.getLocalName(), eNamespace);
+ }
+ } else {
+ writer.writeStartElement(reader.getLocalName());
+ }
}
// Now write out the list of namespace declarations in this list that we constructed
- // while doing the "set" processing.
- if (writePrefixList != null) {
- for (int i=0; i<writePrefixList.size(); i++) {
- String prefix = (String) writePrefixList.get(i);
- String namespace = (String) writeNSList.get(i);
- if (prefix != null) {
- writer.writeNamespace(prefix, namespace);
- } else {
- writer.writeDefaultNamespace(namespace);
- }
- }
+ // while doing the "set" processing.
+ if (writePrefixList != null) {
+ for (int i = 0; i < writePrefixList.size(); i++) {
+ String prefix = (String) writePrefixList.get(i);
+ String namespace = (String) writeNSList.get(i);
+ if (prefix != null) {
+ writer.writeNamespace(prefix, namespace);
+ } else {
+ writer.writeDefaultNamespace(namespace);
+ }
+ }
}
-
+
// Now write the attributes
count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
@@ -254,22 +249,22 @@
prefix = (prefix != null && prefix.length() == 0) ? null : prefix;
String namespace = reader.getAttributeNamespace(i);
namespace = (namespace != null && namespace.length() == 0) ? null : namespace;
-
-
+
+
if (prefix == null && namespace != null) {
- // Default namespaces are not allowed on an attribute reference.
+ // Default namespaces are not allowed on an attribute reference.
// Earlier in this code, a unique prefix was added for this case...now obtain and use it
- prefix = writer.getPrefix(namespace);
+ prefix = writer.getPrefix(namespace);
//XMLStreamWriter doesn't allow for getPrefix to know whether you're asking for the prefix
//for an attribute or an element. So if the namespace matches the default namespace getPrefix will return
//the empty string, as if it were an element, in all cases (even for attributes, and even if
//there was a prefix specifically set up for this), which is not the desired behavior.
//Since the interface is base java, we can't fix it where we need to (by adding an attr boolean to
//XMLStreamWriter.getPrefix), so we hack it in here...
- if ( prefix == null || "".equals( prefix ) ) {
- for (int j=0; j<writePrefixList.size(); j++) {
- if ( namespace.equals( (String)writeNSList.get( j ) ) ) {
- prefix = (String)writePrefixList.get( j );
+ if (prefix == null || "".equals(prefix)) {
+ for (int j = 0; j < writePrefixList.size(); j++) {
+ if (namespace.equals((String) writeNSList.get(j))) {
+ prefix = (String) writePrefixList.get(j);
}
}
}
@@ -283,14 +278,14 @@
}
}
if (namespace != null) {
- // Qualified attribute
- writer.writeAttribute(prefix, namespace,
- reader.getAttributeLocalName(i),
- reader.getAttributeValue(i));
+ // Qualified attribute
+ writer.writeAttribute(prefix, namespace,
+ reader.getAttributeLocalName(i),
+ reader.getAttributeValue(i));
} else {
- // Unqualified attribute
- writer.writeAttribute(reader.getAttributeLocalName(i),
- reader.getAttributeValue(i));
+ // Unqualified attribute
+ writer.writeAttribute(reader.getAttributeLocalName(i),
+ reader.getAttributeValue(i));
}
}
}
@@ -354,7 +349,7 @@
int count = reader.getAttributeCount();
String prefix = null;
String namespaceName = null;
- String writerPrefix=null;
+ String writerPrefix = null;
for (int i = 0; i < count; i++) {
prefix = reader.getAttributePrefix(i);
namespaceName = reader.getAttributeNamespace(i);
@@ -364,41 +359,41 @@
a namespace name that is not null. The best way to work around this
issue is to set the namespace uri to "" if it is null
*/
- if (namespaceName==null) namespaceName="";
+ if (namespaceName == null) namespaceName = "";
- writerPrefix =writer.getNamespaceContext().getPrefix(namespaceName);
+ writerPrefix = writer.getNamespaceContext().getPrefix(namespaceName);
- if (!"".equals(namespaceName)){
+ if (!"".equals(namespaceName)) {
//prefix has already being declared but this particular attrib has a
//no prefix attached. So use the prefix provided by the writer
- if (writerPrefix!=null && (prefix==null || prefix.equals(""))){
+ if (writerPrefix != null && (prefix == null || prefix.equals(""))) {
writer.writeAttribute(writerPrefix, namespaceName,
- reader.getAttributeLocalName(i),
- reader.getAttributeValue(i));
+ reader.getAttributeLocalName(i),
+ reader.getAttributeValue(i));
//writer prefix is available but different from the current
//prefix of the attrib. We should be decalring the new prefix
//as a namespace declaration
- }else if (prefix!=null && !"".equals(prefix)&& !prefix.equals(writerPrefix)){
- writer.writeNamespace(prefix,namespaceName);
+ } else if (prefix != null && !"".equals(prefix) && !prefix.equals(writerPrefix)) {
+ writer.writeNamespace(prefix, namespaceName);
writer.writeAttribute(prefix, namespaceName,
- reader.getAttributeLocalName(i),
- reader.getAttributeValue(i));
+ reader.getAttributeLocalName(i),
+ reader.getAttributeValue(i));
//prefix is null (or empty), but the namespace name is valid! it has not
//being written previously also. So we need to generate a prefix
//here
- }else{
+ } else {
prefix = generateUniquePrefix(writer.getNamespaceContext());
- writer.writeNamespace(prefix,namespaceName);
+ writer.writeNamespace(prefix, namespaceName);
writer.writeAttribute(prefix, namespaceName,
- reader.getAttributeLocalName(i),
- reader.getAttributeValue(i));
+ reader.getAttributeLocalName(i),
+ reader.getAttributeValue(i));
}
- }else{
+ } else {
//empty namespace is equal to no namespace!
writer.writeAttribute(reader.getAttributeLocalName(i),
- reader.getAttributeValue(i));
+ reader.getAttributeValue(i));
}
@@ -406,22 +401,24 @@
}
/**
- * Generates a unique namespace prefix that is not in the
- * scope of the NamespaceContext
+ * Generates a unique namespace prefix that is not in the scope of the NamespaceContext
+ *
* @param nsCtxt
* @return string
*/
- private String generateUniquePrefix(NamespaceContext nsCtxt){
+ private String generateUniquePrefix(NamespaceContext nsCtxt) {
String prefix = NAMESPACE_PREFIX + namespaceSuffix++;
//null should be returned if the prefix is not bound!
- while(nsCtxt.getNamespaceURI(prefix)!=null){
+ while (nsCtxt.getNamespaceURI(prefix) != null) {
prefix = NAMESPACE_PREFIX + namespaceSuffix++;
}
return prefix;
}
+
/**
* Method serializeNamespace.
+ *
* @param prefix
* @param URI
* @param writer
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildElementIterator.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildElementIterator.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildElementIterator.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildElementIterator.java Wed Mar 7 06:59:00 2007
@@ -24,24 +24,16 @@
public class OMChildElementIterator implements Iterator {
- /**
- * Field currentChild
- */
+ /** Field currentChild */
protected OMNode currentChild;
- /**
- * Field lastChild
- */
+ /** Field lastChild */
protected OMNode lastChild;
- /**
- * Field nextCalled
- */
+ /** Field nextCalled */
protected boolean nextCalled = false;
- /**
- * Field removeCalled
- */
+ /** Field removeCalled */
protected boolean removeCalled = false;
/**
@@ -54,18 +46,16 @@
}
/**
- * Removes the last element returned by the iterator (optional operation)
- * from the underlying collection. This method can be called only once per
- * call to <tt>next</tt>. The behavior of an iterator is unspecified if
- * the underlying collection is modified while the iteration is in
+ * Removes the last element returned by the iterator (optional operation) from the underlying
+ * collection. This method can be called only once per call to <tt>next</tt>. The behavior of
+ * an iterator is unspecified if the underlying collection is modified while the iteration is in
* progress in any way other than by calling this method.
*
- * @throws UnsupportedOperationException if the <tt>remove</tt>
- * operation is not supported by this Iterator.
- * @throws IllegalStateException if the <tt>next</tt> method has not
- * yet been called, or the <tt>remove</tt> method has already
- * been called after the last call to the <tt>next</tt>
- * method.
+ * @throws UnsupportedOperationException if the <tt>remove</tt> operation is not supported by
+ * this Iterator.
+ * @throws IllegalStateException if the <tt>next</tt> method has not yet been called, or
+ * the <tt>remove</tt> method has already been called
+ * after the last call to the <tt>next</tt> method.
*/
public void remove() {
if (!nextCalled) {
@@ -85,9 +75,8 @@
}
/**
- * Returns <tt>true</tt> if the iteration has more elements. (In other
- * words, returns <tt>true</tt> if <tt>next</tt> would return an element
- * rather than throwing an exception.)
+ * Returns <tt>true</tt> if the iteration has more elements. (In other words, returns
+ * <tt>true</tt> if <tt>next</tt> would return an element rather than throwing an exception.)
*
* @return Returns <tt>true</tt> if the iterator has more elements.
*/
@@ -108,9 +97,9 @@
if (hasNext()) {
lastChild = currentChild;
- do{
+ do {
currentChild = currentChild.getNextOMSibling();
- }while(currentChild!=null && currentChild.getType()!=OMNode.ELEMENT_NODE);
+ } while (currentChild != null && currentChild.getType() != OMNode.ELEMENT_NODE);
return lastChild;
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org