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 ch...@apache.org on 2005/03/08 09:56:30 UTC
svn commit: r156512 [4/4] - in
webservices/axis/trunk/archive/java/scratch/Thilina: ./ MTOM/ MTOM/lib/
MTOM/src/ MTOM/src/java/ MTOM/src/java/org/ MTOM/src/java/org/apache/
MTOM/src/java/org/apache/axis/ MTOM/src/java/org/apache/axis/encoding/
MTOM/src/java/org/apache/axis/impl/ MTOM/src/java/org/apache/axis/impl/llom/
MTOM/src/java/org/apache/axis/impl/llom/builder/
MTOM/src/java/org/apache/axis/impl/llom/exception/
MTOM/src/java/org/apache/axis/impl/llom/factory/
MTOM/src/java/org/apache/axis/impl/llom/mtom/
MTOM/src/java/org/apache/axis/impl/llom/serialize/
MTOM/src/java/org/apache/axis/impl/llom/traverse/
MTOM/src/java/org/apache/axis/om/ MTOM/src/test-resources/ MTOM/src/test/
MTOM/src/test/org/ MTOM/src/test/org/apache/ MTOM/src/test/org/apache/axis/
MTOM/src/test/org/apache/axis/mtom/
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMHeader.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMHeader.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMHeader.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMHeader.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,104 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.om;
+
+import java.util.Iterator;
+
+
+public interface OMHeader extends OMElement {
+
+
+ /**
+ * Creates a new <CODE>OMHeaderBlock</CODE> object initialized with the
+ * specified name and adds it to this <CODE>OMHeader</CODE> object.
+ *
+ * @return the new <CODE>OMHeaderBlock</CODE> object that was inserted into
+ * this <CODE>OMHeader</CODE> object
+ * @throws OMException if a SOAP error occurs
+ */
+ public abstract OMHeaderBlock addHeaderBlock(String localName, OMNamespace ns)
+ throws OMException;
+
+ /**
+ * Returns a list of all the <CODE>OMHeaderBlock</CODE> objects in this
+ * <CODE>OMHeader</CODE> object that have the the specified actor. An actor
+ * is a global attribute that indicates the intermediate parties to whom the
+ * message should be sent. An actor receives the message and then sends it
+ * to the next actor. The default actor is the ultimate intended recipient
+ * for the message, so if no actor attribute is included in a
+ * <CODE>OMHeader</CODE> object, the message is sent to its ultimate
+ * destination.
+ *
+ * @param actor a <CODE>String</CODE> giving the URI of the actor for which
+ * to search
+ * @return an <CODE>Iterator</CODE> object over all the <CODE>
+ * OMHeaderBlock</CODE> objects that contain the specified actor
+ * @see #extractHeaderBlocks(java.lang.String) extractHeaderBlocks(java.lang.String)
+ */
+ public abstract Iterator examineHeaderBlocks(String actor);
+
+ /**
+ * Returns a list of all the <CODE>OMHeaderBlock</CODE> objects in this
+ * <CODE>OMHeader</CODE> object that have the the specified actor and
+ * detaches them from this <CODE> OMHeader</CODE> object.
+ * <p/>
+ * <P>This method allows an actor to process only the parts of the
+ * <CODE>OMHeader</CODE> object that apply to it and to remove them before
+ * passing the message on to the next actor.
+ *
+ * @param actor a <CODE>String</CODE> giving the URI of the actor for which
+ * to search
+ * @return an <CODE>Iterator</CODE> object over all the <CODE>
+ * OMHeaderBlock</CODE> objects that contain the specified actor
+ * @see #examineHeaderBlocks(java.lang.String) examineHeaderBlocks(java.lang.String)
+ */
+ public abstract Iterator extractHeaderBlocks(String actor);
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>OMHeaderBlock</code>
+ * objects in this <code>OMHeader</code> object that have the specified
+ * actor and that have a MustUnderstand attribute whose value is equivalent
+ * to <code>true</code>.
+ *
+ * @param actor a <code>String</code> giving the URI of the actor for which
+ * to search
+ * @return an <code>Iterator</code> object over all the
+ * <code>OMHeaderBlock</code> objects that contain the specified
+ * actor and are marked as MustUnderstand
+ */
+ public abstract Iterator examineMustUnderstandHeaderBlocks(String actor);
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>OMHeaderBlock</code>
+ * objects in this <code>OMHeader</code> object.
+ *
+ * @return an <code>Iterator</code> object over all the
+ * <code>OMHeaderBlock</code> objects contained by this
+ * <code>OMHeader</code>
+ */
+ public abstract Iterator examineAllHeaderBlocks();
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>OMHeaderBlock</code>
+ * objects in this <code>OMHeader </code> object and detaches them from this
+ * <code>OMHeader</code> object.
+ *
+ * @return an <code>Iterator</code> object over all the
+ * <code>OMHeaderBlock</code> objects contained by this
+ * <code>OMHeader</code>
+ */
+ public abstract Iterator extractAllHeaderBlocks();
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMHeaderBlock.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMHeaderBlock.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMHeaderBlock.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMHeaderBlock.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,76 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.om;
+
+
+/**
+ * <P>An object representing the contents in the SOAP header part of the SOAP
+ * envelope. The immediate children of a <CODE> OMHeader</CODE> object can be
+ * represented only as <CODE> OMHeaderBlock</CODE> objects.</P>
+ * <p/>
+ * <P>B <CODE>OMHeaderBlock</CODE> object can have other <CODE>OMElement</CODE>
+ * objects as its children.</P>
+ */
+public interface OMHeaderBlock extends OMElement {
+
+ /**
+ * Sets the actor associated with this <CODE> OMHeaderBlock</CODE> object to
+ * the specified actor. The default value of an actor is: <CODE>
+ * OMConstants.URI_SOAP_ACTOR_NEXT</CODE>
+ *
+ * @param actorURI a <CODE>String</CODE> giving the URI of the actor to set
+ * @throws java.lang.IllegalArgumentException
+ * if there is a problem in setting the actor.
+ * @see #getActor() getActor()
+ */
+ public abstract void setActor(String actorURI);
+
+ /**
+ * Returns the uri of the actor associated with this <CODE>
+ * OMHeaderBlock</CODE> object.
+ *
+ * @return a <CODE>String</CODE> giving the URI of the actor
+ * @see #setActor(java.lang.String) setActor(java.lang.String)
+ */
+ public abstract String getActor();
+
+ /**
+ * Sets the mustUnderstand attribute for this <CODE> OMHeaderBlock</CODE>
+ * object to be on or off.
+ * <p/>
+ * <P>If the mustUnderstand attribute is on, the actor who receives the
+ * <CODE>OMHeaderBlock</CODE> must process it correctly. This ensures, for
+ * example, that if the <CODE> OMHeaderBlock</CODE> object modifies the
+ * message, that the message is being modified correctly.</P>
+ *
+ * @param mustUnderstand <CODE>true</CODE> to set the mustUnderstand
+ * attribute on; <CODE>false</CODE> to turn if off
+ * @throws java.lang.IllegalArgumentException
+ * if there is a problem in setting the actor.
+ * @see #getMustUnderstand() getMustUnderstand()
+ */
+ public abstract void setMustUnderstand(boolean mustUnderstand);
+
+ /**
+ * Returns whether the mustUnderstand attribute for this
+ * <CODE>OMHeaderBlock</CODE> object is turned on.
+ *
+ * @return <CODE>true</CODE> if the mustUnderstand attribute of this
+ * <CODE>OMHeaderBlock</CODE> object is turned on;
+ * <CODE>false</CODE> otherwise
+ */
+ public abstract boolean getMustUnderstand();
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNamedNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNamedNode.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNamedNode.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNamedNode.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,36 @@
+package org.apache.axis.om;
+
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * <p/>
+ * OMElement and OMAttribute must have namespace support and those two behave in
+ * same manner as far as the namespaces are concerned. So one can implement this
+ * interface specific methods in an abstract class.
+ */
+public interface OMNamedNode extends OMNode {
+
+ public String getLocalName();
+
+ public void setLocalName(String localName);
+
+ public OMNamespace getNamespace() throws OMException;
+
+ public String getNamespaceName();
+
+ public void setNamespace(OMNamespace namespace);
+
+
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNamespace.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNamespace.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNamespace.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNamespace.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,27 @@
+package org.apache.axis.om;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * <p/>
+ */
+public interface OMNamespace {
+
+ public boolean equals(String uri, String prefix);
+
+ public String getPrefix();
+
+ public String getName();
+
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNode.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNode.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMNode.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,149 @@
+package org.apache.axis.om;
+
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * <p/>
+ */
+public interface OMNode {
+ //==================================================================================
+
+ // Followings are the codes for node types. Extracted these from DOM API
+ /**
+ * The node is an <code>Element</code>.
+ */
+ public static final short ELEMENT_NODE = 1;
+ /**
+ * The node is an <code>Attr</code>.
+ */
+ public static final short ATTRIBUTE_NODE = 2;
+ /**
+ * The node is a <code>Text</code> node.
+ */
+ public static final short TEXT_NODE = 3;
+ /**
+ * The node is a <code>CDATASection</code>.
+ */
+ public static final short CDATA_SECTION_NODE = 4;
+
+ /**
+ * The node is a <code>Comment</code>.
+ */
+ public static final short COMMENT_NODE = 8;
+ /**
+ * The node is a <code>Document</code>.
+ */
+ public static final short DOCUMENT_NODE = 9;
+
+ public static final short BLOB_NODE = 10;
+
+ //==================================================================================
+
+ /**
+ * This method should return the immediate parent of the node. Parent is
+ * always an Element
+ *
+ * @return
+ * @throws OMException
+ */
+ public OMElement getParent() throws OMException;
+
+ public void setParent(OMElement element);
+
+ /**
+ * This will give the next sibling. This can be an OMAttribute for
+ * OMAttribute or OMText or OMELement for others.
+ *
+ * @return
+ * @throws OMException
+ */
+ public OMNode getNextSibling() throws OMException;
+
+ public void setNextSibling(OMNode node);
+
+ /**
+ * This will return the literal value of the node. OMText --> the text
+ * OMElement --> local name of the element in String format OMAttribute -->
+ * the value of the attribue
+ *
+ * @return
+ * @throws OMException
+ */
+ public String getValue() throws OMException;
+
+ public void setValue(String value);
+
+ /**
+ * this will indicate whether parser has parsed this information item
+ * completely or not. If somethings info are not available in the item, one
+ * has to check this attribute to make sure that, this item has been parsed
+ * completely or not.
+ *
+ * @return
+ */
+ public boolean isComplete();
+
+ public void setComplete(boolean state);
+
+ /**
+ * This will remove this information item and its children, from the model
+ * completely
+ *
+ * @throws OMException
+ */
+ public void detach() throws OMException;
+
+ /**
+ * This will insert a sibling just after the current information item.
+ *
+ * @param sibling
+ * @throws OMException
+ */
+ public void insertSiblingAfter(OMNode sibling) throws OMException;
+
+ /**
+ * This will insert a sibling just before the current information item
+ *
+ * @param sibling
+ * @throws OMException
+ */
+ public void insertSiblingBefore(OMNode sibling) throws OMException;
+
+ /**
+ * This is to get the type of node, as this is the super class of all the
+ * nodes
+ *
+ * @return
+ * @throws OMException
+ */
+ public short getType() throws OMException;
+
+ public void setType(short nodeType) throws OMException;
+
+ /**
+ * get the previous sibling
+ *
+ * @return
+ */
+ public OMNode getPreviousSibling();
+
+ /**
+ * Set the previous sibling
+ *
+ * @param previousSibling
+ */
+ public void setPreviousSibling(OMNode previousSibling);
+
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMText.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMText.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMText.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMText.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,29 @@
+package org.apache.axis.om;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * <p/>
+ */
+public interface OMText extends OMNode {
+ /**
+ * We use the OMText class to hold comments, text, characterData, CData,
+ * etc., The codes are found in OMNode class
+ *
+ * @param type
+ */
+ public void setTextType(short type);
+
+ public short getTextType();
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMXMLParserWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMXMLParserWrapper.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMXMLParserWrapper.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OMXMLParserWrapper.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,62 @@
+package org.apache.axis.om;
+
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * <p/>
+ */
+public interface OMXMLParserWrapper {
+ /**
+ * Proceed the parser one step and return the event value
+ *
+ * @return
+ * @throws org.apache.axis.om.OMException
+ */
+ int next() throws OMException;
+
+ /**
+ * Discard the current element This should remove the given element and its
+ * decendants.
+ *
+ * @param el
+ * @throws org.apache.axis.om.OMException
+ */
+ void discard(OMElement el) throws OMException;
+
+ /**
+ * @param b
+ * @throws org.apache.axis.om.OMException
+ */
+ void setCache(boolean b) throws OMException;
+
+ /**
+ * Allows to access the underlying parser. Since the parser depends on the
+ * underlying implementation,an Object is returned However the
+ * implementations may have restrictions in letting access to the parser
+ *
+ * @return
+ */
+ Object getParser();
+
+ /**
+ * @return the complete status
+ */
+ boolean isCompleted();
+
+ /**
+ * @return
+ */
+ public OMElement getDocumentElement();
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OutObject.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OutObject.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OutObject.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/OutObject.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,49 @@
+package org.apache.axis.om;
+
+import org.xml.sax.ContentHandler;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * <p/>
+ */
+
+/**
+ * From the point of view of AXIOM, we expect something from the OUT object
+ * provided by the provider. Especially AXIOM expects a SAX interface from the
+ * Object AXIOM recieves.
+ * <p/>
+ * So this interface has to be implemented by the Object which AXIOM recieves
+ * for OUT path.
+ */
+public interface OutObject {
+ /**
+ * This method will help to register a ContentHandler with the Object
+ *
+ * @param contentHandler
+ */
+ public void setContentHandler(ContentHandler contentHandler);
+
+ /**
+ * @return
+ */
+
+ public ContentHandler getContentHandler();
+
+ /**
+ * When this method is being called the Object should start throwing SAX
+ * events through the ContentHandler registered earlier.
+ */
+ public void startBuilding();
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPBody.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPBody.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPBody.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPBody.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,63 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.om;
+
+
+/**
+ * An object that represents the contents of the SOAP body element in a SOAP
+ * message. B SOAP body element consists of XML data that affects the way the
+ * application-specific content is processed. <P> B <code>SOAPBody</code> object
+ * contains <code>OMBodyBlock</code> objects, which have the content for the
+ * SOAP body. B <code>SOAPFault</code> object, which carries status and/or error
+ * information, is an example of a <code>OMBodyBlock</code> object.
+ */
+public interface SOAPBody extends OMElement {
+
+ /**
+ * Creates a new <code>SOAPFault</code> object and adds it to this
+ * <code>SOAPBody</code> object.
+ *
+ * @return the new <code>SOAPFault</code> object
+ * @throws org.apache.axis.om.OMException if there is a SOAP error
+ */
+ public abstract SOAPFault addFault(Exception e) throws OMException;
+
+ /**
+ * Indicates whether a <code>SOAPFault</code> object exists in this
+ * <code>SOAPBody</code> object.
+ *
+ * @return <code>true</code> if a <code>SOAPFault</code> object exists in
+ * this <code>SOAPBody</code> object; <code>false</code> otherwise
+ */
+ public abstract boolean hasFault();
+
+ /**
+ * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object.
+ *
+ * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object
+ */
+ public abstract SOAPFault getFault();
+
+ /**
+ * @param soapFault
+ * @throws OMException
+ */
+ public abstract void addFault(SOAPFault soapFault) throws OMException;
+
+
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPEnvelope.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPEnvelope.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPEnvelope.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPEnvelope.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,76 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * <p/>
+ * User: Eran Chinthaka - Lanka Software Foundation
+ * Date: Oct 28, 2004
+ * Time: 11:52:18 AM
+ * <p/>
+ *
+ */
+
+
+package org.apache.axis.om;
+
+
+public interface SOAPEnvelope extends OMElement {
+
+ /**
+ * Creates a new <CODE>Name</CODE> object initialized with the given local
+ * name, namespace prefix, and namespace URI.
+ * <p/>
+ * <P>This factory method creates <CODE>Name</CODE> objects for use in the
+ * SOAP/XML envelope.
+ *
+ * @param localName a <CODE>String</CODE> giving the local name
+ * @param prefix a <CODE>String</CODE> giving the prefix of the
+ * namespace
+ * @param uri a <CODE>String</CODE> giving the URI of the namespace
+ * @return a <CODE>OMNamespace</CODE> object initialized with the given
+ * local name, namespace prefix, and namespace URI
+ * @throws OMException if there is a SOAP error
+ */
+ public abstract OMNamespace createNamespace(String localName, String prefix, String uri)
+ throws OMException;
+
+
+ /**
+ * Returns the <CODE>SOAPHeader</CODE> object for this <CODE>
+ * SOAPEnvelope</CODE> object.
+ * <p/>
+ * <P> This SOAPHeader will just be a container for all the headers in the
+ * <CODE>OMMessage</CODE> </P>
+ *
+ * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if there
+ * is none
+ * @throws OMException if there is a problem obtaining the <CODE>SOAPHeader</CODE>
+ * object
+ */
+ public abstract SOAPHeader getHeader() throws OMException;
+
+ /**
+ * Returns the <CODE>SOAPBody</CODE> object associated with this
+ * <CODE>SOAPEnvelope</CODE> object.
+ * <p/>
+ * <P> This SOAPBody will just be a container for all the BodyElements in
+ * the <CODE>OMMessage</CODE> </P>
+ *
+ * @return the <CODE>SOAPBody</CODE> object for this <CODE>
+ * SOAPEnvelope</CODE> object or <CODE>null</CODE> if there is none
+ * @throws OMException if there is a problem obtaining the <CODE>SOAPBody</CODE>
+ * object
+ */
+ public abstract SOAPBody getBody() throws OMException;
+
+
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPFault.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPFault.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPFault.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPFault.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,120 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.om;
+
+import javax.xml.namespace.QName;
+import java.util.Locale;
+
+
+/**
+ * An element in the <CODE>SOAPBody</CODE> object that contains error and/or
+ * status information. This information may relate to errors in the
+ * <CODE>OMMessage</CODE> object or to problems that are not related to the
+ * content in the message itself. Problems not related to the message itself are
+ * generally errors in processing, such as the inability to communicate with an
+ * upstream server. <P> The <CODE>SOAPFault</CODE> interface provides methods
+ * for retrieving the information contained in a <CODE> SOAPFault</CODE> object
+ * and for setting the fault code, the fault actor, and a string describing the
+ * fault. B fault code is one of the codes defined in the SOAP 1.1 specification
+ * that describe the fault. An actor is an intermediate recipient to whom a
+ * message was routed. The message path may include one or more actors, or, if
+ * no actors are specified, the message goes only to the default actor, which is
+ * the final intended recipient.
+ */
+public interface SOAPFault extends OMElement {
+
+ /**
+ * Sets this <CODE>SOAPFault</CODE> object with the given fault code.
+ * <p/>
+ * <P>Fault codes, which given information about the fault, are defined in
+ * the SOAP 1.1 specification.</P>
+ *
+ * @param faultCode a <CODE>QName</CODE> giving the fault code to be set;
+ * must be one of the fault codes defined in the SOAP 1.1
+ * specification
+ * @throws OMException if there was an error in adding the <CODE>faultCode</CODE>
+ * to the underlying XML tree.
+ * @see #getFaultCode() getFaultCode()
+ */
+ public abstract void setFaultCode(QName faultCode) throws OMException;
+
+ /**
+ * Gets the fault code for this <CODE>SOAPFault</CODE> object.
+ *
+ * @return a <CODE>String</CODE> with the fault code
+ * @see #setFaultCode(QName) setFaultCode(QName)
+ */
+ public abstract QName getFaultCode();
+
+ /**
+ * Sets this <CODE>SOAPFault</CODE> object with the given fault actor.
+ * <p/>
+ * <P>The fault actor is the recipient in the message path who caused the
+ * fault to happen.</P>
+ *
+ * @param faultActor a <CODE>String</CODE> identifying the actor that caused
+ * this <CODE> SOAPFault</CODE> object
+ * @throws OMException if there was an error in adding the <CODE>faultActor</CODE>
+ * to the underlying XML tree.
+ * @see #getFaultActor() getFaultActor()
+ */
+ public abstract void setFaultActor(String faultActor) throws OMException;
+
+ /**
+ * Gets the fault actor for this <CODE>SOAPFault</CODE> object.
+ *
+ * @return a <CODE>String</CODE> giving the actor in the message path that
+ * caused this <CODE>SOAPFault</CODE> object
+ * @see #setFaultActor(String) setFaultActor(java.lang.String)
+ */
+ public abstract String getFaultActor();
+
+ /**
+ * Sets the fault string for this <CODE>SOAPFault</CODE> object to the given
+ * string.
+ *
+ * @param faultString a <CODE>String</CODE> giving an explanation of the
+ * fault
+ * @throws OMException if there was an error in adding the <CODE>faultString</CODE>
+ * to the underlying XML tree.
+ * @see #getFaultString() getFaultString()
+ */
+ public abstract void setFaultString(String faultString)
+ throws OMException;
+
+ /**
+ * Gets the fault string for this <CODE>SOAPFault</CODE> object.
+ *
+ * @return a <CODE>String</CODE> giving an explanation of the fault
+ */
+ public abstract String getFaultString();
+
+ /**
+ * Sets the fault string for this <code>SOAPFault</code> object to the given
+ * string and localized to the given locale.
+ *
+ * @param faultString a <code>String</code> giving an explanation of the
+ * fault
+ * @param locale a <code>Locale</code> object indicating the native
+ * language of the <code>faultString</code>
+ * @throws OMException if there was an error in adding the <code>faultString</code>
+ * to the underlying XML tree
+ */
+ public abstract void setFaultString(String faultString, Locale locale) throws OMException;
+
+
+ public abstract Exception getException() throws OMException;
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPHeader.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPHeader.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPHeader.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPHeader.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,104 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.om;
+
+import java.util.Iterator;
+
+
+public interface SOAPHeader extends OMElement {
+
+
+ /**
+ * Creates a new <CODE>SOAPHeaderBlock</CODE> object initialized with the
+ * specified name and adds it to this <CODE>SOAPHeader</CODE> object.
+ *
+ * @return the new <CODE>SOAPHeaderBlock</CODE> object that was inserted
+ * into this <CODE>SOAPHeader</CODE> object
+ * @throws OMException if a SOAP error occurs
+ */
+ public abstract SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns)
+ throws OMException;
+
+ /**
+ * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this
+ * <CODE>SOAPHeader</CODE> object that have the the specified actor. An
+ * actor is a global attribute that indicates the intermediate parties to
+ * whom the message should be sent. An actor receives the message and then
+ * sends it to the next actor. The default actor is the ultimate intended
+ * recipient for the message, so if no actor attribute is included in a
+ * <CODE>SOAPHeader</CODE> object, the message is sent to its ultimate
+ * destination.
+ *
+ * @param actor a <CODE>String</CODE> giving the URI of the actor for which
+ * to search
+ * @return an <CODE>Iterator</CODE> object over all the <CODE>
+ * SOAPHeaderBlock</CODE> objects that contain the specified actor
+ * @see #extractHeaderBlocks(java.lang.String) extractHeaderBlocks(java.lang.String)
+ */
+ public abstract Iterator examineHeaderBlocks(String actor);
+
+ /**
+ * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this
+ * <CODE>SOAPHeader</CODE> object that have the the specified actor and
+ * detaches them from this <CODE> SOAPHeader</CODE> object.
+ * <p/>
+ * <P>This method allows an actor to process only the parts of the
+ * <CODE>SOAPHeader</CODE> object that apply to it and to remove them before
+ * passing the message on to the next actor.
+ *
+ * @param actor a <CODE>String</CODE> giving the URI of the actor for which
+ * to search
+ * @return an <CODE>Iterator</CODE> object over all the <CODE>
+ * SOAPHeaderBlock</CODE> objects that contain the specified actor
+ * @see #examineHeaderBlocks(java.lang.String) examineHeaderBlocks(java.lang.String)
+ */
+ public abstract Iterator extractHeaderBlocks(String actor);
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>
+ * objects in this <code>SOAPHeader</code> object that have the specified
+ * actor and that have a MustUnderstand attribute whose value is equivalent
+ * to <code>true</code>.
+ *
+ * @param actor a <code>String</code> giving the URI of the actor for which
+ * to search
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderBlock</code> objects that contain the specified
+ * actor and are marked as MustUnderstand
+ */
+ public abstract Iterator examineMustUnderstandHeaderBlocks(String actor);
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>
+ * objects in this <code>SOAPHeader</code> object.
+ *
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderBlock</code> objects contained by this
+ * <code>SOAPHeader</code>
+ */
+ public abstract Iterator examineAllHeaderBlocks();
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>
+ * objects in this <code>SOAPHeader </code> object and detaches them from
+ * this <code>SOAPHeader</code> object.
+ *
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderBlock</code> objects contained by this
+ * <code>SOAPHeader</code>
+ */
+ public abstract Iterator extractAllHeaderBlocks();
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPHeaderBlock.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPHeaderBlock.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPHeaderBlock.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/SOAPHeaderBlock.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,76 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.om;
+
+
+/**
+ * <P>An object representing the contents in the SOAP header part of the SOAP
+ * envelope. The immediate children of a <CODE> SOAPHeader</CODE> object can be
+ * represented only as <CODE> SOAPHeaderBlock</CODE> objects.</P>
+ * <p/>
+ * <P>B <CODE>SOAPHeaderBlock</CODE> object can have other
+ * <CODE>OMElement</CODE> objects as its children.</P>
+ */
+public interface SOAPHeaderBlock extends OMElement {
+
+ /**
+ * Sets the actor associated with this <CODE> SOAPHeaderBlock</CODE> object
+ * to the specified actor. The default value of an actor is: <CODE>
+ * OMConstants.URI_SOAP_ACTOR_NEXT</CODE>
+ *
+ * @param actorURI a <CODE>String</CODE> giving the URI of the actor to set
+ * @throws java.lang.IllegalArgumentException
+ * if there is a problem in setting the actor.
+ * @see #getActor() getActor()
+ */
+ public abstract void setActor(String actorURI);
+
+ /**
+ * Returns the uri of the actor associated with this <CODE>
+ * SOAPHeaderBlock</CODE> object.
+ *
+ * @return a <CODE>String</CODE> giving the URI of the actor
+ * @see #setActor(java.lang.String) setActor(java.lang.String)
+ */
+ public abstract String getActor();
+
+ /**
+ * Sets the mustUnderstand attribute for this <CODE> SOAPHeaderBlock</CODE>
+ * object to be on or off.
+ * <p/>
+ * <P>If the mustUnderstand attribute is on, the actor who receives the
+ * <CODE>SOAPHeaderBlock</CODE> must process it correctly. This ensures, for
+ * example, that if the <CODE> SOAPHeaderBlock</CODE> object modifies the
+ * message, that the message is being modified correctly.</P>
+ *
+ * @param mustUnderstand <CODE>true</CODE> to set the mustUnderstand
+ * attribute on; <CODE>false</CODE> to turn if off
+ * @throws java.lang.IllegalArgumentException
+ * if there is a problem in setting the actor.
+ * @see #getMustUnderstand() getMustUnderstand()
+ */
+ public abstract void setMustUnderstand(boolean mustUnderstand);
+
+ /**
+ * Returns whether the mustUnderstand attribute for this
+ * <CODE>SOAPHeaderBlock</CODE> object is turned on.
+ *
+ * @return <CODE>true</CODE> if the mustUnderstand attribute of this
+ * <CODE>SOAPHeaderBlock</CODE> object is turned on;
+ * <CODE>false</CODE> otherwise
+ */
+ public abstract boolean getMustUnderstand();
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/StreamingWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/StreamingWrapper.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/StreamingWrapper.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/om/StreamingWrapper.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,132 @@
+package org.apache.axis.om;
+
+import org.apache.axis.impl.llom.exception.OMStreamingException;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ * @author Axis team Date: Nov 18, 2004 Time: 1:52:09 PM
+ */
+public interface StreamingWrapper {
+ /*
+ ######################################################################
+ Following methods are removed. they seem to be duplicates
+ */
+ //int generatePullEvent();
+ //void setCursor(int eventCount);
+
+ /**
+ * Allows to set parser wrapper to switch to the stream when needed. Unless
+ * this switch is "on" the wrapper will always cache the parsed items. If
+ * the need is there to get the pull events <i>without</i> caching then this
+ * switch must be "on"
+ *
+ * @param b
+ */
+ void setAllowSwitching(boolean b);
+
+ /**
+ * get the parser switching flag.
+ *
+ * @return
+ * @see #setAllowSwitching
+ */
+ boolean isAllowSwitching();
+
+
+ /*
+ ######################################################################
+ These methods are actually from the XMLStreamReader interface which are StAX!
+ Unwanted ones (such as the ones that include PI's) are removed
+ */
+ Object getProperty(String s) throws IllegalArgumentException;
+
+ int next() throws OMStreamingException;
+
+ String getElementText() throws OMStreamingException;
+
+ int nextTag() throws OMStreamingException;
+
+ boolean hasNext() throws OMStreamingException;
+
+ void close() throws OMStreamingException;
+
+ String getNamespaceURI(String s);
+
+ boolean isStartElement();
+
+ boolean isEndElement();
+
+ boolean isCharacters();
+
+ boolean isWhiteSpace();
+
+ String getAttributeValue(String s, String s1);
+
+ int getAttributeCount();
+
+ QName getAttributeName(int i);
+
+ String getAttributeNamespace(int i);
+
+ String getAttributeLocalName(int i);
+
+ String getAttributePrefix(int i);
+
+ String getAttributeType(int i);
+
+ String getAttributeValue(int i);
+
+ boolean isAttributeSpecified(int i);
+
+ int getNamespaceCount();
+
+ String getNamespacePrefix(int i);
+
+ String getNamespaceURI(int i);
+
+// NamespaceContext getNamespaceContext();
+
+ int getEventType();
+
+ String getText();
+
+ char[] getTextCharacters();
+
+ int getTextCharacters(int i, char[] chars, int i1, int i2) throws OMStreamingException;
+
+ int getTextStart();
+
+ int getTextLength();
+
+ boolean hasText();
+
+// Location getLocation();
+
+ QName getName();
+
+ String getLocalName();
+
+ boolean hasName();
+
+ String getNamespaceURI();
+
+ String getPrefix();
+
+
+}
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeBase64Out.txt
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeBase64Out.txt?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeBase64Out.txt (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeBase64Out.txt Tue Mar 8 00:56:12 2005
@@ -0,0 +1 @@
+<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><m:data xmlns:m="http://www.example.org/stuff"><m:value>rO0ABXNyAA9qYXZhLmxhbmcuRmxvYXTa7cmi2zzw7AIAAUYABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwP7pRGg==</m:value><m:sig m:contentType="application/pkcs7-signature">rO0ABXQAE1Byb2dyYW1taW5nIFByb2plY3Q=</m:sig><m:photo m:contentType="image/png">rO0ABXVyAAJbQqzzF/gGCFTgAgAAeHAAAAAGaWKKapGG</m:photo></m:data></soap:Body></soap:Envelope>
\ No newline at end of file
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeMTOMBaseOut.txt
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeMTOMBaseOut.txt?view=auto&rev=156512
==============================================================================
Binary files /tmp/tmpnlpP7S and /tmp/tmp2jUfvE differ
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeMTOMOut.txt
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeMTOMOut.txt?view=auto&rev=156512
==============================================================================
Binary files /tmp/tmp5Fku6g and /tmp/tmpID16Xm differ
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMFileTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMFileTest.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMFileTest.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMFileTest.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,51 @@
+package org.apache.axis.mtom;
+
+import org.apache.axis.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis.impl.llom.mtom.OMBlob;
+import org.apache.axis.impl.llom.serialize.SimpleOMSerializer;
+import org.apache.axis.om.OMElement;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Iterator;
+
+/**
+ * @author Thilina Gunarathne Reads in the output file given by
+ * MTOMOMSerializeTest
+ */
+public class MTOMFileTest{
+
+ public static void main(String args[]) {
+ StAXOMBuilder builder;
+ File tempFile;
+
+ try {
+
+ builder = new StAXOMBuilder(new FileInputStream("src/test-resources/OMSerializeMTOMOut.txt"));
+
+ SimpleOMSerializer serializer = new SimpleOMSerializer();
+ OMElement root = (OMElement) builder.getDocumentElement();
+
+ while (!builder.isCompleted()) {
+
+ }
+ System.out.println(root.getLocalName() + " : " + root.getNamespaceName());
+ OMElement body = (OMElement) root.getFirstChild();
+ System.out.println(body.getLocalName() + " : " + body.getNamespaceName());
+ OMElement data = (OMElement) body.getFirstChild();
+ System.out.println(data.getLocalName() + " : " + data.getNamespaceName());
+ Iterator childIt = data.getChildren();
+ while (childIt.hasNext()) {
+ OMElement child = (OMElement) childIt.next();
+ OMBlob blob = (OMBlob) child.getFirstChild();
+ System.out.println(child.getLocalName() + ":-\t"
+ + blob.getObject());
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+}
\ No newline at end of file
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMOMSerializeTester.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMOMSerializeTester.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMOMSerializeTester.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMOMSerializeTester.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,96 @@
+package org.apache.axis.mtom;
+
+import org.apache.axis.encoding.Base64;
+import org.apache.axis.impl.llom.OMAttributeImpl;
+import org.apache.axis.impl.llom.OMElementImpl;
+import org.apache.axis.impl.llom.OMNamespaceImpl;
+import org.apache.axis.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis.impl.llom.mtom.MTOMXMLStreamWriter;
+import org.apache.axis.impl.llom.mtom.OMBlob;
+import org.apache.axis.impl.llom.serialize.SimpleOMSerializer;
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMElement;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+
+/**
+ * @author Thilina Gunarathne Builds an AXIOM & write it as MTOM
+ */
+public class MTOMOMSerializeTester {
+
+ public static void main(String args[]) {
+ StAXOMBuilder test;
+ File outMTOMFile;
+ File outBase64File;
+ File outMTOMBaseFile;
+
+ try {
+
+ outMTOMFile = new File("src/test-resources/OMSerializeMTOMOut.txt");
+ outBase64File = new File("src/test-resources/OMSerializeBase64Out.txt");
+ outMTOMBaseFile = new File("src/test-resources/OMSerializeMTOMBaseOut.txt");
+ XMLStreamWriter baseWriter = XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(new FileOutputStream(outBase64File));
+ MTOMXMLStreamWriter MTOMWriter = new MTOMXMLStreamWriter(new FileOutputStream(outMTOMFile));
+ MTOMXMLStreamWriter MTOMBaseWriter = new MTOMXMLStreamWriter(new FileOutputStream(outMTOMBaseFile));
+
+ SimpleOMSerializer MTOMser = new SimpleOMSerializer();
+ SimpleOMSerializer Baseser = new SimpleOMSerializer();
+ SimpleOMSerializer MTOMBaseser = new SimpleOMSerializer();
+
+ OMNamespaceImpl soap = new OMNamespaceImpl("http://www.w3.org/2003/05/soap-envelope", "soap");
+ OMElement Envelope = new OMElementImpl("Envelope", soap);
+ OMElement Body = new OMElementImpl("Body", soap);
+
+ OMNamespaceImpl m = new OMNamespaceImpl("http://www.example.org/stuff", "m");
+ OMElement data = new OMElementImpl("data", m);
+ OMElement photo = new OMElementImpl("photo", m);
+
+ OMNamespaceImpl mime = new OMNamespaceImpl("http://www.w3.org/2003/06/xmlmime", "m");
+ OMAttribute cType = new OMAttributeImpl("contentType", mime,
+ "image/png");
+ photo.insertAttribute(cType);
+ OMBlob photoData = new OMBlob(Base64.decode("aWKKapGGyq"), true);
+
+ OMElement sig = new OMElementImpl("sig", m);
+ OMAttribute cType1 = new OMAttributeImpl("contentType", mime,
+ "application/pkcs7-signature");
+ sig.insertAttribute(cType1);
+ //java.awt.Image pic =
+ // Toolkit.getDefaultToolkit().getImage("C:\\test.jpg");
+ OMBlob sigData = new OMBlob(new String("Programming Project"), true);
+
+ OMElement val = new OMElementImpl("value", m);
+ OMBlob valData = new OMBlob(new Float(1.4556), true);
+
+ Envelope.addChild(Body);
+ Body.addChild(data);
+ data.addChild(photo);
+ photo.addChild(photoData);
+ data.addChild(sig);
+ sig.addChild(sigData);
+ data.addChild(val);
+ val.addChild(valData);
+
+ MTOMser.serialize(Envelope, MTOMWriter);
+ MTOMWriter.flush();
+ MTOMWriter.complete();
+
+ Baseser.serialize(Envelope, baseWriter);
+ baseWriter.flush();
+
+ valData.setMTOMable(false);
+ //photoData.setMTOMable(false);
+ MTOMBaseser.serialize(Envelope, MTOMBaseWriter);
+ MTOMBaseWriter.flush();
+ MTOMBaseWriter.complete();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+}
\ No newline at end of file
Added: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MtomTesterWhitemesaFile1.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MtomTesterWhitemesaFile1.java?view=auto&rev=156512
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MtomTesterWhitemesaFile1.java (added)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MtomTesterWhitemesaFile1.java Tue Mar 8 00:56:12 2005
@@ -0,0 +1,48 @@
+package org.apache.axis.mtom;
+
+import org.apache.axis.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis.impl.llom.serialize.SimpleOMSerializer;
+import org.apache.axis.om.OMElement;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.Iterator;
+
+
+/**
+ * @author Thilina Gunarathne
+ */
+public class MtomTesterWhitemesaFile1 {
+
+ public static void main(String args[]) {
+ StAXOMBuilder test;
+ File tempFile;
+
+ try {
+ test = new StAXOMBuilder((InputStream) new FileInputStream("src/test-resources/Whitemesa1MTOM.txt"));
+ tempFile = new File("src/test-resources/Whitemesa1MTOMBaseOut.xml");
+
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new FileOutputStream(tempFile));
+ //MTOMXmlStreamWriter writer = new MTOMXmlStreamWriter(new FileOutputStream(tempFile));
+ SimpleOMSerializer ser = new SimpleOMSerializer();
+ OMElement root = (OMElement) test.getDocumentElement();
+
+ Iterator childIt = root.getChildren();
+ while (childIt.hasNext()) {
+ Object temp1 = childIt.next();
+ System.out.println(temp1.toString());
+ }
+ ser.serialize(root, writer);
+ writer.flush();
+ //writer.complete();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+}
\ No newline at end of file