Author: veithen
Date: Sun Aug 30 22:12:44 2015
New Revision: 1700168
URL: http://svn.apache.org/r1700168
Log:
Create a uniform API for node creation.
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASectionSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataNodeSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCommentSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreDocumentTypeDeclarationSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreEntityReferenceSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareAttributeSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNodeSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNodeSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreProcessingInstructionSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.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/dom-aspects/src/main/java/org/apache/axiom/dom/DOMNodeFactorySupport.aj
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMTextNodeSupport.aj
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAPFactorySupport.aj
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/factory/OMLinkedListImplFactory.java
webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASectionSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASectionSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASectionSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCDATASectionSupport.aj
Sun Aug 30 22:12:44 2015
@@ -24,6 +24,6 @@ public aspect CoreCDATASectionSupport {
}
public final CoreNode CoreCDATASection.shallowClone(ClonePolicy policy,
Object options) {
- return coreGetNodeFactory().createCDATASection();
+ return coreGetNodeFactory().createNode(CoreCDATASection.class);
}
}
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataNodeSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataNodeSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataNodeSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataNodeSupport.aj
Sun Aug 30 22:12:44 2015
@@ -49,7 +49,7 @@ public aspect CoreCharacterDataNodeSuppo
}
public final CoreNode CoreCharacterDataNode.shallowClone(ClonePolicy
policy, Object options) {
- CoreCharacterDataNode clone =
coreGetNodeFactory().createCharacterDataNode();
+ CoreCharacterDataNode clone =
coreGetNodeFactory().createNode(CoreCharacterDataNode.class);
clone.data = data instanceof CharacterData ?
((CharacterData)data).clone(policy, options) : data;
clone.coreSetIgnorable(coreIsIgnorable());
return clone;
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCommentSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCommentSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCommentSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCommentSupport.aj
Sun Aug 30 22:12:44 2015
@@ -24,6 +24,6 @@ public aspect CoreCommentSupport {
}
public final CoreNode CoreComment.shallowClone(ClonePolicy policy, Object
options) {
- return coreGetNodeFactory().createComment();
+ return coreGetNodeFactory().createNode(CoreComment.class);
}
}
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreDocumentTypeDeclarationSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreDocumentTypeDeclarationSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreDocumentTypeDeclarationSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreDocumentTypeDeclarationSupport.aj
Sun Aug 30 22:12:44 2015
@@ -61,7 +61,7 @@ public aspect CoreDocumentTypeDeclaratio
}
public final CoreNode CoreDocumentTypeDeclaration.shallowClone(ClonePolicy
policy, Object options) {
- CoreDocumentTypeDeclaration clone =
coreGetNodeFactory().createDocumentTypeDeclaration();
+ CoreDocumentTypeDeclaration clone =
coreGetNodeFactory().createNode(CoreDocumentTypeDeclaration.class);
clone.coreSetRootName(coreGetRootName());
clone.coreSetPublicId(coreGetPublicId());
clone.coreSetSystemId(coreGetSystemId());
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreEntityReferenceSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreEntityReferenceSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreEntityReferenceSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreEntityReferenceSupport.aj
Sun Aug 30 22:12:44 2015
@@ -43,7 +43,7 @@ public aspect CoreEntityReferenceSupport
}
public final CoreNode CoreEntityReference.shallowClone(ClonePolicy policy,
Object options) {
- CoreEntityReference clone =
coreGetNodeFactory().createEntityReference();
+ CoreEntityReference clone =
coreGetNodeFactory().createNode(CoreEntityReference.class);
clone.coreSetName(coreGetName());
clone.coreSetReplacementText(coreGetReplacementText());
return clone;
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareAttributeSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareAttributeSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareAttributeSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareAttributeSupport.aj
Sun Aug 30 22:12:44 2015
@@ -24,7 +24,7 @@ public aspect CoreNSAwareAttributeSuppor
}
public final CoreNode CoreNSAwareAttribute.shallowClone(ClonePolicy
policy, Object options) {
- CoreNSAwareAttribute clone =
coreGetNodeFactory().createNSAwareAttribute();
+ CoreNSAwareAttribute clone =
coreGetNodeFactory().createNode(CoreNSAwareAttribute.class);
clone.coreSetName(this);
clone.coreSetType(coreGetType());
return clone;
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNodeSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNodeSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNodeSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNodeSupport.aj
Sun Aug 30 22:12:44 2015
@@ -37,7 +37,7 @@ public aspect CoreNodeSupport {
if (root instanceof CoreDocument) {
return (CoreDocument)root;
} else if (create) {
- CoreDocument ownerDocument =
root.coreGetNodeFactory().createDocument();
+ CoreDocument ownerDocument =
root.coreGetNodeFactory().createNode(CoreDocument.class);
root.coreSetOwnerDocument(ownerDocument);
return ownerDocument;
} else {
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNodeSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNodeSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNodeSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNodeSupport.aj
Sun Aug 30 22:12:44 2015
@@ -47,7 +47,7 @@ public aspect CoreParentNodeSupport {
final Content CoreParentNode.getContent(boolean create) {
if (getState() == COMPACT) {
Content content = new Content();
- CoreCharacterDataNode cdata =
coreGetNodeFactory().createCharacterDataNode();
+ CoreCharacterDataNode cdata =
coreGetNodeFactory().createNode(CoreCharacterDataNode.class);
cdata.internalSetParent(this);
cdata.coreSetCharacterData((String)this.content);
content.firstChild = cdata;
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreProcessingInstructionSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreProcessingInstructionSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreProcessingInstructionSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreProcessingInstructionSupport.aj
Sun Aug 30 22:12:44 2015
@@ -34,7 +34,7 @@ public aspect CoreProcessingInstructionS
}
public final CoreNode CoreProcessingInstruction.shallowClone(ClonePolicy
policy, Object options) {
- CoreProcessingInstruction clone =
coreGetNodeFactory().createProcessingInstruction();
+ CoreProcessingInstruction clone =
coreGetNodeFactory().createNode(CoreProcessingInstruction.class);
clone.target = target;
return clone;
}
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java
Sun Aug 30 22:12:44 2015
@@ -85,7 +85,7 @@ public final class NSAwareAttributeMatch
}
public CoreAttribute createAttribute(NodeFactory nodeFactory, String
namespaceURI, String name, String prefix, String value) {
- CoreNSAwareAttribute attr = nodeFactory.createNSAwareAttribute();
+ CoreNSAwareAttribute attr =
nodeFactory.createNode(CoreNSAwareAttribute.class);
attr.coreSetName(namespaceURI, name, prefix);
attr.coreSetCharacterData(value, null);
return attr;
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java
(original)
+++
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java
Sun Aug 30 22:12:44 2015
@@ -50,7 +50,7 @@ public final class NamespaceDeclarationM
}
public CoreAttribute createAttribute(NodeFactory nodeFactory, String
namespaceURI, String name, String prefix, String value) {
- CoreNamespaceDeclaration decl =
nodeFactory.createNamespaceDeclaration();
+ CoreNamespaceDeclaration decl =
nodeFactory.createNode(CoreNamespaceDeclaration.class);
decl.coreSetDeclaredNamespace(name, value);
return decl;
}
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=1700168&r1=1700167&r2=1700168&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
Sun Aug 30 22:12:44 2015
@@ -19,17 +19,5 @@
package org.apache.axiom.core;
public interface NodeFactory {
- CoreDocument createDocument();
- CoreDocumentTypeDeclaration createDocumentTypeDeclaration();
- CoreCharacterDataNode createCharacterDataNode();
- CoreCDATASection createCDATASection();
- CoreNSUnawareElement createNSUnawareElement();
- <T extends CoreNSAwareElement> T createNSAwareElement(Class<T> type);
- CoreNSUnawareAttribute createNSUnawareAttribute();
- CoreNSAwareAttribute createNSAwareAttribute();
- CoreNamespaceDeclaration createNamespaceDeclaration();
- CoreProcessingInstruction createProcessingInstruction();
- CoreEntityReference createEntityReference();
- CoreComment createComment();
- CoreDocumentFragment createDocumentFragment();
+ <T extends CoreNode> T createNode(Class<T> type);
}
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=1700168&r1=1700167&r2=1700168&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
Sun Aug 30 22:12:44 2015
@@ -137,21 +137,21 @@ public aspect DOMDocumentSupport {
}
public final Text DOMDocument.createTextNode(String data) {
- DOMText text = (DOMText)coreGetNodeFactory().createCharacterDataNode();
+ DOMText text = coreGetNodeFactory().createNode(DOMText.class);
text.coreSetOwnerDocument(this);
text.coreSetCharacterData(data);
return text;
}
public final CDATASection DOMDocument.createCDATASection(String data) {
- DOMCDATASection cdataSection =
(DOMCDATASection)coreGetNodeFactory().createCDATASection();
+ DOMCDATASection cdataSection =
coreGetNodeFactory().createNode(DOMCDATASection.class);
cdataSection.coreSetOwnerDocument(this);
cdataSection.coreSetCharacterData(data, Policies.DETACH_POLICY);
return cdataSection;
}
public final Element DOMDocument.createElement(String tagName) {
- DOMNSUnawareElement element =
(DOMNSUnawareElement)coreGetNodeFactory().createNSUnawareElement();
+ DOMNSUnawareElement element =
coreGetNodeFactory().createNode(DOMNSUnawareElement.class);
element.coreSetOwnerDocument(this);
element.coreSetName(tagName);
return element;
@@ -159,7 +159,7 @@ public aspect DOMDocumentSupport {
public final Attr DOMDocument.createAttribute(String name) {
NSUtil.validateName(name);
- DOMNSUnawareAttribute attr =
(DOMNSUnawareAttribute)coreGetNodeFactory().createNSUnawareAttribute();
+ DOMNSUnawareAttribute attr =
coreGetNodeFactory().createNode(DOMNSUnawareAttribute.class);
attr.coreSetOwnerDocument(this);
attr.coreSetName(name);
attr.coreSetType("CDATA");
@@ -179,7 +179,7 @@ public aspect DOMDocumentSupport {
}
namespaceURI = NSUtil.normalizeNamespaceURI(namespaceURI);
NSUtil.validateNamespace(namespaceURI, prefix);
- DOMNSAwareElement element =
coreGetNodeFactory().createNSAwareElement(DOMNSAwareElement.class);
+ DOMNSAwareElement element =
coreGetNodeFactory().createNode(DOMNSAwareElement.class);
element.coreSetOwnerDocument(this);
element.coreSetName(namespaceURI, localName, prefix);
return element;
@@ -197,14 +197,14 @@ public aspect DOMDocumentSupport {
localName = qualifiedName.substring(i+1);
}
if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
- DOMNamespaceDeclaration decl =
(DOMNamespaceDeclaration)coreGetNodeFactory().createNamespaceDeclaration();
+ DOMNamespaceDeclaration decl =
coreGetNodeFactory().createNode(DOMNamespaceDeclaration.class);
decl.coreSetOwnerDocument(this);
decl.coreSetDeclaredNamespace(NSUtil.getDeclaredPrefix(localName,
prefix), "");
return decl;
} else {
namespaceURI = NSUtil.normalizeNamespaceURI(namespaceURI);
NSUtil.validateAttributeName(namespaceURI, localName, prefix);
- DOMNSAwareAttribute attr =
(DOMNSAwareAttribute)coreGetNodeFactory().createNSAwareAttribute();
+ DOMNSAwareAttribute attr =
coreGetNodeFactory().createNode(DOMNSAwareAttribute.class);
attr.coreSetOwnerDocument(this);
attr.coreSetName(namespaceURI, localName, prefix);
// TODO: set type?
@@ -213,7 +213,7 @@ public aspect DOMDocumentSupport {
}
public final ProcessingInstruction
DOMDocument.createProcessingInstruction(String target, String data) {
- DOMProcessingInstruction pi =
(DOMProcessingInstruction)coreGetNodeFactory().createProcessingInstruction();
+ DOMProcessingInstruction pi =
coreGetNodeFactory().createNode(DOMProcessingInstruction.class);
pi.coreSetOwnerDocument(this);
pi.coreSetTarget(target);
pi.coreSetCharacterData(data, Policies.DETACH_POLICY);
@@ -221,21 +221,21 @@ public aspect DOMDocumentSupport {
}
public final EntityReference DOMDocument.createEntityReference(String
name) throws DOMException {
- DOMEntityReference node =
(DOMEntityReference)coreGetNodeFactory().createEntityReference();
+ DOMEntityReference node =
coreGetNodeFactory().createNode(DOMEntityReference.class);
node.coreSetOwnerDocument(this);
node.coreSetName(name);
return node;
}
public final Comment DOMDocument.createComment(String data) {
- DOMComment node = (DOMComment)coreGetNodeFactory().createComment();
+ DOMComment node = coreGetNodeFactory().createNode(DOMComment.class);
node.coreSetOwnerDocument(this);
node.coreSetCharacterData(data, Policies.DETACH_POLICY);
return node;
}
public final DocumentFragment DOMDocument.createDocumentFragment() {
- DOMDocumentFragment fragment =
(DOMDocumentFragment)coreGetNodeFactory().createDocumentFragment();
+ DOMDocumentFragment fragment =
coreGetNodeFactory().createNode(DOMDocumentFragment.class);
fragment.coreSetOwnerDocument(this);
return fragment;
}
@@ -275,7 +275,7 @@ public aspect DOMDocumentSupport {
return node;
case NS_AWARE_ATTRIBUTE_NODE:
if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
- DOMNamespaceDeclaration decl =
(DOMNamespaceDeclaration)coreGetNodeFactory().createNamespaceDeclaration();
+ DOMNamespaceDeclaration decl =
coreGetNodeFactory().createNode(DOMNamespaceDeclaration.class);
decl.coreSetOwnerDocument(this);
// TODO: we should have a generic method to move the
content over to the new node
decl.coreSetDeclaredNamespace(NSUtil.getDeclaredPrefix(localName, prefix),
((DOMNSAwareAttribute)node).getValue());
Modified:
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMNodeFactorySupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMNodeFactorySupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMNodeFactorySupport.aj
(original)
+++
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMNodeFactorySupport.aj
Sun Aug 30 22:12:44 2015
@@ -34,7 +34,7 @@ public aspect DOMNodeFactorySupport {
DocumentType doctype) throws DOMException {
// TODO Handle docType stuff
- Document doc = (Document)createDocument();
+ DOMDocument doc = createNode(DOMDocument.class);
Element element = doc.createElementNS(namespaceURI, qualifiedName);
doc.appendChild(element);
Modified:
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMTextNodeSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMTextNodeSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMTextNodeSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMTextNodeSupport.aj
Sun Aug 30 22:12:44 2015
@@ -72,7 +72,7 @@ public aspect DOMTextNodeSupport {
public final Text DOMTextNode.replaceWholeText(String content) throws
DOMException {
DOMText newText;
if (content.length() > 0) {
- newText = (DOMText)coreGetNodeFactory().createCharacterDataNode();
+ newText = coreGetNodeFactory().createNode(DOMText.class);
newText.coreSetCharacterData(content);
} else {
newText = null;
Modified:
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java
(original)
+++
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java
Sun Aug 30 22:12:44 2015
@@ -72,7 +72,7 @@ public final class Policies {
}
public CoreAttribute createAttribute(NodeFactory nodeFactory, String
namespaceURI, String name, String prefix, String value) {
- CoreNSUnawareAttribute attr =
nodeFactory.createNSUnawareAttribute();
+ CoreNSUnawareAttribute attr =
nodeFactory.createNode(CoreNSUnawareAttribute.class);
attr.coreSetName(name);
attr.coreSetCharacterData(value, null);
// TODO: set type?
Modified:
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
(original)
+++
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
Sun Aug 30 22:12:44 2015
@@ -364,7 +364,7 @@ public aspect AxiomElementSupport {
public final OMNamespace AxiomElement.addNamespaceDeclaration(String uri,
String prefix) {
OMNamespace ns = new OMNamespaceImpl(uri, prefix);
- AxiomNamespaceDeclaration decl =
(AxiomNamespaceDeclaration)coreGetNodeFactory().createNamespaceDeclaration();
+ AxiomNamespaceDeclaration decl =
coreGetNodeFactory().createNode(AxiomNamespaceDeclaration.class);
decl.setDeclaredNamespace(ns);
try {
coreAppendAttribute(decl, NodeMigrationPolicy.MOVE_ALWAYS);
@@ -375,7 +375,7 @@ public aspect AxiomElementSupport {
}
public final void AxiomElement.addNamespaceDeclaration(OMNamespace ns) {
- AxiomNamespaceDeclaration decl =
(AxiomNamespaceDeclaration)coreGetNodeFactory().createNamespaceDeclaration();
+ AxiomNamespaceDeclaration decl =
coreGetNodeFactory().createNode(AxiomNamespaceDeclaration.class);
decl.setDeclaredNamespace(ns);
try {
coreSetAttribute(Policies.NAMESPACE_DECLARATION_MATCHER, decl,
@@ -562,7 +562,7 @@ public aspect AxiomElementSupport {
}
public final AxiomElement
AxiomElement.shallowCloneWithoutAttributes(OMCloneOptions options,
CoreParentNode targetParent, boolean namespaceRepairing) {
- AxiomElement clone =
coreGetNodeFactory().createNSAwareElement(options.isPreserveModel() ?
getElementType() : AxiomElement.class);
+ AxiomElement clone =
coreGetNodeFactory().createNode(options.isPreserveModel() ? getElementType() :
AxiomElement.class);
if (targetParent != null) {
targetParent.coreAppendChild(clone, false);
}
Modified:
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=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj
(original)
+++
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj
Sun Aug 30 22:12:44 2015
@@ -53,11 +53,11 @@ import org.apache.axiom.om.impl.util.OMS
public aspect AxiomNodeFactorySupport {
public final OMDocument AxiomNodeFactory.createOMDocument() {
- return (AxiomDocument)createDocument();
+ return createNode(AxiomDocument.class);
}
public final OMDocument
AxiomNodeFactory.createOMDocument(OMXMLParserWrapper builder) {
- AxiomDocument document = (AxiomDocument)createDocument();
+ AxiomDocument document = createNode(AxiomDocument.class);
document.coreSetBuilder(builder);
return document;
}
@@ -69,7 +69,7 @@ public aspect AxiomNodeFactorySupport {
public final OMDocType AxiomNodeFactory.createOMDocType(OMContainer
parent, String rootName,
String publicId, String systemId, String internalSubset, boolean
fromBuilder) {
- AxiomDocType node = (AxiomDocType)createDocumentTypeDeclaration();
+ AxiomDocType node = createNode(AxiomDocType.class);
node.coreSetRootName(rootName);
node.coreSetPublicId(publicId);
node.coreSetSystemId(systemId);
@@ -87,17 +87,17 @@ public aspect AxiomNodeFactorySupport {
AxiomText node;
switch (type) {
case OMNode.TEXT_NODE: {
- node = (AxiomCharacterDataNode)createCharacterDataNode();
+ node = createNode(AxiomCharacterDataNode.class);
break;
}
case OMNode.SPACE_NODE: {
- AxiomCharacterDataNode cdata =
(AxiomCharacterDataNode)createCharacterDataNode();
+ AxiomCharacterDataNode cdata =
createNode(AxiomCharacterDataNode.class);
cdata.coreSetIgnorable(true);
node = cdata;
break;
}
case OMNode.CDATA_SECTION_NODE: {
- node = (AxiomCDATASection)createCDATASection();
+ node = createNode(AxiomCDATASection.class);
break;
}
default:
@@ -179,7 +179,7 @@ public aspect AxiomNodeFactorySupport {
public final OMProcessingInstruction
AxiomNodeFactory.createOMProcessingInstruction(
OMContainer parent, String piTarget, String piData, boolean
fromBuilder) {
- AxiomProcessingInstruction node =
(AxiomProcessingInstruction)createProcessingInstruction();
+ AxiomProcessingInstruction node =
createNode(AxiomProcessingInstruction.class);
node.coreSetTarget(piTarget);
node.coreSetCharacterData(piData, Policies.DETACH_POLICY);
if (parent != null) {
@@ -193,7 +193,7 @@ public aspect AxiomNodeFactorySupport {
}
public final OMEntityReference
AxiomNodeFactory.createOMEntityReference(OMContainer parent, String name,
String replacementText, boolean fromBuilder) {
- AxiomEntityReference node =
(AxiomEntityReference)createEntityReference();
+ AxiomEntityReference node = createNode(AxiomEntityReference.class);
node.coreSetName(name);
node.coreSetReplacementText(replacementText);
if (parent != null) {
@@ -207,7 +207,7 @@ public aspect AxiomNodeFactorySupport {
}
public final OMComment AxiomNodeFactory.createOMComment(OMContainer
parent, String content, boolean fromBuilder) {
- AxiomComment node = (AxiomComment)createComment();
+ AxiomComment node = createNode(AxiomComment.class);
node.coreSetCharacterData(content, Policies.DETACH_POLICY);
if (parent != null) {
((OMContainerEx)parent).addChild(node, fromBuilder);
@@ -222,7 +222,7 @@ public aspect AxiomNodeFactorySupport {
public final <T extends AxiomElement> T
AxiomNodeFactory.createAxiomElement(Class<T> type,
OMContainer parent, String localName, OMNamespace ns,
OMXMLParserWrapper builder,
boolean generateNSDecl) {
- T element = createNSAwareElement(type);
+ T element = createNode(type);
element.coreSetBuilder(builder);
if (parent != null) {
((AxiomContainer)parent).addChild(element, builder != null);
@@ -241,7 +241,7 @@ public aspect AxiomNodeFactorySupport {
}
public final OMElement AxiomNodeFactory.createOMElement(QName qname,
OMContainer parent) {
- AxiomElement element = createNSAwareElement(AxiomElement.class);
+ AxiomElement element = createNode(AxiomElement.class);
if (parent != null) {
parent.addChild(element);
}
@@ -295,7 +295,7 @@ public aspect AxiomNodeFactorySupport {
throw new IllegalArgumentException("Cannot create an
unprefixed attribute with a namespace");
}
}
- AxiomAttribute attr = (AxiomAttribute)createNSAwareAttribute();
+ AxiomAttribute attr = createNode(AxiomAttribute.class);
attr.internalSetLocalName(localName);
attr.coreSetCharacterData(value, Policies.DETACH_POLICY);
attr.internalSetNamespace(ns);
Modified:
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAPFactorySupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAPFactorySupport.aj?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAPFactorySupport.aj
(original)
+++
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAPFactorySupport.aj
Sun Aug 30 22:12:44 2015
@@ -38,7 +38,7 @@ import org.apache.axiom.soap.SOAPMessage
public aspect AxiomSOAPFactorySupport {
public final <T extends AxiomSOAPElement> T
AxiomSOAPFactory.createSOAPElement(Class<T> type, OMElement parent, QName
qname, OMXMLParserWrapper builder) {
- T element = createNSAwareElement(type);
+ T element = createNode(type);
if (builder != null) {
element.coreSetBuilder(builder);
} else if (parent != null) {
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=1700168&r1=1700167&r2=1700168&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
Sun Aug 30 22:12:44 2015
@@ -33,9 +33,22 @@ import org.apache.axiom.core.CoreNSAware
import org.apache.axiom.core.CoreNSUnawareAttribute;
import org.apache.axiom.core.CoreNSUnawareElement;
import org.apache.axiom.core.CoreNamespaceDeclaration;
+import org.apache.axiom.core.CoreNode;
import org.apache.axiom.core.CoreProcessingInstruction;
+import org.apache.axiom.dom.DOMCDATASection;
+import org.apache.axiom.dom.DOMComment;
+import org.apache.axiom.dom.DOMDocument;
+import org.apache.axiom.dom.DOMDocumentFragment;
+import org.apache.axiom.dom.DOMDocumentType;
+import org.apache.axiom.dom.DOMEntityReference;
+import org.apache.axiom.dom.DOMNSAwareAttribute;
import org.apache.axiom.dom.DOMNSAwareElement;
+import org.apache.axiom.dom.DOMNSUnawareAttribute;
+import org.apache.axiom.dom.DOMNSUnawareElement;
+import org.apache.axiom.dom.DOMNamespaceDeclaration;
import org.apache.axiom.dom.DOMNodeFactory;
+import org.apache.axiom.dom.DOMProcessingInstruction;
+import org.apache.axiom.dom.DOMText;
import org.apache.axiom.om.OMComment;
import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMDataSource;
@@ -49,7 +62,16 @@ import org.apache.axiom.om.OMProcessingI
import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.common.AxiomAttribute;
+import org.apache.axiom.om.impl.common.AxiomCDATASection;
+import org.apache.axiom.om.impl.common.AxiomCharacterDataNode;
+import org.apache.axiom.om.impl.common.AxiomComment;
+import org.apache.axiom.om.impl.common.AxiomDocType;
+import org.apache.axiom.om.impl.common.AxiomDocument;
import org.apache.axiom.om.impl.common.AxiomElement;
+import org.apache.axiom.om.impl.common.AxiomEntityReference;
+import org.apache.axiom.om.impl.common.AxiomNamespaceDeclaration;
+import org.apache.axiom.om.impl.common.AxiomProcessingInstruction;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
import org.apache.axiom.om.impl.common.factory.AxiomNodeFactory;
import org.apache.axiom.om.impl.dom.CDATASectionImpl;
@@ -230,103 +252,79 @@ public class OMDOMFactory implements Axi
}
}
- public final CoreDocument createDocument() {
- return new DocumentImpl(this);
- }
-
- public final CoreDocumentTypeDeclaration createDocumentTypeDeclaration() {
- return new DocumentTypeImpl(this);
- }
-
- public final CoreCharacterDataNode createCharacterDataNode() {
- return new TextImpl(this);
- }
-
- public CoreCDATASection createCDATASection() {
- return new CDATASectionImpl(this);
- }
-
- public final <T extends CoreNSAwareElement> T
createNSAwareElement(Class<T> type) {
- CoreNSAwareElement element;
- if (type == AxiomElement.class || type == DOMNSAwareElement.class) {
- element = new NSAwareElement(this);
+ public final <T extends CoreNode> T createNode(Class<T> type) {
+ CoreNode node;
+ if (type == CoreCDATASection.class || type == AxiomCDATASection.class
|| type == DOMCDATASection.class) {
+ node = new CDATASectionImpl(this);
+ } else if (type == CoreCharacterDataNode.class || type ==
AxiomCharacterDataNode.class || type == DOMText.class) {
+ node = new TextImpl(this);
+ } else if (type == CoreComment.class || type == AxiomComment.class ||
type == DOMComment.class) {
+ node = new CommentImpl(this);
+ } else if (type == CoreDocument.class || type == AxiomDocument.class
|| type == DOMDocument.class) {
+ node = new DocumentImpl(this);
+ } else if (type == CoreDocumentFragment.class || type ==
DOMDocumentFragment.class) {
+ node = new DocumentFragmentImpl(this);
+ } else if (type == CoreDocumentTypeDeclaration.class || type ==
AxiomDocType.class || type == DOMDocumentType.class) {
+ node = new DocumentTypeImpl(this);
+ } else if (type == CoreEntityReference.class || type ==
AxiomEntityReference.class || type == DOMEntityReference.class) {
+ node = new EntityReferenceImpl(this);
+ } else if (type == CoreNamespaceDeclaration.class || type ==
AxiomNamespaceDeclaration.class || type == DOMNamespaceDeclaration.class) {
+ node = new NamespaceDeclaration(this);
+ } else if (type == CoreNSAwareAttribute.class || type ==
AxiomAttribute.class || type == DOMNSAwareAttribute.class) {
+ node = new NSAwareAttribute(this);
+ } else if (type == CoreNSAwareElement.class || type ==
AxiomElement.class || type == DOMNSAwareElement.class) {
+ node = new NSAwareElement(this);
+ } else if (type == CoreNSUnawareAttribute.class || type ==
DOMNSUnawareAttribute.class) {
+ node = new NSUnawareAttribute(this);
+ } else if (type == CoreNSUnawareElement.class || type ==
DOMNSUnawareElement.class) {
+ node = new NSUnawareElement(this);
+ } else if (type == CoreProcessingInstruction.class || type ==
AxiomProcessingInstruction.class || type == DOMProcessingInstruction.class) {
+ node = new ProcessingInstructionImpl(this);
} else if (type == AxiomSOAPEnvelope.class) {
- element = new SOAPEnvelopeImpl(this);
+ node = new SOAPEnvelopeImpl(this);
} else if (type == AxiomSOAP11Header.class) {
- element = new SOAP11HeaderImpl(this);
+ node = new SOAP11HeaderImpl(this);
} else if (type == AxiomSOAP12Header.class) {
- element = new SOAP12HeaderImpl(this);
+ node = new SOAP12HeaderImpl(this);
} else if (type == AxiomSOAP11HeaderBlock.class) {
- element = new SOAP11HeaderBlockImpl(this);
+ node = new SOAP11HeaderBlockImpl(this);
} else if (type == AxiomSOAP12HeaderBlock.class) {
- element = new SOAP12HeaderBlockImpl(this);
+ node = new SOAP12HeaderBlockImpl(this);
} else if (type == AxiomSOAP11Body.class) {
- element = new SOAP11BodyImpl(this);
+ node = new SOAP11BodyImpl(this);
} else if (type == AxiomSOAP12Body.class) {
- element = new SOAP12BodyImpl(this);
+ node = new SOAP12BodyImpl(this);
} else if (type == AxiomSOAP11Fault.class) {
- element = new SOAP11FaultImpl(this);
+ node = new SOAP11FaultImpl(this);
} else if (type == AxiomSOAP12Fault.class) {
- element = new SOAP12FaultImpl(this);
+ node = new SOAP12FaultImpl(this);
} else if (type == AxiomSOAP11FaultCode.class) {
- element = new SOAP11FaultCodeImpl(this);
+ node = new SOAP11FaultCodeImpl(this);
} else if (type == AxiomSOAP12FaultCode.class) {
- element = new SOAP12FaultCodeImpl(this);
+ node = new SOAP12FaultCodeImpl(this);
} else if (type == AxiomSOAP12FaultValue.class) {
- element = new SOAP12FaultValueImpl(this);
+ node = new SOAP12FaultValueImpl(this);
} else if (type == AxiomSOAP12FaultSubCode.class) {
- element = new SOAP12FaultSubCodeImpl(this);
+ node = new SOAP12FaultSubCodeImpl(this);
} else if (type == AxiomSOAP11FaultReason.class) {
- element = new SOAP11FaultReasonImpl(this);
+ node = new SOAP11FaultReasonImpl(this);
} else if (type == AxiomSOAP12FaultReason.class) {
- element = new SOAP12FaultReasonImpl(this);
+ node = new SOAP12FaultReasonImpl(this);
} else if (type == AxiomSOAP12FaultText.class) {
- element = new SOAP12FaultTextImpl(this);
+ node = new SOAP12FaultTextImpl(this);
} else if (type == AxiomSOAP12FaultNode.class) {
- element = new SOAP12FaultNodeImpl(this);
+ node = new SOAP12FaultNodeImpl(this);
} else if (type == AxiomSOAP11FaultRole.class) {
- element = new SOAP11FaultRoleImpl(this);
+ node = new SOAP11FaultRoleImpl(this);
} else if (type == AxiomSOAP12FaultRole.class) {
- element = new SOAP12FaultRoleImpl(this);
+ node = new SOAP12FaultRoleImpl(this);
} else if (type == AxiomSOAP11FaultDetail.class) {
- element = new SOAP11FaultDetailImpl(this);
+ node = new SOAP11FaultDetailImpl(this);
} else if (type == AxiomSOAP12FaultDetail.class) {
- element = new SOAP12FaultDetailImpl(this);
+ node = new SOAP12FaultDetailImpl(this);
} else {
throw new IllegalArgumentException();
}
- return type.cast(element);
- }
-
- public final CoreNSUnawareAttribute createNSUnawareAttribute() {
- return new NSUnawareAttribute(this);
- }
-
- public final CoreNSAwareAttribute createNSAwareAttribute() {
- return new NSAwareAttribute(this);
- }
-
- public final CoreNamespaceDeclaration createNamespaceDeclaration() {
- return new NamespaceDeclaration(this);
- }
-
- public final CoreProcessingInstruction createProcessingInstruction() {
- return new ProcessingInstructionImpl(this);
- }
-
- public final CoreEntityReference createEntityReference() {
- return new EntityReferenceImpl(this);
- }
-
- public final CoreComment createComment() {
- return new CommentImpl(this);
- }
-
- public final CoreNSUnawareElement createNSUnawareElement() {
- return new NSUnawareElement(this);
- }
-
- public final CoreDocumentFragment createDocumentFragment() {
- return new DocumentFragmentImpl(this);
+ return type.cast(node);
}
}
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=1700168&r1=1700167&r2=1700168&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
Sun Aug 30 22:12:44 2015
@@ -25,14 +25,12 @@ import org.apache.axiom.core.CoreCDATASe
import org.apache.axiom.core.CoreCharacterDataNode;
import org.apache.axiom.core.CoreComment;
import org.apache.axiom.core.CoreDocument;
-import org.apache.axiom.core.CoreDocumentFragment;
import org.apache.axiom.core.CoreDocumentTypeDeclaration;
import org.apache.axiom.core.CoreEntityReference;
import org.apache.axiom.core.CoreNSAwareAttribute;
import org.apache.axiom.core.CoreNSAwareElement;
-import org.apache.axiom.core.CoreNSUnawareAttribute;
-import org.apache.axiom.core.CoreNSUnawareElement;
import org.apache.axiom.core.CoreNamespaceDeclaration;
+import org.apache.axiom.core.CoreNode;
import org.apache.axiom.core.CoreProcessingInstruction;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMComment;
@@ -46,7 +44,16 @@ import org.apache.axiom.om.OMProcessingI
import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.common.AxiomAttribute;
+import org.apache.axiom.om.impl.common.AxiomCDATASection;
+import org.apache.axiom.om.impl.common.AxiomCharacterDataNode;
+import org.apache.axiom.om.impl.common.AxiomComment;
+import org.apache.axiom.om.impl.common.AxiomDocType;
+import org.apache.axiom.om.impl.common.AxiomDocument;
import org.apache.axiom.om.impl.common.AxiomElement;
+import org.apache.axiom.om.impl.common.AxiomEntityReference;
+import org.apache.axiom.om.impl.common.AxiomNamespaceDeclaration;
+import org.apache.axiom.om.impl.common.AxiomProcessingInstruction;
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;
@@ -233,104 +240,73 @@ public class OMLinkedListImplFactory imp
}
}
- public CoreDocument createDocument() {
- return new OMDocumentImpl(this);
- }
-
- public CoreDocumentTypeDeclaration createDocumentTypeDeclaration() {
- return new OMDocTypeImpl(this);
- }
-
- public CoreCharacterDataNode createCharacterDataNode() {
- return new CharacterDataImpl(this);
- }
-
- public CoreCDATASection createCDATASection() {
- return new CDATASectionImpl(this);
- }
-
- public <T extends CoreNSAwareElement> T createNSAwareElement(Class<T>
type) {
- CoreNSAwareElement element;
- if (type == AxiomElement.class) {
- element = new OMElementImpl(this);
+ public <T extends CoreNode> T createNode(Class<T> type) {
+ CoreNode node;
+ if (type == CoreCDATASection.class || type == AxiomCDATASection.class)
{
+ node = new CDATASectionImpl(this);
+ } else if (type == CoreCharacterDataNode.class || type ==
AxiomCharacterDataNode.class) {
+ node = new CharacterDataImpl(this);
+ } else if (type == CoreComment.class || type == AxiomComment.class) {
+ node = new OMCommentImpl(this);
+ } else if (type == CoreDocument.class || type == AxiomDocument.class) {
+ node = new OMDocumentImpl(this);
+ } else if (type == CoreDocumentTypeDeclaration.class || type ==
AxiomDocType.class) {
+ node = new OMDocTypeImpl(this);
+ } else if (type == CoreEntityReference.class || type ==
AxiomEntityReference.class) {
+ node = new OMEntityReferenceImpl(this);
+ } else if (type == CoreNamespaceDeclaration.class || type ==
AxiomNamespaceDeclaration.class) {
+ node = new NamespaceDeclaration(this);
+ } else if (type == CoreNSAwareAttribute.class || type ==
AxiomAttribute.class) {
+ node = new OMAttributeImpl(this);
+ } else if (type == CoreNSAwareElement.class || type ==
AxiomElement.class) {
+ node = new OMElementImpl(this);
+ } else if (type == CoreProcessingInstruction.class || type ==
AxiomProcessingInstruction.class) {
+ node = new OMProcessingInstructionImpl(this);
} else if (type == AxiomSOAPEnvelope.class) {
- element = new SOAPEnvelopeImpl(this);
+ node = new SOAPEnvelopeImpl(this);
} else if (type == AxiomSOAP11Header.class) {
- element = new SOAP11HeaderImpl(this);
+ node = new SOAP11HeaderImpl(this);
} else if (type == AxiomSOAP12Header.class) {
- element = new SOAP12HeaderImpl(this);
+ node = new SOAP12HeaderImpl(this);
} else if (type == AxiomSOAP11HeaderBlock.class) {
- element = new SOAP11HeaderBlockImpl(this);
+ node = new SOAP11HeaderBlockImpl(this);
} else if (type == AxiomSOAP12HeaderBlock.class) {
- element = new SOAP12HeaderBlockImpl(this);
+ node = new SOAP12HeaderBlockImpl(this);
} else if (type == AxiomSOAP11Body.class) {
- element = new SOAP11BodyImpl(this);
+ node = new SOAP11BodyImpl(this);
} else if (type == AxiomSOAP12Body.class) {
- element = new SOAP12BodyImpl(this);
+ node = new SOAP12BodyImpl(this);
} else if (type == AxiomSOAP11Fault.class) {
- element = new SOAP11FaultImpl(this);
+ node = new SOAP11FaultImpl(this);
} else if (type == AxiomSOAP12Fault.class) {
- element = new SOAP12FaultImpl(this);
+ node = new SOAP12FaultImpl(this);
} else if (type == AxiomSOAP11FaultCode.class) {
- element = new SOAP11FaultCodeImpl(this);
+ node = new SOAP11FaultCodeImpl(this);
} else if (type == AxiomSOAP12FaultCode.class) {
- element = new SOAP12FaultCodeImpl(this);
+ node = new SOAP12FaultCodeImpl(this);
} else if (type == AxiomSOAP12FaultValue.class) {
- element = new SOAP12FaultValueImpl(this);
+ node = new SOAP12FaultValueImpl(this);
} else if (type == AxiomSOAP12FaultSubCode.class) {
- element = new SOAP12FaultSubCodeImpl(this);
+ node = new SOAP12FaultSubCodeImpl(this);
} else if (type == AxiomSOAP11FaultReason.class) {
- element = new SOAP11FaultReasonImpl(this);
+ node = new SOAP11FaultReasonImpl(this);
} else if (type == AxiomSOAP12FaultReason.class) {
- element = new SOAP12FaultReasonImpl(this);
+ node = new SOAP12FaultReasonImpl(this);
} else if (type == AxiomSOAP12FaultText.class) {
- element = new SOAP12FaultTextImpl(this);
+ node = new SOAP12FaultTextImpl(this);
} else if (type == AxiomSOAP12FaultNode.class) {
- element = new SOAP12FaultNodeImpl(this);
+ node = new SOAP12FaultNodeImpl(this);
} else if (type == AxiomSOAP11FaultRole.class) {
- element = new SOAP11FaultRoleImpl(this);
+ node = new SOAP11FaultRoleImpl(this);
} else if (type == AxiomSOAP12FaultRole.class) {
- element = new SOAP12FaultRoleImpl(this);
+ node = new SOAP12FaultRoleImpl(this);
} else if (type == AxiomSOAP11FaultDetail.class) {
- element = new SOAP11FaultDetailImpl(this);
+ node = new SOAP11FaultDetailImpl(this);
} else if (type == AxiomSOAP12FaultDetail.class) {
- element = new SOAP12FaultDetailImpl(this);
+ node = new SOAP12FaultDetailImpl(this);
} else {
throw new IllegalArgumentException();
}
- return type.cast(element);
- }
-
- public CoreNSUnawareAttribute createNSUnawareAttribute() {
- // TODO
- throw new UnsupportedOperationException();
- }
-
- public CoreNSAwareAttribute createNSAwareAttribute() {
- return new OMAttributeImpl(this);
- }
-
- public final CoreNamespaceDeclaration createNamespaceDeclaration() {
- return new NamespaceDeclaration(this);
- }
-
- public CoreProcessingInstruction createProcessingInstruction() {
- return new OMProcessingInstructionImpl(this);
- }
-
- public final CoreEntityReference createEntityReference() {
- return new OMEntityReferenceImpl(this);
- }
-
- public CoreComment createComment() {
- return new OMCommentImpl(this);
- }
-
- public final CoreNSUnawareElement createNSUnawareElement() {
- throw new UnsupportedOperationException();
- }
-
- public final CoreDocumentFragment createDocumentFragment() {
- throw new UnsupportedOperationException();
+ return type.cast(node);
}
}
Modified:
webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?rev=1700168&r1=1700167&r2=1700168&view=diff
==============================================================================
---
webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
(original)
+++
webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
Sun Aug 30 22:12:44 2015
@@ -60,15 +60,31 @@ import org.apache.axiom.core.CoreCDATASe
import org.apache.axiom.core.CoreCharacterDataNode;
import org.apache.axiom.core.CoreComment;
import org.apache.axiom.core.CoreDocument;
+import org.apache.axiom.core.CoreDocumentTypeDeclaration;
+import org.apache.axiom.core.CoreEntityReference;
import org.apache.axiom.core.CoreNSAwareAttribute;
import org.apache.axiom.core.CoreNSAwareElement;
+import org.apache.axiom.core.CoreNamespaceDeclaration;
+import org.apache.axiom.core.CoreNode;
import org.apache.axiom.core.CoreProcessingInstruction;
import org.apache.axiom.fom.AbderaFactory;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.impl.common.AxiomAttribute;
+import org.apache.axiom.om.impl.common.AxiomCDATASection;
+import org.apache.axiom.om.impl.common.AxiomCharacterDataNode;
+import org.apache.axiom.om.impl.common.AxiomComment;
+import org.apache.axiom.om.impl.common.AxiomDocType;
+import org.apache.axiom.om.impl.common.AxiomDocument;
import org.apache.axiom.om.impl.common.AxiomElement;
+import org.apache.axiom.om.impl.common.AxiomEntityReference;
+import org.apache.axiom.om.impl.common.AxiomNamespaceDeclaration;
+import org.apache.axiom.om.impl.common.AxiomProcessingInstruction;
+import org.apache.axiom.om.impl.llom.NamespaceDeclaration;
+import org.apache.axiom.om.impl.llom.OMDocTypeImpl;
+import org.apache.axiom.om.impl.llom.OMEntityReferenceImpl;
import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;
@SuppressWarnings( {"unchecked", "deprecation"})
@@ -139,11 +155,6 @@ public class FOMFactory extends OMLinked
return new FOMDocument(this);
}
- @Override
- public CoreDocument createDocument() {
- return new FOMDocument(this);
- }
-
public Service newService(Base parent) {
return createElement(FOMService.class, SERVICE, (OMContainer)parent);
}
@@ -477,56 +488,74 @@ public class FOMFactory extends OMLinked
}
@Override
- public <T extends CoreNSAwareElement> T createNSAwareElement(Class<T>
type) {
- CoreNSAwareElement element;
- if (type == AxiomElement.class || type == FOMElement.class) {
- element = new FOMElement(this);
+ public <T extends CoreNode> T createNode(Class<T> type) {
+ CoreNode node;
+ if (type == CoreCDATASection.class || type == AxiomCDATASection.class
|| type == FOMCDATASection.class) {
+ node = new FOMCDATASection(this);
+ } else if (type == CoreCharacterDataNode.class || type ==
AxiomCharacterDataNode.class || type == FOMCharacterDataNode.class) {
+ node = new FOMCharacterDataNode(this);
+ } else if (type == CoreComment.class || type == AxiomComment.class ||
type == FOMComment.class) {
+ node = new FOMComment(this);
+ } else if (type == CoreDocument.class || type == AxiomDocument.class
|| type == FOMDocument.class) {
+ node = new FOMDocument(this);
+ } else if (type == CoreDocumentTypeDeclaration.class || type ==
AxiomDocType.class) {
+ node = new OMDocTypeImpl(this);
+ } else if (type == CoreEntityReference.class || type ==
AxiomEntityReference.class) {
+ node = new OMEntityReferenceImpl(this);
+ } else if (type == CoreNamespaceDeclaration.class || type ==
AxiomNamespaceDeclaration.class) {
+ node = new NamespaceDeclaration(this);
+ } else if (type == CoreNSAwareAttribute.class || type ==
AxiomAttribute.class || type == FOMAttribute.class) {
+ node = new FOMAttribute(this);
+ } else if (type == CoreNSAwareElement.class || type ==
AxiomElement.class || type == FOMElement.class) {
+ node = new FOMElement(this);
+ } else if (type == CoreProcessingInstruction.class || type ==
AxiomProcessingInstruction.class || type == FOMProcessingInstruction.class) {
+ node = new FOMProcessingInstruction(this);
} else if (type == FOMCategories.class) {
- element = new FOMCategories(this);
+ node = new FOMCategories(this);
} else if (type == FOMCategory.class) {
- element = new FOMCategory(this);
+ node = new FOMCategory(this);
} else if (type == FOMCollection.class) {
- element = new FOMCollection(this);
+ node = new FOMCollection(this);
} else if (type == FOMContent.class) {
- element = new FOMContent(this);
+ node = new FOMContent(this);
} else if (type == FOMControl.class) {
- element = new FOMControl(this);
+ node = new FOMControl(this);
} else if (type == FOMDateTime.class) {
- element = new FOMDateTime(this);
+ node = new FOMDateTime(this);
} else if (type == FOMDiv.class) {
- element = new FOMDiv(this);
+ node = new FOMDiv(this);
} else if (type == FOMEntry.class) {
- element = new FOMEntry(this);
+ node = new FOMEntry(this);
} else if (type == FOMExtensibleElement.class) {
- element = new FOMExtensibleElement(this);
+ node = new FOMExtensibleElement(this);
} else if (type == FOMFeed.class) {
- element = new FOMFeed(this);
+ node = new FOMFeed(this);
} else if (type == FOMGenerator.class) {
- element = new FOMGenerator(this);
+ node = new FOMGenerator(this);
} else if (type == FOMIRI.class) {
- element = new FOMIRI(this);
+ node = new FOMIRI(this);
} else if (type == FOMLink.class) {
- element = new FOMLink(this);
+ node = new FOMLink(this);
} else if (type == FOMMultipartCollection.class) {
- element = new FOMMultipartCollection(this);
+ node = new FOMMultipartCollection(this);
} else if (type == FOMPerson.class) {
- element = new FOMPerson(this);
+ node = new FOMPerson(this);
} else if (type == FOMService.class) {
- element = new FOMService(this);
+ node = new FOMService(this);
} else if (type == FOMSource.class) {
- element = new FOMSource(this);
+ node = new FOMSource(this);
} else if (type == FOMText.class) {
- element = new FOMText(this);
+ node = new FOMText(this);
} else if (type == FOMWorkspace.class) {
- element = new FOMWorkspace(this);
+ node = new FOMWorkspace(this);
} else {
throw new IllegalArgumentException(type.getName() + " not
supported");
}
- return type.cast(element);
+ return type.cast(node);
}
private <T extends FOMElement> T createElement(Class<T> type, QName qname,
OMContainer parent) {
- T element = createNSAwareElement(type);
+ T element = createNode(type);
if (parent != null) {
parent.addChild(element);
}
@@ -630,29 +659,4 @@ public class FOMFactory extends OMLinked
public String[] listExtensionFactories() {
return factoriesMap.listExtensionFactories();
}
-
- @Override
- public CoreCharacterDataNode createCharacterDataNode() {
- return new FOMCharacterDataNode(this);
- }
-
- @Override
- public CoreCDATASection createCDATASection() {
- return new FOMCDATASection(this);
- }
-
- @Override
- public CoreProcessingInstruction createProcessingInstruction() {
- return new FOMProcessingInstruction(this);
- }
-
- @Override
- public CoreComment createComment() {
- return new FOMComment(this);
- }
-
- @Override
- public CoreNSAwareAttribute createNSAwareAttribute() {
- return new FOMAttribute(this);
- }
}