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/07/18 14:58:52 UTC

svn commit: r1691726 - 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/fom-aspects/src/main/java/org/apache/axiom/fom/ aspects/om-aspects/src/main/ja...

Author: veithen
Date: Sat Jul 18 12:58:51 2015
New Revision: 1691726

URL: http://svn.apache.org/r1691726
Log:
Transform the processing instruction code into aspects.

Added:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreProcessingInstructionSupport.aj   (with props)
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstruction.java   (with props)
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstructionSupport.aj   (with props)
    webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaProcessingInstructionSupport.aj   (with props)
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstructionSupport.aj   (with props)
Modified:
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java

Added: 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=1691726&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreProcessingInstructionSupport.aj (added)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreProcessingInstructionSupport.aj Sat Jul 18 12:58:51 2015
@@ -0,0 +1,40 @@
+/*
+ * 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.core;
+
+public aspect CoreProcessingInstructionSupport {
+    private String CoreProcessingInstruction.target;
+    private String CoreProcessingInstruction.value;
+
+    public final String CoreProcessingInstruction.coreGetTarget() {
+        return target;
+    }
+    
+    public final void CoreProcessingInstruction.coreSetTarget(String target) {
+        this.target = target;
+    }
+    
+    public final String CoreProcessingInstruction.coreGetValue() {
+        return value;
+    }
+    
+    public final void CoreProcessingInstruction.coreSetValue(String value) {
+        this.value = value;
+    }
+}

Propchange: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreProcessingInstructionSupport.aj
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstruction.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstruction.java?rev=1691726&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstruction.java (added)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstruction.java Sat Jul 18 12:58:51 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.dom;
+
+import org.apache.axiom.core.CoreProcessingInstruction;
+import org.w3c.dom.ProcessingInstruction;
+
+public interface DOMProcessingInstruction extends DOMChildNode, ProcessingInstruction, CoreProcessingInstruction {
+
+}

Propchange: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstruction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstructionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstructionSupport.aj?rev=1691726&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstructionSupport.aj (added)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstructionSupport.aj Sat Jul 18 12:58:51 2015
@@ -0,0 +1,45 @@
+/*
+ * 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.dom;
+
+public aspect DOMProcessingInstructionSupport {
+    public final short DOMProcessingInstruction.getNodeType() {
+        return PROCESSING_INSTRUCTION_NODE;
+    }
+
+    public final String DOMProcessingInstruction.getData() {
+        return coreGetValue();
+    }
+    
+    public final void DOMProcessingInstruction.setData(String data) {
+        coreSetValue(data);
+    }
+    
+    public final String DOMProcessingInstruction.getNodeName() {
+        return coreGetTarget();
+    }
+
+    public final String DOMProcessingInstruction.getNodeValue() {
+        return coreGetValue();
+    }
+
+    public final void DOMProcessingInstruction.setNodeValue(String nodeValue) {
+        coreSetValue(nodeValue);
+    }
+}

Propchange: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMProcessingInstructionSupport.aj
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaProcessingInstructionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaProcessingInstructionSupport.aj?rev=1691726&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaProcessingInstructionSupport.aj (added)
+++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaProcessingInstructionSupport.aj Sat Jul 18 12:58:51 2015
@@ -0,0 +1,33 @@
+/*
+ * 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.fom;
+
+import org.apache.abdera.model.ProcessingInstruction;
+
+public aspect AbderaProcessingInstructionSupport {
+    public final String AbderaProcessingInstruction.getText() {
+        return coreGetValue();
+    }
+
+    @SuppressWarnings("unchecked")
+    public final <T extends ProcessingInstruction> T AbderaProcessingInstruction.setText(String text) {
+        coreSetValue(text);
+        return (T)this;
+    }
+}

Propchange: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaProcessingInstructionSupport.aj
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstructionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstructionSupport.aj?rev=1691726&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstructionSupport.aj (added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstructionSupport.aj Sat Jul 18 12:58:51 2015
@@ -0,0 +1,49 @@
+/*
+ * 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;
+
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.impl.common.serializer.push.OutputException;
+import org.apache.axiom.om.impl.common.serializer.push.Serializer;
+
+public aspect AxiomProcessingInstructionSupport {
+    public final int AxiomProcessingInstruction.getType() {
+        return PI_NODE;
+    }
+
+    public final String AxiomProcessingInstruction.getTarget() {
+        return coreGetTarget();
+    }
+
+    public final void AxiomProcessingInstruction.setTarget(String target) {
+        coreSetTarget(target);
+    }
+
+    public final String AxiomProcessingInstruction.getValue() {
+        return coreGetValue();
+    }
+
+    public final void AxiomProcessingInstruction.setValue(String value) {
+        coreSetValue(value);
+    }
+    
+    public final void AxiomProcessingInstruction.internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache) throws OutputException {
+        serializer.writeProcessingInstruction(coreGetTarget() + " ", coreGetValue());
+    }
+}

Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstructionSupport.aj
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java?rev=1691726&r1=1691725&r2=1691726&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java Sat Jul 18 12:58:51 2015
@@ -19,76 +19,18 @@
 
 package org.apache.axiom.om.impl.dom;
 
+import org.apache.axiom.dom.DOMProcessingInstruction;
 import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.common.AxiomProcessingInstruction;
-import org.apache.axiom.om.impl.common.serializer.push.OutputException;
-import org.apache.axiom.om.impl.common.serializer.push.Serializer;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.ProcessingInstruction;
-
-public class ProcessingInstructionImpl extends LeafNode implements ProcessingInstruction, AxiomProcessingInstruction {
-    private String target;
-    private String value;
 
+public class ProcessingInstructionImpl extends LeafNode implements DOMProcessingInstruction, AxiomProcessingInstruction {
     public ProcessingInstructionImpl(String target, String value, OMFactory factory) {
-        
         super(factory);
-        this.target = target;
-        this.value = value;
-    }
-
-    public int getType() {
-        return OMNode.PI_NODE;
-    }
-
-    public short getNodeType() {
-        return Node.PROCESSING_INSTRUCTION_NODE;
-    }
-
-    public String getTarget() {
-        return target;
-    }
-
-    public void setTarget(String target) {
-        this.target = target;
-    }
-
-    public String getValue() {
-        return value;
-    }
-    
-    public void setValue(String text) {
-        this.value = text;
-    }
-    
-    public String getData() {
-        return value;
-    }
-    
-    public void setData(String data) throws DOMException {
-        value = data;
-    }
-    
-    public String getNodeName() {
-        return target;
-    }
-
-    public String getNodeValue() throws DOMException {
-        return value;
-    }
-
-    public void setNodeValue(String nodeValue) throws DOMException {
-        value = nodeValue;
-    }
-
-    public void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache) throws OutputException {
-        serializer.writeProcessingInstruction(target + " ", value);
+        coreSetTarget(target);
+        coreSetValue(value);
     }
 
     ChildNode createClone() {
-        return new ProcessingInstructionImpl(target, value, getOMFactory());
+        return new ProcessingInstructionImpl(coreGetTarget(), coreGetValue(), getOMFactory());
     }
 }

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java?rev=1691726&r1=1691725&r2=1691726&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java Sat Jul 18 12:58:51 2015
@@ -23,74 +23,17 @@ import org.apache.axiom.om.OMCloneOption
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.common.AxiomProcessingInstruction;
-import org.apache.axiom.om.impl.common.serializer.push.OutputException;
-import org.apache.axiom.om.impl.common.serializer.push.Serializer;
 
 public class OMProcessingInstructionImpl extends OMLeafNode implements AxiomProcessingInstruction {
-    protected String target;
-    protected String value;
-
-    /**
-     * Constructor OMProcessingInstructionImpl.
-     *
-     * @param parentNode
-     * @param target
-     * @param value
-     */
     public OMProcessingInstructionImpl(OMContainer parentNode, String target,
                                        String value, OMFactory factory, boolean fromBuilder) {
         super(parentNode, factory, fromBuilder);
-        this.target = target;
-        this.value = value;
-    }
-
-    public final int getType() {
-        return OMNode.PI_NODE;
-    }
-
-    public void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache) throws OutputException {
-        serializer.writeProcessingInstruction(this.target + " ", this.value);
-    }
-
-    /**
-     * Gets the value of this Processing Instruction.
-     *
-     * @return string
-     */
-    public String getValue() {
-        return value;
-    }
-
-    /**
-     * Sets the target of this Processing Instruction.
-     *
-     * @param target
-     */
-    public void setTarget(String target) {
-        this.target = target;
-    }
-
-    /**
-     * Gets the target of this Processing Instruction.
-     *
-     * @return Returns String.
-     */
-    public String getTarget() {
-        return target;
-    }
-
-    /**
-     * Sets the value of this Processing Instruction.
-     *
-     * @param text
-     */
-    public void setValue(String text) {
-        this.value = text;
+        coreSetTarget(target);
+        coreSetValue(value);
     }
 
     OMNode clone(OMCloneOptions options, OMContainer targetParent) {
-        return getOMFactory().createOMProcessingInstruction(targetParent, target, value);
+        return getOMFactory().createOMProcessingInstruction(targetParent, coreGetTarget(), coreGetValue());
     }
 }

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java?rev=1691726&r1=1691725&r2=1691726&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java (original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java Sat Jul 18 12:58:51 2015
@@ -31,15 +31,6 @@ public class FOMProcessingInstruction ex
         super(parent, target, value, factory, fromBuilder);
     }
 
-    public String getText() {
-        return getValue();
-    }
-
-    public <T extends ProcessingInstruction> T setText(String text) {
-        setValue(text);
-        return (T)this;
-    }
-
     public String toString() {
         java.io.CharArrayWriter w = new java.io.CharArrayWriter();
         try {
@@ -48,9 +39,4 @@ public class FOMProcessingInstruction ex
         }
         return w.toString();
     }
-
-    public void setTarget(String target) {
-        super.setTarget(target);
-    }
-
 }