You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ru...@apache.org on 2006/01/10 08:54:32 UTC
svn commit: r367519 [5/5] - in /webservices/axis2/trunk/java/modules:
doom/src/org/apache/axis2/om/impl/dom/
doom/src/org/apache/axis2/om/impl/dom/factory/
doom/src/org/apache/axis2/om/impl/dom/jaxp/
integration/test/org/apache/axis2/security/
Modified: webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/TextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/TextImpl.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/TextImpl.java (original)
+++ webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/TextImpl.java Mon Jan 9 23:53:43 2006
@@ -36,26 +36,23 @@
public class TextImpl extends CharacterImpl implements Text, OMText {
-
- private String mimeType;
-
- private boolean optimize;
-
- private boolean isBinary;
+ private String mimeType;
+
+ private boolean optimize;
+
+ private boolean isBinary;
/**
- *
+ *
*/
private String contentID = null;
/**
- * Field dataHandler contains the DataHandler.
- * Declaring as Object to remove the dependency on
- * Javax.activation.DataHandler
+ * Field dataHandler contains the DataHandler. Declaring as Object to remove
+ * the dependency on Javax.activation.DataHandler
*/
private Object dataHandlerObject = null;
-
/**
* Field nameSpace is used when serializing Binary stuff as MTOM optimized.
*/
@@ -71,50 +68,52 @@
* Field attribute is used when serializing Binary stuff as MTOM optimized.
*/
protected OMAttribute attribute;
-
-
- /**
- * Creates a text node with the given text required by the OMDOMFactory.
- * The owner document should be set properly when appending this to a DOM tree.
- * @param text
- */
- public TextImpl(String text) {
- this.textValue = new StringBuffer(text);
- this.done = true;
- }
-
+
+ /**
+ * Creates a text node with the given text required by the OMDOMFactory. The
+ * owner document should be set properly when appending this to a DOM tree.
+ *
+ * @param text
+ */
+ public TextImpl(String text) {
+ this.textValue = new StringBuffer(text);
+ this.done = true;
+ }
+
/**
* @param contentID
* @param parent
- * @param builder Used when the builder is encountered with a XOP:Include tag
- * Stores a reference to the builder and the content-id. Supports
- * deffered parsing of MIME messages
+ * @param builder
+ * Used when the builder is encountered with a XOP:Include tag
+ * Stores a reference to the builder and the content-id. Supports
+ * deffered parsing of MIME messages
*/
public TextImpl(String contentID, OMElement parent,
- OMXMLParserWrapper builder) {
- super((DocumentImpl)((ParentNode)parent).getOwnerDocument());
+ OMXMLParserWrapper builder) {
+ super((DocumentImpl) ((ParentNode) parent).getOwnerDocument());
this.contentID = contentID;
this.optimize = true;
this.isBinary = true;
this.done = true;
this.builder = builder;
}
-
- public TextImpl(String text, String mimeType, boolean optimize) {
- this(text,mimeType,optimize,true);
- }
-
- public TextImpl(String text, String mimeType, boolean optimize, boolean isBinary) {
- this(text);
- this.mimeType = mimeType;
- this.optimize = optimize;
- this.isBinary = isBinary;
- }
-
+
+ public TextImpl(String text, String mimeType, boolean optimize) {
+ this(text, mimeType, optimize, true);
+ }
+
+ public TextImpl(String text, String mimeType, boolean optimize,
+ boolean isBinary) {
+ this(text);
+ this.mimeType = mimeType;
+ this.optimize = optimize;
+ this.isBinary = isBinary;
+ }
/**
* @param dataHandler
- * @param optimize To send binary content. Created progrmatically.
+ * @param optimize
+ * To send binary content. Created progrmatically.
*/
public TextImpl(Object dataHandler, boolean optimize) {
this.dataHandlerObject = dataHandler;
@@ -122,126 +121,130 @@
this.optimize = optimize;
done = true;
}
-
- /**
- * @param ownerNode
- */
- public TextImpl(DocumentImpl ownerNode) {
- super(ownerNode);
- this.done =true;
- }
-
- /**
- * @param ownerNode
- * @param value
- */
- public TextImpl(DocumentImpl ownerNode, String value) {
- super(ownerNode, value);
- this.done = true;
- }
-
- /**
- * @param ownerNode
- * @param value
- */
- public TextImpl(DocumentImpl ownerNode, String value, String mimeType, boolean optimize) {
- this(ownerNode,value);
- this.mimeType = mimeType;
- this.optimize = optimize;
+
+ /**
+ * @param ownerNode
+ */
+ public TextImpl(DocumentImpl ownerNode) {
+ super(ownerNode);
+ this.done = true;
+ }
+
+ /**
+ * @param ownerNode
+ * @param value
+ */
+ public TextImpl(DocumentImpl ownerNode, String value) {
+ super(ownerNode, value);
+ this.done = true;
+ }
+
+ /**
+ * @param ownerNode
+ * @param value
+ */
+ public TextImpl(DocumentImpl ownerNode, String value, String mimeType,
+ boolean optimize) {
+ this(ownerNode, value);
+ this.mimeType = mimeType;
+ this.optimize = optimize;
this.isBinary = true;
done = true;
- }
+ }
+
+ /**
+ * Breaks this node into two nodes at the specified offset, keeping both in
+ * the tree as siblings. After being split, this node will contain all the
+ * content up to the offset point. A new node of the same type, which
+ * contains all the content at and after the offset point, is returned. If
+ * the original node had a parent node, the new node is inserted as the next
+ * sibling of the original node. When the offset is equal to the length of
+ * this node, the new node has no data.
+ */
+ public Text splitText(int offset) throws DOMException {
+ if (this.isReadonly()) {
+ throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "NO_MODIFICATION_ALLOWED_ERR", null));
+ }
+ if (offset < 0 || offset > this.textValue.length()) {
+ throw new DOMException(DOMException.INDEX_SIZE_ERR,
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN, "INDEX_SIZE_ERR",
+ null));
+ }
+ String newValue = this.textValue.substring(offset);
+ this.deleteData(offset, this.textValue.length());
+
+ TextImpl newText = (TextImpl) this.getOwnerDocument().createTextNode(
+ newValue);
+
+ if (this.parentNode != null) {
+ newText.setParent(this.parentNode);
+ }
+
+ this.insertSiblingAfter(newText);
+
+ return newText;
+ }
+
+ // /
+ // /org.w3c.dom.Node methods
+ // /
+ public String getNodeName() {
+ return "#text";
+ }
+
+ public short getNodeType() {
+ return Node.TEXT_NODE;
+ }
+
+ // /
+ // /OMNode methods
+ // /
-
- /**
- * Breaks this node into two nodes at the specified offset, keeping both
- * in the tree as siblings. After being split, this node will contain all
- * the content up to the offset point. A new node of the same type, which
- * contains all the content at and after the offset point, is returned. If
- * the original node had a parent node, the new node is inserted as the
- * next sibling of the original node. When the offset is equal to the
- * length of this node, the new node has no data.
- */
- public Text splitText(int offset) throws DOMException {
- if (this.isReadonly()) {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "NO_MODIFICATION_ALLOWED_ERR", null));
- }
- if(offset < 0 || offset > this.textValue.length()) {
- throw new DOMException(DOMException.INDEX_SIZE_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN, "INDEX_SIZE_ERR",
- null));
- }
- String newValue = this.textValue.substring(offset);
- this.deleteData(offset, this.textValue.length());
-
- TextImpl newText = (TextImpl)this.getOwnerDocument().createTextNode(newValue);
-
- if(this.parentNode != null) {
- newText.setParent(this.parentNode);
- }
-
- this.insertSiblingAfter(newText);
-
-
- return newText;
- }
-
- ///
- ///org.w3c.dom.Node methods
- ///
- public String getNodeName() {
- return "#text";
- }
- public short getNodeType() {
- return Node.TEXT_NODE;
- }
-
-
- ///
- ///OMNode methods
- ///
-
-
-
- /* (non-Javadoc)
- * @see org.apache.axis2.om.OMNode#getType()
- */
- public int getType() throws OMException {
- return Node.TEXT_NODE;
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis2.om.OMNode#setType(int)
- */
- public void setType(int nodeType) throws OMException {
- //do not do anything here
- //Its not clear why we should let someone change the type of a node
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.axis2.om.OMNode#serialize(org.apache.axis2.om.OMOutput)
- */
- public void serialize(OMOutputImpl omOutput) throws XMLStreamException {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.axis2.om.OMNode#getType()
+ */
+ public int getType() throws OMException {
+ return Node.TEXT_NODE;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.axis2.om.OMNode#setType(int)
+ */
+ public void setType(int nodeType) throws OMException {
+ // do not do anything here
+ // Its not clear why we should let someone change the type of a node
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.axis2.om.OMNode#serialize(org.apache.axis2.om.OMOutput)
+ */
+ public void serialize(OMOutputImpl omOutput) throws XMLStreamException {
serializeLocal(omOutput);
- }
-
- public void serializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException {
+ }
+
+ public void serializeAndConsume(OMOutputImpl omOutput)
+ throws XMLStreamException {
serializeLocal(omOutput);
- }
+ }
+
+ public boolean isOptimized() {
+ return this.optimize;
+ }
+
+ public void setOptimize(boolean value) {
+ this.optimize = value;
+ }
- public boolean isOptimized() {
- return this.optimize;
- }
-
- public void setOptimize(boolean value) {
- this.optimize = value;
- }
-
public void discard() throws OMException {
if (done) {
this.detach();
@@ -249,10 +252,10 @@
builder.discard((OMElement) this.parentNode);
}
}
-
+
/**
* Writes the relevant output.
- *
+ *
* @param omOutput
* @throws XMLStreamException
*/
@@ -268,25 +271,24 @@
}
}
-
- public String getText() {
- if (this.textValue!= null) {
+ public String getText() {
+ if (this.textValue != null) {
return this.textValue.toString();
} else {
try {
InputStream inStream;
inStream = this.getInputStream();
- //int x = inStream.available();
+ // int x = inStream.available();
byte[] data;
StringBuffer text = new StringBuffer();
do {
- data = new byte[1024];
- int len;
- while((len = inStream.read(data)) > 0) {
- byte[] temp = new byte[len];
- System.arraycopy(data,0,temp,0,len);
- text.append(Base64.encode(temp));
- }
+ data = new byte[1024];
+ int len;
+ while ((len = inStream.read(data)) > 0) {
+ byte[] temp = new byte[len];
+ System.arraycopy(data, 0, temp, 0, len);
+ text.append(Base64.encode(temp));
+ }
} while (inStream.available() > 0);
return text.toString();
@@ -294,26 +296,27 @@
throw new OMException(e);
}
}
- }
-
- public String getNodeValue() throws DOMException {
- return this.getText();
- }
-
- public String getContentID() {
+ }
+
+ public String getNodeValue() throws DOMException {
+ return this.getText();
+ }
+
+ public String getContentID() {
if (contentID == null) {
- contentID = UUIDGenerator.getUUID()
- + "@apache.org";
+ contentID = UUIDGenerator.getUUID() + "@apache.org";
}
return this.contentID;
- }
- public Object getDataHandler() {
+ }
+
+ public Object getDataHandler() {
/*
* this should return a DataHandler containing the binary data
* reperesented by the Base64 strings stored in OMText
*/
if (textValue != null & isBinary) {
- return org.apache.axis2.attachments.DataHandlerUtils.getDataHandlerFromText(textValue.toString() ,mimeType);
+ return org.apache.axis2.attachments.DataHandlerUtils
+ .getDataHandlerFromText(textValue.toString(), mimeType);
} else {
if (dataHandlerObject == null) {
@@ -324,9 +327,8 @@
.getDataHandler(contentID);
}
return dataHandlerObject;
- }
- }
-
+ }
+ }
public java.io.InputStream getInputStream() throws OMException {
if (isBinary) {
@@ -334,7 +336,7 @@
getDataHandler();
}
InputStream inStream;
- javax.activation.DataHandler dataHandler = (javax.activation.DataHandler)dataHandlerObject;
+ javax.activation.DataHandler dataHandler = (javax.activation.DataHandler) dataHandlerObject;
try {
inStream = dataHandler.getDataSource().getInputStream();
} catch (IOException e) {
@@ -346,9 +348,9 @@
throw new OMException("Unsupported Operation");
}
}
-
-
- private void serializeLocal(OMOutputImpl omOutput) throws XMLStreamException {
+
+ private void serializeLocal(OMOutputImpl omOutput)
+ throws XMLStreamException {
if (!this.isBinary) {
writeOutput(omOutput);
} else {
@@ -364,10 +366,9 @@
omOutput.getXmlStreamWriter().writeEndElement();
} else {
omOutput.getXmlStreamWriter().writeCharacters(this.getText());
- }
+ }
}
}
-
/*
* Methods to copy from OMSerialize utils.
@@ -391,8 +392,8 @@
if (prefix != null) {
writer.writeStartElement(prefix, this.getLocalName(),
nameSpaceName);
- //TODO FIX ME
- //writer.writeNamespace(prefix, nameSpaceName);
+ // TODO FIX ME
+ // writer.writeNamespace(prefix, nameSpaceName);
writer.setPrefix(prefix, nameSpaceName);
} else {
writer.writeStartElement(nameSpaceName, this
@@ -415,7 +416,7 @@
/**
* Method serializeAttribute.
- *
+ *
* @param attr
* @param omOutput
* @throws XMLStreamException
@@ -439,13 +440,15 @@
.getAttributeValue());
}
} else {
- writer.writeAttribute(attr.getLocalName(), attr.getAttributeValue());
+ writer
+ .writeAttribute(attr.getLocalName(), attr
+ .getAttributeValue());
}
}
/**
* Method serializeNamespace.
- *
+ *
* @param namespace
* @param omOutput
* @throws XMLStreamException
@@ -461,36 +464,33 @@
}
}
-
public Node cloneNode(boolean deep) {
- TextImpl textImpl = new TextImpl(this.textValue.toString());
- textImpl.setOwnerDocument(this.ownerNode);
- return textImpl;
- }
-
- /*
- * DOM-Level 3 methods
- */
-
- public String getWholeText() {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public boolean isElementContentWhitespace() {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public Text replaceWholeText(String arg0) throws DOMException {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
-
- public String toString() {
- return (this.textValue != null)?textValue.toString() : "";
- }
-
-
+ TextImpl textImpl = new TextImpl(this.textValue.toString());
+ textImpl.setOwnerDocument(this.ownerNode);
+ return textImpl;
+ }
+
+ /*
+ * DOM-Level 3 methods
+ */
+
+ public String getWholeText() {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public boolean isElementContentWhitespace() {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public Text replaceWholeText(String arg0) throws DOMException {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public String toString() {
+ return (this.textValue != null) ? textValue.toString() : "";
+ }
+
}
Modified: webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java (original)
+++ webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java Mon Jan 9 23:53:43 2006
@@ -42,129 +42,150 @@
import javax.xml.namespace.QName;
public class OMDOMFactory implements OMFactory {
-
- protected DocumentImpl document;
-
- public OMDOMFactory() {}
-
- public OMDOMFactory(DocumentImpl doc) {
- this.document = doc;
- }
-
- public OMDocument createOMDocument() {
- if(this.document == null)
- this.document = new DocumentImpl();
-
- return this.document;
- }
-
- /**
- * Configure this factory to use the given document.
- * Use with care.
- * @param document
- */
- public void setDocument(DocumentImpl document) {
- this.document = document;
- }
-
- public OMElement createOMElement(String localName, OMNamespace ns) {
- return new ElementImpl((DocumentImpl)this.createOMDocument(), localName, (NamespaceImpl)ns);
- }
-
- public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) throws OMDOMException{
- switch(((ParentNode)parent).getNodeType()) {
- case Node.ELEMENT_NODE : // We are adding a new child to an elem
- ElementImpl parentElem = (ElementImpl)parent;
- ElementImpl elem = new ElementImpl((DocumentImpl)parentElem.getOwnerDocument(),localName,(NamespaceImpl)ns);
- parentElem.appendChild(elem);
- return elem;
-
- case Node.DOCUMENT_NODE :
- DocumentImpl docImpl = (DocumentImpl) parent;
- ElementImpl elem2 = new ElementImpl(docImpl,localName,(NamespaceImpl)ns);
- return elem2;
-
- case Node.DOCUMENT_FRAGMENT_NODE :
- DocumentFragmentimpl docFragImpl = (DocumentFragmentimpl)parent;
- ElementImpl elem3 = new ElementImpl((DocumentImpl)docFragImpl.getOwnerDocument(),localName, (NamespaceImpl)ns);
- return elem3;
- default:
- throw new OMDOMException("The parent container can only be an ELEMENT, DOCUMENT or a DOCUMENT FRAGMENT");
- }
- }
-
- /**
- * Creates an OMElement with the builder.
- */
- public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent, OMXMLParserWrapper builder) {
- switch(((ParentNode)parent).getNodeType()) {
- case Node.ELEMENT_NODE: // We are adding a new child to an elem
- ElementImpl parentElem = (ElementImpl) parent;
- ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
- .getOwnerDocument(), localName, (NamespaceImpl) ns, builder);
- parentElem.appendChild(elem);
- return elem;
- case Node.DOCUMENT_NODE:
- DocumentImpl docImpl = (DocumentImpl) parent;
- ElementImpl elem2 = new ElementImpl(docImpl, localName,
- (NamespaceImpl) ns, builder);
- docImpl.appendChild(elem2);
- return elem2;
-
- case Node.DOCUMENT_FRAGMENT_NODE:
- DocumentFragmentimpl docFragImpl = (DocumentFragmentimpl) parent;
- ElementImpl elem3 = new ElementImpl((DocumentImpl) docFragImpl
- .getOwnerDocument(), localName, (NamespaceImpl) ns, builder);
- return elem3;
- default:
- throw new OMDOMException(
- "The parent container can only be an ELEMENT, DOCUMENT or a DOCUMENT FRAGMENT");
- }
- }
-
- /**
- * Creates an OMElement.
- * @see org.apache.axis2.om.OMFactory#createOMElement(java.lang.String, java.lang.String, java.lang.String)
- */
- public OMElement createOMElement(String localName, String namespaceURI, String namespacePrefix) {
- NamespaceImpl ns = new NamespaceImpl(namespaceURI,namespacePrefix);
- return this.createOMElement(localName, ns);
- }
-
- /**
- * Creates a new OMDOM Element node and adds it to the given parent.
- * @see #createOMElement(String, OMNamespace, OMContainer)
- * @see org.apache.axis2.om.OMFactory#createOMElement(javax.xml.namespace.QName, org.apache.axis2.om.OMContainer)
- */
- public OMElement createOMElement(QName qname, OMContainer parent) throws OMException {
- NamespaceImpl ns;
- if(qname.getPrefix() != null) {
- ns = new NamespaceImpl(qname.getNamespaceURI(), qname.getPrefix());
- } else {
- ns = new NamespaceImpl(qname.getNamespaceURI());
- }
- return createOMElement(qname.getLocalPart(),ns,parent);
- }
-
- /**
- * Creates a new OMNamespace.
- * @see org.apache.axis2.om.OMFactory#createOMNamespace(java.lang.String, java.lang.String)
- */
- public OMNamespace createOMNamespace(String uri, String prefix) {
- return new NamespaceImpl(uri,prefix);
- }
-
- /**
- * Creates a new OMDOM Text node with the given value and appends it to the
- * given parent element.
- * @see org.apache.axis2.om.OMFactory#createText(org.apache.axis2.om.OMElement, java.lang.String)
- */
- public OMText createText(OMElement parent, String text) {
- ElementImpl parentElem = (ElementImpl) parent;
- TextImpl txt = new TextImpl((DocumentImpl) parentElem.getOwnerDocument(), text);
- parentElem.addChild(txt);
- return txt;
- }
+
+ protected DocumentImpl document;
+
+ public OMDOMFactory() {
+ }
+
+ public OMDOMFactory(DocumentImpl doc) {
+ this.document = doc;
+ }
+
+ public OMDocument createOMDocument() {
+ if (this.document == null)
+ this.document = new DocumentImpl();
+
+ return this.document;
+ }
+
+ /**
+ * Configure this factory to use the given document. Use with care.
+ *
+ * @param document
+ */
+ public void setDocument(DocumentImpl document) {
+ this.document = document;
+ }
+
+ public OMElement createOMElement(String localName, OMNamespace ns) {
+ return new ElementImpl((DocumentImpl) this.createOMDocument(),
+ localName, (NamespaceImpl) ns);
+ }
+
+ public OMElement createOMElement(String localName, OMNamespace ns,
+ OMContainer parent) throws OMDOMException {
+ switch (((ParentNode) parent).getNodeType()) {
+ case Node.ELEMENT_NODE: // We are adding a new child to an elem
+ ElementImpl parentElem = (ElementImpl) parent;
+ ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
+ .getOwnerDocument(), localName, (NamespaceImpl) ns);
+ parentElem.appendChild(elem);
+ return elem;
+
+ case Node.DOCUMENT_NODE:
+ DocumentImpl docImpl = (DocumentImpl) parent;
+ ElementImpl elem2 = new ElementImpl(docImpl, localName,
+ (NamespaceImpl) ns);
+ return elem2;
+
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ DocumentFragmentimpl docFragImpl = (DocumentFragmentimpl) parent;
+ ElementImpl elem3 = new ElementImpl((DocumentImpl) docFragImpl
+ .getOwnerDocument(), localName, (NamespaceImpl) ns);
+ return elem3;
+ default:
+ throw new OMDOMException(
+ "The parent container can only be an ELEMENT, DOCUMENT " +
+ "or a DOCUMENT FRAGMENT");
+ }
+ }
+
+ /**
+ * Creates an OMElement with the builder.
+ */
+ public OMElement createOMElement(String localName, OMNamespace ns,
+ OMContainer parent, OMXMLParserWrapper builder) {
+ switch (((ParentNode) parent).getNodeType()) {
+ case Node.ELEMENT_NODE: // We are adding a new child to an elem
+ ElementImpl parentElem = (ElementImpl) parent;
+ ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
+ .getOwnerDocument(), localName, (NamespaceImpl) ns, builder);
+ parentElem.appendChild(elem);
+ return elem;
+ case Node.DOCUMENT_NODE:
+ DocumentImpl docImpl = (DocumentImpl) parent;
+ ElementImpl elem2 = new ElementImpl(docImpl, localName,
+ (NamespaceImpl) ns, builder);
+ docImpl.appendChild(elem2);
+ return elem2;
+
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ DocumentFragmentimpl docFragImpl = (DocumentFragmentimpl) parent;
+ ElementImpl elem3 = new ElementImpl((DocumentImpl) docFragImpl
+ .getOwnerDocument(), localName, (NamespaceImpl) ns, builder);
+ return elem3;
+ default:
+ throw new OMDOMException(
+ "The parent container can only be an ELEMENT, DOCUMENT " +
+ "or a DOCUMENT FRAGMENT");
+ }
+ }
+
+ /**
+ * Creates an OMElement.
+ *
+ * @see org.apache.axis2.om.OMFactory#createOMElement(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public OMElement createOMElement(String localName, String namespaceURI,
+ String namespacePrefix) {
+ NamespaceImpl ns = new NamespaceImpl(namespaceURI, namespacePrefix);
+ return this.createOMElement(localName, ns);
+ }
+
+ /**
+ * Creates a new OMDOM Element node and adds it to the given parent.
+ *
+ * @see #createOMElement(String, OMNamespace, OMContainer)
+ * @see org.apache.axis2.om.OMFactory#createOMElement(
+ * javax.xml.namespace.QName, org.apache.axis2.om.OMContainer)
+ */
+ public OMElement createOMElement(QName qname, OMContainer parent)
+ throws OMException {
+ NamespaceImpl ns;
+ if (qname.getPrefix() != null) {
+ ns = new NamespaceImpl(qname.getNamespaceURI(), qname.getPrefix());
+ } else {
+ ns = new NamespaceImpl(qname.getNamespaceURI());
+ }
+ return createOMElement(qname.getLocalPart(), ns, parent);
+ }
+
+ /**
+ * Creates a new OMNamespace.
+ *
+ * @see org.apache.axis2.om.OMFactory#createOMNamespace(java.lang.String,
+ * java.lang.String)
+ */
+ public OMNamespace createOMNamespace(String uri, String prefix) {
+ return new NamespaceImpl(uri, prefix);
+ }
+
+ /**
+ * Creates a new OMDOM Text node with the given value and appends it to the
+ * given parent element.
+ *
+ * @see org.apache.axis2.om.OMFactory#createText(
+ * org.apache.axis2.om.OMElement,java.lang.String)
+ */
+ public OMText createText(OMElement parent, String text) {
+ ElementImpl parentElem = (ElementImpl) parent;
+ TextImpl txt = new TextImpl((DocumentImpl) parentElem
+ .getOwnerDocument(), text);
+ parentElem.addChild(txt);
+ return txt;
+ }
public OMText createText(OMElement parent, String text, int type) {
OMText textNode = createText(parent, text);
@@ -174,96 +195,106 @@
/**
* Creates a OMDOM Text node carrying the given value.
- *
+ *
* @see org.apache.axis2.om.OMFactory#createText(java.lang.String)
*/
public OMText createText(String s) {
return new TextImpl(s);
}
- /**
- * Creates a Character node of the given type.
- * @see org.apache.axis2.om.OMFactory#createText(java.lang.String, int)
- */
- public OMText createText(String text, int type) {
- switch (type) {
- case Node.TEXT_NODE:
- return new TextImpl(text);
- default:
- throw new OMDOMException("Only Text nodes are supported right now");
- }
- }
-
- /**
- * Creates a new OMDOM Text node with the value of the given text
- * value along with the MTOM optimization parameters and returns it.
- * @see org.apache.axis2.om.OMFactory#createText(java.lang.String, java.lang.String, boolean)
- */
- public OMText createText(String text, String mimeType, boolean optimize) {
- return new TextImpl(text, mimeType, optimize);
- }
-
- /**
- * Creates a new OMDOM Text node with the given datahandler and the given
- * MTOM optimization configuration and returns it.
- * @see org.apache.axis2.om.OMFactory#createText(java.lang.Object, boolean)
- */
- public OMText createText(Object dataHandler, boolean optimize) {
- return new TextImpl(dataHandler, optimize);
- }
-
- /**
- * Creates an OMDOM Text node, adds it to the give parent element and returns it.
- * @see org.apache.axis2.om.OMFactory#createText(org.apache.axis2.om.OMElement, java.lang.String, java.lang.String, boolean)
- */
- public OMText createText(OMElement parent, String s, String mimeType, boolean optimize) {
- TextImpl text = new TextImpl((DocumentImpl)((ElementImpl)parent).getOwnerDocument(),s, mimeType, optimize);
- parent.addChild(text);
- return text;
- }
+ /**
+ * Creates a Character node of the given type.
+ *
+ * @see org.apache.axis2.om.OMFactory#createText(java.lang.String, int)
+ */
+ public OMText createText(String text, int type) {
+ switch (type) {
+ case Node.TEXT_NODE:
+ return new TextImpl(text);
+ default:
+ throw new OMDOMException("Only Text nodes are supported right now");
+ }
+ }
+
+ /**
+ * Creates a new OMDOM Text node with the value of the given text value
+ * along with the MTOM optimization parameters and returns it.
+ *
+ * @see org.apache.axis2.om.OMFactory#createText(java.lang.String,
+ * java.lang.String, boolean)
+ */
+ public OMText createText(String text, String mimeType, boolean optimize) {
+ return new TextImpl(text, mimeType, optimize);
+ }
+
+ /**
+ * Creates a new OMDOM Text node with the given datahandler and the given
+ * MTOM optimization configuration and returns it.
+ *
+ * @see org.apache.axis2.om.OMFactory#createText(java.lang.Object, boolean)
+ */
+ public OMText createText(Object dataHandler, boolean optimize) {
+ return new TextImpl(dataHandler, optimize);
+ }
+
+ /**
+ * Creates an OMDOM Text node, adds it to the give parent element and
+ * returns it.
+ *
+ * @see org.apache.axis2.om.OMFactory#createText(org.apache.axis2.om.OMElement,
+ * java.lang.String, java.lang.String, boolean)
+ */
+ public OMText createText(OMElement parent, String s, String mimeType,
+ boolean optimize) {
+ TextImpl text = new TextImpl((DocumentImpl) ((ElementImpl) parent)
+ .getOwnerDocument(), s, mimeType, optimize);
+ parent.addChild(text);
+ return text;
+ }
public OMText createText(String contentID, OMElement parent,
OMXMLParserWrapper builder) {
- TextImpl text = new TextImpl(contentID,parent,builder);
- parent.addChild(text);
- return text;
- }
-
- public OMAttribute createOMAttribute(String localName, OMNamespace ns, String value) {
- return new AttrImpl(this.getDocument() ,localName,ns, value);
- }
-
- public OMDocType createOMDocType(OMContainer parent, String content) {
- // TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData) {
- // TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public OMComment createOMComment(OMContainer parent, String content) {
- DocumentImpl doc = null;
- if(parent instanceof DocumentImpl) {
- doc = (DocumentImpl)parent;
- } else {
- doc = (DocumentImpl)((ParentNode)parent).getOwnerDocument();
- }
-
- CommentImpl comment = new CommentImpl(doc, content);
- parent.addChild(comment);
- return comment;
- }
-
- public DocumentImpl getDocument() {
- return (DocumentImpl)this.createOMDocument();
- }
-
-
- public OMDocument createOMDocument(OMXMLParserWrapper builder) {
- this.document = new DocumentImpl(builder);
- return this.document;
- }
-
+ TextImpl text = new TextImpl(contentID, parent, builder);
+ parent.addChild(text);
+ return text;
+ }
+
+ public OMAttribute createOMAttribute(String localName, OMNamespace ns,
+ String value) {
+ return new AttrImpl(this.getDocument(), localName, ns, value);
+ }
+
+ public OMDocType createOMDocType(OMContainer parent, String content) {
+ // TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public OMProcessingInstruction createOMProcessingInstruction(
+ OMContainer parent, String piTarget, String piData) {
+ // TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public OMComment createOMComment(OMContainer parent, String content) {
+ DocumentImpl doc = null;
+ if (parent instanceof DocumentImpl) {
+ doc = (DocumentImpl) parent;
+ } else {
+ doc = (DocumentImpl) ((ParentNode) parent).getOwnerDocument();
+ }
+
+ CommentImpl comment = new CommentImpl(doc, content);
+ parent.addChild(comment);
+ return comment;
+ }
+
+ public DocumentImpl getDocument() {
+ return (DocumentImpl) this.createOMDocument();
+ }
+
+ public OMDocument createOMDocument(OMXMLParserWrapper builder) {
+ this.document = new DocumentImpl(builder);
+ return this.document;
+ }
+
}
Modified: webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java (original)
+++ webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java Mon Jan 9 23:53:43 2006
@@ -4,37 +4,40 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory{
+public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
- public DocumentBuilderFactoryImpl() {
- super();
- }
-
- public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
- return new DocumentBuilderImpl();
- }
-
- public Object getAttribute(String arg0) throws IllegalArgumentException {
- // TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public void setAttribute(String arg0, Object arg1) throws IllegalArgumentException {
-// // TODO
-// throw new UnsupportedOperationException("TODO");
- }
-
- public static DocumentBuilderFactory newInstance() {
- return new DocumentBuilderFactoryImpl();
- }
-
- public void setFeature(String arg0, boolean arg1) throws ParserConfigurationException {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public boolean getFeature(String arg0) throws ParserConfigurationException {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
+ public DocumentBuilderFactoryImpl() {
+ super();
+ }
+
+ public DocumentBuilder newDocumentBuilder()
+ throws ParserConfigurationException {
+ return new DocumentBuilderImpl();
+ }
+
+ public Object getAttribute(String arg0) throws IllegalArgumentException {
+ // TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public void setAttribute(String arg0, Object arg1)
+ throws IllegalArgumentException {
+ // // TODO
+ // throw new UnsupportedOperationException("TODO");
+ }
+
+ public static DocumentBuilderFactory newInstance() {
+ return new DocumentBuilderFactoryImpl();
+ }
+
+ public void setFeature(String arg0, boolean arg1)
+ throws ParserConfigurationException {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public boolean getFeature(String arg0) throws ParserConfigurationException {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
}
Modified: webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderImpl.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderImpl.java (original)
+++ webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderImpl.java Mon Jan 9 23:53:43 2006
@@ -38,111 +38,118 @@
public class DocumentBuilderImpl extends DocumentBuilder {
- public DocumentBuilderImpl() {
- super();
- }
-
- /**
- * Returns whether the parser is configured to understand namespaces or not.
- * The StAX parser used by this DOM impl is namespace aware
- * therefore this will always return true.
- * @see javax.xml.parsers.DocumentBuilder#isNamespaceAware()
- */
- public boolean isNamespaceAware() {
- return true;
- }
-
- /**
- * The StAX builder used is the org.apache.axis2.om.impl.llom.StAXOMBuilder
- * is a validating builder.
- * @see javax.xml.parsers.DocumentBuilder#isValidating()
- */
- public boolean isValidating() {
- return true;
- }
-
- public DOMImplementation getDOMImplementation() {
- return new DOMImplementationImpl();
- }
-
- /**
- * Returns a new document impl.
- * @see javax.xml.parsers.DocumentBuilder#newDocument()
- */
- public Document newDocument() {
- DocumentImpl documentImpl = new DocumentImpl();
- documentImpl.setComplete(true);
- return documentImpl;
- }
-
- public void setEntityResolver(EntityResolver arg0) {
- // TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public void setErrorHandler(ErrorHandler arg0) {
- // TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public Document parse(InputSource inputSource) throws SAXException, IOException {
- try {
- OMDOMFactory factory = new OMDOMFactory();
- //Not really sure whether this will work :-?
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(inputSource.getCharacterStream());
- StAXOMBuilder builder = new StAXOMBuilder(factory,reader);
- DocumentImpl doc = (DocumentImpl)builder.getDocument();
- ((ElementImpl)doc.getDocumentElement()).build();
- return (DocumentImpl)builder.getDocument();
- }catch (XMLStreamException e) {
- throw new SAXException(e);
- }
- }
-
- /**
- * @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream)
- */
- public Document parse(InputStream is) throws SAXException, IOException {
- try {
- OMDOMFactory factory = new OMDOMFactory();
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(is);
- StAXOMBuilder builder = new StAXOMBuilder(factory,reader);
- return (DocumentImpl)builder.getDocument();
- }catch (XMLStreamException e) {
- throw new SAXException(e);
- }
- }
-
- /**
- * @see javax.xml.parsers.DocumentBuilder#parse(java.io.File)
- */
- public Document parse(File file) throws SAXException, IOException {
- try {
- OMDOMFactory factory = new OMDOMFactory();
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(file));
- StAXOMBuilder builder = new StAXOMBuilder(factory,reader);
- return (DocumentImpl)builder.getDocument();
- }catch (XMLStreamException e) {
- throw new SAXException(e);
- }
- }
-
- /**
- * @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream, java.lang.String)
- */
- public Document parse(InputStream is, String systemId) throws SAXException, IOException {
- // TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- /**
- * @see javax.xml.parsers.DocumentBuilder#parse(java.lang.String)
- */
- public Document parse(String uri) throws SAXException, IOException {
- // TODO
- throw new UnsupportedOperationException("TODO");
- }
+ public DocumentBuilderImpl() {
+ super();
+ }
+
+ /**
+ * Returns whether the parser is configured to understand namespaces or not.
+ * The StAX parser used by this DOM impl is namespace aware therefore this
+ * will always return true.
+ *
+ * @see javax.xml.parsers.DocumentBuilder#isNamespaceAware()
+ */
+ public boolean isNamespaceAware() {
+ return true;
+ }
+
+ /**
+ * The StAX builder used is the org.apache.axis2.om.impl.llom.StAXOMBuilder
+ * is a validating builder.
+ *
+ * @see javax.xml.parsers.DocumentBuilder#isValidating()
+ */
+ public boolean isValidating() {
+ return true;
+ }
+
+ public DOMImplementation getDOMImplementation() {
+ return new DOMImplementationImpl();
+ }
+
+ /**
+ * Returns a new document impl.
+ *
+ * @see javax.xml.parsers.DocumentBuilder#newDocument()
+ */
+ public Document newDocument() {
+ DocumentImpl documentImpl = new DocumentImpl();
+ documentImpl.setComplete(true);
+ return documentImpl;
+ }
+
+ public void setEntityResolver(EntityResolver arg0) {
+ // TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public void setErrorHandler(ErrorHandler arg0) {
+ // TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public Document parse(InputSource inputSource) throws SAXException,
+ IOException {
+ try {
+ OMDOMFactory factory = new OMDOMFactory();
+ // Not really sure whether this will work :-?
+ XMLStreamReader reader = XMLInputFactory.newInstance()
+ .createXMLStreamReader(inputSource.getCharacterStream());
+ StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
+ DocumentImpl doc = (DocumentImpl) builder.getDocument();
+ ((ElementImpl) doc.getDocumentElement()).build();
+ return (DocumentImpl) builder.getDocument();
+ } catch (XMLStreamException e) {
+ throw new SAXException(e);
+ }
+ }
+
+ /**
+ * @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream)
+ */
+ public Document parse(InputStream is) throws SAXException, IOException {
+ try {
+ OMDOMFactory factory = new OMDOMFactory();
+ XMLStreamReader reader = XMLInputFactory.newInstance()
+ .createXMLStreamReader(is);
+ StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
+ return (DocumentImpl) builder.getDocument();
+ } catch (XMLStreamException e) {
+ throw new SAXException(e);
+ }
+ }
+
+ /**
+ * @see javax.xml.parsers.DocumentBuilder#parse(java.io.File)
+ */
+ public Document parse(File file) throws SAXException, IOException {
+ try {
+ OMDOMFactory factory = new OMDOMFactory();
+ XMLStreamReader reader = XMLInputFactory.newInstance()
+ .createXMLStreamReader(new FileInputStream(file));
+ StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
+ return (DocumentImpl) builder.getDocument();
+ } catch (XMLStreamException e) {
+ throw new SAXException(e);
+ }
+ }
+
+ /**
+ * @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream,
+ * java.lang.String)
+ */
+ public Document parse(InputStream is, String systemId) throws SAXException,
+ IOException {
+ // TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ /**
+ * @see javax.xml.parsers.DocumentBuilder#parse(java.lang.String)
+ */
+ public Document parse(String uri) throws SAXException, IOException {
+ // TODO
+ throw new UnsupportedOperationException("TODO");
+ }
-
-
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java Mon Jan 9 23:53:43 2006
@@ -22,46 +22,47 @@
public class AddressingMTOMSecurityTest extends InteropTestBase {
- protected OutflowConfiguration getOutflowConfiguration() {
- OutflowConfiguration ofc = new OutflowConfiguration();
-
- ofc.setActionItems("Timestamp Signature Encrypt");
- ofc.setUser("alice");
- ofc.setEncryptionUser("bob");
- ofc.setSignaturePropFile("interop.properties");
- ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
- ofc.setSignatureKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
- ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
- ofc.setSignatureParts("{Element}{http://schemas.xmlsoap.org/ws/2004/08/addressing}To;{Element}{http://schemas.xmlsoap.org/ws/2004/08/addressing}ReplyTo;{Element}{http://schemas.xmlsoap.org/ws/2004/08/addressing}MessageID;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp");
- ofc.setOptimizeParts("//xenc:EncryptedData/xenc:CipherData/xenc:CipherValue");
-
- return ofc;
- }
-
- protected InflowConfiguration getInflowConfiguration() {
- InflowConfiguration ifc = new InflowConfiguration();
-
- ifc.setActionItems("Timestamp Signature Encrypt");
- ifc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
- ifc.setSignaturePropFile("interop.properties");
-
- return ifc;
- }
-
- protected String getClientRepo() {
- return COMPLETE_CLIENT_REPOSITORY;
- }
-
- protected String getServiceRepo() {
- return COMPLETE_SERVICE_REPOSITORY;
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
- protected boolean isUseSOAP12InStaticConfigTest() {
- return true;
- }
-
-
+ protected OutflowConfiguration getOutflowConfiguration() {
+
+ OutflowConfiguration ofc = new OutflowConfiguration();
+
+ ofc.setActionItems("Timestamp Signature Encrypt");
+ ofc.setUser("alice");
+ ofc.setEncryptionUser("bob");
+ ofc.setSignaturePropFile("interop.properties");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setSignatureKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+ ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+ ofc.setSignatureParts("{Element}{" + ADDR_NS + "}To;" +
+ "{Element}{" + ADDR_NS + "}ReplyTo;" +
+ "{Element}{" + ADDR_NS + "}MessageID;" +
+ "{Element}{" + WSU_NS + "}Timestamp");
+ ofc.setOptimizeParts(
+ "//xenc:EncryptedData/xenc:CipherData/xenc:CipherValue");
+
+ return ofc;
+ }
+
+ protected InflowConfiguration getInflowConfiguration() {
+ InflowConfiguration ifc = new InflowConfiguration();
+
+ ifc.setActionItems("Timestamp Signature Encrypt");
+ ifc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ifc.setSignaturePropFile("interop.properties");
+
+ return ifc;
+ }
+
+ protected String getClientRepo() {
+ return COMPLETE_CLIENT_REPOSITORY;
+ }
+
+ protected String getServiceRepo() {
+ return COMPLETE_SERVICE_REPOSITORY;
+ }
+
+ protected boolean isUseSOAP12InStaticConfigTest() {
+ return true;
+ }
+
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java Mon Jan 9 23:53:43 2006
@@ -18,73 +18,108 @@
import junit.framework.TestCase;
import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.integration.UtilServer;
import org.apache.axis2.security.handler.config.InflowConfiguration;
import org.apache.axis2.security.handler.config.OutflowConfiguration;
+import org.apache.ws.security.WSConstants;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public abstract class InteropTestBase extends TestCase {
- protected static final String SCENARIO1_SERVICE_REPOSITORY = "scenario1_service_repo";
+ protected static final String SCENARIO1_SERVICE_REPOSITORY =
+ "scenario1_service_repo";
- protected static final String SCENARIO1_CLIENT_REPOSITORY = "scenario1_client_repo";
+ protected static final String SCENARIO1_CLIENT_REPOSITORY =
+ "scenario1_client_repo";
- protected static final String SCENARIO2_SERVICE_REPOSITORY = "scenario2_service_repo";
+ protected static final String SCENARIO2_SERVICE_REPOSITORY =
+ "scenario2_service_repo";
- protected static final String SCENARIO2_CLIENT_REPOSITORY = "scenario2_client_repo";
+ protected static final String SCENARIO2_CLIENT_REPOSITORY =
+ "scenario2_client_repo";
- protected static final String SCENARIO2a_SERVICE_REPOSITORY = "scenario2a_service_repo";
+ protected static final String SCENARIO2a_SERVICE_REPOSITORY =
+ "scenario2a_service_repo";
- protected static final String SCENARIO2a_CLIENT_REPOSITORY = "scenario2a_client_repo";
+ protected static final String SCENARIO2a_CLIENT_REPOSITORY =
+ "scenario2a_client_repo";
- protected static final String SCENARIO3_SERVICE_REPOSITORY = "scenario3_service_repo";
+ protected static final String SCENARIO3_SERVICE_REPOSITORY =
+ "scenario3_service_repo";
- protected static final String SCENARIO3_CLIENT_REPOSITORY = "scenario3_client_repo";
+ protected static final String SCENARIO3_CLIENT_REPOSITORY =
+ "scenario3_client_repo";
- protected static final String SCENARIO4_SERVICE_REPOSITORY = "scenario4_service_repo";
+ protected static final String SCENARIO4_SERVICE_REPOSITORY =
+ "scenario4_service_repo";
- protected static final String SCENARIO4_CLIENT_REPOSITORY = "scenario4_client_repo";
+ protected static final String SCENARIO4_CLIENT_REPOSITORY =
+ "scenario4_client_repo";
- protected static final String SCENARIO5_SERVICE_REPOSITORY = "scenario5_service_repo";
+ protected static final String SCENARIO5_SERVICE_REPOSITORY =
+ "scenario5_service_repo";
- protected static final String SCENARIO5_CLIENT_REPOSITORY = "scenario5_client_repo";
+ protected static final String SCENARIO5_CLIENT_REPOSITORY =
+ "scenario5_client_repo";
- protected static final String SCENARIO6_SERVICE_REPOSITORY = "scenario6_service_repo";
+ protected static final String SCENARIO6_SERVICE_REPOSITORY =
+ "scenario6_service_repo";
- protected static final String SCENARIO6_CLIENT_REPOSITORY = "scenario6_client_repo";
+ protected static final String SCENARIO6_CLIENT_REPOSITORY =
+ "scenario6_client_repo";
- protected static final String SCENARIO7_SERVICE_REPOSITORY = "scenario7_service_repo";
+ protected static final String SCENARIO7_SERVICE_REPOSITORY =
+ "scenario7_service_repo";
- protected static final String SCENARIO7_CLIENT_REPOSITORY = "scenario7_client_repo";
+ protected static final String SCENARIO7_CLIENT_REPOSITORY =
+ "scenario7_client_repo";
- protected static final String SCENARIO_ST1_SERVICE_REPOSITORY = "scenarioST1_service_repo";
+ protected static final String SCENARIO_ST1_SERVICE_REPOSITORY =
+ "scenarioST1_service_repo";
- protected static final String SCENARIO_ST1_CLIENT_REPOSITORY = "scenarioST1_client_repo";
+ protected static final String SCENARIO_ST1_CLIENT_REPOSITORY =
+ "scenarioST1_client_repo";
- protected static final String SCENARIO_ST3_SERVICE_REPOSITORY = "scenarioST3_service_repo";
+ protected static final String SCENARIO_ST3_SERVICE_REPOSITORY =
+ "scenarioST3_service_repo";
- protected static final String SCENARIO_ST3_CLIENT_REPOSITORY = "scenarioST3_client_repo";
+ protected static final String SCENARIO_ST3_CLIENT_REPOSITORY =
+ "scenarioST3_client_repo";
- protected static final String SCENARIO_ST4_SERVICE_REPOSITORY = "scenarioST4_service_repo";
+ protected static final String SCENARIO_ST4_SERVICE_REPOSITORY =
+ "scenarioST4_service_repo";
- protected static final String SCENARIO_ST4_CLIENT_REPOSITORY = "scenarioST4_client_repo";
+ protected static final String SCENARIO_ST4_CLIENT_REPOSITORY =
+ "scenarioST4_client_repo";
- protected static final String MTOM_SEC_SERVICE_REPOSITORY = "mtom_sec_service_repo";
+ protected static final String MTOM_SEC_SERVICE_REPOSITORY =
+ "mtom_sec_service_repo";
- protected static final String MTOM_SEC_CLIENT_REPOSITORY = "mtom_sec_client_repo";
+ protected static final String MTOM_SEC_CLIENT_REPOSITORY =
+ "mtom_sec_client_repo";
- protected static final String COMPLETE_SERVICE_REPOSITORY = "complete_service_repo";
+ protected static final String COMPLETE_SERVICE_REPOSITORY =
+ "complete_service_repo";
- protected static final String COMPLETE_CLIENT_REPOSITORY = "complete_client_repo";
+ protected static final String COMPLETE_CLIENT_REPOSITORY =
+ "complete_client_repo";
- protected static final String DEFAULT_CLIENT_REPOSITORY = "default_security_client_repo";
+ protected static final String DEFAULT_CLIENT_REPOSITORY =
+ "default_security_client_repo";
+
+ protected static final String WSSE_NS = WSConstants.WSSE_NS;
+
+ protected static final String WSU_NS = WSConstants.WSU_NS;
+
+ protected static final String ADDR_NS =
+ AddressingConstants.Submission.WSA_NAMESPACE;
private String targetEpr = "http://127.0.0.1:" +
- //5556 +
- UtilServer.TESTING_PORT +
- "/axis2/services/PingPort";
+ // 5556 +
+ UtilServer.TESTING_PORT + "/axis2/services/PingPort";
public InteropTestBase() {
super();
@@ -95,9 +130,9 @@
}
/**
- * Each time an interop test is run the relevant service
- * will be started with the given service repository
- *
+ * Each time an interop test is run the relevant service will be started
+ * with the given service repository
+ *
* set up the service
*/
protected void setUp() throws Exception {
@@ -111,39 +146,53 @@
UtilServer.stop();
}
-
/**
* Do test
*/
public void testInteropWithConfigFiles() {
try {
- Class interopScenarioClientClass = Class.forName("org.apache.axis2.security.InteropScenarioClient");
- Constructor c = interopScenarioClientClass.getConstructor(new Class[]{boolean.class});
- Object clientObj = c.newInstance(new Object[]{this.isUseSOAP12InStaticConfigTest()?Boolean.TRUE:Boolean.FALSE});
- Method m = interopScenarioClientClass.getMethod("invokeWithStaticConfig",new Class[]{String.class,String.class});
- m.invoke(clientObj,new Object[]{Constants.TESTING_PATH + getClientRepo(),targetEpr});
+ Class interopScenarioClientClass = Class
+ .forName("org.apache.axis2.security.InteropScenarioClient");
+ Constructor c = interopScenarioClientClass
+ .getConstructor(new Class[] { boolean.class });
+ Object clientObj = c.newInstance(new Object[] { this
+ .isUseSOAP12InStaticConfigTest() ? Boolean.TRUE
+ : Boolean.FALSE });
+ Method m = interopScenarioClientClass.getMethod(
+ "invokeWithStaticConfig", new Class[] { String.class,
+ String.class });
+ m.invoke(clientObj, new Object[] {
+ Constants.TESTING_PATH + getClientRepo(), targetEpr });
} catch (Exception e) {
e.printStackTrace();
- fail("Error in introperating with " + targetEpr + ", client configuration: " + getClientRepo());
+ fail("Error in introperating with " + targetEpr
+ + ", client configuration: " + getClientRepo());
}
}
public void testInteropWithDynamicConfig() {
try {
- Class interopScenarioClientClass = Class.forName("org.apache.axis2.security.InteropScenarioClient");
- Constructor c = interopScenarioClientClass.getConstructor(new Class[]{boolean.class});
- Object clientObj = c.newInstance(new Object[]{this.isUseSOAP12InStaticConfigTest()?Boolean.TRUE:Boolean.FALSE});
- Method m = interopScenarioClientClass.getMethod("invokeWithGivenConfig",new Class[]{String.class,
- String.class,
- OutflowConfiguration.class,
- InflowConfiguration.class
- });
- m.invoke(clientObj,new Object[]{Constants.TESTING_PATH + DEFAULT_CLIENT_REPOSITORY,targetEpr,getOutflowConfiguration(), getInflowConfiguration()});
+ Class interopScenarioClientClass = Class
+ .forName("org.apache.axis2.security.InteropScenarioClient");
+ Constructor c = interopScenarioClientClass
+ .getConstructor(new Class[] { boolean.class });
+ Object clientObj = c.newInstance(new Object[] { this
+ .isUseSOAP12InStaticConfigTest() ? Boolean.TRUE
+ : Boolean.FALSE });
+ Method m = interopScenarioClientClass.getMethod(
+ "invokeWithGivenConfig", new Class[] { String.class,
+ String.class, OutflowConfiguration.class,
+ InflowConfiguration.class });
+ m.invoke(clientObj, new Object[] {
+ Constants.TESTING_PATH + DEFAULT_CLIENT_REPOSITORY,
+ targetEpr, getOutflowConfiguration(),
+ getInflowConfiguration() });
} catch (Exception e) {
e.printStackTrace();
- fail("Error in introperating with " + targetEpr + ", client configuration: " + getClientRepo());
+ fail("Error in introperating with " + targetEpr
+ + ", client configuration: " + getClientRepo());
}
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java Mon Jan 9 23:53:43 2006
@@ -22,7 +22,8 @@
/**
* Testing optimizing the base 64 elements with
- * <code><parameter name="optimizeParts" locked="false">//xenc:EncryptedData/xenc:CipherData/xenc:CipherValue</parameter></code>
+ * <code><parameter name="optimizeParts" locked="false">//xenc:Encrypted
+ * Data/xenc:CipherData/xenc:CipherValue</parameter></code>
*/
public class MTOMOptimizedSecurityTest extends InteropTestBase {
@@ -36,7 +37,8 @@
ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
ofc.setSignatureKeyIdentifier(WSSHandlerConstants.BST_DIRECT_REFERENCE);
ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
- ofc.setOptimizeParts("//xenc:EncryptedData/xenc:CipherData/xenc:CipherValue");
+ ofc.setOptimizeParts("//xenc:EncryptedData/xenc:CipherData/" +
+ "xenc:CipherValue");
return ofc;
}
@@ -59,9 +61,6 @@
return MTOM_SEC_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java Mon Jan 9 23:53:43 2006
@@ -45,9 +45,6 @@
return SCENARIO1_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java Mon Jan 9 23:53:43 2006
@@ -32,7 +32,7 @@
ofc.setActionItems("UsernameToken Encrypt");
ofc.setUser("Chris");
ofc.setAddUTElements("Nonce Created");
- ofc.setEncryptionParts("{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken");
+ ofc.setEncryptionParts("{Element}{" + WSSE_NS + "}UsernameToken");
ofc.setEncryptionUser("bob");
ofc.setEncryptionPropFile("interop.properties");
ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
@@ -55,9 +55,6 @@
return SCENARIO2_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java Mon Jan 9 23:53:43 2006
@@ -31,7 +31,7 @@
ofc.setActionItems("UsernameTokenSignature Encrypt Timestamp");
ofc.setUser("Chris");
- ofc.setEncryptionParts("{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken");
+ ofc.setEncryptionParts("{Element}{" + WSSE_NS + "}UsernameToken");
ofc.setEncryptionUser("bob");
ofc.setEncryptionPropFile("interop.properties");
ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
@@ -53,9 +53,6 @@
return SCENARIO2a_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java Mon Jan 9 23:53:43 2006
@@ -59,9 +59,6 @@
return SCENARIO3_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java Mon Jan 9 23:53:43 2006
@@ -60,9 +60,6 @@
return SCENARIO4_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java Mon Jan 9 23:53:43 2006
@@ -57,9 +57,6 @@
return SCENARIO5_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java Mon Jan 9 23:53:43 2006
@@ -60,9 +60,6 @@
return SCENARIO6_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java Mon Jan 9 23:53:43 2006
@@ -19,6 +19,7 @@
import org.apache.axis2.security.handler.WSSHandlerConstants;
import org.apache.axis2.security.handler.config.InflowConfiguration;
import org.apache.axis2.security.handler.config.OutflowConfiguration;
+import org.apache.axis2.soap.SOAP11Constants;
import org.apache.ws.security.WSConstants;
/**
@@ -39,7 +40,9 @@
ofc.setSignatureKeyIdentifier(WSSHandlerConstants.BST_DIRECT_REFERENCE);
ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
ofc.setEmbeddedKeyCallbackClass("rg.apache.axis2.security.PWCallback");
- ofc.setSignatureParts("{}{http://schemas.xmlsoap.org/soap/envelope/}Body;STRTransform");
+ ofc.setSignatureParts("{}{" +
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI +
+ "}Body;STRTransform");
return ofc;
}
@@ -63,9 +66,6 @@
return SCENARIO7_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
return false;
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java?rev=367519&r1=367518&r2=367519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java Mon Jan 9 23:53:43 2006
@@ -42,9 +42,6 @@
return SCENARIO_ST1_SERVICE_REPOSITORY;
}
- /* (non-Javadoc)
- * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
- */
protected boolean isUseSOAP12InStaticConfigTest() {
// TODO TODO
throw new UnsupportedOperationException("TODO");