cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r647008 - in /incubator/cxf/trunk: distribution/bundle/pom.xml rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
Date Thu, 10 Apr 2008 23:29:19 GMT
Author: dkulp
Date: Thu Apr 10 16:29:16 2008
New Revision: 647008

URL: http://svn.apache.org/viewvc?rev=647008&view=rev
Log:
Remove direct dependency on woodstox from the code
Mark the woodstox import as optional in osgi manifest
Update other deps in osgi manifest as optional

Modified:
    incubator/cxf/trunk/distribution/bundle/pom.xml
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java

Modified: incubator/cxf/trunk/distribution/bundle/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/bundle/pom.xml?rev=647008&r1=647007&r2=647008&view=diff
==============================================================================
--- incubator/cxf/trunk/distribution/bundle/pom.xml (original)
+++ incubator/cxf/trunk/distribution/bundle/pom.xml Thu Apr 10 16:29:16 2008
@@ -262,6 +262,8 @@
                 <configuration>
                     <instructions>
                         <Import-Package>
+                            antlr*;resolution:=optional,
+                            com.ctc.wstx*;resolution:=optional,
                             com.ibm*;resolution:=optional,
                             com.sun*;resolution:=optional,
                             javanet.staxutils*;resolution:=optional,
@@ -270,11 +272,13 @@
                             junit.framework*;resolution:=optional,
                             org.apache.abdera*;resolution:=optional,
                             org.apache.commons.lang*;resolution:=optional,
+                            org.apache.commons.codec*;resolution:=optional,
                             org.apache.log4j*;resolution:=optional,
                             org.apache.velocity*;resolution:=optional,
                             org.apache.xmlbeans*;resolution:=optional,
                             org.apache.ws.security*;resolution:=optional,
                             org.codehaus.jra*;resolution:=optional,
+                            org.codehaus.jettison*;resolution:=optional,
                             org.jdom*;resolution:=optional,
                             org.junit*;resolution:=optional,
                             org.mortbay*;resolution:=optional,

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java?rev=647008&r1=647007&r2=647008&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
Thu Apr 10 16:29:16 2008
@@ -28,6 +28,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
@@ -41,7 +42,6 @@
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 
-import com.ctc.wstx.sax.WstxSAXParserFactory;
 import com.sun.xml.fastinfoset.sax.SAXDocumentParser;
 
 import org.springframework.beans.factory.xml.DefaultDocumentLoader;
@@ -66,9 +66,28 @@
         }
     }
     private TransformerFactory transformerFactory;
+    private SAXParserFactory saxParserFactory;
+    private SAXParserFactory nsasaxParserFactory;
     
     TunedDocumentLoader() {
         transformerFactory = TransformerFactory.newInstance();
+        
+        try {
+            Class<?> cls = Class.forName("com.ctc.wstx.sax.WstxSAXParserFactory");
+            saxParserFactory = (SAXParserFactory)cls.newInstance();
+            nsasaxParserFactory = (SAXParserFactory)cls.newInstance();
+        } catch (Exception e) {
+            //woodstox not found, use any other Stax parser
+            saxParserFactory = SAXParserFactory.newInstance();
+            nsasaxParserFactory = SAXParserFactory.newInstance();
+        }
+
+        try {
+            nsasaxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes",

+                                           true);
+        } catch (Exception e) {
+            //ignore
+        }
     }
 
     @Override
@@ -77,11 +96,9 @@
         throws Exception {
         if (validationMode == XmlBeanDefinitionReader.VALIDATION_NONE) {
             
-            WstxSAXParserFactory woodstoxParserFactory;
-            woodstoxParserFactory = new WstxSAXParserFactory();
-            woodstoxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes",

-                                             namespaceAware);
-            SAXParser parser = woodstoxParserFactory.newSAXParser();
+            SAXParserFactory parserFactory = 
+                namespaceAware ? nsasaxParserFactory : saxParserFactory;
+            SAXParser parser = parserFactory.newSAXParser();
             XMLReader reader = parser.getXMLReader();
             reader.setEntityResolver(entityResolver);
             reader.setErrorHandler(errorHandler);



Mime
View raw message