You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2012/04/23 12:27:05 UTC
svn commit: r1329164 [9/12] - in /webservices/axiom/branches/AXIOM-201: ./
etc/ legal/ modules/axiom-all/ modules/axiom-api/
modules/axiom-api/src/main/java/org/apache/axiom/attachments/
modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl...
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java Mon Apr 23 10:26:45 2012
@@ -70,7 +70,6 @@ public abstract class OMNodeImpl extends
super(factory);
this.done = done;
if ((parent != null)) {
- this.parent = (OMContainerEx) parent;
parent.addChild(this);
}
@@ -154,6 +153,8 @@ public abstract class OMNodeImpl extends
parent.setComplete(false);
} else if (parent instanceof OMElementImpl) {
((OMElementImpl) parent).notifyChildComplete();
+ } else if (parent instanceof OMDocumentImpl) {
+ ((OMDocumentImpl) parent).notifyChildComplete();
}
}
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java Mon Apr 23 10:26:45 2012
@@ -31,12 +31,14 @@ import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.OMXMLStreamReaderConfiguration;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
import org.apache.axiom.om.util.StAXUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
@@ -46,6 +48,7 @@ import javax.xml.transform.sax.SAXSource
import java.io.IOException;
import java.io.OutputStream;
+import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Iterator;
@@ -71,15 +74,24 @@ public class OMSourcedElementImpl extend
private OMNamespace definedNamespace = null;
/** Flag for parser provided to base element class. */
- private boolean isExpanded = false;
+ private boolean isExpanded;
- private static Log log = LogFactory.getLog(OMSourcedElementImpl.class);
- private static final boolean isDebugEnabled = log.isDebugEnabled();
+ private static final Log log = LogFactory.getLog(OMSourcedElementImpl.class);
- private static Log forceExpandLog = LogFactory.getLog(OMSourcedElementImpl.class.toString()+".forceExpand");
+ private static final Log forceExpandLog = LogFactory.getLog(OMSourcedElementImpl.class.getName() + ".forceExpand");
private XMLStreamReader readerFromDS = null; // Reader from DataSource
+ private static OMNamespace normalize(OMNamespace ns) {
+ // TODO: the ns.getPrefix() == null case actually doesn't make sense for a sourced element!
+ return ns == null || (ns.getPrefix() == null || ns.getPrefix().length() == 0) && ns.getNamespaceURI().length() == 0 ? null : ns;
+ }
+
+ private static OMNamespace getOMNamespace(QName qName) {
+ return qName.getNamespaceURI().length() == 0 ? null
+ : new OMNamespaceImpl(qName.getNamespaceURI(), qName.getPrefix());
+ }
+
/**
* Constructor.
*
@@ -91,18 +103,17 @@ public class OMSourcedElementImpl extend
public OMSourcedElementImpl(String localName, OMNamespace ns, OMFactory factory,
OMDataSource source) {
super(localName, null, factory);
+ if (source == null) {
+ throw new IllegalArgumentException("OMDataSource can't be null");
+ }
dataSource = source;
- isExpanded = (dataSource == null);
- if (!isExpanded) {
- if (!isLossyPrefix(dataSource)) {
- // Believe the prefix and create a normal OMNamespace
- definedNamespace = ns;
- } else {
- // Create a deferred namespace that forces an expand to get the prefix
- definedNamespace = new DeferredNamespace(ns.getNamespaceURI());
- }
+ isExpanded = false;
+ if (!isLossyPrefix(dataSource)) {
+ // Believe the prefix and create a normal OMNamespace
+ definedNamespace = normalize(ns);
} else {
- definedNamespace = ns;
+ // Create a deferred namespace that forces an expand to get the prefix
+ definedNamespace = new DeferredNamespace(ns.getNamespaceURI());
}
}
@@ -116,18 +127,17 @@ public class OMSourcedElementImpl extend
public OMSourcedElementImpl(QName qName, OMFactory factory, OMDataSource source) {
//create a namespace
super(qName.getLocalPart(), null, factory);
+ if (source == null) {
+ throw new IllegalArgumentException("OMDataSource can't be null");
+ }
dataSource = source;
- isExpanded = (dataSource == null);
- if (!isExpanded) {
- if (!isLossyPrefix(dataSource)) {
- // Believe the prefix and create a normal OMNamespace
- definedNamespace = new OMNamespaceImpl(qName.getNamespaceURI(), qName.getPrefix());
- } else {
- // Create a deferred namespace that forces an expand to get the prefix
- definedNamespace = new DeferredNamespace(qName.getNamespaceURI());
- }
+ isExpanded = false;
+ if (!isLossyPrefix(dataSource)) {
+ // Believe the prefix and create a normal OMNamespace
+ definedNamespace = getOMNamespace(qName);
} else {
- definedNamespace = new OMNamespaceImpl(qName.getNamespaceURI(), qName.getPrefix());
+ // Create a deferred namespace that forces an expand to get the prefix
+ definedNamespace = new DeferredNamespace(qName.getNamespaceURI());
}
}
@@ -229,7 +239,7 @@ public class OMSourcedElementImpl extend
log.error("Could not get parser from data source for element " +
getPrintableName(), e);
throw new RuntimeException("Error obtaining parser from data source:" +
- e.getMessage());
+ e.getMessage(), e);
}
}
@@ -238,9 +248,12 @@ public class OMSourcedElementImpl extend
* tree on demand, this first creates a builder
*/
private void forceExpand() {
- if (!isExpanded) {
+ // The dataSource != null is required because this method may be called indirectly
+ // by the constructor before the data source is set. After the constructor has completed,
+ // isExpanded is always true if dataSource is null.
+ if (!isExpanded && dataSource != null) {
- if (isDebugEnabled) {
+ if (log.isDebugEnabled()) {
log.debug("forceExpand: expanding element " +
getPrintableName());
if(forceExpandLog.isDebugEnabled()){
@@ -268,7 +281,7 @@ public class OMSourcedElementImpl extend
log.error("forceExpand: error parsing data soruce document for element " +
getLocalName(), e);
throw new RuntimeException("Error parsing data source document:" +
- e.getMessage());
+ e.getMessage(), e);
}
// Make sure element local name and namespace matches what was expected
@@ -333,70 +346,50 @@ public class OMSourcedElementImpl extend
return isExpanded;
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getChildElements()
- */
public Iterator getChildElements() {
forceExpand();
return super.getChildElements();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#declareNamespace(java.lang.String, java.lang.String)
- */
public OMNamespace declareNamespace(String uri, String prefix) {
forceExpand();
return super.declareNamespace(uri, prefix);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#declareDefaultNamespace(java.lang.String)
- */
public OMNamespace declareDefaultNamespace(String uri) {
forceExpand();
return super.declareDefaultNamespace(uri);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getDefaultNamespace()
- */
public OMNamespace getDefaultNamespace() {
forceExpand();
return super.getDefaultNamespace();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#declareNamespace(org.apache.axiom.om.OMNamespace)
- */
public OMNamespace declareNamespace(OMNamespace namespace) {
forceExpand();
return super.declareNamespace(namespace);
}
+ public OMNamespace addNamespaceDeclaration(String uri, String prefix) {
+ return super.addNamespaceDeclaration(uri, prefix);
+ }
+
public void undeclarePrefix(String prefix) {
forceExpand();
super.undeclarePrefix(prefix);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#findNamespace(java.lang.String, java.lang.String)
- */
public OMNamespace findNamespace(String uri, String prefix) {
forceExpand();
return super.findNamespace(uri, prefix);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#findNamespaceURI(java.lang.String)
- */
public OMNamespace findNamespaceURI(String prefix) {
forceExpand();
return super.findNamespaceURI(prefix);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getAllDeclaredNamespaces()
- */
public Iterator getAllDeclaredNamespaces() throws OMException {
forceExpand();
return super.getAllDeclaredNamespaces();
@@ -407,104 +400,81 @@ public class OMSourcedElementImpl extend
return super.getNamespacesInScope();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getAllAttributes()
- */
+ public NamespaceContext getNamespaceContext(boolean detached) {
+ forceExpand();
+ return super.getNamespaceContext(detached);
+ }
+
public Iterator getAllAttributes() {
forceExpand();
return super.getAllAttributes();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getAttribute(javax.xml.namespace.QName)
- */
public OMAttribute getAttribute(QName qname) {
forceExpand();
return super.getAttribute(qname);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getAttributeValue(javax.xml.namespace.QName)
- */
public String getAttributeValue(QName qname) {
forceExpand();
return super.getAttributeValue(qname);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#addAttribute(org.apache.axiom.om.OMAttribute)
- */
public OMAttribute addAttribute(OMAttribute attr) {
forceExpand();
return super.addAttribute(attr);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#addAttribute(java.lang.String,
- * java.lang.String, org.apache.axiom.om.OMNamespace)
- */
public OMAttribute addAttribute(String attributeName, String value, OMNamespace namespace) {
forceExpand();
return super.addAttribute(attributeName, value, namespace);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#removeAttribute(org.apache.axiom.om.OMAttribute)
- */
public void removeAttribute(OMAttribute attr) {
forceExpand();
super.removeAttribute(attr);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#setBuilder(org.apache.axiom.om.OMXMLParserWrapper)
- */
public void setBuilder(OMXMLParserWrapper wrapper) {
throw new UnsupportedOperationException(
"Builder cannot be set for element backed by data source");
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getBuilder()
- */
public OMXMLParserWrapper getBuilder() {
forceExpand();
return super.getBuilder();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#setFirstChild(org.apache.axiom.om.OMNode)
- */
public void setFirstChild(OMNode node) {
forceExpand();
super.setFirstChild(node);
}
-
public void setLastChild(OMNode omNode) {
forceExpand();
super.setLastChild(omNode);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getFirstElement()
- */
public OMElement getFirstElement() {
forceExpand();
return super.getFirstElement();
}
public XMLStreamReader getXMLStreamReader(boolean cache) {
- if (isDebugEnabled) {
+ return getXMLStreamReader(cache, new OMXMLStreamReaderConfiguration());
+ }
+
+ public XMLStreamReader getXMLStreamReader(boolean cache, OMXMLStreamReaderConfiguration configuration) {
+ if (log.isDebugEnabled()) {
log.debug("getting XMLStreamReader for " + getPrintableName()
+ " with cache=" + cache);
}
if (isExpanded) {
- return super.getXMLStreamReader(cache);
+ return super.getXMLStreamReader(cache, configuration);
} else {
if (cache && isDestructiveRead()) {
forceExpand();
- return super.getXMLStreamReader();
+ return super.getXMLStreamReader(true, configuration);
}
return getDirectReader();
}
@@ -518,57 +488,44 @@ public class OMSourcedElementImpl extend
return getXMLStreamReader(false);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#setText(java.lang.String)
- */
public void setText(String text) {
forceExpand();
super.setText(text);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#setText(javax.xml.namespace.QName)
- */
public void setText(QName text) {
forceExpand();
super.setText(text);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getText()
- */
public String getText() {
forceExpand();
return super.getText();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getTextAsQName()
- */
+ public Reader getTextAsStream(boolean cache) {
+ return super.getTextAsStream(cache);
+ }
+
public QName getTextAsQName() {
forceExpand();
return super.getTextAsQName();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getLocalName()
- */
+ public void writeTextTo(Writer out, boolean cache) throws IOException {
+ super.writeTextTo(out, cache);
+ }
+
public String getLocalName() {
// no need to set the parser, just call base method directly
return super.getLocalName();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#setLocalName(java.lang.String)
- */
public void setLocalName(String localName) {
// no need to expand the tree, just call base method directly
super.setLocalName(localName);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getNamespace()
- */
public OMNamespace getNamespace() throws OMException {
if (isExpanded()) {
return super.getNamespace();
@@ -576,30 +533,24 @@ public class OMSourcedElementImpl extend
return definedNamespace;
}
+ public String getPrefix() {
+ return super.getPrefix();
+ }
+
public String getNamespaceURI() {
return super.getNamespaceURI();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#setNamespace(org.apache.axiom.om.OMNamespace)
- */
public void setNamespace(OMNamespace namespace) {
forceExpand();
super.setNamespace(namespace);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#
- * setNamespaceWithNoFindInCurrentScope(org.apache.axiom.om.OMNamespace)
- */
public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace) {
forceExpand();
super.setNamespaceWithNoFindInCurrentScope(namespace);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getQName()
- */
public QName getQName() {
if (isExpanded()) {
return super.getQName();
@@ -611,9 +562,6 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#toStringWithConsume()
- */
public String toStringWithConsume() throws XMLStreamException {
if (isExpanded()) {
return super.toStringWithConsume();
@@ -642,50 +590,32 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#resolveQName(java.lang.String)
- */
public QName resolveQName(String qname) {
forceExpand();
return super.resolveQName(qname);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#cloneOMElement()
- */
public OMElement cloneOMElement() {
forceExpand();
return super.cloneOMElement();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#setLineNumber(int)
- */
public void setLineNumber(int lineNumber) {
// no need to expand the tree, just call base method directly
super.setLineNumber(lineNumber);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMElement#getLineNumber()
- */
public int getLineNumber() {
// no need to expand the tree, just call base method directly
return super.getLineNumber();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#discard()
- */
public void discard() throws OMException {
// discard without expanding the tree
setComplete(true);
super.detach();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#getType()
- */
public int getType() {
// no need to expand the tree, just call base method directly
return super.getType();
@@ -707,34 +637,21 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#serialize(javax.xml.stream.XMLStreamWriter)
- */
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
// The contract is to serialize with caching
internalSerialize(xmlWriter, true);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#serialize(java.io.OutputStream)
- */
public void serialize(OutputStream output) throws XMLStreamException {
OMOutputFormat format = new OMOutputFormat();
serialize(output, format);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#serialize(java.io.Writer)
- */
public void serialize(Writer writer) throws XMLStreamException {
OMOutputFormat format = new OMOutputFormat();
serialize(writer, format);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#
- * serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat)
- */
public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
if (isExpanded) {
super.serialize(output, format);
@@ -746,10 +663,6 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#
- * serialize(java.io.Writer, org.apache.axiom.om.OMOutputFormat)
- */
public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
if (isExpanded) {
super.serialize(writer, format);
@@ -761,19 +674,13 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#serializeAndConsume(javax.xml.stream.XMLStreamWriter)
- */
public void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
throws XMLStreamException {
internalSerialize(xmlWriter, false);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#serializeAndConsume(java.io.OutputStream)
- */
public void serializeAndConsume(OutputStream output) throws XMLStreamException {
- if (isDebugEnabled) {
+ if (log.isDebugEnabled()) {
log.debug("serialize " + getPrintableName() + " to output stream");
}
OMOutputFormat format = new OMOutputFormat();
@@ -784,11 +691,8 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#serializeAndConsume(java.io.Writer)
- */
public void serializeAndConsume(Writer writer) throws XMLStreamException {
- if (isDebugEnabled) {
+ if (log.isDebugEnabled()) {
log.debug("serialize " + getPrintableName() + " to writer");
}
if (isExpanded()) {
@@ -799,13 +703,9 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#
- * serializeAndConsume(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat)
- */
public void serializeAndConsume(OutputStream output, OMOutputFormat format)
throws XMLStreamException {
- if (isDebugEnabled) {
+ if (log.isDebugEnabled()) {
log.debug("serialize formatted " + getPrintableName() +
" to output stream");
}
@@ -816,13 +716,9 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#
- * serializeAndConsume(java.io.Writer, org.apache.axiom.om.OMOutputFormat)
- */
public void serializeAndConsume(Writer writer, OMOutputFormat format)
throws XMLStreamException {
- if (isDebugEnabled) {
+ if (log.isDebugEnabled()) {
log.debug("serialize formatted " + getPrintableName() +
" to writer");
}
@@ -833,17 +729,11 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMContainer#addChild(org.apache.axiom.om.OMNode)
- */
public void addChild(OMNode omNode) {
forceExpand();
super.addChild(omNode);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMContainer#getChildrenWithName(javax.xml.namespace.QName)
- */
public Iterator getChildrenWithName(QName elementQName) {
forceExpand();
return super.getChildrenWithName(elementQName);
@@ -859,17 +749,11 @@ public class OMSourcedElementImpl extend
return super.getChildrenWithNamespaceURI(uri);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMContainer#getFirstChildWithName(javax.xml.namespace.QName)
- */
public OMElement getFirstChildWithName(QName elementQName) throws OMException {
forceExpand();
return super.getFirstChildWithName(elementQName);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMContainer#getChildren()
- */
public Iterator getChildren() {
forceExpand();
return super.getChildren();
@@ -880,9 +764,6 @@ public class OMSourcedElementImpl extend
return super.getDescendants(includeSelf);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMContainer#getFirstOMChild()
- */
public OMNode getFirstOMChild() {
forceExpand();
return super.getFirstOMChild();
@@ -892,17 +773,11 @@ public class OMSourcedElementImpl extend
return super.getFirstOMChildIfAvailable();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMContainer#buildNext()
- */
public void buildNext() {
forceExpand();
super.buildNext();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.impl.llom.OMElementImpl#detach()
- */
public OMNode detach() throws OMException {
// detach without expanding the tree
boolean complete = isComplete();
@@ -912,9 +787,6 @@ public class OMSourcedElementImpl extend
return result;
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.impl.llom.OMElementImpl#getNextOMSibling()
- */
public OMNode getNextOMSibling() throws OMException {
// no need to expand the tree, just call base method directly
return super.getNextOMSibling();
@@ -924,25 +796,11 @@ public class OMSourcedElementImpl extend
return super.getNextOMSiblingIfAvailable();
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.impl.llom.OMElementImpl#getTrimmedText()
- */
- public String getTrimmedText() {
- forceExpand();
- return super.getTrimmedText();
- }
-
- /* (non-Javadoc)
- * @see org.apache.axiom.om.impl.llom.OMElementImpl#handleNamespace(javax.xml.namespace.QName)
- */
OMNamespace handleNamespace(QName qname) {
forceExpand();
return super.handleNamespace(qname);
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.impl.llom.OMElementImpl#isComplete()
- */
public boolean isComplete() {
if (isExpanded) {
return super.isComplete();
@@ -951,9 +809,6 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.impl.llom.OMElementImpl#toString()
- */
public String toString() {
if (isExpanded) {
return super.toString();
@@ -976,9 +831,6 @@ public class OMSourcedElementImpl extend
}
}
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#buildAll()
- */
public void buildWithAttachments() {
// If not done, force the parser to build the elements
@@ -1004,7 +856,7 @@ public class OMSourcedElementImpl extend
super.build();
}
- protected void notifyChildComplete() {
+ void notifyChildComplete() {
super.notifyChildComplete();
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java Mon Apr 23 10:26:45 2012
@@ -28,7 +28,6 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.builder.XOPBuilder;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
import org.apache.axiom.util.UIDGenerator;
import org.apache.axiom.util.base64.Base64Utils;
@@ -356,11 +355,7 @@ public class OMTextImpl extends OMNodeIm
} else {
if (dataHandlerObject == null) {
- if (contentID == null) {
- throw new RuntimeException("ContentID is null");
- }
- dataHandlerObject = ((XOPBuilder) builder)
- .getDataHandler(contentID);
+ throw new OMException("No DataHandler available");
} else if (dataHandlerObject instanceof DataHandlerProvider) {
try {
dataHandlerObject = ((DataHandlerProvider)dataHandlerObject).getDataHandler();
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java Mon Apr 23 10:26:45 2012
@@ -44,6 +44,7 @@ import org.apache.axiom.om.impl.llom.OME
import org.apache.axiom.om.impl.llom.OMProcessingInstructionImpl;
import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
import org.apache.axiom.om.impl.llom.OMTextImpl;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
import javax.xml.namespace.QName;
@@ -276,6 +277,14 @@ public class OMLinkedListImplFactory imp
public OMAttribute createOMAttribute(String localName,
OMNamespace ns,
String value) {
+ if (ns != null && ns.getPrefix() == null) {
+ String namespaceURI = ns.getNamespaceURI();
+ if (namespaceURI.length() == 0) {
+ ns = null;
+ } else {
+ ns = new OMNamespaceImpl(namespaceURI, OMSerializerUtil.getNextNSPrefix());
+ }
+ }
return new OMAttributeImpl(localName, ns, value, this);
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java Mon Apr 23 10:26:45 2012
@@ -27,10 +27,6 @@ import org.apache.axiom.soap.impl.llom.s
/**
* Meta factory for the linked list OM implementation.
- * <p>
- * Since all OM factories for LLOM are stateless, {@link #getOMFactory()},
- * {@link #getSOAP11Factory()} and {@link #getSOAP12Factory()} will return the
- * same instance on every invocation.
*/
public class OMLinkedListMetaFactory extends AbstractOMMetaFactory {
private final OMFactory omFactory = new OMLinkedListImplFactory(this);
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/XMLComparator.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/XMLComparator.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/XMLComparator.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/XMLComparator.java Mon Apr 23 10:26:45 2012
@@ -33,7 +33,7 @@ import java.util.Vector;
/** @deprecated This class is outdated. Please use XmlUnit to compate two xml files. */
public class XMLComparator {
- private static Log log = LogFactory.getLog(XMLComparator.class);
+ private static final Log log = LogFactory.getLog(XMLComparator.class);
private Vector ignorableNamespaceList = new Vector();
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java Mon Apr 23 10:26:45 2012
@@ -50,8 +50,7 @@ import javax.xml.stream.XMLStreamWriter;
/** Class SOAPEnvelopeImpl */
public class SOAPEnvelopeImpl extends SOAPElement
implements SOAPEnvelope, OMConstants {
- private static Log log = LogFactory.getLog(SOAPEnvelopeImpl.class);
- private static final boolean isDebugEnabled = log.isDebugEnabled();
+ private static final Log log = LogFactory.getLog(SOAPEnvelopeImpl.class);
/**
* Constructor
@@ -185,21 +184,6 @@ public class SOAPEnvelopeImpl extends SO
return null;
}
- /**
- * Method detach
- *
- * @throws OMException
- */
- public OMNode detach() throws OMException {
-// throw new OMException("Root Element can not be detached");
- // I'm confused why this threw an exception as above. One should be able to create
- // a SOAP envelope and be able to detach from the its parent document.
- // The example is if I want to send a SOAPEnvelope inside another SOAP message, then this will
- // not allow to do that.
- // Must be an idea of a DOM guy ;)
- return this;
- }
-
protected void checkParent(OMElement parent) throws SOAPProcessingException {
// here do nothing as SOAPEnvelope doesn't have a parent !!!
}
@@ -253,18 +237,18 @@ public class SOAPEnvelopeImpl extends SO
// TODO: should use 'instance of OMXMLParserWrapper' instead? StAXBuilder is more generic
if ((builder != null) && (builder instanceof StAXBuilder)) {
try {
- if (isDebugEnabled) {
+ if (log.isDebugEnabled()) {
log.debug("closing builder: " + builder);
}
StAXBuilder staxBuilder = (StAXBuilder) builder;
staxBuilder.close();
} catch (Exception e) {
- if (isDebugEnabled) {
+ if (log.isDebugEnabled()) {
log.error("Could not close builder or parser due to: ", e);
}
}
} else {
- if (isDebugEnabled) {
+ if (log.isDebugEnabled()) {
log.debug("Could not close builder or parser due to:");
if (builder == null) {
log.debug("builder is null");
@@ -294,9 +278,8 @@ public class SOAPEnvelopeImpl extends SO
if (payloadQName != null) {
if (SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(payloadQName.getLocalPart())) {
String ns = payloadQName.getNamespaceURI();
- return (ns != null &&
- (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns) ||
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns)));
+ return SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns) ||
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns);
}
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java Mon Apr 23 10:26:45 2012
@@ -26,15 +26,17 @@ import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.OMNodeEx;
import org.apache.axiom.soap.RolePlayer;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAP12Version;
import org.apache.axiom.soap.SOAPConstants;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axiom.soap.SOAPProcessingException;
-import org.apache.axiom.soap.SOAPVersion;
+import org.apache.axiom.soap.impl.common.Checker;
+import org.apache.axiom.soap.impl.common.HeaderIterator;
+import org.apache.axiom.soap.impl.common.MURoleChecker;
+import org.apache.axiom.soap.impl.common.RoleChecker;
+import org.apache.axiom.soap.impl.common.RolePlayerChecker;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -42,194 +44,10 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-/**
- * A local interface we can use to make "header checker" objects which can be used by
- * HeaderIterators to filter results. This really SHOULD be done with anonymous classes:
- * <p/>
- * public void getHeadersByRole(final String role) {
- * return new HeaderIterator() {
- * public boolean checkHeader(SOAPHeaderBlock header) {
- * ...
- * if (role.equals(headerRole)) return true;
- * return false;
- * }
- * }
- * }
- * <p/>
- * ...but there appears to be some kind of weird problem with the JVM not correctly scoping the
- * passed "role" value in a situation like the above. As such, we have to make Checker objects
- * instead (sigh).
- */
-interface Checker {
- boolean checkHeader(SOAPHeaderBlock header);
-}
-
-/**
- * A Checker to make sure headers match a given role. If the role we're looking for is null, then
- * everything matches.
- */
-class RoleChecker implements Checker {
- String role;
-
- public RoleChecker(String role) {
- this.role = role;
- }
-
- public boolean checkHeader(SOAPHeaderBlock header) {
- if (role == null) {
- return true;
- }
- String thisRole = header.getRole();
- return (role.equals(thisRole));
- }
-}
-
-/**
- * This Checker uses a RolePlayer to return the appropriate headers for that RolePlayer to process.
- * Ignore "none", always "next", etc.
- */
-class RolePlayerChecker implements Checker {
- RolePlayer rolePlayer;
-
- /** Optional namespace - if non-null we'll only return headers that match */
- String namespace;
-
- /**
- * Constructor.
- *
- * @param rolePlayer the RolePlayer to check against. This can be null, in which
- * case we assume we're the ultimate destination.
- */
- public RolePlayerChecker(RolePlayer rolePlayer) {
- this.rolePlayer = rolePlayer;
- }
-
- public RolePlayerChecker(RolePlayer rolePlayer, String namespace) {
- this.rolePlayer = rolePlayer;
- this.namespace = namespace;
- }
-
- public boolean checkHeader(SOAPHeaderBlock header) {
- // If we're filtering on namespace, check that first since the compare is simpler.
- if (namespace != null) {
- OMNamespace headerNamespace = header.getNamespace();
- if (headerNamespace == null || !namespace.equals(headerNamespace.getNamespaceURI())) {
- return false;
- }
- }
-
- String role = header.getRole();
- SOAPVersion version = header.getVersion();
-
- // 1. If role is ultimatedest, go by what the rolePlayer says
- if (role == null || role.equals("") ||
- (version instanceof SOAP12Version &&
- role.equals(SOAP12Constants.SOAP_ROLE_ULTIMATE_RECEIVER))) {
- return (rolePlayer == null || rolePlayer.isUltimateDestination());
- }
-
- // 2. If role is next, always return true
- if (role.equals(version.getNextRoleURI())) return true;
-
- // 3. If role is none, always return false
- if (version instanceof SOAP12Version &&
- role.equals(SOAP12Constants.SOAP_ROLE_NONE)) {
- return false;
- }
-
- // 4. Return t/f depending on match
- List roles = (rolePlayer == null) ? null : rolePlayer.getRoles();
- if (roles != null) {
- for (Iterator i = roles.iterator(); i.hasNext();) {
- String thisRole = (String) i.next();
- if (thisRole.equals(role)) return true;
- }
- }
-
- return false;
- }
-}
-
-/** A Checker to see that we both match a given role AND are mustUnderstand=true */
-class MURoleChecker extends RoleChecker {
- public MURoleChecker(String role) {
- super(role);
- }
-
- public boolean checkHeader(SOAPHeaderBlock header) {
- if (header.getMustUnderstand())
- return super.checkHeader(header);
- return false;
- }
-}
-
/** A class representing the SOAP Header, primarily allowing access to the contained HeaderBlocks. */
public abstract class SOAPHeaderImpl extends SOAPElement implements SOAPHeader {
- static Log log = LogFactory.getLog(SOAPHeaderImpl.class);
- /** An Iterator which walks the header list as needed, potentially filtering as we traverse. */
- class HeaderIterator implements Iterator {
- SOAPHeaderBlock current;
- boolean advance = false;
- Checker checker;
-
- public HeaderIterator() {
- this(null);
- }
-
- public HeaderIterator(Checker checker) {
- this.checker = checker;
- current = (SOAPHeaderBlock) getFirstElement();
- if (current != null) {
- if (!checkHeader(current)) {
- advance = true;
- hasNext();
- }
- }
- }
-
- public void remove() {
- }
-
- public boolean checkHeader(SOAPHeaderBlock header) {
- if (checker == null) return true;
- return checker.checkHeader(header);
- }
-
- public boolean hasNext() {
- if (!advance) {
- return current != null;
- }
-
- advance = false;
- OMNode sibling = current.getNextOMSibling();
-
- while (sibling != null) {
- if (sibling instanceof SOAPHeaderBlock) {
- SOAPHeaderBlock possible = (SOAPHeaderBlock) sibling;
- if (checkHeader(possible)) {
- current = (SOAPHeaderBlock) sibling;
- return true;
- }
- }
- sibling = sibling.getNextOMSibling();
- }
-
- current = null;
- return false;
- }
-
- public Object next() {
- SOAPHeaderBlock ret = current;
- if (ret != null) {
- advance = true;
- hasNext();
- }
- return ret;
- }
- }
-
-
+ private static final Log log = LogFactory.getLog(SOAPHeaderImpl.class);
protected SOAPHeaderImpl(OMNamespace ns, SOAPFactory factory) {
super(SOAPConstants.HEADER_LOCAL_NAME, ns, factory);
}
@@ -277,21 +95,21 @@ public abstract class SOAPHeaderImpl ext
protected abstract SOAPHeaderBlock createHeaderBlock(String localname, OMNamespace ns);
public Iterator getHeadersToProcess(RolePlayer rolePlayer) {
- return new HeaderIterator(new RolePlayerChecker(rolePlayer));
+ return new HeaderIterator(this, new RolePlayerChecker(rolePlayer));
}
public Iterator getHeadersToProcess(RolePlayer rolePlayer, String namespace) {
- return new HeaderIterator(new RolePlayerChecker(rolePlayer, namespace));
+ return new HeaderIterator(this, new RolePlayerChecker(rolePlayer, namespace));
}
public Iterator examineHeaderBlocks(String role) {
- return new HeaderIterator(new RoleChecker(role));
+ return new HeaderIterator(this, new RoleChecker(role));
}
public abstract Iterator extractHeaderBlocks(String role);
public Iterator examineMustUnderstandHeaderBlocks(String actor) {
- return new HeaderIterator(new MURoleChecker(actor));
+ return new HeaderIterator(this, new MURoleChecker(actor));
}
public Iterator examineAllHeaderBlocks() {
@@ -301,7 +119,7 @@ public abstract class SOAPHeaderImpl ext
}
}
- return new HeaderIterator(new DefaultChecker());
+ return new HeaderIterator(this, new DefaultChecker());
}
public Iterator extractAllHeaderBlocks() {
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java Mon Apr 23 10:26:45 2012
@@ -20,7 +20,6 @@
package org.apache.axiom.soap.impl.llom;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.OMNodeEx;
import org.apache.axiom.om.impl.llom.OMDocumentImpl;
@@ -61,11 +60,6 @@ public class SOAPMessageImpl extends OMD
"This is not allowed. Use set SOAPEnvelope instead");
}
- public void setFirstChild(OMNode firstChild) {
- throw new UnsupportedOperationException(
- "This is not allowed. Use set SOAPEnvelope instead");
- }
-
protected void internalSerialize(XMLStreamWriter writer, boolean cache,
boolean includeXMLDeclaration) throws XMLStreamException {
((OMNodeEx)getOMDocumentElement()).internalSerialize(writer, cache);
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java Mon Apr 23 10:26:45 2012
@@ -30,6 +30,7 @@ import org.apache.axiom.soap.SOAPFaultVa
import org.apache.axiom.soap.SOAPProcessingException;
import org.apache.axiom.soap.impl.llom.SOAPFaultCodeImpl;
+import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
@@ -97,4 +98,8 @@ public class SOAP11FaultCodeImpl extends
return null;
// throw new UnsupportedOperationException("getSubCode() not supported for SOAP 1.1 faults");
}
+
+ public void setValue(QName value) {
+ setText(value);
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java Mon Apr 23 10:26:45 2012
@@ -19,6 +19,8 @@
package org.apache.axiom.soap.impl.llom.soap11;
+import javax.xml.namespace.QName;
+
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.soap.SOAP12Constants;
@@ -88,4 +90,9 @@ public class SOAP11FaultSubCodeImpl exte
}
super.setValue(soapFaultSubCodeValue);
}
+
+ public void setValue(QName value) {
+ // TODO: AXIOM-394: SOAPFaultSubCode should not exist for SOAP 1.1
+ throw new UnsupportedOperationException();
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java Mon Apr 23 10:26:45 2012
@@ -88,4 +88,12 @@ public class SOAP12FaultCodeImpl extends
public SOAPFaultSubCode getSubCode() {
return (SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE);
}
+
+ public void setValue(QName value) {
+ SOAPFaultValue valueElement = getValue();
+ if (valueElement == null) {
+ valueElement = ((SOAPFactory)getOMFactory()).createSOAPFaultValue(this);
+ }
+ valueElement.setText(value);
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java Mon Apr 23 10:26:45 2012
@@ -19,6 +19,8 @@
package org.apache.axiom.soap.impl.llom.soap12;
+import javax.xml.namespace.QName;
+
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.soap.SOAP12Constants;
@@ -86,4 +88,12 @@ public class SOAP12FaultSubCodeImpl exte
}
super.setValue(soapFaultSubCodeValue);
}
+
+ public void setValue(QName value) {
+ SOAPFaultValue valueElement = getValue();
+ if (valueElement == null) {
+ valueElement = ((SOAPFactory)getOMFactory()).createSOAPFaultValue(this);
+ }
+ valueElement.setText(value);
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java Mon Apr 23 10:26:45 2012
@@ -22,7 +22,7 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory;
-import org.apache.axiom.ts.OMTestSuiteBuilder;
+import org.apache.axiom.ts.om.OMTestSuiteBuilder;
import org.apache.axiom.ts.om.builder.TestCreateOMBuilderFromDOMSource;
import org.apache.axiom.ts.om.container.TestSerialize;
import org.apache.axiom.ts.om.document.TestDigest;
@@ -32,15 +32,12 @@ import org.apache.axiom.ts.om.node.TestI
public class OMImplementationTest extends TestCase {
public static TestSuite suite() {
- OMTestSuiteBuilder builder = new OMTestSuiteBuilder(new OMLinkedListMetaFactory());
- // TODO: this looks like a bug
- builder.exclude(org.apache.axiom.ts.om.document.TestIsCompleteAfterAddingIncompleteChild.class);
-
+ OMTestSuiteBuilder builder = new OMTestSuiteBuilder(new OMLinkedListMetaFactory(), true);
// TODO: Axiom should throw an exception if an attempt is made to create a cyclic parent-child relationship
builder.exclude(TestInsertSiblingAfterOnChild.class);
builder.exclude(TestInsertSiblingBeforeOnChild.class);
- // WSCOMMONS-453
+ // AXIOM-201
builder.exclude(TestGetXMLStreamReaderWithOMSourcedElementDescendant.class);
// TODO: this case is not working because Axiom generates an XML declaration
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-integration/pom.xml?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-integration/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-integration/pom.xml Mon Apr 23 10:26:45 2012
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-parent</artifactId>
- <version>1.2.13-SNAPSHOT</version>
+ <version>1.2.14-SNAPSHOT</version>
<relativePath>../axiom-parent/pom.xml</relativePath>
</parent>
<artifactId>axiom-integration</artifactId>
@@ -58,7 +58,6 @@
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
- <version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -84,7 +83,6 @@
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
- <version>2.7.1</version>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-jaxen-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-jaxen-testsuite/pom.xml?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-jaxen-testsuite/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-jaxen-testsuite/pom.xml Mon Apr 23 10:26:45 2012
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-parent</artifactId>
- <version>1.2.13-SNAPSHOT</version>
+ <version>1.2.14-SNAPSHOT</version>
<relativePath>../axiom-parent/pom.xml</relativePath>
</parent>
<artifactId>axiom-jaxen-testsuite</artifactId>
@@ -48,20 +48,25 @@
<artifactId>junit</artifactId>
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- Source code, resources and license files from Jaxen (see LEGAL-74 & WSCOMMONS-545) -->
- <exclude>src/main/resources/xml/**</exclude>
- <exclude>src/main/java/org/jaxen/test/**</exclude>
- <exclude>src/main/resources/META-INF/LICENSE-JAXEN</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <profiles>
+ <profile>
+ <id>apache-release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <!-- Source code, resources and license files from Jaxen (see LEGAL-74 & WSCOMMONS-545) -->
+ <exclude>src/main/resources/xml/**</exclude>
+ <exclude>src/main/java/org/jaxen/test/**</exclude>
+ <exclude>src/main/resources/META-INF/LICENSE-JAXEN</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/pom.xml?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-osgi-tests/pom.xml Mon Apr 23 10:26:45 2012
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-parent</artifactId>
- <version>1.2.13-SNAPSHOT</version>
+ <version>1.2.14-SNAPSHOT</version>
<relativePath>../axiom-parent/pom.xml</relativePath>
</parent>
<artifactId>axiom-osgi-tests</artifactId>
@@ -48,10 +48,22 @@
<scope>provided</scope>
</dependency>
<dependency>
- <!-- An OSGI aware version of the StAX API -->
- <groupId>org.apache.servicemix.specs</groupId>
- <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
- <version>1.1.1</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-stax-api_1.2_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <!-- Used by geronimo-stax-api_1.2_spec to locate the StAX implementation;
+ only required in an OSGi environment -->
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-osgi-registry</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>1.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-parent/pom.xml?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-parent/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-parent/pom.xml Mon Apr 23 10:26:45 2012
@@ -27,7 +27,7 @@
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-parent</artifactId>
<name>Axiom Parent POM</name>
- <version>1.2.13-SNAPSHOT</version>
+ <version>1.2.14-SNAPSHOT</version>
<packaging>pom</packaging>
<description>Axiom Parent POM</description>
<url>http://ws.apache.org/axiom/</url>
@@ -297,30 +297,52 @@
<attach>true</attach>
</configuration>
</plugin>
+ <!-- We don't need to generate the site in sub-modules -->
<plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <executions>
- <execution>
- <phase>verify</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.0</version>
<configuration>
- <excludes>
- <!-- We can't add license headers to test resources -->
- <exclude>src/test/resources/**</exclude>
- <!-- Temporary file created by maven-shade-plugin -->
- <exclude>dependency-reduced-pom.xml</exclude>
- </excludes>
- </configuration>
+ <skip>true</skip>
+ </configuration>
</plugin>
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>apache-release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>0.8</version>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <excludes>
+ <!-- We can't add license headers to test resources -->
+ <exclude>src/test/resources/**</exclude>
+ <!-- Temporary file created by maven-shade-plugin -->
+ <exclude>dependency-reduced-pom.xml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
<dependencyManagement>
<dependencies>
+ <!-- We use the 1.0 version of the StAX API as Maven dependency (because
+ we need to ensure compatibility with that StAX version), but we need
+ the 1.2 version because Geronimo's 1.0 bundles are not fully OSGi aware
+ (they don't locate StAX implementations that are deployed as bundles). -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-stax-api_1.0_spec</artifactId>
@@ -328,13 +350,19 @@
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-stax-api_1.2_spec</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-activation_1.1_spec</artifactId>
- <version>1.0.2</version>
+ <version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
- <version>1.6</version>
+ <version>1.7.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -369,7 +397,7 @@
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
- <version>1.1.1</version>
+ <version>1.1.3</version>
<exclusions>
<exclusion>
<artifactId>dom4j</artifactId>
@@ -395,6 +423,16 @@
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
+ <!-- No, this is not a mistake: Jaxen 1.1.3 indeed has dependencies
+ on these plugins in scope compile! -->
+ <exclusion>
+ <groupId>maven-plugins</groupId>
+ <artifactId>maven-cobertura-plugin</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>maven-plugins</groupId>
+ <artifactId>maven-findbugs-plugin</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -420,23 +458,15 @@
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
- <version>1.1</version>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.1</version>
</dependency>
</dependencies>
</dependencyManagement>
- <reporting>
- <plugins>
- <!-- We don't need to generate the site in sub-modules;
- skip report generation -->
- <plugin>
- <artifactId>maven-site-plugin</artifactId>
- <version>2.0.1</version>
- <configuration>
- <generateReports>false</generateReports>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
<distributionManagement>
<site>
<id>website</id>
@@ -446,8 +476,8 @@
<properties>
<osgi.version>4.2.0</osgi.version>
<stax.impl.groupid>org.codehaus.woodstox</stax.impl.groupid>
- <stax.impl.artifact>wstx-asl</stax.impl.artifact>
- <stax.impl.version>3.2.9</stax.impl.version>
+ <stax.impl.artifact>woodstox-core-asl</stax.impl.artifact>
+ <stax.impl.version>4.1.2</stax.impl.version>
<failIfNoTests>false</failIfNoTests>
<!--
<stax.impl.groupid>com.sun.xml.stream</stax.impl.groupid>
@@ -459,6 +489,6 @@
<stax.impl.artifact>stax</stax.impl.artifact>
<stax.impl.version>1.2.0</stax.impl.version>
-->
- <shade.plugin.version>1.4</shade.plugin.version>
+ <shade.plugin.version>1.6</shade.plugin.version>
</properties>
</project>
Propchange: webservices/axiom/branches/AXIOM-201/modules/axiom-samples/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Apr 23 10:26:45 2012
@@ -0,0 +1,4 @@
+.classpath
+.project
+target
+.settings
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-tests/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-tests/pom.xml?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-tests/pom.xml (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-tests/pom.xml Mon Apr 23 10:26:45 2012
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-parent</artifactId>
- <version>1.2.13-SNAPSHOT</version>
+ <version>1.2.14-SNAPSHOT</version>
<relativePath>../axiom-parent/pom.xml</relativePath>
</parent>
<artifactId>axiom-tests</artifactId>
@@ -58,6 +58,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <!-- TODO: eliminate this dependency -->
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-compat</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
</dependency>
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java Mon Apr 23 10:26:45 2012
@@ -20,13 +20,15 @@
package org.apache.axiom.attachments;
import org.apache.axiom.om.AbstractTestCase;
+import org.apache.axiom.om.MIMEResource;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.TestConstants;
import org.apache.axiom.om.impl.MIMEOutputUtils;
import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
-import org.apache.axiom.om.impl.builder.XOPAwareStAXOMBuilder;
+import org.apache.axiom.om.util.StAXParserConfiguration;
import org.apache.axiom.soap.SOAPModelBuilder;
import java.io.ByteArrayInputStream;
@@ -40,18 +42,12 @@ public class AttachmentsTest extends Abs
super(testName);
}
- String img1FileName = "mtom/img/test.jpg";
- String img2FileName = "mtom/img/test2.jpg";
- String inSWAFileName = "soap/soap11/SWAAttachmentStream.txt";
-
- String contentTypeString =
- "multipart/related; boundary=\"MIMEBoundaryurn:uuid:A3ADBAEE51A1A87B2A11443668160701\"; type=\"application/xop+xml\"; start=\"<0....@apache.org>\"; start-info=\"application/soap+xml\"; charset=UTF-8;action=\"mtomSample\"";
-
public void testWritingBinaryAttachments() throws Exception {
+ MIMEResource testMessage = TestConstants.MTOM_MESSAGE;
// Read in message: SOAPPart and 2 image attachments
- InputStream inStream = getTestResource(TestConstants.MTOM_MESSAGE);
- Attachments attachments = new Attachments(inStream, TestConstants.MTOM_MESSAGE_CONTENT_TYPE);
+ InputStream inStream = getTestResource(testMessage.getName());
+ Attachments attachments = new Attachments(inStream, testMessage.getContentType());
attachments.getRootPartInputStream();
@@ -59,16 +55,15 @@ public class AttachmentsTest extends Abs
OMOutputFormat oof = new OMOutputFormat();
oof.setDoOptimize(true);
- oof.setMimeBoundary(TestConstants.MTOM_MESSAGE_BOUNDARY);
- oof.setRootContentId(TestConstants.MTOM_MESSAGE_START);
+ oof.setMimeBoundary(testMessage.getBoundary());
+ oof.setRootContentId(testMessage.getStart());
// Write out the message
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(baos, oof);
- XOPAwareStAXOMBuilder builder =
- new XOPAwareStAXOMBuilder(attachments.getRootPartInputStream(),
- attachments);
+ OMXMLParserWrapper builder =
+ OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments);
OMElement om = builder.getDocumentElement();
om.serialize(writer);
om.close(false);
@@ -83,8 +78,7 @@ public class AttachmentsTest extends Abs
Boolean.TRUE);
writer = new MTOMXMLStreamWriter(baos, oof);
builder =
- new XOPAwareStAXOMBuilder(attachments.getRootPartInputStream(),
- attachments);
+ OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments);
om = builder.getDocumentElement();
om.serialize(writer);
om.close(false);
@@ -98,7 +92,7 @@ public class AttachmentsTest extends Abs
// Now read the data back in
InputStream is = new ByteArrayInputStream(outBase64.getBytes());
- Attachments attachments2 = new Attachments(is, TestConstants.MTOM_MESSAGE_CONTENT_TYPE);
+ Attachments attachments2 = new Attachments(is, testMessage.getContentType());
// Now write it back out with binary...
baos = new ByteArrayOutputStream();
@@ -106,8 +100,7 @@ public class AttachmentsTest extends Abs
Boolean.FALSE);
writer = new MTOMXMLStreamWriter(baos, oof);
builder =
- new XOPAwareStAXOMBuilder(attachments2.getRootPartInputStream(),
- attachments2);
+ OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments2);
om = builder.getDocumentElement();
om.serialize(writer);
om.close(false);
@@ -117,13 +110,14 @@ public class AttachmentsTest extends Abs
// Now do it again but use base64 content-type-encoding for
// binary attachments
+ is = new ByteArrayInputStream(outBase64.getBytes());
+ attachments2 = new Attachments(is, testMessage.getContentType());
baos = new ByteArrayOutputStream();
oof.setProperty(OMOutputFormat.USE_CTE_BASE64_FOR_NON_TEXTUAL_ATTACHMENTS,
Boolean.TRUE);
writer = new MTOMXMLStreamWriter(baos, oof);
builder =
- new XOPAwareStAXOMBuilder(attachments2.getRootPartInputStream(),
- attachments2);
+ OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments2);
om = builder.getDocumentElement();
om.serialize(writer);
om.close(false);
@@ -138,8 +132,8 @@ public class AttachmentsTest extends Abs
public void testSWAWriteWithIncomingOrder() throws Exception {
// Read the stream that has soap xml followed by BAttachment then AAttachment
- InputStream inStream = getTestResource(inSWAFileName);
- Attachments attachments = new Attachments(inStream, contentTypeString);
+ InputStream inStream = getTestResource(TestConstants.SWA_MESSAGE.getName());
+ Attachments attachments = new Attachments(inStream, TestConstants.SWA_MESSAGE.getContentType());
// Get the contentIDs to force the reading
String[] contentIDs = attachments.getAllContentIDs();
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java Mon Apr 23 10:26:45 2012
@@ -20,11 +20,7 @@
package org.apache.axiom.om;
import org.apache.axiom.om.util.StAXUtils;
-import org.apache.axiom.om.xpath.AXIOMXPath;
import org.custommonkey.xmlunit.XMLTestCase;
-import org.jaxen.JaxenException;
-import org.jaxen.SimpleNamespaceContext;
-import org.jaxen.XPath;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
@@ -90,21 +86,21 @@ public class DefaultNSHandlingTest exten
// e.printStackTrace();
// }
// }
-
-
- private OMElement getOMElement(String xpathString,
- OMElement parentElement) throws JaxenException {
- XPath xpath = getXPath(xpathString);
- return (OMElement) xpath.selectSingleNode(parentElement);
- }
-
- private XPath getXPath(String xpathString) throws JaxenException {
- SimpleNamespaceContext nsCtx = new SimpleNamespaceContext();
- nsCtx.addNamespace("ns", "http://geronimo.apache.org/xml/ns/j2ee/connector-1.1");
- XPath xpath = new AXIOMXPath(xpathString);
- xpath.setNamespaceContext(nsCtx);
- return xpath;
- }
+//
+//
+// private OMElement getOMElement(String xpathString,
+// OMElement parentElement) throws JaxenException {
+// XPath xpath = getXPath(xpathString);
+// return (OMElement) xpath.selectSingleNode(parentElement);
+// }
+//
+// private XPath getXPath(String xpathString) throws JaxenException {
+// SimpleNamespaceContext nsCtx = new SimpleNamespaceContext();
+// nsCtx.addNamespace("ns", "http://geronimo.apache.org/xml/ns/j2ee/connector-1.1");
+// XPath xpath = new AXIOMXPath(xpathString);
+// xpath.setNamespaceContext(nsCtx);
+// return xpath;
+// }
public static void main(String[] args) {
try {
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java Mon Apr 23 10:26:45 2012
@@ -19,7 +19,7 @@
package org.apache.axiom.om;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
+import org.apache.axiom.om.util.AXIOMUtil;
import org.apache.axiom.om.util.StAXUtils;
import org.custommonkey.xmlunit.XMLTestCase;
import org.xml.sax.SAXException;
@@ -27,9 +27,7 @@ import org.xml.sax.SAXException;
import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@@ -116,18 +114,6 @@ public class NamespaceTest extends XMLTe
assertTrue(documentElement.toStringWithConsume().indexOf("ns2:ChildElement") > -1);
}
- public void testNamespaceProblem4() throws Exception {
- String xml =
- "<getCreditScoreResponse xmlns=\"http://www.example.org/creditscore/doclitwrapped/\"><score xmlns=\"\">750</score></getCreditScoreResponse>";
- XMLStreamReader parser = StAXUtils.createXMLStreamReader(
- new ByteArrayInputStream(xml.getBytes()));
- OMXMLParserWrapper builder =
- OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), parser);
- OMElement root = builder.getDocumentElement();
- String actualXML = root.toString();
- assertTrue(actualXML.indexOf("xmlns=\"\"") != -1);
- }
-
public void testNamespaceProblem5() {
String xml =
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header /><soapenv:Body><ns1:createAccountRequest xmlns:ns1=\"http://www.wso2.com/types\"><clientinfo xmlns=\"http://www.wso2.com/types\"><name>bob</name><ssn>123456789</ssn></clientinfo><password xmlns=\"\">passwd</password></ns1:createAccountRequest></soapenv:Body></soapenv:Envelope>";
@@ -172,7 +158,7 @@ public class NamespaceTest extends XMLTe
}
/**
- * This is re-producing and testing the bug mentioned in http://issues.apache.org/jira/browse/WSCOMMONS-74
+ * This is re-producing and testing the bug mentioned in http://issues.apache.org/jira/browse/AXIOM-35
*/
public void testNamespaceProblem7() throws Exception {
@@ -207,7 +193,7 @@ public class NamespaceTest extends XMLTe
}
/**
- * This is re-producing and testing the bug mentioned in http://issues.apache.org/jira/browse/WSCOMMONS-74
+ * This is re-producing and testing the bug mentioned in http://issues.apache.org/jira/browse/AXIOM-35
*/
public void testNamespaceProblem8() throws Exception {
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBodyTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBodyTest.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBodyTest.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBodyTest.java Mon Apr 23 10:26:45 2012
@@ -67,16 +67,14 @@ public class OMBodyTest extends OMTestCa
soapBody.addChild(om1); // NOOP..Expected behavior: child removed and then added
soapBody.addChild(om2);
- OMElement node = (OMElement) soapBody.
- getFirstChildWithName(new QName("http://myChild", "child1"));
+ OMElement node = soapBody.getFirstChildWithName(new QName("http://myChild", "child1"));
node = (OMElement) node.detach();
assertTrue("Node is missing", node != null);
assertTrue("Node has the wrong name " + node.getLocalName(),
node.getLocalName().equals("child1"));
- node = (OMElement) soapBody.
- getFirstChildWithName(new QName("http://myChild", "child2"));
+ node = soapBody.getFirstChildWithName(new QName("http://myChild", "child2"));
assertTrue("Node is missing", node != null);
assertTrue("Node has the wrong name " + node.getLocalName(),
node.getLocalName().equals("child2"));
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java?rev=1329164&r1=1329163&r2=1329164&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java Mon Apr 23 10:26:45 2012
@@ -30,7 +30,7 @@ public class OMDTDTest extends AbstractT
protected void setUp() throws Exception {
try {
OMXMLParserWrapper stAXOMBuilder = OMXMLBuilderFactory.createOMBuilder(getTestResource("dtd.xml"));
- document = this.document = stAXOMBuilder.getDocument();
+ document = stAXOMBuilder.getDocument();
} catch (Exception e) {
e.printStackTrace();
}