abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1006114 - in /abdera/java/trunk: ./ parser/ parser/src/main/java/org/apache/abdera/parser/stax/
Date Sat, 09 Oct 2010 08:03:55 GMT
Author: antelder
Date: Sat Oct  9 08:03:55 2010
New Revision: 1006114

URL: http://svn.apache.org/viewvc?rev=1006114&view=rev
Log:
ABDERA-267: Apply patch from Andreas Veithen to use latest axiom to get fix for performance
issue. This is using the latest axiom snapshot so we can't release abdera till an axiom release
is done with the fix, hopefullt that wont be too long

Added:
    abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java
  (with props)
Modified:
    abdera/java/trunk/parser/pom.xml
    abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
    abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
    abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
    abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/StaxStreamWriter.java
    abdera/java/trunk/pom.xml

Modified: abdera/java/trunk/parser/pom.xml
URL: http://svn.apache.org/viewvc/abdera/java/trunk/parser/pom.xml?rev=1006114&r1=1006113&r2=1006114&view=diff
==============================================================================
--- abdera/java/trunk/parser/pom.xml (original)
+++ abdera/java/trunk/parser/pom.xml Sat Oct  9 08:03:55 2010
@@ -84,4 +84,13 @@
       <scope>runtime</scope>
     </dependency>
   </dependencies>
+    <repositories>
+        <repository>
+            <id>apache.snapshots</id>
+            <url>http://repository.apache.org/snapshots</url>
+           <snapshots>
+               <enabled>true</enabled>
+           </snapshots>
+        </repository>
+    </repositories>
 </project>

Modified: abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java?rev=1006114&r1=1006113&r2=1006114&view=diff
==============================================================================
--- abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
(original)
+++ abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
Sat Oct  9 08:03:55 2010
@@ -67,7 +67,7 @@ public class FOMDocument<T extends Eleme
     protected boolean preserve = true;
 
     public FOMDocument() {
-        super();
+        super(new FOMFactory());
     }
 
     protected FOMDocument(OMElement documentElement, OMXMLParserWrapper parserWrapper, OMFactory
factory) {
@@ -75,7 +75,7 @@ public class FOMDocument<T extends Eleme
     }
 
     protected FOMDocument(OMElement documentElement, OMXMLParserWrapper parserWrapper) {
-        super(documentElement, parserWrapper);
+        super(documentElement, parserWrapper, new FOMFactory());
     }
 
     protected FOMDocument(OMFactory factory) {
@@ -87,7 +87,7 @@ public class FOMDocument<T extends Eleme
     }
 
     protected FOMDocument(OMXMLParserWrapper parserWrapper) {
-        super(parserWrapper);
+        super(parserWrapper, new FOMFactory());
     }
 
     public T getRoot() {

Modified: abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?rev=1006114&r1=1006113&r2=1006114&view=diff
==============================================================================
--- abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java (original)
+++ abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java Sat
Oct  9 08:03:55 2010
@@ -72,7 +72,7 @@ public class FOMFactory extends OMLinked
     private final Abdera abdera;
 
     public static void registerAsDefault() {
-        System.setProperty(OMAbstractFactory.OM_FACTORY_NAME_PROPERTY, FOMFactory.class.getName());
+        System.setProperty(OMAbstractFactory.META_FACTORY_NAME_PROPERTY, FOMFactory.class.getName());
     }
 
     public FOMFactory() {

Added: abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java?rev=1006114&view=auto
==============================================================================
--- abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java
(added)
+++ abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java
Sat Oct  9 08:03:55 2010
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera.parser.stax;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory;
+import org.apache.axiom.soap.impl.llom.soap12.SOAP12Factory;
+
+public class FOMMetaFactory implements OMMetaFactory {
+    private final OMFactory omFactory = new FOMFactory();
+    private final SOAPFactory soap11Factory = new SOAP11Factory();
+    private final SOAPFactory soap12Factory = new SOAP12Factory();
+    
+    public OMFactory getOMFactory() {
+        return omFactory;
+    }
+    
+    public SOAPFactory getSOAP11Factory() {
+        return soap11Factory;
+    }
+    
+    public SOAPFactory getSOAP12Factory() {
+        return soap12Factory;
+    }
+}

Propchange: abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java?rev=1006114&r1=1006113&r2=1006114&view=diff
==============================================================================
--- abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java (original)
+++ abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java Sat
Oct  9 08:03:55 2010
@@ -38,9 +38,23 @@ import org.apache.abdera.parser.stax.uti
 import org.apache.abdera.parser.stax.util.FOMXmlRestrictedCharReader;
 import org.apache.abdera.util.AbstractParser;
 import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.util.StAXParserConfiguration;
 import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.util.stax.dialect.StAXDialect;
 
 public class FOMParser extends AbstractParser implements Parser {
+    private static final StAXParserConfiguration ABDERA_PARSER_CONFIGURATION = new StAXParserConfiguration()
{
+        public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) {
+            factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
+            return factory;
+        }
+        
+        // This is used in log statements inside Axiom
+        @Override
+        public String toString() {
+            return "ABDERA";
+        }
+    };
 
     public FOMParser() {
         super();
@@ -135,9 +149,7 @@ public class FOMParser extends AbstractP
     }
 
     private static XMLInputFactory getXMLInputFactory() {
-        XMLInputFactory inputFactory = StAXUtils.getXMLInputFactory();
-        inputFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
-        return inputFactory;
+        return StAXUtils.getXMLInputFactory(ABDERA_PARSER_CONFIGURATION);
     }
 
     private static void releaseXMLInputFactory(XMLInputFactory inputFactory) {

Modified: abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/StaxStreamWriter.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/StaxStreamWriter.java?rev=1006114&r1=1006113&r2=1006114&view=diff
==============================================================================
--- abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/StaxStreamWriter.java
(original)
+++ abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/StaxStreamWriter.java
Sat Oct  9 08:03:55 2010
@@ -36,8 +36,22 @@ import org.apache.abdera.util.AbstractSt
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.writer.StreamWriter;
 import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.om.util.StAXWriterConfiguration;
+import org.apache.axiom.util.stax.dialect.StAXDialect;
 
 public class StaxStreamWriter extends AbstractStreamWriter {
+    private static final StAXWriterConfiguration ABDERA_WRITER_CONFIGURATION = new StAXWriterConfiguration()
{
+        public XMLOutputFactory configure(XMLOutputFactory factory, StAXDialect dialect)
{
+            factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+            return factory;
+        }
+        
+        // This is used in log statements inside Axiom
+        @Override
+        public String toString() {
+            return "ABDERA";
+        }
+    }; 
 
     private static final String NAME = "default";
 
@@ -74,16 +88,9 @@ public class StaxStreamWriter extends Ab
     }
 
     private static XMLStreamWriter createXMLStreamWriter(Writer out) throws XMLStreamException
{
-        XMLOutputFactory outputFactory = StAXUtils.getXMLOutputFactory();
-        Object curval = outputFactory.getProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES);
-        try {
-            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
-            XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out);
-            return writer;
-        } finally {
-            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, curval);
-            StAXUtils.releaseXMLOutputFactory(outputFactory);
-        }
+        XMLOutputFactory outputFactory = StAXUtils.getXMLOutputFactory(ABDERA_WRITER_CONFIGURATION);
+        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out);
+        return writer;
     }
 
     public StreamWriter setOutputStream(java.io.OutputStream out) {
@@ -96,16 +103,9 @@ public class StaxStreamWriter extends Ab
     }
 
     private static XMLStreamWriter createXMLStreamWriter(OutputStream out, String encoding)
throws XMLStreamException {
-        XMLOutputFactory outputFactory = StAXUtils.getXMLOutputFactory();
-        Object curval = outputFactory.getProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES);
-        try {
-            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
-            XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out, encoding);
-            return writer;
-        } finally {
-            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, curval);
-            StAXUtils.releaseXMLOutputFactory(outputFactory);
-        }
+        XMLOutputFactory outputFactory = StAXUtils.getXMLOutputFactory(ABDERA_WRITER_CONFIGURATION);
+        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out, encoding);
+        return writer;
     }
 
     public StreamWriter setOutputStream(java.io.OutputStream out, String charset) {

Modified: abdera/java/trunk/pom.xml
URL: http://svn.apache.org/viewvc/abdera/java/trunk/pom.xml?rev=1006114&r1=1006113&r2=1006114&view=diff
==============================================================================
--- abdera/java/trunk/pom.xml (original)
+++ abdera/java/trunk/pom.xml Sat Oct  9 08:03:55 2010
@@ -336,7 +336,7 @@
       <dependency>
         <groupId>org.apache.ws.commons.axiom</groupId>
         <artifactId>axiom-impl</artifactId>
-        <version>1.2.5</version>  
+        <version>1.2.10-SNAPSHOT</version>  
 
       <exclusions>
         <exclusion>



Mime
View raw message