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/14 06:53:09 UTC
svn commit: r157393 [1/3] - in
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src:
java/org/apache/axis/impl/llom/ java/org/apache/axis/impl/llom/builder/
java/org/apache/axis/impl/llom/exception/
java/org/apache/axis/impl/llom/factory/ java/org/apache/axis/impl/llom/mtom/
java/org/apache/axis/impl/llom/serialize/
java/org/apache/axis/impl/llom/traverse/ test-resources/
test/org/apache/axis/mtom/
Author: chinthaka
Date: Sun Mar 13 21:53:01 2005
New Revision: 157393
URL: http://svn.apache.org/viewcvs?view=rev&rev=157393
Log:
Applying patch for Thilina.
Modified:
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMDocument.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamespaceImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNavigator.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNodeImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMTextImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/builder/StAXOMBuilder.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/exception/MTOMException.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/exception/OMBuilderException.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/exception/OMSerializerException.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/exception/OMStreamingException.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/exception/XMLStreamException.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/AttachmentPart.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/ByteArrayDataSource.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEBodyPartInputStream.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEInputStream.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MIMEParser.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMBuilder.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/MTOMXMLStreamWriter.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/mtom/OMBlob.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/SimpleOMSerializer.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/serialize/XMLSerilazer.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test-resources/OMSerializeBase64Out.txt
webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/test/org/apache/axis/mtom/MTOMTest.java
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java Sun Mar 13 21:53:01 2005
@@ -1,79 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis.om.OMAttribute;
-import org.apache.axis.om.OMNamespace;
-
-/**
- * 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 class OMAttributeImpl implements OMAttribute {
-
- private String localName;
- private String value;
- private OMNamespace namespace;
-
- private static String QUOTE_ENTITY = """;
- private static Matcher matcher = Pattern.compile("\"").matcher(null);
-
- public OMAttributeImpl(String localName, OMNamespace ns, String value) {
- setLocalName(localName);
- setValue(value);
- setOMNamespace(ns);
- }
-
- synchronized static String replaceQuoteWithEntity(String value) {
- matcher.reset(value);
- return matcher.replaceAll(QUOTE_ENTITY);
- }
-
- public QName getQName() {
-
-
- String namespaceName = namespace != null ? namespace.getName() : null;
- return new QName(namespaceName, localName);
- }
-
- // -------- Getters and Setters
- public String getLocalName() {
- return localName;
- }
-
- public void setLocalName(String localName) {
- this.localName = localName;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public void setOMNamespace(OMNamespace omNamespace) {
- this.namespace = omNamespace;
- }
-
- public OMNamespace getNamespace() {
- return namespace;
- }
-
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMDocument.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMDocument.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMDocument.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMDocument.java Sun Mar 13 21:53:01 2005
@@ -1,52 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMXMLParserWrapper;
-
-/**
- * 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 class OMDocument {
- private OMElement rootElement;
- private OMXMLParserWrapper parserWrapper;
-
- /**
- * @param rootElement
- * @param parserWrapper
- */
- public OMDocument(OMElement rootElement, OMXMLParserWrapper parserWrapper) {
- this.rootElement = rootElement;
- this.parserWrapper = parserWrapper;
- }
-
- /**
- * @param parserWrapper
- */
- public OMDocument(OMXMLParserWrapper parserWrapper) {
- this.parserWrapper = parserWrapper;
- }
-
- public OMElement getRootElement() {
- if (rootElement == null) {
- parserWrapper.next();
- }
- return rootElement;
- }
-
- public void setRootElement(OMElement rootElement) {
- this.rootElement = rootElement;
- }
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMElementImpl.java Sun Mar 13 21:53:01 2005
@@ -1,380 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.ListIterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axis.impl.llom.traverse.OMChildrenIterator;
-import org.apache.axis.impl.llom.traverse.OMChildrenQNameIterator;
-import org.apache.axis.om.OMAttribute;
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMFactory;
-import org.apache.axis.om.OMNamespace;
-import org.apache.axis.om.OMNode;
-import org.apache.axis.om.OMText;
-import org.apache.axis.om.OMXMLParserWrapper;
-
-
-/**
- * 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 class OMElementImpl extends OMNamedNodeImpl implements OMElement {
-
- private OMNode firstChild;
- private OMXMLParserWrapper builder;
- private OMAttributeImpl firstAttribute;
- private ArrayList namespaces;
- private ArrayList attributes;
-
- public OMElementImpl(OMElement parent) {
- super(parent);
- done = true;
- }
-
-
- public OMElementImpl(String localName, OMNamespace ns) {
- super(localName, ns, null);
- done = true;
- }
-
-
- public OMElementImpl(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder) {
- super(localName, ns, parent);
- this.builder = builder;
- }
-
- /**
- * This will add child to the element. One can decide whether he append the
- * child or he adds to the front of the children list
- *
- * @param child
- */
- public void addChild(OMNode child) {
- addChild((OMNodeImpl) child);
- }
-
- /**
- * This will search for children with a given QName and will return an
- * iterator to traverse through the OMNodes. This QName can contain any
- * combination of prefix, localname and URI
- *
- * @param elementQName
- * @return
- * @throws org.apache.axis.om.OMException
- */
- public Iterator getChildrenWithName(QName elementQName) throws OMException {
- return new OMChildrenQNameIterator((OMNodeImpl) getFirstChild(), elementQName);
- }
-
- private void addChild(OMNodeImpl child) {
- if (firstChild == null && !done)
- builder.next();
- child.setPreviousSibling(null);
- child.setNextSibling(firstChild);
- if (firstChild != null) {
- OMNodeImpl firstChildImpl = (OMNodeImpl) firstChild;
- firstChildImpl.setPreviousSibling(child);
- }
- child.setParent(this);
-// child.setComplete(true);
- firstChild = child;
- }
-
- /**
- * This will give the next sibling. This can be an OMAttribute for
- * OMAttribute or OMText or OMELement for others.
- *
- * @return
- * @throws org.apache.axis.om.OMException
- */
- public OMNode getNextSibling() throws OMException {
- while (!done)
- builder.next();
- return super.getNextSibling();
- }
-
- /**
- * This returns a collection of this element. Children can be of types
- * OMElement, OMText.
- */
- public Iterator getChildren() {
- return new OMChildrenIterator(getFirstChild());
- }
-
- // --------------------- Namespace Methods ------------------------------------------------------------
- /**
- * THis will create a namespace in the current element scope
- *
- * @param uri
- * @param prefix
- * @return
- */
- public OMNamespace declareNamespace(String uri, String prefix) {
-
- if (namespaces == null) {
- namespaces = new ArrayList(5);
- // the default size of the ArrayList is 10. But I think this is too much as on average number of namespaces is
- // much more than 10. So I selected 5. Hope this is ok as an initial value. -- Eran Chinthaka 13/12/2004
-
- }
- OMNamespaceImpl ns = new OMNamespaceImpl(uri, prefix);
- namespaces.add(ns);
- return ns;
- }
-
- //TODO correct this
- public void setValue(String value) {
- OMText txt = OMFactory.newInstance().createText(value);
- this.addChild(txt);
- }
-
- /**
- * @param namespace
- * @return
- */
- public OMNamespace declareNamespace(OMNamespace namespace) {
- if (namespaces == null) {
- namespaces = new ArrayList(5);
- // the default size of the ArrayList is 10. But I think this is too much as on average number of namespaces is
- // much more than 10. So I selected 5. Hope this is ok as an initial value. -- Eran Chinthaka 13/12/2004
-
- }
- namespaces.add(namespace);
- return namespace;
- }
-
- /**
- * This will find a namespace with the given uri and prefix, in the scope of
- * the docuemnt. This will start to find from the current element and goes
- * up in the hiararchy until this finds one. If none is found, return null
- *
- * @param uri
- * @param prefix
- * @return
- * @throws org.apache.axis.om.OMException
- */
- public OMNamespace findInScopeNamespace(String uri, String prefix) throws OMException {
-
- // check in the current element
- OMNamespace namespace = findDeclaredNamespace(uri, prefix);
- if (namespace != null) {
- return namespace;
- }
- // go up to check with ancestors
- if (parent != null)
- return parent.findInScopeNamespace(uri, prefix);
- return null;
- }
-
- /**
- * This will ckeck for the namespace <B>only</B> in the current Element
- *
- * @param uri
- * @param prefix
- * @return
- * @throws OMException
- */
- public OMNamespace findDeclaredNamespace(String uri, String prefix) throws OMException {
-
- if (namespaces == null) {
- return null;
- }
- // check in the current element
- ListIterator namespaceListIterator = namespaces.listIterator();
- if (prefix == null) {
- while (namespaceListIterator.hasNext()) {
- OMNamespace omNamespace = (OMNamespace) namespaceListIterator.next();
- if (omNamespace.getName().equals(uri)) {
- return omNamespace;
- }
- }
- } else {
- while (namespaceListIterator.hasNext()) {
- OMNamespace omNamespace = (OMNamespace) namespaceListIterator.next();
- if (omNamespace.equals(uri, prefix)) {
- return omNamespace;
- }
- }
-
- }
- return null;
-
- }
-
- public Iterator getAllDeclaredNamespaces() {
- if (namespaces == null) {
-
- // no namespace declared in this element.
- // return a null iterator
- // have to look in to this later
- return new Iterator() {
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- public boolean hasNext() {
- return false;
- }
-
- public Object next() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- return namespaces.listIterator();
- }
-
- // ---------------------------------------------------------------------------------------------------------------
-
- /**
- * This will help to search for an attribute with a given QName within this
- * Element
- *
- * @param qname
- * @return
- * @throws org.apache.axis.om.OMException
- */
- public OMAttribute getAttributeWithQName(QName qname) throws OMException {
-
- if (attributes == null) {
- return null;
- }
-
- ListIterator attrIter = attributes.listIterator();
- OMAttribute omAttribute = null;
- while (attrIter.hasNext()) {
- omAttribute = (OMAttribute) attrIter.next();
- if (omAttribute.getQName().equals(qname)) {
- return omAttribute;
- }
- }
-
- return null;
- }
-
- /**
- * This will return a List of OMAttributes
- *
- * @return
- */
- public Iterator getAttributes() {
- if (attributes == null) {
- attributes = new ArrayList(1);
- }
- return attributes.listIterator();
- }
-
- /**
- * This will insert attribute to this element. Implementor can decide as to
- * insert this in the front or at the end of set of attributes
- *
- * @param attr
- */
- public void insertAttribute(OMAttribute attr) {
- if (attributes == null) {
- attributes = new ArrayList(5);
- }
- attributes.add(attr);
- }
-
- public void removeAttribute(OMAttribute attr) {
- if (attributes.indexOf(attr) != -1) {
- attributes.remove(attr);
- }
- }
-
- public void setBuilder(OMXMLParserWrapper wrapper) {
- this.builder = wrapper;
- }
-
- public OMXMLParserWrapper getBuilder() {
- return builder;
- }
-
- /**
- * This will force the parser to proceed, if parser has not yet finished
- * with the XML input
- */
- public void buildNext() {
- builder.next();
- }
-
- public OMNode getFirstChild() {
- if (firstChild == null && !done)
- buildNext();
- return firstChild;
- }
-
-
- public void setFirstChild(OMNode firstChild) {
- this.firstChild = firstChild;
- }
-
-
- /**
- * This will remove this information item and its children, from the model
- * completely
- *
- * @throws org.apache.axis.om.OMException
- */
- public void detach() throws OMException {
- if (done)
- super.detach();
- else
- builder.discard(this);
- }
-
- public boolean isComplete() {
- return done;
- }
-
- /**
- * 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 org.apache.axis.om.OMException
- */
- public String getValue() throws OMException {
- throw new UnsupportedOperationException();
- }
-
- /**
- * This is to get the type of node, as this is the super class of all the
- * nodes
- *
- * @return
- * @throws org.apache.axis.om.OMException
- */
- public short getType() throws OMException {
- return OMNode.ELEMENT_NODE;
- }
-
- /**
- *
- */
- public XMLStreamReader getPullParser(boolean cacheOff) {
- if (builder == null && cacheOff)
- throw new UnsupportedOperationException("This element was not created in a manner to be switched");
- return new OMStAXWrapper(builder, this, cacheOff);
- }
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java Sun Mar 13 21:53:01 2005
@@ -1,94 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMNamedNode;
-import org.apache.axis.om.OMNamespace;
-
-/**
- * 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 class OMNamedNodeImpl extends OMNodeImpl implements OMNamedNode {
-
- protected OMNamespace ns;
- protected String localName;
-
-
- public OMNamedNodeImpl(String localName, OMNamespace ns, OMElement parent) {
- super(parent);
- this.localName = localName;
- this.ns = ns;
- }
-
- public OMNamedNodeImpl(OMElement parent) {
- super(parent);
- }
-
- public String getLocalName() {
- return localName;
- }
-
- public void setLocalName(String localName) {
- this.localName = localName;
- }
-
- public OMNamespace getNamespace() throws OMException {
- if (ns == null)
- throw new OMException("all elements in a soap message must be namespace qualified");
- return ns;
- }
-
- public String getNamespaceName() {
- return ns.getName();
- }
-
- /**
- * @param namespace
- */
- public void setNamespace(OMNamespace namespace) {
- this.ns = namespace;
- }
-
-
- public QName getQName() {
- QName qName = new QName(ns.getName(), localName, ns.getPrefix());
- return qName;
- }
-
-// /**
-// * Equals method of QName seems doesn't working the way I need in this situation.
-// * So implementing my own !!
-// *
-// * @param qName
-// * @return
-// */
-// public boolean isQNameEquals(QName qName) {
-// String thatLocalName = qName.getLocalName();
-//
-// return ((thatLocalName == null && this.localName == null) || (thatLocalName != null && thatLocalName.equalsIgnoreCase(this.localName)))
-// && ns.equals(qName.getNamespaceURI(), qName.getPrefix());
-// }
-//
-// private String getStringValue(String s) {
-// if (s == null) {
-// return "null";
-// }
-//
-// return s;
-// }
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamespaceImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamespaceImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamespaceImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNamespaceImpl.java Sun Mar 13 21:53:01 2005
@@ -1,51 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import org.apache.axis.om.OMNamespace;
-
-/**
- * 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 class OMNamespaceImpl implements OMNamespace {
- private String prefix;
- private String uri;
- //private String value;
-
- /**
- * @param uri
- * @param prefix
- */
- public OMNamespaceImpl(String uri, String prefix) {
- this.uri = uri;
- this.prefix = prefix;
- }
-
-
- public boolean equals(String uri, String prefix) {
- return ((prefix == null && this.prefix == null) || (prefix != null && prefix.equals(this.prefix)))
- && uri.equals(uri);
- }
-
-
- public String getPrefix() {
- return prefix;
- }
-
- public String getName() {
- return uri;
- }
-
-
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNavigator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNavigator.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNavigator.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNavigator.java Sun Mar 13 21:53:01 2005
@@ -1,158 +0,0 @@
-/*
-* 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.
-*
-*/
-
-/*
-* Created on Sep 25, 2004
-*
-
-*/
-package org.apache.axis.impl.llom;
-
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMNode;
-
-/**
- * Refer to the testClass to find out how to use features like isNavigable,
- * isComplete and step
- */
-public class OMNavigator {
-
- protected OMNode node;
- private boolean visited;
- private OMNode next;
-
- //root is the starting element. Once the navigator comes back to the
- //root, the traversal is terminated
- private OMNode root;
- private boolean backtracked;
-
- //flags that tell the status of the navigator
- private boolean end = false;
- private boolean start = true;
-
- public OMNavigator() {
- }
-
- public OMNavigator(OMNode node) {
- init(node);
- }
-
- public void init(OMNode node) {
- next = node;
- root = node;
- backtracked = false;
- }
-
- /**
- * get the next node
- *
- * @return OMnode in the sequence of preorder traversal. Note however that
- * an element node is treated slightly diffrently. Once the element
- * is passed it returns the same element in the next encounter as
- * well
- */
- public OMNode next() {
- if (next == null) {
- return null;
- }
- node = next;
- visited = backtracked;
- backtracked = false;
-
- updateNextNode();
- //set the starting and ending flags
- if (root.equals(node)) {
- if (!start) {
- end = true;
- } else {
- start = false;
- }
- }
-
- return node;
- }
-
- /**
- * Private method to encapsulate the searching logic
- */
- private void updateNextNode() {
- if (next instanceof OMElement && !visited) {
-
- OMElement e = (OMElement) next;
- if (e.getFirstChild() != null)
- next = e.getFirstChild();
- else if (e.isComplete())
- backtracked = true;
- else
- next = null;
-
- } else {
- OMNode nextSibling = next.getNextSibling();
- OMNode parent = next.getParent();
-
- if (nextSibling != null)
- next = nextSibling;
- else if (parent != null && parent.isComplete()) {
- next = parent;
- backtracked = true;
- } else
- next = null;
- }
- }
-
-
- public boolean visited() {
- return visited;
- }
-
- /**
- * This is a very special method. This allows the navigator to step once it
- * has reached the existing om. At this point the isNavigable method will
- * return false but the isComplete method may return false which means that
- * the navigating the given element is not complete but the navigator cannot
- * proceed
- */
- public void step() {
- if (!end) {
- next = node;
- updateNextNode();
- }
- }
-
- /**
- * the navigable status
- *
- * @return
- */
- public boolean isNavigable() {
- if (end)
- return false;
- else if (next == null)
- return false;
- else
- return true;
- }
-
- /**
- * The completed status
- *
- * @return
- */
- public boolean isCompleted() {
- return end;
- }
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNodeImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNodeImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMNodeImpl.java Sun Mar 13 21:53:01 2005
@@ -1,202 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMNode;
-
-/**
- * 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 class OMNodeImpl implements OMNode {
- protected OMElementImpl parent;
- protected OMNodeImpl nextSibling;
- protected OMNodeImpl previousSibling;
- protected String value;
- protected boolean done = false;
- protected short nodeType;
-
- public OMNodeImpl() {
- }
-
-
- /**
- * For a node to exist there must be a parent
- *
- * @param parent
- */
-
-
- public OMNodeImpl(OMElement parent) {
- if (parent instanceof OMNodeImpl)
- this.parent = (OMElementImpl) parent;
- }
-
- /**
- * This method should return the immediate parent of the node. Parent is
- * always an Element
- *
- * @return
- * @throws org.apache.axis.om.OMException
- */
- public OMElement getParent() throws OMException {
- return parent;
- }
-
- public void setParent(OMElement element) {
- if (element instanceof OMNodeImpl)
- this.parent = (OMElementImpl) element;
- }
-
- /**
- * This will give the next sibling. This can be an OMAttribute for
- * OMAttribute or OMText or OMELement for others.
- *
- * @return
- * @throws org.apache.axis.om.OMException
- */
- public OMNode getNextSibling() throws OMException {
- if (nextSibling == null && parent != null && !parent.isComplete())
- parent.buildNext();
- return nextSibling;
- }
-
- public void setNextSibling(OMNode node) {
- this.nextSibling = (OMNodeImpl) 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 org.apache.axis.om.OMException
- */
- public String getValue() throws OMException {
- return value;
- }
-
- public void setValue(String value) {
- this.value = 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() {
- return true;
- }
-
- public void setComplete(boolean state) {
- this.done = state;
- }
-
- /**
- * This will remove this information item and its children, from the model
- * completely
- *
- * @throws org.apache.axis.om.OMException
- */
- public void detach() throws OMException {
- if (parent == null)
- throw new OMException();
- OMNodeImpl nextSibling = (OMNodeImpl) getNextSibling();
- if (previousSibling == null)
- parent.setFirstChild(nextSibling);
- else
- previousSibling.setNextSibling(nextSibling);
- if (nextSibling != null)
- nextSibling.setPreviousSibling(previousSibling);
-
- }
-
- /**
- * This will insert a sibling just after the current information item.
- *
- * @param sibling
- * @throws org.apache.axis.om.OMException
- */
- public void insertSiblingAfter(OMNode sibling) throws OMException {
- if (parent == null)
- throw new OMException();
- sibling.setParent(parent);
-
- if (sibling instanceof OMNodeImpl) {
- OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
- if (nextSibling == null)
- getNextSibling();
- siblingImpl.setPreviousSibling(this);
- if (nextSibling != null)
- nextSibling.setPreviousSibling(sibling);
- sibling.setNextSibling(nextSibling);
- nextSibling = siblingImpl;
- }
-
- }
-
- /**
- * This will insert a sibling just before the current information item
- *
- * @param sibling
- * @throws org.apache.axis.om.OMException
- */
- public void insertSiblingBefore(OMNode sibling) throws OMException {
- if (parent == null)
- throw new OMException();
- sibling.setParent(parent);
-
- if (sibling instanceof OMNodeImpl) {
- OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
- siblingImpl.setPreviousSibling(previousSibling);
- siblingImpl.setNextSibling(this);
- if (previousSibling == null)
- parent.setFirstChild(siblingImpl);
- else
- previousSibling.setNextSibling(siblingImpl);
- previousSibling = siblingImpl;
- }
- }
-
- /**
- * This is to get the type of node, as this is the super class of all the
- * nodes
- *
- * @return
- * @throws org.apache.axis.om.OMException
- */
- public short getType() throws OMException {
- return nodeType;
- }
-
- public void setType(short nodeType) throws OMException {
- this.nodeType = nodeType;
- }
-
- public OMNode getPreviousSibling() {
- return previousSibling;
- }
-
- public void setPreviousSibling(OMNode previousSibling) {
- this.previousSibling = (OMNodeImpl) previousSibling;
- }
-
-
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java Sun Mar 13 21:53:01 2005
@@ -1,872 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import java.util.Iterator;
-import java.util.Stack;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axis.impl.llom.exception.OMStreamingException;
-import org.apache.axis.om.OMAttribute;
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMNamedNode;
-import org.apache.axis.om.OMNamespace;
-import org.apache.axis.om.OMNode;
-import org.apache.axis.om.OMText;
-import org.apache.axis.om.OMXMLParserWrapper;
-
-/**
- * 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.
- */
-
-/**
- * Note - This class also implements the streaming constants interface to get
- * access to the StAX constants
- */
-public class OMStAXWrapper implements XMLStreamReader, XMLStreamConstants {
-
-
- private OMNavigator navigator;
- private OMXMLParserWrapper builder;
- private XMLStreamReader parser;
- private OMNode rootNode;
- private boolean isFirst = true;
- //the boolean flag that keeps the state of the document!
- private boolean complete = false;
-
-
- private int currentEvent = 0;
- // navigable means the output should be taken from the navigator
- // as soon as the navigator returns a null navigable will be reset
- //to false and the subsequent events will be taken from the builder
- //or the parser directly
- private boolean navigable = true;
-
- // SwitchingAllowed is set to false by default
- // this means that unless the user explicitly states
- // that he wants things not to be cached, everything will
- // be cached
- boolean switchingAllowed = false;
-
- private Stack elementStack = new Stack();
-
- //keeps the next event. The parser actually keeps one step ahead to
- //detect the end of navigation. (at the end of the stream the navigator
- //returns a null
- private OMNode nextNode = null;
-
- //holder for the current node. Needs this to generate events from the current node
- private OMNode currentNode = null;
-
- //needs this to refer to the last known node
- private OMNode lastNode = null;
-
- private boolean switched = false;
-
- public void setAllowSwitching(boolean b) {
- this.switchingAllowed = b;
- }
-
- public boolean isAllowSwitching() {
- return switchingAllowed;
- }
-
- /**
- * When constructing the OMStaxWrapper, the creator must produce the builder
- * (an instance of the OMXMLparserWrapper of the input) and the Element Node
- * to start parsing. The wrapper wil parse(proceed) until the end of the
- * given element. hence care should be taken to pass the root element if the
- * entire document is needed
- */
- OMStAXWrapper(OMXMLParserWrapper builder, OMElement startNode) {
- this(builder, startNode, false);
- }
-
- OMStAXWrapper(OMXMLParserWrapper builder, OMElement startNode, boolean cacheOff) {
- //create a navigator
- this.navigator = new OMNavigator(startNode);
- this.builder = builder;
- this.rootNode = startNode;
- //initaite the next and current nodes
- //Note - navigator is written in such a way that it first
- //returns the starting node at the first call to it
- currentNode = navigator.next();
- nextNode = navigator.next();
- switchingAllowed = cacheOff;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getPrefix()
- */
- public String getPrefix() {
- String returnStr = null;
- if (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT) {
- if (navigable) {
- OMNamespace ns = ((OMElement) lastNode).getNamespace();
- returnStr = ns == null ? null : ns.getPrefix();
- } else {
- returnStr = parser.getPrefix();
- }
- }
- return returnStr;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getNamespaceURI()
- */
- public String getNamespaceURI() {
- String returnStr = null;
- if (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT || currentEvent == NAMESPACE) {
- if (navigable) {
- OMNamespace ns = ((OMElement) lastNode).getNamespace();
- returnStr = ns == null ? null : ns.getName();
- } else {
- returnStr = parser.getNamespaceURI();
- }
- }
-
- return returnStr;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#hasName()
- */
- public boolean hasName() {
- if (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getLocalName()
- */
- public String getLocalName() {
- String returnStr = null;
- if (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT || currentEvent == ENTITY_REFERENCE) {
- if (navigable) {
- returnStr = ((OMElement) lastNode).getLocalName();
- } else {
- returnStr = parser.getLocalName();
- }
- }
- return returnStr;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getName()
- */
- public QName getName() {
- QName returnName = null;
- if (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT) {
- if (navigable) {
- returnName = getQName((OMNamedNode) lastNode);
- } else {
- returnName = parser.getName();
- }
- }
- return returnName;
- }
-
-
- /**
- * @see javax.xml.stream.XMLStreamReader#hasText()
- */
- public boolean hasText() {
- return (currentEvent == CHARACTERS ||
- currentEvent == DTD ||
- currentEvent == ENTITY_REFERENCE ||
- currentEvent == COMMENT ||
- currentEvent == SPACE);
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getTextLength()
- */
- public int getTextLength() {
- int returnLength = 0;
- if (hasText()) {
- if (navigable) {
- OMText textNode = (OMText) lastNode;
- returnLength = textNode.getValue().length();
- } else {
- returnLength = parser.getTextLength();
- }
-
- }
- return returnLength;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getTextStart()
- */
- public int getTextStart() {
- int returnLength = 0;
- if (hasText()) {
- if (!navigable) {
- returnLength = parser.getTextStart();
- }
- //Note - this has no relevant method in the OM
- }
- return returnLength;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getTextCharacters(int, char[], int,
- * int)
- */
- public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
- int returnLength = 0;
- if (hasText()) {
- if (!navigable) {
- try {
- returnLength = parser.getTextCharacters(i, chars, i1, i2);
- } catch (XMLStreamException e) {
- throw new OMStreamingException(e);
- }
- }
- //Note - this has no relevant method in the OM
- }
- return returnLength;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getTextCharacters()
- */
- public char[] getTextCharacters() {
- char[] returnArray = null;
- if (hasText()) {
- if (navigable) {
- OMText textNode = (OMText) lastNode;
- String str = textNode.getValue();
- returnArray = str.toCharArray();
- } else {
- returnArray = parser.getTextCharacters();
- }
-
- }
- return returnArray;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getText()
- */
- public String getText() {
- String returnString = null;
- if (hasText()) {
- if (navigable) {
- OMText textNode = (OMText) lastNode;
- returnString = textNode.getValue();
- } else {
- returnString = parser.getText();
- }
- }
- return returnString;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getEventType()
- */
- //todo this should be improved
- public int getEventType() {
- return currentEvent;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getNamespaceURI
- */
- public String getNamespaceURI(int i) {
- String returnString = null;
- if (isStartElement() || isEndElement() || currentEvent == NAMESPACE) {
- if (navigable) {
- OMNamespace ns = (OMNamespace) getItemFromIterator(((OMElement) lastNode).getAllDeclaredNamespaces(), i);
- returnString = ns == null ? null : ns.getName();
- } else {
- returnString = parser.getNamespaceURI(i);
- }
- }
- return returnString;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getNamespacePrefix
- */
- public String getNamespacePrefix(int i) {
- String returnString = null;
- if (isStartElement() || isEndElement() || currentEvent == NAMESPACE) {
- if (navigable) {
- OMNamespace ns = (OMNamespace) getItemFromIterator(((OMElement) lastNode).getAllDeclaredNamespaces(), i);
- returnString = ns == null ? null : ns.getPrefix();
- } else {
- returnString = parser.getNamespacePrefix(i);
- }
- }
- return returnString;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getNamespaceCount()
- */
- public int getNamespaceCount() {
- int returnCount = 0;
- if (isStartElement() || isEndElement() || currentEvent == NAMESPACE) {
- if (navigable) {
- returnCount = getCount(((OMElement) lastNode).getAllDeclaredNamespaces());
- } else {
- returnCount = parser.getNamespaceCount();
- }
- }
- return returnCount;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#isAttributeSpecified
- */
- public boolean isAttributeSpecified(int i) {
- boolean returnValue = false;
- if (isStartElement() || currentEvent == ATTRIBUTE) {
- if (navigable) {
- //theres nothing to be returned here
- } else {
- returnValue = parser.isAttributeSpecified(i);
- }
- } else {
- throw new IllegalStateException("attribute type accessed in illegal event!");
- }
- return returnValue;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getAttributeValue
- */
- public String getAttributeValue(int i) {
- String returnString = null;
- if (isStartElement() || currentEvent == ATTRIBUTE) {
- if (navigable) {
- OMAttribute attrib = getAttribute((OMElement) lastNode, i);
- if (attrib != null) {
- returnString = attrib.getValue();
- }
- } else {
- returnString = parser.getAttributeValue(i);
- }
- } else {
- throw new IllegalStateException("attribute type accessed in illegal event!");
- }
- return returnString;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getAttributeType
- */
- public String getAttributeType(int i) {
- String returnString = null;
- if (isStartElement() || currentEvent == ATTRIBUTE) {
- if (navigable) {
- //todo implement this
- } else {
- returnString = parser.getAttributeType(i);
- }
- } else {
- throw new IllegalStateException("attribute type accessed in illegal event!");
- }
- return returnString;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getAttributePrefix
- */
- public String getAttributePrefix(int i) {
- String returnString = null;
- if (isStartElement() || currentEvent == ATTRIBUTE) {
- if (navigable) {
- OMAttribute attrib = getAttribute((OMElement) lastNode, i);
- if (attrib != null) {
- OMNamespace nameSpace = attrib.getNamespace();
- if (nameSpace != null) {
- returnString = nameSpace.getPrefix();
- }
- }
- } else {
- returnString = parser.getAttributePrefix(i);
- }
- } else {
- throw new IllegalStateException("attribute prefix accessed in illegal event!");
- }
- return returnString;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getAttributeLocalName
- */
- public String getAttributeLocalName(int i) {
- String returnString = null;
- if (isStartElement() || currentEvent == ATTRIBUTE) {
- if (navigable) {
- OMAttribute attrib = getAttribute((OMElement) lastNode, i);
- if (attrib != null)
- returnString = attrib.getLocalName();
-
- } else {
- returnString = parser.getAttributeLocalName(i);
- }
- } else {
- throw new IllegalStateException("attribute localName accessed in illegal event!");
- }
- return returnString;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getAttributeNamespace
- */
- public String getAttributeNamespace(int i) {
- String returnString = null;
- if (isStartElement() || currentEvent == ATTRIBUTE) {
- if (navigable) {
- OMAttribute attrib = getAttribute((OMElement) lastNode, i);
- if (attrib != null) {
- OMNamespace nameSpace = attrib.getNamespace();
- if (nameSpace != null) {
- returnString = nameSpace.getName();
- }
- }
- } else {
- returnString = parser.getAttributeNamespace(i);
- }
- } else {
- throw new IllegalStateException("attribute nameSpace accessed in illegal event!");
- }
- return returnString;
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getAttributeName
- */
- public QName getAttributeName(int i) {
- QName returnQName = null;
- if (isStartElement() || currentEvent == ATTRIBUTE) {
- if (navigable) {
- returnQName = getAttribute((OMElement) lastNode, i).getQName();
- } else {
- returnQName = parser.getAttributeName(i);
- }
- } else {
- throw new IllegalStateException("attribute count accessed in illegal event!");
- }
- return returnQName;
- }
-
- /**
- * @return
- * @see javax.xml.stream.XMLStreamReader#getAttributeCount
- */
- public int getAttributeCount() {
- int returnCount = 0;
- if (isStartElement() || currentEvent == ATTRIBUTE) {
- if (navigable) {
- OMElement elt = (OMElement) lastNode;
- returnCount = getCount(elt.getAttributes());
- } else {
- returnCount = parser.getAttributeCount();
- }
-
- } else {
- throw new IllegalStateException("attribute count accessed in illegal event!");
- }
-
- return returnCount;
- }
-
-
- //todo
- public String getAttributeValue(String s, String s1) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isWhiteSpace() {
- boolean b;
- if (navigable) {
- b = (currentEvent == SPACE);
- } else {
- b = parser.isWhiteSpace();
- }
-
- return b;
- }
-
- public boolean isCharacters() {
- boolean b;
- if (navigable) {
- b = (currentEvent == CHARACTERS);
- } else {
- b = parser.isCharacters();
- }
- return b;
- }
-
- public boolean isEndElement() {
- boolean b;
- if (navigable) {
- b = (currentEvent == END_ELEMENT);
- } else {
- b = parser.isEndElement();
- }
- return b;
- }
-
- /**
- * @param i
- * @param s
- * @param s1
- * @throws XMLStreamException
- * @see javax.xml.stream.XMLStreamReader#require(int, String, String)
- */
- public void require(int i, String s, String s1) throws XMLStreamException {
- throw new XMLStreamException();
- }
-
- public boolean isStartElement() {
- boolean b;
- if (navigable) {
- b = (currentEvent == START_ELEMENT);
- } else {
- b = parser.isStartElement();
- }
- return b;
- }
-
- public String getNamespaceURI(String s) {
- String returnString = null;
- if (isStartElement() || isEndElement() || currentEvent == NAMESPACE) {
- if (navigable) {
- //Nothing to do here! How to get the namespacace references
- } else {
- returnString = parser.getNamespaceURI(s);
- }
- }
- return returnString;
- }
-
- public void close() throws XMLStreamException {
- //this doesnot mean anything with respect to the OM
- if (!navigable) {
- parser.close();
-
- }
-
- }
-
- public boolean hasNext() throws XMLStreamException {
- return !complete;
- }
-
- /**
- * Not implemented yet
- *
- * @return
- * @throws org.apache.axis.impl.llom.exception.OMStreamingException
- *
- */
- public int nextTag() throws XMLStreamException {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see javax.xml.stream.XMLStreamReader#getElementText()
- */
- public String getElementText() throws XMLStreamException {
-
- String returnText = "";
-
- if (navigable) {
- if (currentNode.getType() == OMNode.ELEMENT_NODE) {
- //todo complete this
- return null;
- }
- } else {
- try {
- returnText = parser.getElementText();
- } catch (XMLStreamException e) {
- throw new OMStreamingException(e);
- }
- }
- return returnText;
- }
-
- public int next() throws XMLStreamException {
-
- if (complete) {
- throw new OMStreamingException("Parser completed!");
- }
-
- if (switched) {
- //set navigable to false.Now the subsequent requests will be directed to
- //the parser
- navigable = false;
- }
- if (navigable) {
- currentEvent = generateEvents(currentNode);
- updateCompleteStatus();
- updateNextNode();
- } else {
- currentEvent = builder.next();
- updateCompleteStatus();
- }
- return currentEvent;
- }
-
- public Object getProperty(String s) throws IllegalArgumentException {
- throw new UnsupportedOperationException();
- }
-
-
- /**
- * This is a very important method. this keeps the navigator one step ahead
- * and pushes the navigator one event ahead. If the nextNode is null then
- * navigable is set to false; At the same time the parser and builder are
- * set up for the upcoming event generation
- */
- private void updateNextNode() throws XMLStreamException {
- lastNode = currentNode;
- currentNode = nextNode;
-
- if (navigator.isNavigable()) {
- nextNode = navigator.next();
- } else {
- if (!switchingAllowed) {
- if (navigator.isCompleted()) {
- nextNode = null;
- } else {
- builder.next();
- navigator.step();
- nextNode = navigator.next();
- }
- } else {
- //reset caching (the default is ON so it was not needed in the
- //earlier case!
- builder.setCache(false);
- //load the parser
- try {
- parser = (XMLStreamReader) builder.getParser();
- } catch (ClassCastException e) {
- throw new XMLStreamException("incompatible parser found!", e);
- }
-
- switched = true;
-
-
- }
- }
- }
-
- private void updateCompleteStatus() {
-
- if (!navigable) {
- complete = (currentEvent == END_DOCUMENT);
- } else {
- if (rootNode.equals(currentNode))
- if (isFirst)
- isFirst = false;
- else
- complete = true;
- }
- }
-
-
- public NamespaceContext getNamespaceContext() {
- throw new UnsupportedOperationException();
- }
-
- public String getEncoding() {
- throw new UnsupportedOperationException();
- }
-
- public Location getLocation() {
- throw new UnsupportedOperationException();
- }
-
- public String getVersion() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isStandalone() {
- throw new UnsupportedOperationException();
- }
-
- public boolean standaloneSet() {
- throw new UnsupportedOperationException();
- }
-
- public String getCharacterEncodingScheme() {
- throw new UnsupportedOperationException();
- }
-
- public String getPITarget() {
- throw new UnsupportedOperationException();
- }
-
- public String getPIData() {
- throw new UnsupportedOperationException();
- }
-
- /*
-
- ################################################################
- Generator methods for the OMNodes returned by the navigator
- ################################################################
-
- */
-
- private int generateEvents(OMNode node) {
- int returnEvent = 0;
-
- int nodeType = node.getType();
- switch (nodeType) {
- case OMNode.ELEMENT_NODE:
- returnEvent = generateElementEvents((OMElement) node);
- break;
- case OMNode.TEXT_NODE:
- returnEvent = generateTextEvents();
- break;
- case OMNode.COMMENT_NODE:
- returnEvent = generateCommentEvents();
- break;
- case OMNode.CDATA_SECTION_NODE:
- returnEvent = generateCdataEvents();
- break;
- default:
- break; //just ignore any other nodes
- }
-
- return returnEvent;
- }
-
-
- private int generateElementEvents(OMElement elt) {
- int returnValue = START_ELEMENT;
- if (!elementStack.isEmpty() && elementStack.peek().equals(elt)) {
- returnValue = END_ELEMENT;
- elementStack.pop();
- } else {
- elementStack.push(elt);
- }
- return returnValue;
- }
-
-
- private int generateTextEvents() {
- return CHARACTERS;
- }
-
- private int generateCommentEvents() {
- return COMMENT;
- }
-
- private int generateCdataEvents() {
- return CDATA;
- }
-
- /*
- ####################################################################
- Other helper methods
- ####################################################################
- */
-
- /**
- * helper method
- *
- * @param it
- * @return
- */
- private int getCount(Iterator it) {
- int count = 0;
- if (it != null) {
- while (it.hasNext()) {
- it.next();
- count++;
- }
- }
- return count;
- }
-
- /**
- * Helper method
- *
- * @param it
- * @param index
- * @return
- */
- private Object getItemFromIterator(Iterator it, int index) {
- int count = 0;
- Object returnObject = null;
- boolean found = false;
- if (it != null) {
- while (it.hasNext()) {
- returnObject = it.next();
- if (index == count++) {
- found = true;
- break;
- }
- }
- }
-
- if (found) {
- return returnObject;
- } else {
- return null;
- }
- }
-
- /**
- * Helper method
- *
- * @param namedNode
- * @return
- */
- private QName getQName(OMNamedNode namedNode) {
- QName returnName;
- OMNamespace ns = namedNode.getNamespace();
- String localPart = namedNode.getLocalName();
- if (ns != null) {
- String prefix = ns.getPrefix();
- String uri = ns.getName();
- if (prefix == null || prefix.equals(""))
- returnName = new QName(uri, localPart);
- else
- returnName = new QName(uri, localPart, prefix);
- } else {
- returnName = new QName(localPart);
- }
- return returnName;
- }
-
- /**
- * @param elt
- * @param index
- * @return
- */
- private OMAttribute getAttribute(OMElement elt, int index) {
- OMAttribute returnAttrib = null;
- if (elt != null) {
- returnAttrib = (OMAttribute) getItemFromIterator(elt.getAttributes(), index);
- }
- return returnAttrib;
- }
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMTextImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMTextImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/OMTextImpl.java Sun Mar 13 21:53:01 2005
@@ -1,73 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMNode;
-import org.apache.axis.om.OMText;
-
-/**
- * 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 class OMTextImpl extends OMNodeImpl implements OMText {
-
- protected short textType;
-
- public OMTextImpl(OMElement parent, String text) {
- super(parent);
- setValue(text);
- done = true;
- }
-
- public OMTextImpl(String s) {
- super();
- setValue(s);
- }
-
- /**
- * 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) {
- this.textType = type;
- }
-
- public short getTextType() {
- return textType;
- }
-
- public OMNode getFirstChild() throws OMException {
- throw new UnsupportedOperationException();
- }
-
- public void setFirstChild(OMNode node) throws OMException {
- throw new UnsupportedOperationException();
- }
-
- /**
- * This is to get the type of node, as this is the super class of all the
- * nodes
- *
- * @return
- * @throws org.apache.axis.om.OMException
- */
- public short getType() throws OMException {
- return OMNode.TEXT_NODE;
- }
-
-
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java Sun Mar 13 21:53:01 2005
@@ -1,114 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis.om.OMConstants;
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMNamespace;
-import org.apache.axis.om.OMXMLParserWrapper;
-import org.apache.axis.om.SOAPBody;
-import org.apache.axis.om.SOAPEnvelope;
-import org.apache.axis.om.SOAPFault;
-
-/**
- * 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 class SOAPBodyImpl extends OMElementImpl implements SOAPBody, OMConstants {
-
- private boolean hasSOAPFault = false;
-
-
- /**
- * @param envelope
- */
- public SOAPBodyImpl(SOAPEnvelope envelope) {
- super(envelope);
- this.ns = envelope.getNamespace();
- this.localName = OMConstants.BODY_LOCAL_NAME;
- }
-
- public SOAPBodyImpl(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder) {
- super(localName, ns, parent, builder);
- }
-
- /**
- * 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 SOAPFault addFault(Exception e) throws OMException {
- SOAPFault soapFault = new SOAPFaultImpl(this, e);
- addFault(soapFault);
- return soapFault;
- }
-
- /**
- * 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 boolean hasFault() {
- if (hasSOAPFault) {
- return true;
- } else {
- Iterator soapFaultChildren = getChildrenWithName(new QName(SOAPFAULT_NAMESPACE_URI, SOAPFAULT_LOCAL_NAME));
- if (soapFaultChildren.hasNext()) {
- hasSOAPFault = true;
- return true;
- }
- }
- return false;
- }
-
- /**
- * 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 SOAPFault getFault() {
- Iterator soapFaultChildren = getChildrenWithName(new QName(SOAPFAULT_NAMESPACE_URI, SOAPFAULT_LOCAL_NAME));
- if (soapFaultChildren.hasNext()) {
- SOAPFault soapFault = (SOAPFault) soapFaultChildren.next();
- return soapFault;
- }
- return null;
- }
-
-
- /**
- * @param soapFault
- * @throws org.apache.axis.om.OMException
- */
- public void addFault(SOAPFault soapFault) throws OMException {
- if (hasSOAPFault) {
- throw new OMException("SOAP Body already has a SOAP Fault and there can not be more than one SOAP fault");
- }
- addChild(soapFault);
- hasSOAPFault = true;
-
- }
-
-
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPEnvelopeImpl.java Sun Mar 13 21:53:01 2005
@@ -1,120 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis.om.OMConstants;
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMNamespace;
-import org.apache.axis.om.OMXMLParserWrapper;
-import org.apache.axis.om.SOAPBody;
-import org.apache.axis.om.SOAPEnvelope;
-import org.apache.axis.om.SOAPHeader;
-
-/**
- * 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 class SOAPEnvelopeImpl extends OMElementImpl implements SOAPEnvelope, OMConstants {
-
- /**
- * @param builder
- */
- public SOAPEnvelopeImpl(OMXMLParserWrapper builder) {
- super("", null, null, builder);
- this.localName = SOAPENVELOPE_LOCAL_NAME;
-
- }
-
- public SOAPEnvelopeImpl(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder) {
- super(localName, ns, parent, builder);
- }
-
- /**
- * @param localName
- * @param ns
- */
- public SOAPEnvelopeImpl(String localName, OMNamespace ns) {
- super(localName, ns);
- }
-
- /**
- * 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 document.
- *
- * @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 org.apache.axis.om.OMException if there is a SOAP error
- */
- public OMNamespace createNamespace(String localName, String prefix, String uri) throws OMException {
- return this.createNamespace(localName, prefix, uri);
- }
-
- /**
- * 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 org.apache.axis.om.OMException if there is a problem obtaining
- * the <CODE>SOAPHeader</CODE>
- * object
- */
- public SOAPHeader getHeader() throws OMException {
- Iterator headerIterator = this.getChildrenWithName(new QName(OMConstants.HEADER_NAMESPACEURI, OMConstants.HEADER_LOCAL_NAME));
- SOAPHeader soapHeader = null;
- if (headerIterator.hasNext()) {
- soapHeader = (SOAPHeader) headerIterator.next();
- }
-
- return soapHeader;
- }
-
- /**
- * 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 org.apache.axis.om.OMException if there is a problem obtaining
- * the <CODE>SOAPBody</CODE> object
- */
- public SOAPBody getBody() throws OMException {
- Iterator bodyIterator = this.getChildrenWithName(new QName(OMConstants.BODY_NAMESPACE_URI, OMConstants.BODY_LOCAL_NAME));
- SOAPBody soapBody = null;
- if (bodyIterator.hasNext()) {
- soapBody = (SOAPBody) bodyIterator.next();
- }
-
- return soapBody;
- }
-
-
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java Sun Mar 13 21:53:01 2005
@@ -1,88 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import java.util.Locale;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis.engine.AxisFault;
-import org.apache.axis.om.OMConstants;
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMFactory;
-import org.apache.axis.om.OMNamespace;
-import org.apache.axis.om.OMXMLParserWrapper;
-import org.apache.axis.om.SOAPFault;
-
-/**
- * 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 class SOAPFaultImpl extends OMElementImpl implements SOAPFault, OMConstants {
-
- private Exception e;
-
- public SOAPFaultImpl(OMElement parent, Exception e) {
- super(parent);
- this.e = e;
- this.addChild(OMFactory.newInstance().createText(this, e.getMessage()));
- localName = SOAPFAULT_LOCAL_NAME;
- setNamespace(new OMNamespaceImpl(SOAPFAULT_NAMESPACE_URI, SOAPFAULT_NAMESPACE_PREFIX));
- }
-
-// public SOAPFaultImpl(OMElement parent) {
-// super(parent);
-//
-// }
-
- public SOAPFaultImpl(OMNamespace ns, OMElement parent, OMXMLParserWrapper builder) {
- super(SOAPFAULT_LOCAL_NAME, ns, parent, builder);
- }
-
- public void setFaultCode(QName faultCode) throws OMException {
- throw new UnsupportedOperationException(); //TODO implement this
- }
-
- public QName getFaultCode() {
- throw new UnsupportedOperationException(); //TODO implement this
- }
-
- public void setFaultActor(String faultActor) throws OMException {
- throw new UnsupportedOperationException(); //TODO implement this
- }
-
- public String getFaultActor() {
- throw new UnsupportedOperationException(); //TODO implement this
- }
-
- public void setFaultString(String faultString) throws OMException {
- throw new UnsupportedOperationException(); //TODO implement this
- }
-
- public String getFaultString() {
- throw new UnsupportedOperationException(); //TODO implement this
- }
-
- public void setFaultString(String faultString, Locale locale) throws OMException {
- throw new UnsupportedOperationException(); //TODO implement this
- }
-
- public Exception getException() throws OMException {
- if (e == null) {
- return new AxisFault();
- } else {
- return e;
- }
- }
-}
Modified: webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java?view=diff&r1=157392&r2=157393
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/Thilina/MTOM/src/java/org/apache/axis/impl/llom/SOAPHeaderBlockImpl.java Sun Mar 13 21:53:01 2005
@@ -1,121 +0,0 @@
-package org.apache.axis.impl.llom;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis.om.OMAttribute;
-import org.apache.axis.om.OMConstants;
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMNamespace;
-import org.apache.axis.om.OMXMLParserWrapper;
-import org.apache.axis.om.SOAPHeaderBlock;
-
-/**
- * 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 class SOAPHeaderBlockImpl extends OMElementImpl implements SOAPHeaderBlock {
-
- /**
- * @param localName
- * @param ns
- */
- public SOAPHeaderBlockImpl(String localName, OMNamespace ns) {
- super(localName, ns);
- }
-
- public SOAPHeaderBlockImpl(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder) {
- super(localName, ns, parent, builder);
- }
-
- /**
- * 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 IllegalArgumentException if there is a problem in setting the
- * actor.
- * @see #getActor() getActor()
- */
- public void setActor(String actorURI) {
- setAttribute(OMConstants.ATTR_ACTOR, actorURI);
- }
-
- /**
- * @param attributeName
- * @param attrValue
- */
- private void setAttribute(String attributeName, String attrValue) {
- OMAttribute omAttribute = this.getAttributeWithQName(new QName(OMConstants.SOAP_ENVELOPE_NAMESPACE_URI, attributeName));
- if (omAttribute != null) {
- omAttribute.setValue(attrValue);
- } else {
- OMAttribute attribute = new OMAttributeImpl(attributeName, new OMNamespaceImpl(OMConstants.SOAP_ENVELOPE_NAMESPACE_URI, OMConstants.SOAPENVELOPE_NAMESPACE_PREFIX), attrValue);
- this.insertAttribute(attribute);
- }
- }
-
- /**
- * 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(String) setActor(java.lang.String)
- */
- public String getActor() {
- return getAttribute(OMConstants.ATTR_ACTOR);
- }
-
- private String getAttribute(String attrName) {
-
- OMAttribute omAttribute = this.getAttributeWithQName(new QName(OMConstants.SOAP_ENVELOPE_NAMESPACE_URI, attrName));
- return (omAttribute != null) ? omAttribute.getValue() : null;
- }
-
- /**
- * 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 IllegalArgumentException if there is a problem in setting the
- * actor.
- * @see #getMustUnderstand() getMustUnderstand()
- */
- public void setMustUnderstand(boolean mustUnderstand) {
- setAttribute(OMConstants.ATTR_MUSTUNDERSTAND, mustUnderstand ? "true" : "false");
- }
-
- /**
- * 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 boolean getMustUnderstand() {
- String mustUnderstand = "";
- if ((mustUnderstand = getAttribute(OMConstants.ATTR_MUSTUNDERSTAND)) != null) {
- return mustUnderstand.equalsIgnoreCase("true");
- }
- return false;
- }
-}