You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/05/01 22:59:07 UTC
svn commit: r1677231 - in /webservices/axiom/trunk:
aspects/core-aspects/src/main/java/org/apache/axiom/core/
aspects/dom-aspects/src/main/java/org/apache/axiom/dom/
aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/
aspects/om-aspects/s...
Author: veithen
Date: Fri May 1 20:59:06 2015
New Revision: 1677231
URL: http://svn.apache.org/r1677231
Log:
Unify the OMText code.
Added:
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomInformationItemSupport.aj (with props)
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactory.java (with props)
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj (with props)
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CDATASectionImpl.java (with props)
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CharacterDataImpl.java (with props)
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASection.java
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.aj
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCDATASectionSupport.aj
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCharacterDataSupport.aj
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomTextSupport.aj
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMInformationItemImpl.java
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASection.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASection.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASection.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASection.java Fri May 1 20:59:06 2015
@@ -19,5 +19,6 @@
package org.apache.axiom.core;
public interface CoreCDATASection {
-
+ String coreGetData();
+ void coreSetData(String data);
}
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java Fri May 1 20:59:06 2015
@@ -21,4 +21,5 @@ package org.apache.axiom.core;
public interface NodeFactory {
CoreDocument createDocument();
CoreCharacterData createCharacterData();
+ CoreCDATASection createCDATASection();
}
Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.aj?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.aj Fri May 1 20:59:06 2015
@@ -18,7 +18,9 @@
*/
package org.apache.axiom.dom;
+import org.w3c.dom.CDATASection;
import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
@@ -84,4 +86,11 @@ public aspect DOMDocumentSupport {
text.coreSetData(data);
return text;
}
+
+ public final CDATASection DOMDocument.createCDATASection(String data) throws DOMException {
+ DOMCDATASection cdataSection = (DOMCDATASection)coreGetNodeFactory().createCDATASection();
+ cdataSection.coreSetOwnerDocument(this);
+ cdataSection.coreSetData(data);
+ return cdataSection;
+ }
}
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCDATASectionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCDATASectionSupport.aj?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCDATASectionSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCDATASectionSupport.aj Fri May 1 20:59:06 2015
@@ -24,4 +24,8 @@ public aspect AxiomCDATASectionSupport {
public final int AxiomCDATASection.getType() {
return OMNode.CDATA_SECTION_NODE;
}
+
+ public final AxiomText AxiomCDATASection.createInstanceOfSameType() {
+ return (AxiomText)coreGetNodeFactory().createCDATASection();
+ }
}
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCharacterDataSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCharacterDataSupport.aj?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCharacterDataSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomCharacterDataSupport.aj Fri May 1 20:59:06 2015
@@ -24,4 +24,10 @@ public aspect AxiomCharacterDataSupport
public final int AxiomCharacterData.getType() {
return coreIsIgnorable() ? OMNode.SPACE_NODE : OMNode.TEXT_NODE;
}
+
+ public final AxiomText AxiomCharacterData.createInstanceOfSameType() {
+ AxiomCharacterData instance = (AxiomCharacterData)coreGetNodeFactory().createCharacterData();
+ instance.coreSetIgnorable(coreIsIgnorable());
+ return instance;
+ }
}
Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomInformationItemSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomInformationItemSupport.aj?rev=1677231&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomInformationItemSupport.aj (added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomInformationItemSupport.aj Fri May 1 20:59:06 2015
@@ -0,0 +1,9 @@
+package org.apache.axiom.om.impl.common;
+
+import org.apache.axiom.core.NodeFactory;
+
+public aspect AxiomInformationItemSupport {
+ public final NodeFactory AxiomInformationItem.coreGetNodeFactory() {
+ return (NodeFactory)getOMFactory();
+ }
+}
Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomInformationItemSupport.aj
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java Fri May 1 20:59:06 2015
@@ -21,5 +21,5 @@ package org.apache.axiom.om.impl.common;
import org.apache.axiom.om.OMText;
public interface AxiomText extends OMText, AxiomChildNode {
-
+ AxiomText createInstanceOfSameType();
}
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomTextSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomTextSupport.aj?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomTextSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomTextSupport.aj Fri May 1 20:59:06 2015
@@ -18,11 +18,41 @@
*/
package org.apache.axiom.om.impl.common;
+import java.io.IOException;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.attachments.utils.DataHandlerUtils;
+import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.common.serializer.push.OutputException;
+import org.apache.axiom.om.impl.common.serializer.push.Serializer;
+import org.apache.axiom.util.UIDGenerator;
+import org.apache.axiom.util.base64.Base64Utils;
public aspect AxiomTextSupport {
declare parents: (InformationItem+ && OMText+) implements AxiomText;
+ // TODO: should be private
+ public String AxiomText.value;
+ private char[] AxiomText.charArray;
+
+ private String AxiomText.mimeType;
+
+ /** Field contentID for the mime part used when serializing Binary stuff as MTOM optimized. */
+ private String AxiomText.contentID;
+
+ /**
+ * Contains a {@link DataHandler} or {@link DataHandlerProvider} object if the text node
+ * represents base64 encoded binary data.
+ */
+ private Object AxiomText.dataHandlerObject;
+
private boolean AxiomText.optimize;
private boolean AxiomText.binary;
@@ -44,4 +74,148 @@ public aspect AxiomTextSupport {
binary = true;
}
}
+
+ /**
+ * This OMText contains two data source:value and charArray. This method will return text from
+ * correct place.
+ */
+ private String AxiomText.getTextFromProperPlace() {
+ return charArray != null ? new String(charArray) : value;
+ }
+
+ public final String AxiomText.getText() throws OMException {
+ if (charArray != null || value != null) {
+ return getTextFromProperPlace();
+ } else {
+ try {
+ return Base64Utils.encode((DataHandler)getDataHandler());
+ } catch (Exception e) {
+ throw new OMException(e);
+ }
+ }
+ }
+
+ public final char[] AxiomText.getTextCharacters() {
+ if (charArray != null) {
+ return charArray;
+ } else if (value != null) {
+ return value.toCharArray();
+ } else {
+ try {
+ return Base64Utils.encodeToCharArray((DataHandler)getDataHandler());
+ } catch (IOException ex) {
+ throw new OMException(ex);
+ }
+ }
+ }
+
+ public final boolean AxiomText.isCharacters() {
+ return charArray != null;
+ }
+
+ public final QName AxiomText.getTextAsQName() throws OMException {
+ return ((OMElement)getParent()).resolveQName(getTextFromProperPlace());
+ }
+
+ public final OMNamespace AxiomText.getNamespace() {
+ // Note: efficiency is not important here; the method is deprecated anyway
+ QName qname = getTextAsQName();
+ if (qname == null) {
+ return null;
+ } else {
+ String namespaceURI = qname.getNamespaceURI();
+ return namespaceURI.length() == 0 ? null : new OMNamespaceImpl(namespaceURI, qname.getPrefix());
+ }
+ }
+
+ public final Object AxiomText.getDataHandler() {
+ if ((value != null || charArray != null) && isBinary()) {
+ String text = getTextFromProperPlace();
+ return DataHandlerUtils.getDataHandlerFromText(text, mimeType);
+ } else {
+ if (dataHandlerObject == null) {
+ throw new OMException("No DataHandler available");
+ } else if (dataHandlerObject instanceof DataHandlerProvider) {
+ try {
+ dataHandlerObject = ((DataHandlerProvider)dataHandlerObject).getDataHandler();
+ } catch (IOException ex) {
+ throw new OMException(ex);
+ }
+ }
+ return dataHandlerObject;
+ }
+ }
+
+ public final String AxiomText.getContentID() {
+ if (contentID == null) {
+ contentID = UIDGenerator.generateContentId();
+ }
+ return this.contentID;
+ }
+
+ public final void AxiomText.internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache) throws OutputException {
+ if (!isBinary()) {
+ serializer.writeText(getType(), getText());
+ } else if (dataHandlerObject instanceof DataHandlerProvider) {
+ serializer.writeDataHandler((DataHandlerProvider)dataHandlerObject, contentID, isOptimized());
+ } else {
+ serializer.writeDataHandler((DataHandler)getDataHandler(), contentID, isOptimized());
+ }
+ }
+
+ public final void AxiomText.buildWithAttachments() {
+ if (isOptimized()) {
+ // The call to getDataSource ensures that the MIME part is completely read
+ ((DataHandler)this.getDataHandler()).getDataSource();
+ }
+ }
+
+ public final void AxiomText.setContentID(String cid) {
+ this.contentID = cid;
+ }
+
+ public final void AxiomText.internalSetValue(String value) {
+ this.value = value;
+ }
+
+ public final void AxiomText.internalSetCharArray(char[] charArray) {
+ this.charArray = charArray;
+ }
+
+ public final void AxiomText.internalSetMimeType(String mimeType) {
+ this.mimeType = mimeType;
+ }
+
+ public final void AxiomText.internalSetDataHandlerObject(Object dataHandlerObject) {
+ this.dataHandlerObject = dataHandlerObject;
+ }
+
+ public final String AxiomText.coreGetData() {
+ return value;
+ }
+
+ public final void AxiomText.coreSetData(String data) {
+ this.value = data;
+ }
+
+ public final AxiomText AxiomText.doClone() {
+ AxiomText clone = createInstanceOfSameType();
+ clone.value = value;
+
+ // Clone the charArray (if it exists)
+ if (charArray != null) {
+ clone.charArray = new char[charArray.length];
+ System.arraycopy(charArray, 0, clone.charArray, 0, charArray.length);
+ }
+
+ // Copy the optimized related settings.
+ clone.optimize = optimize;
+ clone.mimeType = mimeType;
+ clone.binary = binary;
+
+ clone.contentID = contentID;
+ clone.dataHandlerObject = dataHandlerObject;
+
+ return clone;
+ }
}
Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactory.java?rev=1677231&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactory.java (added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactory.java Fri May 1 20:59:06 2015
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl.common.factory;
+
+import org.apache.axiom.core.NodeFactory;
+import org.apache.axiom.om.impl.builder.OMFactoryEx;
+
+public interface AxiomNodeFactory extends NodeFactory, OMFactoryEx {
+
+}
Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj?rev=1677231&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj (added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj Fri May 1 20:59:06 2015
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl.common.factory;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.common.AxiomCDATASection;
+import org.apache.axiom.om.impl.common.AxiomCharacterData;
+import org.apache.axiom.om.impl.common.AxiomElement;
+import org.apache.axiom.om.impl.common.AxiomText;
+
+public aspect AxiomNodeFactorySupport {
+ public void AxiomNodeFactory.validateOMTextParent(OMContainer parent) {
+ }
+
+ private AxiomText AxiomNodeFactory.createAxiomText(OMContainer parent, int type, boolean fromBuilder) {
+ AxiomText node;
+ switch (type) {
+ case OMNode.TEXT_NODE: {
+ node = (AxiomCharacterData)createCharacterData();
+ break;
+ }
+ case OMNode.SPACE_NODE: {
+ AxiomCharacterData cdata = (AxiomCharacterData)createCharacterData();
+ cdata.coreSetIgnorable(true);
+ node = cdata;
+ break;
+ }
+ case OMNode.CDATA_SECTION_NODE: {
+ node = (AxiomCDATASection)createCDATASection();
+ break;
+ }
+ default:
+ throw new IllegalArgumentException("Invalid node type");
+ }
+ if (parent != null) {
+ validateOMTextParent(parent);
+ ((OMContainerEx)parent).addChild(node, fromBuilder);
+ }
+ return node;
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(OMContainer parent, String text, int type, boolean fromBuilder) {
+ AxiomText node = createAxiomText(parent, type, fromBuilder);
+ node.internalSetValue(text);
+ return node;
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(String s, int type) {
+ return createOMText(null, s, type, false);
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(String s) {
+ return createOMText(null, s, OMNode.TEXT_NODE, false);
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(OMContainer parent, String text, int type) {
+ return createOMText(parent, text, type, false);
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(OMContainer parent, String text) {
+ return createOMText(parent, text, OMNode.TEXT_NODE, false);
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(OMContainer parent, char[] charArray, int type) {
+ AxiomText node = createAxiomText(parent, type, false);
+ node.internalSetCharArray(charArray);
+ return node;
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(OMContainer parent, QName text, int type) {
+ if (text == null) {
+ throw new IllegalArgumentException("QName text arg cannot be null!");
+ }
+ AxiomText node = createAxiomText(parent, type, false);
+ OMNamespace ns = ((AxiomElement)parent).handleNamespace(text.getNamespaceURI(), text.getPrefix());
+ node.internalSetValue(ns == null ? text.getLocalPart() : ns.getPrefix() + ":" + text.getLocalPart());
+ return node;
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(OMContainer parent, QName text) {
+ return createOMText(parent, text, OMNode.TEXT_NODE);
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(OMContainer parent, String s, String mimeType, boolean optimize) {
+ AxiomText node = createAxiomText(parent, OMNode.TEXT_NODE, false);
+ node.internalSetValue(s);
+ node.internalSetMimeType(mimeType);
+ node.setOptimize(optimize);
+ node.setBinary(true);
+ return node;
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(String s, String mimeType, boolean optimize) {
+ return createOMText(null, s, mimeType, optimize);
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(OMContainer parent, OMText source) {
+ // TODO: this doesn't necessarily produce a node with the expected OMFactory
+ AxiomText node = ((AxiomText)source).doClone();
+ if (parent != null) {
+ ((OMContainerEx)parent).addChild(node, false);
+ }
+ return node;
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(Object dataHandler, boolean optimize) {
+ return createOMText(null, dataHandler, optimize, false);
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(OMContainer parent, Object dataHandler, boolean optimize, boolean fromBuilder) {
+ AxiomText node = createAxiomText(parent, OMNode.TEXT_NODE, fromBuilder);
+ node.internalSetDataHandlerObject(dataHandler);
+ node.setBinary(true);
+ node.setOptimize(optimize);
+ return node;
+ }
+
+ public final OMText AxiomNodeFactory.createOMText(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize) {
+ AxiomText node = createAxiomText(null, OMNode.TEXT_NODE, false);
+ node.setContentID(contentID);
+ node.internalSetDataHandlerObject(dataHandlerProvider);
+ node.setBinary(true);
+ node.setOptimize(optimize);
+ return node;
+ }
+}
Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java Fri May 1 20:59:06 2015
@@ -32,6 +32,7 @@ import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.impl.OMAttributeEx;
import org.apache.axiom.om.impl.common.AxiomAttribute;
+import org.apache.axiom.om.impl.common.AxiomText;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
import org.apache.axiom.om.impl.common.serializer.push.Serializer;
import org.w3c.dom.Attr;
@@ -76,7 +77,7 @@ public class AttrImpl extends RootNode i
}
}
internalSetLocalName(localName);
- coreAppendChild(new TextImpl(value, factory), false);
+ coreAppendChild((AxiomText)factory.createOMText(value), false);
this.type = OMConstants.XMLATTRTYPE_CDATA;
internalSetNamespace(ns);
}
@@ -85,7 +86,7 @@ public class AttrImpl extends RootNode i
OMFactory factory) {
this(ownerDocument, factory);
internalSetLocalName(name);
- coreAppendChild(new TextImpl(value, factory), false);
+ coreAppendChild((AxiomText)factory.createOMText(value), false);
this.type = OMConstants.XMLATTRTYPE_CDATA;
}
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java Fri May 1 20:59:06 2015
@@ -24,11 +24,7 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.impl.common.AxiomCDATASection;
public class CDATASectionImpl extends TextNodeImpl implements DOMCDATASection, AxiomCDATASection {
- public CDATASectionImpl(String text, OMFactory factory) {
- super(text, factory);
- }
-
- ChildNode createClone() {
- return new CDATASectionImpl(textValue, getOMFactory());
+ public CDATASectionImpl(OMFactory factory) {
+ super(factory);
}
}
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java Fri May 1 20:59:06 2015
@@ -19,6 +19,7 @@
package org.apache.axiom.om.impl.dom;
+import org.apache.axiom.core.NodeFactory;
import org.apache.axiom.dom.DOMDocumentFragment;
import org.apache.axiom.om.OMCloneOptions;
import org.apache.axiom.om.OMFactory;
@@ -36,6 +37,10 @@ public class DocumentFragmentImpl extend
super(factory);
}
+ public final NodeFactory coreGetNodeFactory() {
+ return (NodeFactory)getOMFactory();
+ }
+
public void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache) {
// TODO
throw new UnsupportedOperationException("TODO");
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java Fri May 1 20:59:06 2015
@@ -40,7 +40,6 @@ import org.apache.axiom.om.impl.common.s
import org.apache.axiom.om.impl.common.serializer.push.Serializer;
import org.apache.axiom.om.impl.common.serializer.push.stax.StAXSerializer;
import org.w3c.dom.Attr;
-import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMImplementation;
@@ -118,12 +117,6 @@ public class DocumentImpl extends RootNo
return new AttrImpl(this, localName, namespace, getOMFactory());
}
- public CDATASection createCDATASection(String data) throws DOMException {
- CDATASectionImpl cdataSection = new CDATASectionImpl(data, getOMFactory());
- cdataSection.coreSetOwnerDocument(this);
- return cdataSection;
- }
-
public Comment createComment(String data) {
CommentImpl comment = new CommentImpl(data, getOMFactory());
comment.coreSetOwnerDocument(this);
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java Fri May 1 20:59:06 2015
@@ -22,7 +22,6 @@ package org.apache.axiom.om.impl.dom;
import static org.apache.axiom.dom.DOMExceptionUtil.newDOMException;
import org.apache.axiom.core.CoreChildNode;
-import org.apache.axiom.core.NodeFactory;
import org.apache.axiom.dom.DOMNode;
import org.apache.axiom.om.OMCloneOptions;
import org.apache.axiom.om.OMFactory;
@@ -366,10 +365,6 @@ public abstract class NodeImpl extends I
return (DocumentImpl)coreGetOwnerDocument(true);
}
- public final NodeFactory coreGetNodeFactory() {
- return (NodeFactory)getOMFactory();
- }
-
void checkSameOwnerDocument(Node otherNode) {
if (!(otherNode instanceof NodeImpl && coreHasSameOwnerDocument((NodeImpl)otherNode))) {
throw newDOMException(DOMException.WRONG_DOCUMENT_ERR);
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java Fri May 1 20:59:06 2015
@@ -19,71 +19,12 @@
package org.apache.axiom.om.impl.dom;
-import javax.xml.namespace.QName;
-
import org.apache.axiom.dom.DOMText;
-import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
-import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.impl.common.AxiomCharacterData;
public class TextImpl extends TextNodeImpl implements DOMText, AxiomCharacterData {
- public TextImpl(char[] value, OMFactory factory) {
- super(value, factory);
- }
-
- public TextImpl(Object dataHandler, boolean optimize, OMFactory factory) {
- super(dataHandler, optimize, factory);
- }
-
- public TextImpl(String contentID,
- DataHandlerProvider dataHandlerProvider, boolean optimize, OMFactory factory) {
- super(contentID, dataHandlerProvider, optimize, factory);
- }
-
public TextImpl(OMFactory factory) {
super(factory);
}
-
- public TextImpl(String value, int nodeType, OMFactory factory) {
- super(value, factory);
- coreSetIgnorable(nodeType == SPACE_NODE);
- }
-
- public TextImpl(OMContainer parent, QName text, int nodeType, OMFactory factory) {
- super(parent, text, nodeType, factory);
- }
-
- public TextImpl(OMContainer parent, QName text, OMFactory factory) {
- super(parent, text, factory);
- }
-
- public TextImpl(TextNodeImpl source, OMFactory factory) {
- super(source, factory);
- }
-
- public TextImpl(String text, OMFactory factory) {
- super(text, factory);
- }
-
- public TextImpl(String text, String mimeType, boolean optimize, boolean isBinary,
- OMFactory factory) {
- super(text, mimeType, optimize, isBinary, factory);
- }
-
- public TextImpl(String text, String mimeType, boolean optimize, OMFactory factory) {
- super(text, mimeType, optimize, factory);
- }
-
- ChildNode createClone() {
- return new TextImpl(this, getOMFactory());
- }
-
- public String coreGetData() {
- return textValue;
- }
-
- public void coreSetData(String data) {
- this.textValue = data;
- }
}
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java Fri May 1 20:59:06 2015
@@ -21,136 +21,17 @@ package org.apache.axiom.om.impl.dom;
import static org.apache.axiom.dom.DOMExceptionUtil.newDOMException;
-import org.apache.axiom.attachments.utils.DataHandlerUtils;
-import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
import org.apache.axiom.dom.DOMTextNode;
import org.apache.axiom.om.OMCloneOptions;
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.OMNodeEx;
-import org.apache.axiom.om.impl.common.OMNamespaceImpl;
-import org.apache.axiom.om.impl.common.serializer.push.OutputException;
-import org.apache.axiom.om.impl.common.serializer.push.Serializer;
-import org.apache.axiom.util.UIDGenerator;
-import org.apache.axiom.util.base64.Base64Utils;
import org.w3c.dom.DOMException;
import org.w3c.dom.Text;
import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-
-import java.io.IOException;
public abstract class TextNodeImpl extends LeafNode implements DOMTextNode, OMText, OMNodeEx {
- protected String textValue;
-
- private String mimeType;
-
- private String contentID;
-
- protected char[] charArray;
-
- /**
- * Contains a {@link DataHandler} or {@link DataHandlerProvider} object if the text node
- * represents base64 encoded binary data.
- */
- private Object dataHandlerObject;
-
- /**
- * Creates a text node with the given text required by the OMDOMFactory. The owner document
- * should be set properly when appending this to a DOM tree.
- *
- * @param text
- */
- public TextNodeImpl(String text, OMFactory factory) {
- super(factory);
- //this.textValue = (text != null) ? new StringBuffer(text)
- // : new StringBuffer("");
- this.textValue = (text != null) ? text : "";
- }
-
- /**
- * Construct TextImpl that is a copy of the source OMTextImpl
- *
- * @param parent
- * @param source TextImpl
- * @param factory
- */
- public TextNodeImpl(TextNodeImpl source, OMFactory factory) {
- super(factory);
-
- // Copy the value of the text
- if (source.textValue != null) {
- this.textValue = source.textValue;
- }
-
- // Clone the charArray (if it exists)
- if (source.charArray != null) {
- this.charArray = new char[source.charArray.length];
- for (int i = 0; i < source.charArray.length; i++) {
- this.charArray[i] = source.charArray[i];
- }
- }
-
- // Copy the optimized related settings.
- setOptimize(source.isOptimized());
- this.mimeType = source.mimeType;
- setBinary(source.isBinary());
-
- // TODO
- // Do we need a deep copy of the data-handler
- this.contentID = source.contentID;
- this.dataHandlerObject = source.dataHandlerObject;
- }
-
- public TextNodeImpl(String text, String mimeType, boolean optimize,
- OMFactory factory) {
- this(text, mimeType, optimize, true, factory);
- }
-
- public TextNodeImpl(String text, String mimeType, boolean optimize,
- boolean isBinary, OMFactory factory) {
- this(text, factory);
- this.mimeType = mimeType;
- setOptimize(optimize);
- setBinary(isBinary());
- }
-
- /**
- * @param dataHandler
- * @param optimize To send binary content. Created progrmatically.
- */
- public TextNodeImpl(Object dataHandler, boolean optimize,
- OMFactory factory) {
- super(factory);
- this.dataHandlerObject = dataHandler;
- setBinary(true);
- setOptimize(optimize);
- }
-
- /**
- * Constructor.
- *
- * @param contentID
- * @param dataHandlerProvider
- * @param optimize
- * @param factory
- */
- public TextNodeImpl(String contentID, DataHandlerProvider
- dataHandlerProvider, boolean optimize, OMFactory factory) {
- super(factory);
- this.contentID = contentID;
- dataHandlerObject = dataHandlerProvider;
- setBinary(true);
- setOptimize(optimize);
- }
-
/**
* @param ownerNode
*/
@@ -158,27 +39,9 @@ public abstract class TextNodeImpl exten
super(factory);
}
- public TextNodeImpl(char[] value, OMFactory factory) {
- super(factory);
- this.charArray = value;
- }
-
- public TextNodeImpl(OMContainer parent, QName text, OMFactory factory) {
- this(parent, text, OMNode.TEXT_NODE, factory);
-
- }
-
- public TextNodeImpl(OMContainer parent, QName text, int nodeType,
- OMFactory factory) {
- this(factory);
- OMNamespace textNS =
- ((ElementImpl) parent).handleNamespace(text.getNamespaceURI(), text.getPrefix());
- this.textValue = textNS == null ? text.getLocalPart() : textNS.getPrefix() + ":" + text.getLocalPart();
- }
-
/** Sets the text value of data. */
public void setData(String data) throws DOMException {
- this.textValue = data;
+ this.value = data;
}
/**
@@ -190,11 +53,11 @@ public abstract class TextNodeImpl exten
* node has no data.
*/
public Text splitText(int offset) throws DOMException {
- if (offset < 0 || offset > this.textValue.length()) {
+ if (offset < 0 || offset > this.value.length()) {
throw newDOMException(DOMException.INDEX_SIZE_ERR);
}
- String newValue = this.textValue.substring(offset);
- this.deleteData(offset, this.textValue.length());
+ String newValue = this.value.substring(offset);
+ this.deleteData(offset, this.value.length());
TextImpl newText = (TextImpl) this.getOwnerDocument().createTextNode(
newValue);
@@ -211,87 +74,10 @@ public abstract class TextNodeImpl exten
// /OMNode methods
// /
- public String getText() {
- if (this.charArray != null || this.textValue != null) {
- return getTextFromProperPlace();
- } else {
- try {
- return Base64Utils.encode((DataHandler) getDataHandler());
- } catch (Exception e) {
- throw new OMException(e);
- }
- }
- }
-
public String getData() throws DOMException {
return this.getText();
}
- public char[] getTextCharacters() {
- if (charArray != null) {
- return charArray;
- } else if (textValue != null) {
- return textValue.toCharArray();
- } else {
- try {
- return Base64Utils.encodeToCharArray((DataHandler)getDataHandler());
- } catch (IOException ex) {
- throw new OMException(ex);
- }
- }
- }
-
- public boolean isCharacters() {
- return charArray != null;
- }
-
- private String getTextFromProperPlace() {
- return charArray != null ? new String(charArray) : textValue;
- }
-
- public QName getTextAsQName() {
- return ((OMElement)coreGetParent()).resolveQName(getTextFromProperPlace());
- }
-
- public String getContentID() {
- if (contentID == null) {
- contentID = UIDGenerator.generateContentId();
- }
- return this.contentID;
- }
-
- public Object getDataHandler() {
- /*
- * this should return a DataHandler containing the binary data
- * reperesented by the Base64 strings stored in OMText
- */
- if ((textValue != null || charArray != null) & isBinary()) {
- return DataHandlerUtils.getDataHandlerFromText(getTextFromProperPlace(), mimeType);
- } else {
-
- if (dataHandlerObject == null) {
- throw new OMException("No DataHandler available");
- } else if (dataHandlerObject instanceof DataHandlerProvider) {
- try {
- dataHandlerObject = ((DataHandlerProvider) dataHandlerObject).getDataHandler();
- } catch (IOException ex) {
- throw new OMException(ex);
- }
- }
- return dataHandlerObject;
- }
- }
-
- public void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache) throws OutputException {
- if (!isBinary()) {
- serializer.writeText(getType(), getText());
- } else if (dataHandlerObject instanceof DataHandlerProvider) {
- serializer.writeDataHandler((DataHandlerProvider)dataHandlerObject, contentID, isOptimized());
- } else {
- serializer.writeDataHandler((DataHandler)getDataHandler(), contentID, isOptimized());
- }
- }
-
/*
* DOM-Level 3 methods
*/
@@ -302,30 +88,7 @@ public abstract class TextNodeImpl exten
}
public String toString() {
- return (this.textValue != null) ? textValue : "";
- }
-
- public void buildWithAttachments() {
- this.build();
- if (isOptimized()) {
- // The call to getDataSource ensures that the MIME part is completely read
- ((DataHandler)this.getDataHandler()).getDataSource();
- }
- }
-
- public OMNamespace getNamespace() {
- // Note: efficiency is not important here; the method is deprecated anyway
- QName qname = getTextAsQName();
- if (qname == null) {
- return null;
- } else {
- String namespaceURI = qname.getNamespaceURI();
- return namespaceURI.length() == 0 ? null : new OMNamespaceImpl(namespaceURI, qname.getPrefix());
- }
- }
-
- public void setContentID(String cid) {
- this.contentID = cid;
+ return (this.value != null) ? value : "";
}
void beforeClone(OMCloneOptions options) {
@@ -335,4 +98,8 @@ public abstract class TextNodeImpl exten
((DataHandler)getDataHandler()).getDataSource();
}
}
+
+ final ChildNode createClone() {
+ return (ChildNode)doClone();
+ }
}
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java Fri May 1 20:59:06 2015
@@ -19,10 +19,9 @@
package org.apache.axiom.om.impl.dom.factory;
+import org.apache.axiom.core.CoreCDATASection;
import org.apache.axiom.core.CoreCharacterData;
import org.apache.axiom.core.CoreDocument;
-import org.apache.axiom.core.NodeFactory;
-import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMComment;
import org.apache.axiom.om.OMContainer;
@@ -41,9 +40,9 @@ import org.apache.axiom.om.OMSourcedElem
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.OMContainerEx;
-import org.apache.axiom.om.impl.builder.OMFactoryEx;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
+import org.apache.axiom.om.impl.common.factory.AxiomNodeFactory;
import org.apache.axiom.om.impl.dom.AttrImpl;
import org.apache.axiom.om.impl.dom.CDATASectionImpl;
import org.apache.axiom.om.impl.dom.CommentImpl;
@@ -55,7 +54,6 @@ import org.apache.axiom.om.impl.dom.OMDO
import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.impl.dom.ProcessingInstructionImpl;
import org.apache.axiom.om.impl.dom.TextImpl;
-import org.apache.axiom.om.impl.dom.TextNodeImpl;
import org.apache.axiom.om.impl.util.OMSerializerUtil;
import javax.xml.namespace.QName;
@@ -64,7 +62,7 @@ import javax.xml.namespace.QName;
* OM factory implementation for DOOM. It creates nodes that implement
* DOM as defined by the interfaces in {@link org.w3c.dom}.
*/
-public class OMDOMFactory implements OMFactoryEx, NodeFactory {
+public class OMDOMFactory implements AxiomNodeFactory {
private final OMDOMMetaFactory metaFactory;
public OMDOMFactory(OMDOMMetaFactory metaFactory) {
@@ -178,124 +176,13 @@ public class OMDOMFactory implements OMF
return new OMNamespaceImpl(uri, prefix);
}
- public OMText createOMText(OMContainer parent, String text) {
- return createOMText(parent, text, OMNode.TEXT_NODE);
- }
-
- public OMText createOMText(OMContainer parent, QName text) {
- return createOMText(parent, text, OMNode.TEXT_NODE);
- }
-
- public OMText createOMText(OMContainer parent, QName text, int type) {
- TextImpl txt = new TextImpl(parent, text, type, this);
- parent.addChild(txt);
- return txt;
- }
-
- public OMText createOMText(OMContainer parent, String text, int type) {
- return createOMText(parent, text, type, false);
- }
-
- public OMText createOMText(OMContainer parent, String text, int type, boolean fromBuilder) {
- if (parent == null) {
- return createOMText(text, type);
- } else if (parent instanceof DocumentImpl) {
+ public final void validateOMTextParent(OMContainer parent) {
+ if (parent instanceof DocumentImpl) {
throw new OMHierarchyException(
"DOM doesn't support text nodes as children of a document");
- } else {
- TextNodeImpl txt;
- if (type == OMNode.CDATA_SECTION_NODE) {
- txt = new CDATASectionImpl(text, this);
- } else {
- txt = new TextImpl(text, type, this);
- }
- ((OMContainerEx)parent).addChild(txt, fromBuilder);
- return txt;
}
}
-
- public OMText createOMText(OMContainer parent, OMText source) {
- TextImpl text = new TextImpl((TextImpl) source, this);
- parent.addChild(text);
- return text;
- }
-
- public OMText createOMText(OMContainer parent, char[] charArary, int type) {
- TextImpl txt = new TextImpl(charArary, this);
- parent.addChild(txt);
- return txt;
- }
-
- /**
- * Creates a OMDOM Text node carrying the given value.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(String)
- */
- public OMText createOMText(String s) {
- return new TextImpl(s, this);
- }
-
- /**
- * Creates a Character node of the given type.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(String, int)
- */
- public OMText createOMText(String text, int type) {
- if (type == OMNode.CDATA_SECTION_NODE) {
- return new CDATASectionImpl(text, this);
- } else {
- return new TextImpl(text, this);
- }
- }
-
- /**
- * Creates a new OMDOM Text node with the value of the given text value along with the MTOM
- * optimization parameters and returns it.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(String, String, boolean)
- */
- public OMText createOMText(String text, String mimeType, boolean optimize) {
- return new TextImpl(text, mimeType, optimize, this);
- }
-
- /**
- * Creates a new OMDOM Text node with the given datahandler and the given MTOM optimization
- * configuration and returns it.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(Object, boolean)
- */
- public OMText createOMText(Object dataHandler, boolean optimize) {
- return createOMText(null, dataHandler, optimize, false);
- }
-
- public OMText createOMText(OMContainer parent, Object dataHandler, boolean optimize,
- boolean fromBuilder) {
- TextImpl text = new TextImpl(dataHandler, optimize, this);
- if (parent != null) {
- ((OMContainerEx)parent).addChild(text, fromBuilder);
- }
- return text;
- }
-
- public OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider,
- boolean optimize) {
- return new TextImpl(contentID, dataHandlerProvider, optimize, this);
- }
-
- /**
- * Creates an OMDOM Text node, adds it to the give parent element and returns it.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(OMContainer, String,
- * String, boolean)
- */
- public OMText createOMText(OMContainer parent, String s, String mimeType,
- boolean optimize) {
- TextImpl text = new TextImpl(s, mimeType, optimize, this);
- parent.addChild(text);
- return text;
- }
-
public OMAttribute createOMAttribute(String localName, OMNamespace ns,
String value) {
if (ns != null && ns.getPrefix() == null) {
@@ -391,9 +278,9 @@ public class OMDOMFactory implements OMF
newText = createOMText(importedText
.getDataHandler(), isOptimize);
} else if (importedText.isCharacters()) {
- newText = new TextImpl(importedText.getTextCharacters(), this);
+ newText = createOMText(null, importedText.getTextCharacters(), OMNode.TEXT_NODE);
} else {
- newText = new TextImpl(importedText.getText(), this);
+ newText = createOMText(importedText.getText());
}
return newText;
}
@@ -431,4 +318,8 @@ public class OMDOMFactory implements OMF
public final CoreCharacterData createCharacterData() {
return new TextImpl(this);
}
+
+ public CoreCDATASection createCDATASection() {
+ return new CDATASectionImpl(this);
+ }
}
Added: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CDATASectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CDATASectionImpl.java?rev=1677231&view=auto
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CDATASectionImpl.java (added)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CDATASectionImpl.java Fri May 1 20:59:06 2015
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl.llom;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.impl.common.AxiomCDATASection;
+
+public class CDATASectionImpl extends OMTextImpl implements AxiomCDATASection {
+ public CDATASectionImpl(OMFactory factory) {
+ super(factory);
+ }
+}
Propchange: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CDATASectionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CharacterDataImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CharacterDataImpl.java?rev=1677231&view=auto
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CharacterDataImpl.java (added)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CharacterDataImpl.java Fri May 1 20:59:06 2015
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl.llom;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.impl.common.AxiomCharacterData;
+
+public class CharacterDataImpl extends OMTextImpl implements AxiomCharacterData {
+ public CharacterDataImpl(OMFactory factory) {
+ super(factory);
+ }
+}
Propchange: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/CharacterDataImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMInformationItemImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMInformationItemImpl.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMInformationItemImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMInformationItemImpl.java Fri May 1 20:59:06 2015
@@ -18,12 +18,9 @@
*/
package org.apache.axiom.om.impl.llom;
-import org.apache.axiom.core.NodeFactory;
import org.apache.axiom.om.impl.common.AxiomInformationItem;
import org.apache.axiom.om.impl.common.InformationItem;
public abstract class OMInformationItemImpl extends InformationItem implements AxiomInformationItem {
- public final NodeFactory coreGetNodeFactory() {
- throw new UnsupportedOperationException();
- }
+
}
Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java Fri May 1 20:59:06 2015
@@ -19,299 +19,18 @@
package org.apache.axiom.om.impl.llom;
-import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
import org.apache.axiom.om.OMCloneOptions;
import org.apache.axiom.om.OMConstants;
import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.common.OMNamespaceImpl;
-import org.apache.axiom.om.impl.common.serializer.push.OutputException;
-import org.apache.axiom.om.impl.common.serializer.push.Serializer;
-import org.apache.axiom.util.UIDGenerator;
-import org.apache.axiom.util.base64.Base64Utils;
+import org.apache.axiom.om.impl.common.AxiomText;
import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import java.io.IOException;
-public class OMTextImpl extends OMLeafNode implements OMText, OMConstants {
- /**
- * The node type; either {@link OMNode#TEXT_NODE} or {@link OMNode#CDATA_SECTION_NODE}. Note
- * that this field must be final. The Axiom API doesn't allow to change the node type of an
- * existing {@link OMText} instance. In addition to that, an Axiom implementation is free to use
- * different concrete classes for simple character data and CDATA sections.
- */
- private final int nodeType;
-
- protected String value;
- protected char[] charArray;
-
- protected String mimeType;
-
- /** Field contentID for the mime part used when serializing Binary stuff as MTOM optimized. */
- private String contentID;
-
- /**
- * Contains a {@link DataHandler} or {@link DataHandlerProvider} object if the text node
- * represents base64 encoded binary data.
- */
- private Object dataHandlerObject;
-
- private static final String EMTPY_STRING = "";
-
- /**
- * Constructor OMTextImpl.
- *
- * @param s
- */
- public OMTextImpl(String s, OMFactory factory) {
- this(s, TEXT_NODE, factory);
- }
-
- /**
- * @param s
- * @param nodeType - OMText can handle CHARACTERS, SPACES, CDATA and ENTITY REFERENCES.
- * Constants for this can be found in OMNode.
- */
- public OMTextImpl(String s, int nodeType, OMFactory factory) {
- this(null, s, nodeType, factory, false);
- }
-
- /**
- * Constructor OMTextImpl.
- *
- * @param parent
- * @param text
- */
- public OMTextImpl(OMContainer parent, String text, OMFactory factory) {
- this(parent, text, TEXT_NODE, factory, false);
- }
-
- /**
- * Construct OMTextImpl that is a copy of the source OMTextImpl
- * @param parent
- * @param source OMTextImpl
- * @param factory
- */
- public OMTextImpl(OMContainer parent, OMTextImpl source, OMFactory factory) {
- super(parent, factory, false);
- // Copy the value of the text
- this.value = source.value;
- this.nodeType = source.nodeType;
-
- // Clone the charArray (if it exists)
- if (source.charArray != null) {
- this.charArray = new char[source.charArray.length];
- System.arraycopy(source.charArray, 0, this.charArray, 0, source.charArray.length);
- }
-
- // Copy the optimized related settings.
- setOptimize(source.isOptimized());
- this.mimeType = source.mimeType;
- setBinary(source.isBinary());
-
- // TODO
- // Do we need a deep copy of the data-handler
- this.contentID = source.contentID;
- this.dataHandlerObject = source.dataHandlerObject;
- }
-
- public OMTextImpl(OMContainer parent, String text, int nodeType,
- OMFactory factory, boolean fromBuilder) {
- super(parent, factory, fromBuilder);
- this.value = text == null ? EMTPY_STRING : text;
- this.nodeType = nodeType;
- }
-
- public OMTextImpl(OMContainer parent, char[] charArray, int nodeType,
- OMFactory factory) {
- super(parent, factory, false);
- this.charArray = charArray;
- this.nodeType = nodeType;
- }
-
-
- public OMTextImpl(OMContainer parent, QName text, OMFactory factory) {
- this(parent, text, TEXT_NODE, factory);
- }
-
- public OMTextImpl(OMContainer parent, QName text, int nodeType,
- OMFactory factory) {
- super(parent, factory, false);
- if (text == null) throw new IllegalArgumentException("QName text arg cannot be null!");
- OMNamespace textNS =
- ((OMElementImpl) parent).handleNamespace(text.getNamespaceURI(), text.getPrefix());
- this.value = textNS == null ? text.getLocalPart() : textNS.getPrefix() + ":" + text.getLocalPart();
- this.nodeType = nodeType;
- }
-
- /**
- * @param s - base64 encoded String representation of Binary
- * @param mimeType of the Binary
- */
- public OMTextImpl(String s, String mimeType, boolean optimize,
- OMFactory factory) {
- this(null, s, mimeType, optimize, factory);
- }
-
- /**
- * @param parent
- * @param s - base64 encoded String representation of Binary
- * @param mimeType of the Binary
- */
- public OMTextImpl(OMContainer parent, String s, String mimeType,
- boolean optimize, OMFactory factory) {
- this(parent, s, factory);
- this.mimeType = mimeType;
- setOptimize(optimize);
- setBinary(true);
- }
-
- /** @param dataHandler To send binary optimised content Created programatically. */
- public OMTextImpl(Object dataHandler, OMFactory factory) {
- this(null, dataHandler, true, factory, false);
- }
-
- /**
- * @param dataHandler
- * @param optimize To send binary content. Created progrmatically.
- */
- public OMTextImpl(OMContainer parent, Object dataHandler, boolean optimize, OMFactory factory, boolean fromBuilder) {
- super(parent, factory, fromBuilder);
- this.dataHandlerObject = dataHandler;
- setBinary(true);
- setOptimize(optimize);
- this.nodeType = TEXT_NODE;
- }
-
- /**
- * Constructor.
- *
- * @param dataHandlerProvider
- * @param optimize
- * @param factory
- */
- public OMTextImpl(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize,
- OMFactory factory) {
+public abstract class OMTextImpl extends OMLeafNode implements AxiomText, OMConstants {
+ public OMTextImpl(OMFactory factory) {
super(factory);
- this.contentID = contentID;
- dataHandlerObject = dataHandlerProvider;
- setBinary(true);
- setOptimize(optimize);
- nodeType = TEXT_NODE;
- }
-
- public final int getType() {
- return nodeType;
- }
-
- /** Returns the value. */
- public String getText() throws OMException {
- if (charArray != null || this.value != null) {
- return getTextFromProperPlace();
- } else {
- try {
- return Base64Utils.encode((DataHandler)getDataHandler());
- } catch (Exception e) {
- throw new OMException(e);
- }
- }
- }
-
- public char[] getTextCharacters() {
- if (charArray != null) {
- return charArray;
- } else if (value != null) {
- return value.toCharArray();
- } else {
- try {
- return Base64Utils.encodeToCharArray((DataHandler)getDataHandler());
- } catch (IOException ex) {
- throw new OMException(ex);
- }
- }
- }
-
- public boolean isCharacters() {
- return charArray != null;
- }
-
- /**
- * This OMText contains two data source:value and charArray. This method will return text from
- * correct place.
- */
- private String getTextFromProperPlace() {
- return charArray != null ? new String(charArray) : value;
- }
-
- public QName getTextAsQName() throws OMException {
- return ((OMElement)getParent()).resolveQName(getTextFromProperPlace());
- }
-
- public OMNamespace getNamespace() {
- // Note: efficiency is not important here; the method is deprecated anyway
- QName qname = getTextAsQName();
- if (qname == null) {
- return null;
- } else {
- String namespaceURI = qname.getNamespaceURI();
- return namespaceURI.length() == 0 ? null : new OMNamespaceImpl(namespaceURI, qname.getPrefix());
- }
- }
-
- public Object getDataHandler() {
- if ((value != null || charArray != null) && isBinary()) {
- String text = getTextFromProperPlace();
- return org.apache.axiom.attachments.utils.DataHandlerUtils
- .getDataHandlerFromText(text, mimeType);
- } else {
-
- if (dataHandlerObject == null) {
- throw new OMException("No DataHandler available");
- } else if (dataHandlerObject instanceof DataHandlerProvider) {
- try {
- dataHandlerObject = ((DataHandlerProvider)dataHandlerObject).getDataHandler();
- } catch (IOException ex) {
- throw new OMException(ex);
- }
- }
- return dataHandlerObject;
- }
- }
-
- public String getContentID() {
- if (contentID == null) {
- contentID = UIDGenerator.generateContentId();
- }
- return this.contentID;
- }
-
- public void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache) throws OutputException {
-
- if (!isBinary()) {
- serializer.writeText(getType(), getText());
- } else if (dataHandlerObject instanceof DataHandlerProvider) {
- serializer.writeDataHandler((DataHandlerProvider)dataHandlerObject, contentID, isOptimized());
- } else {
- serializer.writeDataHandler((DataHandler)getDataHandler(), contentID, isOptimized());
- }
- }
-
- public void buildWithAttachments() {
- if (isOptimized()) {
- // The call to getDataSource ensures that the MIME part is completely read
- ((DataHandler)this.getDataHandler()).getDataSource();
- }
- }
-
- public void setContentID(String cid) {
- this.contentID = cid;
}
OMNode clone(OMCloneOptions options, OMContainer targetParent) {
Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=1677231&r1=1677230&r2=1677231&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java Fri May 1 20:59:06 2015
@@ -19,7 +19,9 @@
package org.apache.axiom.om.impl.llom.factory;
-import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
+import org.apache.axiom.core.CoreCDATASection;
+import org.apache.axiom.core.CoreCharacterData;
+import org.apache.axiom.core.CoreDocument;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMComment;
@@ -37,9 +39,11 @@ import org.apache.axiom.om.OMProcessingI
import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.builder.OMFactoryEx;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
+import org.apache.axiom.om.impl.common.factory.AxiomNodeFactory;
+import org.apache.axiom.om.impl.llom.CDATASectionImpl;
+import org.apache.axiom.om.impl.llom.CharacterDataImpl;
import org.apache.axiom.om.impl.llom.OMAttributeImpl;
import org.apache.axiom.om.impl.llom.OMCommentImpl;
import org.apache.axiom.om.impl.llom.OMDocTypeImpl;
@@ -48,14 +52,13 @@ import org.apache.axiom.om.impl.llom.OME
import org.apache.axiom.om.impl.llom.OMEntityReferenceImpl;
import org.apache.axiom.om.impl.llom.OMProcessingInstructionImpl;
import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
-import org.apache.axiom.om.impl.llom.OMTextImpl;
import org.apache.axiom.om.impl.util.OMSerializerUtil;
import javax.xml.namespace.QName;
/** Class OMLinkedListImplFactory
*/
-public class OMLinkedListImplFactory implements OMFactoryEx {
+public class OMLinkedListImplFactory implements AxiomNodeFactory {
private final OMLinkedListMetaFactory metaFactory;
/**
@@ -187,103 +190,6 @@ public class OMLinkedListImplFactory imp
}
/**
- * Method createOMText.
- *
- * @param parent
- * @param text
- * @return Returns OMText.
- */
- public OMText createOMText(OMContainer parent, String text) {
- return new OMTextImpl(parent, text, this);
- }
-
- public OMText createOMText(OMContainer parent, QName text) {
- return new OMTextImpl(parent, text, this);
- }
-
- public OMText createOMText(OMContainer parent, String text, int type) {
- return createOMText(parent, text, type, false);
- }
-
- public OMText createOMText(OMContainer parent, String text, int type, boolean fromBuilder) {
- return new OMTextImpl(parent, text, type, this, fromBuilder);
- }
-
- public OMText createOMText(OMContainer parent, char[] charArary, int type) {
- return new OMTextImpl(parent, charArary, type, this);
- }
-
- public OMText createOMText(OMContainer parent, QName text, int type) {
- return new OMTextImpl(parent, text, type, this);
- }
-
- /**
- * Method createOMText.
- *
- * @param s
- * @return Returns OMText.
- */
- public OMText createOMText(String s) {
- return new OMTextImpl(s, this);
- }
-
- public OMText createOMText(String s, int type) {
- return new OMTextImpl(s, type, this);
- }
-
- /**
- * Creates text.
- *
- * @param s
- * @param mimeType
- * @param optimize
- * @return Returns OMText.
- */
- public OMText createOMText(String s, String mimeType, boolean optimize) {
- return new OMTextImpl(s, mimeType, optimize, this);
- }
-
- /**
- * Creates text.
- *
- * @param dataHandler
- * @param optimize
- * @return Returns OMText.
- */
- public OMText createOMText(Object dataHandler, boolean optimize) {
- return createOMText(null, dataHandler, optimize, false);
- }
-
- public OMText createOMText(OMContainer parent, Object dataHandler, boolean optimize, boolean fromBuilder) {
- return new OMTextImpl(parent, dataHandler, optimize, this, fromBuilder);
- }
-
- public OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider,
- boolean optimize) {
- return new OMTextImpl(contentID, dataHandlerProvider, optimize, this);
- }
-
- public OMText createOMText(OMContainer parent, OMText source) {
- return new OMTextImpl(parent, (OMTextImpl) source, this);
- }
-
- /**
- * Creates text.
- *
- * @param parent
- * @param s
- * @param mimeType
- * @param optimize
- * @return Returns OMText.
- */
- public OMText createOMText(OMContainer parent,
- String s,
- String mimeType,
- boolean optimize) {
- return new OMTextImpl(parent, s, mimeType, optimize, this);
- }
-
- /**
* Creates attribute.
*
* @param localName
@@ -425,4 +331,16 @@ public class OMLinkedListImplFactory imp
}
}
}
+
+ public CoreDocument createDocument() {
+ return new OMDocumentImpl(this);
+ }
+
+ public CoreCharacterData createCharacterData() {
+ return new CharacterDataImpl(this);
+ }
+
+ public CoreCDATASection createCDATASection() {
+ return new CDATASectionImpl(this);
+ }
}