You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ch...@apache.org on 2006/02/01 11:36:10 UTC
svn commit: r374036 [2/15] - in /webservices/commons/trunk/axiom:
src/org/apache/ws/ src/org/apache/ws/commons/
src/org/apache/ws/commons/attachments/
src/org/apache/ws/commons/attachments/utils/ src/org/apache/ws/commons/om/
src/org/apache/ws/commons/...
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMContainer.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMContainer.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMContainer.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMContainer.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * Captures the operations related to containment shared by both a document and an element.
+ *
+ * <p>Exposes the ability to add, find, and iterate over the children of a document or
+ * element.</p>
+ */
+public interface OMContainer {
+
+ /**
+ * Adds the given node as the last child. One must preserve the order of children,
+ * in this operation.
+ * Tip : appending the new child is preferred.
+ *
+ * @param omNode
+ */
+ public void addChild(OMNode omNode);
+
+ /**
+ * Returns an iterator for child nodes matching the criteria indicated by the given QName.
+ *
+ * <p>This function searches in three ways:
+ * <ul>
+ * <li>Exact match - Both parts of the passed QName are non-null. Only children with the
+ * same namespace and local name will be returned.
+ * </li>
+ * <li>Namespace match - The local name of the passed QName is null. All children matching the
+ * namespace will be returned by the iterator.
+ * </li>
+ * <li>Local name match - The namespace of the passed QName is null. All children with the
+ * matching local name will be returned by the iterator.
+ * </li>
+ * </ul>
+ *
+ * <p>
+ * <b>Example:</b> <code>header.getChildrenWithName( new QName(ADDRESSING_NAMESPACE, null));</code>
+ * will return all of the "addressing" headers.
+ * </p>
+ *
+ * @param elementQName The QName specifying namespace and local name to match.
+ * @return Returns an iterator of {@link OMElement} items that match the given QName appropriately.
+ */
+ public Iterator getChildrenWithName(QName elementQName);
+
+ /**
+ * Returns the first child in document order that matches the given QName criteria.
+ *
+ * <p>The QName filter is applied as in the function {@link #getChildrenWithName}.</p>
+ *
+ * @param elementQName The QName to use for matching.
+ *
+ * @return Returns the first element in document order that matches the <tt>elementQName</tt> criteria.
+ *
+ * @see #getChildrenWithName
+ *
+ * @throws OMException Could indirectly trigger building of child nodes.
+ */
+ public OMElement getFirstChildWithName(QName elementQName) throws OMException;
+
+ /**
+ * Returns an iterator for the children of the container.
+ *
+ * @return Returns a {@link Iterator} of children, all of which implement {@link OMNode}.
+ *
+ * @see #getFirstChildWithName
+ * @see #getChildrenWithName
+ */
+ public Iterator getChildren();
+
+ /**
+ * Gets the first child.
+ *
+ * @return Returns the first child. May return null if the container has no children.
+ */
+ public OMNode getFirstOMChild();
+
+ public boolean isComplete();
+
+ public void buildNext();
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMDocType.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMDocType.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMDocType.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMDocType.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+/**
+ * Interface OMDocType
+ */
+public interface OMDocType extends OMNode {
+ /**
+ * Returns the value of this DocType.
+ * @return Returns String.
+ */
+ public String getValue();
+
+ /**
+ * Sets the content of this DocType to the specified string.
+ * @param text
+ */
+ public void setValue(String text);
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMDocument.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMDocument.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMDocument.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMDocument.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.OutputStream;
+
+
+public interface OMDocument extends OMContainer {
+
+ /**
+ * Field XML_10 XML Version 1.0
+ */
+ public final static String XML_10 = "1.0";
+
+ /**
+ * Field XML_11 XML Version 1.1
+ */
+ public final static String XML_11 = "1.1";
+
+ /**
+ * Returns the document element.
+ * @return Returns OMElement.
+ */
+ public OMElement getOMDocumentElement();
+
+ /**
+ * Sets the document element of the XML document.
+ * @param rootElement
+ */
+ public void setOMDocumentElement(OMElement rootElement);
+
+ /**
+ * Returns the XML version.
+ * @return Returns String.
+ */
+ public String getXMLVersion();
+
+ /**
+ * Sets the XML version.
+ * @see org.apache.ws.commons.om.impl.llom.OMDocumentImpl#XML_10 XML 1.0
+ * @see org.apache.ws.commons.om.impl.llom.OMDocumentImpl#XML_11 XML 1.1
+ * @param version
+ */
+ public void setXMLVersion(String version);
+
+ /**
+ * Returns the character set encoding scheme.
+ * @return Returns String.
+ */
+ public String getCharsetEncoding();
+
+ /**
+ * Sets the character set encoding scheme to be used.
+ * @param charsetEncoding
+ */
+ public void setCharsetEncoding(String charsetEncoding);
+
+ /**
+ * XML standalone value.
+ * This will be yes, no or null (if not available)
+ * @return Returns boolean.
+ */
+ public String isStandalone();
+ public void setStandalone(String isStandalone);
+
+ /**
+ * Serializes the OMDocument.
+ * @param output
+ * @param format
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException;
+
+ /**
+ * Builds the OM node/tree and then serializes the document.
+ * @param output
+ * @param format
+ * @throws XMLStreamException
+ */
+ public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException;
+
+ /**
+ * Serializes the OMDocument.
+ * @param output
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(OutputStream output) throws XMLStreamException;
+
+ /**
+ * Serializes the document with cache on.
+ * @param output
+ * @throws XMLStreamException
+ */
+ public void serialize(OutputStream output) throws XMLStreamException;
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMElement.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMElement.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMElement.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMElement.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,299 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.util.Iterator;
+
+/**
+ * A particular kind of node that represents an element infoset information item.
+ * <p/>
+ * <p>An element has a collection of children, attributes, and namespaces.</p>
+ * <p>In contrast with DOM, this interface exposes namespaces separately from the
+ * attributes.</p>
+ */
+public interface OMElement extends OMNode, OMContainer {
+
+ /**
+ * Returns a filtered list of children - just the elements.
+ *
+ * @return Returns an iterator over the child elements.
+ * @see #getChildren()
+ * @see #getChildrenWithName(javax.xml.namespace.QName)
+ */
+ public Iterator getChildElements();
+
+ /**
+ * Creates a namespace in the current element scope.
+ *
+ * @param uri The namespace to declare in the current scope. The
+ * caller is expected to ensure that the URI is a valid namespace name.
+ * @param prefix The prefix to associate with the given namespace.
+ * The caller is expected to ensure that this is a valid XML prefix.
+ * @return Returns the created namespace information item.
+ * @see #declareNamespace(OMNamespace)
+ * @see #findNamespace(String, String)
+ * @see #getAllDeclaredNamespaces()
+ */
+ public OMNamespace declareNamespace(String uri, String prefix);
+
+ /**
+ * Declares a namespace with the element as its scope.
+ *
+ * @param namespace The namespace to declare
+ * @return Returns the namespace parameter passed.
+ * @see #declareNamespace(String, String)
+ * @see #findNamespace(String, String)
+ * @see #getAllDeclaredNamespaces()
+ */
+ public OMNamespace declareNamespace(OMNamespace namespace);
+
+ /**
+ * Finds a namespace with the given uri and prefix, in the scope of the hierarchy.
+ * <p/>
+ * <p>Searches from the current element and goes up the hiararchy until a match is found.
+ * If no match is found, returns <tt>null</tt>.</p>
+ * <p/>
+ * <p>Either <tt>prefix</tt> or <tt>uri</tt> should be null. Results are undefined
+ * if both are specified.</p>
+ *
+ * @param uri The namespace to look for. If this is specified, <tt>prefix</tt> should be null.
+ * @param prefix The prefix to look for. If this is specified, <tt>uri</tt> should be null.
+ * @return Returns the matching namespace declaration, or <tt>null</tt> if none was found.
+ * @see #declareNamespace(String, String)
+ * @see #declareNamespace(OMNamespace)
+ * @see #getAllDeclaredNamespaces()
+ */
+ public OMNamespace findNamespace(String uri, String prefix);
+
+ /**
+ * Checks for a namespace in the context of this element with the given prefix and
+ * returns the relevant namespace object, if available. If not available, returns null.
+ *
+ * @param prefix
+ */
+ public OMNamespace findNamespaceURI(String prefix);
+
+ /**
+ * Returns an iterator for all of the namespaces declared on this element.
+ * <p/>
+ * <p>If you're interested in all namespaces in scope, you need to call this function
+ * for all parent elements as well. Note that the iterator may be invalidated by
+ * any call to either <tt>declareNamespace</tt> function.
+ * </p>
+ *
+ * @return Returns an iterator over the {@link OMNamespace} items declared on the current element.
+ * @see #findNamespace(String, String)
+ * @see #declareNamespace(String, String)
+ * @see #declareNamespace(OMNamespace)
+ */
+ public Iterator getAllDeclaredNamespaces() throws OMException;
+
+ /**
+ * Returns a list of OMAttributes.
+ *
+ * <p>Note that the iterator returned by this function will be invalidated by
+ * any <tt>addAttribute</tt> call.
+ * </p>
+ *
+ * @return Returns an {@link Iterator} of {@link OMAttribute} items associated with the element.
+ * @see #getAttribute
+ * @see #addAttribute(OMAttribute)
+ * @see #addAttribute(String, String, OMNamespace)
+ */
+ public Iterator getAllAttributes();
+
+ /**
+ * Returns a named attribute if present.
+ *
+ * @param qname the qualified name to search for
+ * @return Returns an OMAttribute with the given name if found, or null
+ */
+ public OMAttribute getAttribute(QName qname);
+
+ /**
+ * Returns a named attribute's value, if present.
+ *
+ * @param qname the qualified name to search for
+ * @return Returns a String containing the attribute value, or null
+ */
+ public String getAttributeValue(QName qname);
+
+ /**
+ * Adds an attribute to this element.
+ * <p/>
+ * <p>There is no order implied by added attributes.</p>
+ *
+ * @param attr The attribute to add.
+ * @return Returns the passed in attribute.
+ */
+ public OMAttribute addAttribute(OMAttribute attr);
+
+ /**
+ * Adds an attribute to the current element.
+ * <p/>
+ * <p>This function does not check to make sure that the given attribute value can be serialized directly
+ * as an XML value. The caller may, for example, pass a string with the character 0x01.
+ *
+ * @param attributeName The "local name" for the attribute.
+ * @param value The string value of the attribute.
+ * @param ns The namespace has to be one of the in scope namespace. i.e. the passed namespace
+ * must be declared in the parent element of this attribute or ancestors of the parent element of the attribute.
+ * @return Returns the added attribute.
+ */
+ public OMAttribute addAttribute(String attributeName, String value,
+ OMNamespace ns);
+
+ /**
+ * Method removeAttribute
+ *
+ * @param attr
+ */
+ public void removeAttribute(OMAttribute attr);
+
+ /**
+ * Method setBuilder.
+ *
+ * @param wrapper
+ */
+ public void setBuilder(OMXMLParserWrapper wrapper);
+
+ /**
+ * Returns the builder object.
+ *
+ * @return Returns the builder object used to construct the underlying XML infoset on the fly.
+ */
+ public OMXMLParserWrapper getBuilder();
+
+ /**
+ * Sets the first child.
+ *
+ * @param node
+ */
+ public void setFirstChild(OMNode node);
+
+ /**
+ * Returns the first child element of the element.
+ *
+ * @return Returns the first child element of the element, or <tt>null</tt> if none was found.
+ */
+
+ public OMElement getFirstElement();
+
+
+ /**
+ * Returns the pull parser that will generate the pull
+ * events relevant to THIS element.
+ * <p/>
+ * <p>Caching is on.</p>
+ *
+ * @return Returns an XMLStreamReader relative to this element.
+ */
+ public XMLStreamReader getXMLStreamReader();
+
+ /**
+ * Returns the pull parser that will generate the pull
+ * events relevant to THIS element.
+ * <p/>
+ * <p>Caching is off.</p>
+ *
+ * @return Returns an XMLStreamReader relative to this element, with no caching.
+ */
+ public XMLStreamReader getXMLStreamReaderWithoutCaching();
+
+ /**
+ * @param text
+ */
+ public void setText(String text);
+
+ /**
+ * Returns the non-empty text children as a String.
+ *
+ * @return Returns a String representing the concatenation of the child text nodes.
+ */
+ public String getText();
+
+ /**
+ * Returns the local name of the element.
+ *
+ * @return Returns the local name of the element.
+ */
+ public String getLocalName();
+
+ /**
+ * Method setLocalName
+ *
+ * @param localName
+ */
+ public void setLocalName(String localName);
+
+ /**
+ * @return Returns the OMNamespace object associated with this element
+ * @throws OMException
+ */
+ public OMNamespace getNamespace() throws OMException;
+
+ /**
+ * Sets the Namespace.
+ *
+ * @param namespace
+ */
+ public void setNamespace(OMNamespace namespace);
+
+ /**
+ * Gets the QName of this node.
+ *
+ * @return Returns the {@link QName} for the element.
+ */
+ public QName getQName();
+
+ /**
+ * This is a convenience method only. This will basically serialize the given OMElement
+ * to a String but will build the OMTree in the memory
+ */
+ public String toString();
+
+ /**
+ * This is a convenience method only. This basically serializes the given OMElement
+ * to a String but will NOT build the OMTree in the memory. So you are at your own risk of
+ * losing information.
+ */
+ public String toStringWithConsume() throws XMLStreamException;
+
+
+ /**
+ * Turns a prefix:local qname string into a proper QName, evaluating it in the OMElement context.
+ * Unprefixed qnames resolve to the local namespace.
+ *
+ * @param qname prefixed qname string to resolve
+ * @return Returns null for any failure to extract a qname.
+ */
+ QName resolveQName(String qname);
+
+ /**
+ * Clones this element. Since both elements are build compleletely, you will
+ * lose the differed building capability.
+ * @return Returns OMElement.
+ */
+ public OMElement cloneOMElement();
+
+
+ public void setLineNumber(int lineNumber);
+ public int getLineNumber();
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMException.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMException.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMException.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMException.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+/**
+ * Class OMException
+ */
+public class OMException extends RuntimeException {
+ /**
+ * Constructor OMException
+ */
+ public OMException() {
+ }
+
+ /**
+ * Constructor OMException
+ *
+ * @param message
+ */
+ public OMException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor OMException
+ *
+ * @param message
+ * @param cause
+ */
+ public OMException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructor OMException
+ *
+ * @param cause
+ */
+ public OMException(Throwable cause) {
+ super(cause);
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMFactory.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMFactory.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMFactory.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMFactory.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class OMFactory
+ */
+public interface OMFactory {
+
+ /**
+ * Creates a new OMDocument.
+ */
+ public OMDocument createOMDocument();
+ public OMDocument createOMDocument(OMXMLParserWrapper builder);
+
+
+ /**
+ * @param localName
+ * @param ns
+ */
+ public OMElement createOMElement(String localName, OMNamespace ns);
+ public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) throws OMException;
+
+ /**
+ * @param localName
+ * @param ns
+ * @param parent
+ * @param builder
+ */
+ public OMElement createOMElement(String localName, OMNamespace ns,
+ OMContainer parent,
+ OMXMLParserWrapper builder);
+
+ /**
+ * This is almost the same as as createOMElement(localName,OMNamespace) method above.
+ * But some people may, for some reason, need to use the conventional method of putting a namespace.
+ * Or in other words people might not want to use the new OMNamespace.
+ * Well, this is for those people.
+ *
+ * @param localName
+ * @param namespaceURI
+ * @param namespacePrefix
+ * @return Returns the newly created OMElement.
+ */
+ public OMElement createOMElement(String localName,
+ String namespaceURI,
+ String namespacePrefix);
+
+ /**
+ * QName(localPart),
+ * QName(namespaceURI, localPart) - a prefix will be assigned to this
+ * QName(namespaceURI, localPart, prefix)
+ *
+ * @param qname
+ * @param parent
+ * @return Returns the new OMElement.
+ * @throws OMException
+ */
+ public OMElement createOMElement(QName qname, OMContainer parent)
+ throws OMException;
+
+ /**
+ * @param uri
+ * @param prefix
+ * @return Returns OMNameSpace.
+ */
+ public OMNamespace createOMNamespace(String uri, String prefix);
+
+ /**
+ * @param parent
+ * @param text
+ * @return Returns OMText.
+ */
+ public OMText createText(OMElement parent, String text);
+
+ /**
+ *
+ * @param parent
+ * @param text
+ * @param type - this should be either of XMLStreamConstants.CHARACTERS, XMLStreamConstants.CDATA,
+ * XMLStreamConstants.SPACE, XMLStreamConstants.ENTITY_REFERENCE
+ * @return Returns OMText.
+ */
+ public OMText createText(OMElement parent, String text, int type);
+
+ /**
+ * @param s
+ * @return Returns OMText.
+ */
+ public OMText createText(String s);
+
+ /**
+ *
+ * @param s
+ * @param type - OMText node can handle SPACE, CHARACTERS, CDATA and ENTITY REFERENCES. For Constants, use either
+ * XMLStreamConstants or constants found in OMNode.
+ * @return Returns OMText.
+ */
+ public OMText createText(String s, int type);
+
+ public OMText createText(String s, String mimeType, boolean optimize);
+
+ public OMText createText(Object dataHandler, boolean optimize);
+
+ public OMText createText(OMElement parent, String s, String mimeType,
+ boolean optimize);
+
+ public OMText createText(String contentID, OMElement parent,
+ OMXMLParserWrapper builder);
+
+ public OMAttribute createOMAttribute(String localName,
+ OMNamespace ns,
+ String value);
+
+ /**
+ * Creates DocType/DTD.
+ * @param parent
+ * @param content
+ * @return Returns doctype.
+ */
+ public OMDocType createOMDocType(OMContainer parent, String content);
+
+ /**
+ * Creates a PI.
+ * @param parent
+ * @param piTarget
+ * @param piData
+ * @return Returns OMProcessingInstruction.
+ */
+ public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData);
+
+ /**
+ * Creates a comment.
+ * @param parent
+ * @param content
+ * @return Returns OMComment.
+ */
+ public OMComment createOMComment(OMContainer parent, String content);
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMFactoryException.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMFactoryException.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMFactoryException.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMFactoryException.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+/**
+ * Class OMFactoryException
+ */
+public class OMFactoryException extends OMException {
+ /**
+ * Constructor OMFactoryException
+ */
+ public OMFactoryException() {
+ }
+
+ /**
+ * Constructor OMFactoryException
+ *
+ * @param message
+ */
+ public OMFactoryException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor OMFactoryException
+ *
+ * @param message
+ * @param cause
+ */
+ public OMFactoryException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructor OMFactoryException
+ *
+ * @param cause
+ */
+ public OMFactoryException(Throwable cause) {
+ super(cause);
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMNamespace.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMNamespace.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMNamespace.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMNamespace.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+/**
+ * Interface OMNamespace
+ */
+public interface OMNamespace {
+ /**
+ * Method equals.
+ *
+ * @param uri
+ * @param prefix
+ * @return Returns boolean.
+ */
+ public boolean equals(String uri, String prefix);
+
+ /**
+ * Method getPrefix.
+ *
+ * @return Returns String.
+ */
+ public String getPrefix();
+
+ /**
+ * Method getName.
+ *
+ * @return Returns String.
+ */
+ public String getName();
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMNode.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMNode.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMNode.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,272 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * Defines the base interface used by most of the XML object model within Axis.
+ *
+ * <p>This tree model for XML captures the idea of deferring the construction of child nodes
+ * until they are needed. The <code>isComplete</code> function identifies whether or not
+ * a particular node has been fully parsed. A node may not be fully parsed, for example, if
+ * all of the children of an element have not yet been parsed.</p>
+ *
+ * <p>In comparison to DOM, in this model, you will not find document fragments, or entities.
+ * In addition, while {@link OMDocument} and {@link OMAttribute} exist, neither is an extension
+ * of <code>OMNode</code>.
+ * </p>
+ */
+public interface OMNode {
+ /**
+ * The node is an <code>Element</code>.
+ *
+ * @see #getType()
+ */
+ public static final short ELEMENT_NODE = 1;
+
+ /**
+ * The node is a <code>Text</code> node.
+ *
+ * @see #getType()
+ */
+ public static final short TEXT_NODE = XMLStreamConstants.CHARACTERS;
+
+ /**
+ * The node is a <code>CDATASection</code>.
+ *
+ * @see #getType()
+ */
+ public static final short CDATA_SECTION_NODE = XMLStreamConstants.CDATA;
+
+ /**
+ * The node is a <code>Comment</code>.
+ *
+ * @see #getType()
+ */
+ public static final short COMMENT_NODE = XMLStreamConstants.COMMENT;
+
+ /**
+ * This node is a <code>DTD</code>.
+ *
+ * @see #getType()
+ */
+ public static final short DTD_NODE = XMLStreamConstants.DTD;
+
+ /**
+ * This node is a <code>ProcessingInstruction</code>.
+ *
+ * @see #getType()
+ */
+ public static final short PI_NODE = XMLStreamConstants.PROCESSING_INSTRUCTION;
+
+ /**
+ * This node is an <code>Entity Reference</code>.
+ *
+ * @see #getType()
+ */
+ public static final short ENTITY_REFERENCE_NODE = XMLStreamConstants.ENTITY_REFERENCE;
+
+ /**
+ * This node is an <code>Entity Reference</code>.
+ *
+ * @see #getType()
+ */
+ public static final short SPACE_NODE = XMLStreamConstants.SPACE;
+
+ /**
+ * Returns the parent containing node.
+ *
+ * <p>Returns the parent container, which may be either an {@link OMDocument} or {@link OMElement}.
+ *
+ * @return The {@link OMContainer} of the node.
+ */
+ public OMContainer getParent();
+
+ /**
+ * Returns the next sibling in document order.
+ *
+ * @return Returns the next sibling in document order.
+ */
+ public OMNode getNextOMSibling() throws OMException;
+
+ /**
+ * Indicates whether parser has parsed this information item completely or not.
+ * If some 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 Returns boolean.
+ */
+ public boolean isComplete();
+
+ /**
+ * Removes a node (and all of its children) from its containing parent.
+ *
+ * <p>Removes a node from its parent. Partially complete nodes will be completed before
+ * they are detached from the model. A node cannot be detached until its next sibling
+ * has been identified, so that the next sibling and parent can be updated appropriately.
+ * Please note that this will not handle the namespaces. For example, if there you have used a
+ * namespace within the detaching node and which is defined outside the detaching node, user has
+ * to handle it manually.
+ * </p>
+ *
+ * @throws OMException If a node is not complete, the detach can trigger further
+ * parsing, which may cause an exception.
+ */
+ public OMNode detach() throws OMException;
+
+ /**
+ * Discards a node.
+ *
+ * <p>Discard goes to the parser level and if the element is not completely built, then it will be
+ * completely skipped at the parser level.</p>
+ *
+ * @throws OMException
+ */
+ public void discard() throws OMException;
+
+ /**
+ * Inserts a new sibling after the current node.
+ *
+ * @param sibling The node that will be added after the current node.
+ *
+ * @throws OMException
+ */
+ public void insertSiblingAfter(OMNode sibling) throws OMException;
+
+ /**
+ * Inserts a sibling just before the current node.
+ *
+ * @param sibling The node that will be added before the current node.
+ * @throws OMException
+ */
+ public void insertSiblingBefore(OMNode sibling) throws OMException;
+
+ /**
+ * Returns the type of node.
+ *
+ * @return Returns one of {@link #ELEMENT_NODE}, {@link #TEXT_NODE}, {@link #CDATA_SECTION_NODE}, {@link #COMMENT_NODE},
+ * {@link #DTD_NODE}, {@link #PI_NODE}, {@link #ENTITY_REFERENCE_NODE}, {@link #SPACE_NODE},
+ * or {@link #TEXT_NODE}.
+ */
+ public int getType();
+
+ /**
+ * Gets the previous sibling.
+ *
+ * @return Returns node.
+ */
+ public OMNode getPreviousOMSibling();
+
+ /**
+ * Serializes the node with caching.
+ *
+ * @param xmlWriter
+ * @throws XMLStreamException
+ */
+ public void serialize(XMLStreamWriter xmlWriter)
+ throws XMLStreamException;
+
+ /**
+ * Serializes the node with caching.
+ *
+ * @param output
+ * @throws XMLStreamException
+ */
+ public void serialize(OutputStream output)
+ throws XMLStreamException;
+
+ /**
+ * Serializes the node with caching.
+ *
+ * @param writer
+ * @throws XMLStreamException
+ */
+ public void serialize(Writer writer)
+ throws XMLStreamException;
+
+ /**
+ * Serializes the node with caching.
+ *
+ * @param output
+ * @param format
+ * @throws XMLStreamException
+ */
+ public void serialize(OutputStream output, OMOutputFormat format)
+ throws XMLStreamException;
+
+ /**
+ * Serializes the node with caching.
+ *
+ * @param writer
+ * @param format
+ * @throws XMLStreamException
+ */
+ public void serialize(Writer writer, OMOutputFormat format)
+ throws XMLStreamException;
+
+ /**
+ * Serializes the node without caching.
+ *
+ * @param xmlWriter
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException;
+
+ /**
+ * Serializes the node without caching.
+ *
+ * @param output
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(OutputStream output) throws XMLStreamException;
+
+ /**
+ * Serializes the node without caching.
+ *
+ * @param writer
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(Writer writer) throws XMLStreamException;
+
+ /**
+ * Serializes the node without caching.
+ *
+ * @param output
+ * @param format
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException;
+
+ /**
+ * Serializes the node without caching.
+ *
+ * @param writer
+ * @param format
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(Writer writer, OMOutputFormat format) throws XMLStreamException;
+
+ /**
+ * Builds itself.
+ */
+ public void build();
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMOutputFormat.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMOutputFormat.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMOutputFormat.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMOutputFormat.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+import org.apache.ws.commons.om.impl.MIMEOutputUtils;
+import org.apache.ws.commons.om.util.UUIDGenerator;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAP12Constants;
+
+
+/**
+ * Formats options for OM Output.
+ */
+public class OMOutputFormat {
+ private String mimeBoundary = null;
+ private String rootContentId = null;
+ private int nextid = 0;
+ private boolean doOptimize;
+ private boolean isSoap11 = true;
+
+ /**
+ * Field DEFAULT_CHAR_SET_ENCODING. Specifies the default
+ * character encoding scheme to be used.
+ */
+ public static final String DEFAULT_CHAR_SET_ENCODING = "utf-8";
+
+ private String charSetEncoding;
+ private String xmlVersion;
+ private boolean ignoreXMLDeclaration = false;
+
+
+ public OMOutputFormat() {
+ }
+
+ public boolean isOptimized() {
+ return doOptimize;
+ }
+
+ public String getContentType() {
+ String SOAPContentType;
+ if (isOptimized()) {
+ if (isSoap11) {
+ SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
+ } else {
+ SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+ }
+ return MIMEOutputUtils.getContentTypeForMime(
+ getMimeBoundary(),
+ getRootContentId(),
+ this.getCharSetEncoding(), SOAPContentType);
+ } else {
+ if (!isSoap11) {
+ return SOAP12Constants.SOAP_12_CONTENT_TYPE;
+ } else {
+ return SOAP11Constants.SOAP_11_CONTENT_TYPE;
+ }
+ }
+ }
+
+ public String getMimeBoundary() {
+ if (mimeBoundary == null) {
+ mimeBoundary =
+ "MIMEBoundary"
+ + UUIDGenerator.getUUID();
+ }
+ return mimeBoundary;
+ }
+
+ public String getRootContentId() {
+ if (rootContentId == null) {
+ rootContentId =
+ "0."
+ + UUIDGenerator.getUUID()
+ + "@apache.org";
+ }
+ return rootContentId;
+ }
+
+ public String getNextContentId() {
+ nextid++;
+ return nextid
+ + "."
+ + UUIDGenerator.getUUID()
+ + "@apache.org";
+ }
+
+ /**
+ * Returns the character set encoding scheme. If the value of the
+ * charSetEncoding is not set then the default will be returned.
+ *
+ * @return Returns encoding string.
+ */
+ public String getCharSetEncoding() {
+ return this.charSetEncoding;
+ }
+
+ public void setCharSetEncoding(String charSetEncoding) {
+ this.charSetEncoding = charSetEncoding;
+ }
+
+ public String getXmlVersion() {
+ return xmlVersion;
+ }
+
+ public void setXmlVersion(String xmlVersion) {
+ this.xmlVersion = xmlVersion;
+ }
+
+ public void setSOAP11(boolean b) {
+ isSoap11 = b;
+ }
+
+ public boolean isSOAP11() {
+ return isSoap11;
+ }
+
+ public boolean isIgnoreXMLDeclaration() {
+ return ignoreXMLDeclaration;
+ }
+
+ public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) {
+ this.ignoreXMLDeclaration = ignoreXMLDeclaration;
+ }
+
+ public void setDoOptimize(boolean b) {
+ doOptimize = b;
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMProcessingInstruction.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMProcessingInstruction.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMProcessingInstruction.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMProcessingInstruction.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+/**
+ * Interface OMProcessingInstruction
+ */
+public interface OMProcessingInstruction extends OMNode {
+ /**
+ * Sets the target of this Processing Instruction.
+ * @param target
+ */
+ public void setTarget(String target);
+
+ /**
+ * Gets the target of this Processing Instruction.
+ * @return Returns string.
+ */
+ public String getTarget();
+
+ /**
+ * Sets the value of this Processing Instruction.
+ * @param value
+ */
+ public void setValue(String value);
+
+ /**
+ * Gets the value of this Processing Instruction.
+ * @return Returns String.
+ */
+ public String getValue();
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMSerializer.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMSerializer.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMSerializer.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Interface OMSerializer
+ */
+public interface OMSerializer {
+ /**
+ * Method serializeAndConsume
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ void serialize(XMLStreamReader reader, XMLStreamWriter writer)
+ throws XMLStreamException;
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMText.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMText.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMText.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMText.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+
+/**
+ * Interface OMText
+ */
+public interface OMText extends OMNode {
+ /**
+ * Returns the text value of this node.
+ *
+ * @return Returns String.
+ */
+ String getText();
+
+ /**
+ * Gets the datahandler.
+ * @return Returns datahandler.
+ */
+ Object getDataHandler();
+
+ /**
+ * @return Returns boolean flag saying whether the node contains
+ * an optimized text or not.
+ */
+ boolean isOptimized();
+
+ /**
+ * Sets the optimize flag.
+ * @param value
+ */
+ void setOptimize(boolean value);
+
+ /**
+ * Gets the content id.
+ * @return Returns String.
+ */
+ String getContentID();
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMXMLParserWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMXMLParserWrapper.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMXMLParserWrapper.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/OMXMLParserWrapper.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om;
+
+/**
+ * Interface OMXMLParserWrapper
+ */
+public interface OMXMLParserWrapper {
+ /**
+ * Proceed the parser one step and return the event value.
+ *
+ * @return Returns int.
+ * @throws org.apache.ws.commons.om.OMException
+ *
+ * @throws OMException
+ */
+ int next() throws OMException;
+
+ /**
+ * Discards the current element.
+ * This will remove the given element and its decendants.
+ *
+ * @param el
+ * @throws org.apache.ws.commons.om.OMException
+ *
+ * @throws OMException
+ */
+ void discard(OMElement el) throws OMException;
+
+ /**
+ * @param b
+ * @throws org.apache.ws.commons.om.OMException
+ *
+ * @throws 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 Returns Object.
+ */
+ Object getParser();
+
+ /**
+ * @return Returns the complete status.
+ */
+ boolean isCompleted();
+
+ /**
+ * @return Returns the document element.
+ */
+ OMElement getDocumentElement();
+
+ /**
+ * Returns the type of the builder.
+ * Can be either PUSH_TYPE_BUILDER or PULL_TYPE_BUILDER.
+ *
+ * @return Returns short.
+ */
+ short getBuilderType();
+
+ /**
+ * Registers an external content handler. Especially useful for
+ * push type builders. Throws an unsupportedOperationException if
+ * such handler registration is not supported.
+ *
+ * @param obj
+ */
+ void registerExternalContentHandler(Object obj);
+
+ /**
+ * get the registered external content handler
+ *
+ * @return Returns Object.
+ */
+ Object getRegisteredContentHandler();
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/MIMEOutputUtils.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/MIMEOutputUtils.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/MIMEOutputUtils.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/MIMEOutputUtils.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om.impl;
+
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMText;
+
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeBodyPart;
+import javax.activation.DataHandler;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public class MIMEOutputUtils {
+
+ private static byte[] CRLF = { 13, 10 };
+
+ public static void complete(OutputStream outStream,
+ StringWriter writer, LinkedList binaryNodeList,
+ String boundary, String contentId, String charSetEncoding,String SOAPContentType) {
+ try {
+ startWritingMime(outStream, boundary);
+
+ javax.activation.DataHandler dh = new javax.activation.DataHandler(writer.toString(),
+ "text/xml; charset=" + charSetEncoding);
+ MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
+ rootMimeBodyPart.setDataHandler(dh);
+
+ rootMimeBodyPart.addHeader("content-type",
+ "application/xop+xml; charset=" + charSetEncoding +
+ "; type=\""+SOAPContentType+"\";");
+ rootMimeBodyPart.addHeader("content-transfer-encoding", "binary");
+ rootMimeBodyPart.addHeader("content-id","<"+contentId+">");
+
+ writeBodyPart(outStream, rootMimeBodyPart, boundary);
+
+ Iterator binaryNodeIterator = binaryNodeList.iterator();
+ while (binaryNodeIterator.hasNext()) {
+ OMText binaryNode = (OMText) binaryNodeIterator.next();
+ writeBodyPart(outStream, createMimeBodyPart(binaryNode),
+ boundary);
+ }
+ finishWritingMime(outStream);
+ } catch (IOException e) {
+ throw new OMException("Problem with the OutputStream.", e);
+ } catch (MessagingException e) {
+ throw new OMException("Problem writing Mime Parts.", e);
+ }
+ }
+
+ public static MimeBodyPart createMimeBodyPart(OMText node)
+ throws MessagingException {
+ MimeBodyPart mimeBodyPart = new MimeBodyPart();
+ final DataHandler dataHandler = (DataHandler) node.getDataHandler();
+ mimeBodyPart.setDataHandler(dataHandler);
+ mimeBodyPart.addHeader("content-id", "<"+node.getContentID()+">");
+ mimeBodyPart.addHeader("content-type", dataHandler.getContentType());
+ mimeBodyPart.addHeader("content-transfer-encoding", "binary");
+ return mimeBodyPart;
+
+ }
+
+ /**
+ * @throws IOException This will write the boundary to output Stream
+ */
+ public static void writeMimeBoundary(OutputStream outStream,
+ String boundary) throws IOException {
+ outStream.write(new byte[]{45, 45});
+ outStream.write(boundary.getBytes());
+ }
+
+ /**
+ * @throws IOException This will write the boundary with CRLF
+ */
+ public static void startWritingMime(OutputStream outStream,
+ String boundary)
+ throws IOException {
+ writeMimeBoundary(outStream, boundary);
+ //outStream.write(CRLF);
+ }
+
+ /**
+ * Writes a CRLF for the earlier boundary then the BodyPart data
+ * with headers followed by boundary. Writes only the boundary. No more
+ * CRLF's are written after that.
+ *
+ * @throws IOException
+ * @throws MessagingException
+ */
+ public static void writeBodyPart(OutputStream outStream,
+ MimeBodyPart part,
+ String boundary) throws IOException,
+ MessagingException {
+ outStream.write(CRLF);
+ part.writeTo(outStream);
+ outStream.write(CRLF);
+ writeMimeBoundary(outStream, boundary);
+ }
+
+ /**
+ * @throws IOException This will write "--" to the end of last boundary
+ */
+ public static void finishWritingMime(OutputStream outStream)
+ throws IOException {
+ outStream.write(new byte[]{45, 45});
+ }
+
+ public static String getContentTypeForMime(String boundary, String contentId, String charSetEncoding, String SOAPContentType) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("multipart/related");
+ sb.append("; ");
+ sb.append("boundary=");
+ sb.append(boundary);
+ sb.append("; ");
+ sb.append("type=\"application/xop+xml\"");
+ sb.append("; ");
+ sb.append("start=\"<" + contentId + ">\"");
+ sb.append("; ");
+ sb.append("start-info=\""+SOAPContentType+"\"");
+ return sb.toString();
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/MTOMConstants.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/MTOMConstants.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/MTOMConstants.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/MTOMConstants.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om.impl;
+
+public interface MTOMConstants {
+ public static final String XOP_INCLUDE = "Include";
+ public static final String XOP_NAMESPACE_URI = "http://www.w3.org/2004/08/xop/include";
+
+ /**
+ * If the Message is MTOM optimised then <code>MTOM_TYPE</code>
+ */
+ String MTOM_TYPE = "application/xop+xml";
+ /**
+ * If the message is Soap with Attachments <code>SWA_TYPE</code>
+ */
+ String SWA_TYPE = "text/xml";
+ /**
+ * <code>rootPart</code> is used as the key for the root BodyPart in the
+ * Parts HashMap
+ */
+ String ROOT_PART = "SoapPart";
+ String ATTACHMENTS = "Attachments";
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMContainerEx.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMContainerEx.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMContainerEx.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMContainerEx.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om.impl;
+
+import org.apache.ws.commons.om.OMContainer;
+import org.apache.ws.commons.om.OMNode;
+
+/**
+ * Interface OMContainerEx
+ *
+ * Internal Implementation detail. Adding special interface to stop folks from accidently using OMContainer.
+ * Please use at your own risk. May corrupt the data integrity.
+ */
+public interface OMContainerEx extends OMContainer {
+ public void setComplete(boolean state);
+
+ public void setFirstChild(OMNode omNode);
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMNodeEx.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMNodeEx.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMNodeEx.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMNodeEx.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om.impl;
+
+import org.apache.ws.commons.om.OMContainer;
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMNode;
+
+import javax.xml.stream.XMLStreamException;
+
+/**
+ * Interface OMNodeEx
+ *
+ * Internal Implementation detail. Adding special interface to stop folks from accidently using OMNode.
+ * Please use at your own risk. May corrupt the data integrity.
+ */
+public interface OMNodeEx extends OMNode {
+ public void setNextOMSibling(OMNode node);
+
+ public void setPreviousOMSibling(OMNode previousSibling);
+
+ public void setParent(OMContainer element);
+
+ public void setComplete(boolean state);
+
+ public void setType(int nodeType) throws OMException;
+
+ /**
+ * Serializes the node with caching.
+ *
+ * @param omOutput
+ * @throws javax.xml.stream.XMLStreamException
+ * @see #serialize(org.apache.ws.commons.om.impl.OMOutputImpl)
+ */
+ public void serialize(org.apache.ws.commons.om.impl.OMOutputImpl omOutput)
+ throws XMLStreamException;
+
+ /**
+ * Serializes the node without caching.
+ *
+ * @param omOutput
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException;
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMOutputImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMOutputImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMOutputImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/OMOutputImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om.impl;
+
+import org.apache.ws.commons.om.OMOutputFormat;
+import org.apache.ws.commons.om.OMText;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAP12Constants;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.util.LinkedList;
+
+
+/**
+ * For the moment this assumes that transport takes the decision of whether
+ * to optimize or not by looking at whether the MTOM optimize is enabled &
+ * also looking at the OM tree whether it has any optimizable content.
+ */
+public class OMOutputImpl {
+ private XMLStreamWriter xmlWriter;
+ private OutputStream outStream;
+ private LinkedList binaryNodeList = new LinkedList();
+ private StringWriter bufferedSOAPBody;
+ private OMOutputFormat format = new OMOutputFormat();
+
+ public OMOutputImpl(XMLStreamWriter xmlWriter) {
+ this.xmlWriter = xmlWriter;
+ }
+
+ /**
+ * Creates a new OMOutputImpl with specified encoding.
+ *
+ * @param outStream
+ * @param format
+ * @throws XMLStreamException
+ * @throws FactoryConfigurationError
+ * @see OMOutputFormat#DEFAULT_CHAR_SET_ENCODING
+ */
+ public OMOutputImpl(OutputStream outStream, OMOutputFormat format)
+ throws XMLStreamException, FactoryConfigurationError {
+ this.format = format;
+ this.outStream = outStream;
+
+ if (format.getCharSetEncoding() == null) //Default encoding is UTF-8
+ format.setCharSetEncoding(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
+
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+
+ if (format.isOptimized()) {
+ bufferedSOAPBody = new StringWriter();
+ xmlWriter = factory.createXMLStreamWriter(bufferedSOAPBody);
+ } else {
+ xmlWriter = factory.createXMLStreamWriter(outStream,
+ format.getCharSetEncoding());
+ }
+ }
+
+ public void flush() throws XMLStreamException {
+ xmlWriter.flush();
+ String SOAPContentType;
+ if (format.isOptimized()) {
+ if (format.isSOAP11()) {
+ SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
+ } else {
+ SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+ }
+ MIMEOutputUtils.complete(
+ outStream,
+ bufferedSOAPBody,
+ binaryNodeList,
+ format.getMimeBoundary(),
+ format.getRootContentId(),
+ format.getCharSetEncoding(), SOAPContentType);
+ }
+ }
+
+ public boolean isOptimized() {
+ return format.isOptimized();
+ }
+
+ public String getContentType() {
+ return format.getContentType();
+ }
+
+ public void writeOptimized(OMText node) {
+ binaryNodeList.add(node);
+ }
+
+ public void setXmlStreamWriter(XMLStreamWriter xmlWriter) {
+ this.xmlWriter = xmlWriter;
+ }
+
+ public XMLStreamWriter getXmlStreamWriter() {
+ return xmlWriter;
+ }
+
+ public String getMimeBoundary() {
+ return format.getMimeBoundary();
+ }
+
+ public String getRootContentId() {
+ return format.getRootContentId();
+ }
+
+ public String getNextContentId() {
+ return format.getNextContentId();
+ }
+
+ /**
+ * Returns the character set encoding scheme. If the value of the
+ * charSetEncoding is not set then the default will be returned.
+ *
+ * @return Returns encoding.
+ */
+ public String getCharSetEncoding() {
+ return format.getCharSetEncoding();
+ }
+
+ public void setCharSetEncoding(String charSetEncoding) {
+ format.setCharSetEncoding(charSetEncoding);
+ }
+
+ public String getXmlVersion() {
+ return format.getXmlVersion();
+ }
+
+ public void setXmlVersion(String xmlVersion) {
+ format.setXmlVersion(xmlVersion);
+ }
+
+ public void setSoap11(boolean b) {
+ format.setSOAP11(b);
+ }
+
+ public boolean isIgnoreXMLDeclaration() {
+ return format.isIgnoreXMLDeclaration();
+ }
+
+ public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) {
+ format.setIgnoreXMLDeclaration(ignoreXMLDeclaration);
+ }
+
+ public void setDoOptimize(boolean b) {
+ format.setDoOptimize(b);
+ }
+
+ public void setOutputFormat(OMOutputFormat format) {
+ this.format = format;
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/EmptyOMLocation.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/EmptyOMLocation.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/EmptyOMLocation.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/EmptyOMLocation.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,45 @@
+package org.apache.ws.commons.om.impl.llom;
+
+import javax.xml.stream.Location;
+
+/*
+ * Copyright 2001-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.
+ *
+ */
+
+public class EmptyOMLocation implements Location {
+
+
+ public int getLineNumber() {
+ return -1; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public int getColumnNumber() {
+ return -1; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public int getCharacterOffset() {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getPublicId() {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getSystemId() {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMAttributeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMAttributeImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMAttributeImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMAttributeImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om.impl.llom;
+
+import org.apache.ws.commons.om.OMAttribute;
+import org.apache.ws.commons.om.OMNamespace;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class OMAttributeImpl
+ */
+public class OMAttributeImpl implements OMAttribute {
+ /**
+ * Field localName
+ */
+ private String localName;
+
+ /**
+ * Field value
+ */
+ private String value;
+
+ /**
+ * Field namespace
+ */
+ private OMNamespace namespace;
+
+ /**
+ * Constructor OMAttributeImpl.
+ *
+ * @param localName
+ * @param ns
+ * @param value
+ */
+ public OMAttributeImpl(String localName, OMNamespace ns, String value) {
+ setLocalName(localName);
+ setAttributeValue(value);
+ setOMNamespace(ns);
+ }
+
+ /**
+ *
+ * @return Returns QName.
+ */
+ public QName getQName() {
+ if(namespace != null){
+ return new QName(namespace.getName(), localName, namespace.getPrefix());
+ }else{
+ return new QName(localName);
+ }
+ }
+
+ // -------- Getters and Setters
+
+ /**
+ * Method getLocalName.
+ *
+ * @return Returns local name.
+ */
+ public String getLocalName() {
+ return localName;
+ }
+
+ /**
+ * Method setLocalName.
+ *
+ * @param localName
+ */
+ public void setLocalName(String localName) {
+ this.localName = localName;
+ }
+
+ /**
+ * Method getAttributeValue.
+ *
+ * @return Returns value.
+ */
+ public String getAttributeValue() {
+ return value;
+ }
+
+ /**
+ * Method setAttributeValue.
+ *
+ * @param value
+ */
+ public void setAttributeValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Method setOMNamespace.
+ *
+ * @param omNamespace
+ */
+ public void setOMNamespace(OMNamespace omNamespace) {
+ this.namespace = omNamespace;
+ }
+
+ /**
+ * Method getNamespace.
+ *
+ * @return Returns namespace.
+ */
+ public OMNamespace getNamespace() {
+ return namespace;
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMCommentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMCommentImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMCommentImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMCommentImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om.impl.llom;
+
+import org.apache.ws.commons.om.OMComment;
+import org.apache.ws.commons.om.OMContainer;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMNode;
+import org.apache.ws.commons.om.impl.OMOutputImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class OMCommentImpl extends OMNodeImpl implements OMComment {
+ protected String value;
+
+ /**
+ * Constructor OMCommentImpl.
+ *
+ * @param parentNode
+ * @param contentText
+ */
+ public OMCommentImpl(OMContainer parentNode, String contentText) {
+ super(parentNode);
+ this.value = contentText;
+ nodeType = OMNode.COMMENT_NODE;
+ this.done = true;
+ }
+
+ /**
+ * Constructor OMCommentImpl.
+ *
+ * @param parentNode
+ */
+ public OMCommentImpl(OMContainer parentNode) {
+ this(parentNode, null);
+ }
+
+ /**
+ * Serializes the node with caching.
+ *
+ * @param omOutput
+ * @throws XMLStreamException
+ * @see #serialize(org.apache.ws.commons.om.impl.OMOutputImpl)
+ */
+ public void serialize(OMOutputImpl omOutput) throws XMLStreamException {
+ XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+ writer.writeComment(this.value);
+ }
+
+ /**
+ * Serializes the node without caching.
+ *
+ * @param omOutput
+ * @throws XMLStreamException
+ * @see #serializeAndConsume(org.apache.ws.commons.om.impl.OMOutputImpl)
+ */
+ public void serializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException {
+ serialize(omOutput);
+ }
+
+ /**
+ * Gets the value of this comment.
+ *
+ * @return Returns String.
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of this comment.
+ *
+ * @param text
+ */
+ public void setValue(String text) {
+ this.value = text;
+ }
+
+ /**
+ * Discards this node.
+ *
+ * @throws OMException
+ */
+ public void discard() throws OMException {
+ if (done) {
+ this.detach();
+ } else {
+ builder.discard((OMElement) this.parent);
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMDocTypeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMDocTypeImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMDocTypeImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/impl/llom/OMDocTypeImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2004,2005 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.ws.commons.om.impl.llom;
+
+import org.apache.ws.commons.om.OMContainer;
+import org.apache.ws.commons.om.OMDocType;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMNode;
+import org.apache.ws.commons.om.impl.OMOutputImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class OMDocTypeImpl extends OMNodeImpl implements OMDocType {
+ protected String value;
+
+ /**
+ * Constructor OMDocTypeImpl.
+ *
+ * @param parentNode
+ * @param contentText
+ */
+ public OMDocTypeImpl(OMContainer parentNode, String contentText) {
+ super(parentNode);
+ this.value = contentText;
+ nodeType = OMNode.DTD_NODE;
+ }
+
+ /**
+ * Constructor OMDocTypeImpl.
+ *
+ * @param parentNode
+ */
+ public OMDocTypeImpl(OMContainer parentNode) {
+ this(parentNode, null);
+ }
+
+ /**
+ * Serializes the node with caching.
+ *
+ * @param omOutput
+ * @throws XMLStreamException
+ * @see #serialize(org.apache.ws.commons.om.impl.OMOutputImpl)
+ */
+ public void serialize(OMOutputImpl omOutput) throws XMLStreamException {
+ XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+ writer.writeDTD(this.value);
+ }
+
+ /**
+ * Serializes the node without caching.
+ *
+ * @param omOutput
+ * @throws XMLStreamException
+ * @see #serializeAndConsume(org.apache.ws.commons.om.impl.OMOutputImpl)
+ */
+ public void serializeAndConsume(org.apache.ws.commons.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
+ serialize(omOutput);
+ }
+
+ /**
+ * Gets the value of this DocType.
+ *
+ * @return Returns String.
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of this DocType.
+ *
+ * @param text
+ */
+ public void setValue(String text) {
+ this.value = text;
+ }
+
+ /**
+ * Discards this node.
+ *
+ * @throws OMException
+ */
+ public void discard() throws OMException {
+ if (done) {
+ this.detach();
+ } else {
+ builder.discard((OMElement) this.parent);
+ }
+ }
+}