tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r801895 - in /tuscany/java/sca/modules: ./ databinding/ databinding/META-INF/ databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/ databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/ databinding/src/test/java/org...
Date Fri, 07 Aug 2009 06:56:50 GMT
Author: rfeng
Date: Fri Aug  7 06:56:48 2009
New Revision: 801895

URL: http://svn.apache.org/viewvc?rev=801895&view=rev
Log:
Refactor the databinding module to use common-xml

Removed:
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java.fixme
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java.fixme
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java
Modified:
    tuscany/java/sca/modules/databinding/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/databinding/pom.xml
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
    tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
    tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
    tuscany/java/sca/modules/pom.xml

Modified: tuscany/java/sca/modules/databinding/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/META-INF/MANIFEST.MF?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/databinding/META-INF/MANIFEST.MF Fri Aug  7 06:56:48 2009
@@ -45,6 +45,10 @@
  javax.xml.transform.dom,
  javax.xml.transform.sax,
  javax.xml.transform.stream,
+ org.apache.tuscany.sca.common.xml.dom;version="2.0.0",
+ org.apache.tuscany.sca.common.xml.sax;version="2.0.0",
+ org.apache.tuscany.sca.common.xml.stax;version="2.0.0",
+ org.apache.tuscany.sca.common.xml.stax.reader;version="2.0.0",
  org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
  org.apache.tuscany.sca.core;version="2.0.0",
  org.apache.tuscany.sca.databinding;version="2.0.0",

Modified: tuscany/java/sca/modules/databinding/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/pom.xml?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/pom.xml (original)
+++ tuscany/java/sca/modules/databinding/pom.xml Fri Aug  7 06:56:48 2009
@@ -59,14 +59,13 @@
             <version>2.0-SNAPSHOT</version>
         </dependency>		
 
-        <!-- 
         <dependency>
-            <groupId>javax.xml.stream</groupId>
-            <artifactId>stax-api</artifactId>
-            <version>1.0-2</version>
-        </dependency>
-        -->
-        
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-common-xml</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>       
+
+<!--         
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-stax-api_1.0_spec</artifactId>
@@ -85,7 +84,7 @@
                 </exclusion>
             </exclusions>
         </dependency>
-
+ -->
         <dependency>
             <groupId>xmlunit</groupId>
             <artifactId>xmlunit</artifactId>

Modified: tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
(original)
+++ tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
Fri Aug  7 06:56:48 2009
@@ -37,6 +37,9 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.tuscany.sca.common.xml.stax.reader.SimpleXmlNodeImpl;
+import org.apache.tuscany.sca.common.xml.stax.reader.XmlNode;
+import org.apache.tuscany.sca.common.xml.stax.reader.XmlTreeStreamReaderImpl;
 import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
 import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
 import org.apache.tuscany.sca.interfacedef.util.TypeInfo;

Modified: tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
(original)
+++ tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
Fri Aug  7 06:56:48 2009
@@ -20,6 +20,7 @@
 
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.common.xml.stax.reader.DOMXMLStreamReader;
 import org.apache.tuscany.sca.databinding.PullTransformer;
 import org.apache.tuscany.sca.databinding.TransformationContext;
 import org.apache.tuscany.sca.databinding.TransformationException;

Modified: tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
(original)
+++ tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
Fri Aug  7 06:56:48 2009
@@ -18,8 +18,8 @@
  */
 package org.apache.tuscany.sca.databinding.xml;
 
-import javax.xml.parsers.ParserConfigurationException;
-
+import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.DataPipe;
 import org.apache.tuscany.sca.databinding.DataPipeTransformer;
 import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
@@ -27,12 +27,13 @@
 import org.xml.sax.ContentHandler;
 
 public class SAX2DOMPipe extends BaseTransformer<ContentHandler, Node> implements DataPipeTransformer<ContentHandler,
Node> {
-
+    private DOMHelper domHelper;
     /**
      * 
      */
-    public SAX2DOMPipe() {
+    public SAX2DOMPipe(ExtensionPointRegistry registry) {
         super();
+        domHelper = DOMHelper.getInstance(registry);
     }
 
     /**
@@ -57,20 +58,16 @@
         return 30;
     }
 
-    private static class Pipe implements DataPipe<ContentHandler, Node> {
-        private SAX2DOM pipe;
+    private class Pipe implements DataPipe<ContentHandler, Node> {
+        private DOMHelper.NodeContentHandler pipe;
 
         public Pipe() {
             super();
-            try {
-                this.pipe = new SAX2DOM();
-            } catch (ParserConfigurationException e) {
-                throw new IllegalArgumentException(e);
-            }
+            this.pipe = domHelper.createContentHandler(null);
         }
 
         public Node getResult() {
-            return pipe.getDOM();
+            return pipe.getNode();
         }
 
         public ContentHandler getSink() {

Modified: tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
(original)
+++ tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
Fri Aug  7 06:56:48 2009
@@ -21,6 +21,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.PullTransformer;
 import org.apache.tuscany.sca.databinding.TransformationContext;
 import org.apache.tuscany.sca.databinding.TransformationException;
@@ -28,10 +30,15 @@
 
 public class String2XMLStreamReader extends BaseTransformer<String, XMLStreamReader>
implements
     PullTransformer<String, XMLStreamReader> {
-
+    private StAXHelper helper;
+    
+    public String2XMLStreamReader(ExtensionPointRegistry registry) {
+        helper = StAXHelper.getInstance(registry);
+    }
+    
     public XMLStreamReader transform(String source, TransformationContext context) {
         try {
-            return StAXHelper.createXMLStreamReader(source);
+            return helper.createXMLStreamReader(source);
         } catch (XMLStreamException e) {
             throw new TransformationException(e);
         }

Modified: tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
(original)
+++ tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
Fri Aug  7 06:56:48 2009
@@ -20,6 +20,7 @@
 
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.DataPipe;
 import org.apache.tuscany.sca.databinding.PullTransformer;
 import org.apache.tuscany.sca.databinding.TransformationContext;
@@ -38,11 +39,17 @@
 public class XMLStreamReader2Node extends BaseTransformer<XMLStreamReader, Node> implements
     PullTransformer<XMLStreamReader, Node> {
 
-    private XMLStreamReader2SAX stax2sax = new XMLStreamReader2SAX();
+    private XMLStreamReader2SAX stax2sax;
+    private SAX2DOMPipe sax2domPipe;
+    
+    public XMLStreamReader2Node(ExtensionPointRegistry registry) {
+        stax2sax = new XMLStreamReader2SAX(registry);
+        sax2domPipe = new SAX2DOMPipe(registry);
+    }
 
     public Node transform(XMLStreamReader source, TransformationContext context) {
         try {
-            DataPipe<ContentHandler, Node> pipe = new SAX2DOMPipe().newInstance();
+            DataPipe<ContentHandler, Node> pipe = sax2domPipe.newInstance();
             stax2sax.transform(source, pipe.getSink(), context);
             Node node = pipe.getResult();
             source.close();

Modified: tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
(original)
+++ tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
Fri Aug  7 06:56:48 2009
@@ -20,6 +20,8 @@
 
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.PushTransformer;
 import org.apache.tuscany.sca.databinding.TransformationContext;
 import org.apache.tuscany.sca.databinding.TransformationException;
@@ -33,7 +35,13 @@
  */
 public class XMLStreamReader2SAX extends BaseTransformer<XMLStreamReader, ContentHandler>
implements
     PushTransformer<XMLStreamReader, ContentHandler> {
-
+    
+    private StAXHelper helper;
+    
+    public XMLStreamReader2SAX(ExtensionPointRegistry registry) {
+        helper = StAXHelper.getInstance(registry);
+    }
+    
     @Override
     protected Class<ContentHandler> getTargetType() {
         return ContentHandler.class;
@@ -58,9 +66,8 @@
      *      org.apache.tuscany.sca.databinding.TransformationContext)
      */
     public void transform(XMLStreamReader source, ContentHandler sink, TransformationContext
context) {
-        StAX2SAXAdapter adapter = new StAX2SAXAdapter(false);
         try {
-            adapter.parse(source, sink);
+            helper.saveAsSAX(source, sink);
             source.close();
         } catch (Exception e) {
             throw new TransformationException(e);

Modified: tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
(original)
+++ tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
Fri Aug  7 06:56:48 2009
@@ -21,6 +21,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.PullTransformer;
 import org.apache.tuscany.sca.databinding.TransformationContext;
 import org.apache.tuscany.sca.databinding.TransformationException;
@@ -28,10 +30,15 @@
 
 public class XMLStreamReader2String extends BaseTransformer<XMLStreamReader, String>
implements
     PullTransformer<XMLStreamReader, String> {
-
+    private StAXHelper helper;
+    
+    public XMLStreamReader2String(ExtensionPointRegistry registry) {
+        helper = StAXHelper.getInstance(registry);
+    }
+    
     public String transform(XMLStreamReader source, TransformationContext context) {
         try {
-            String str = StAXHelper.save(source);
+            String str = helper.saveAsString(source);
             source.close();
             return str;
         } catch (XMLStreamException e) {

Modified: tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
(original)
+++ tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
Fri Aug  7 06:56:48 2009
@@ -21,6 +21,8 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
 import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
 import org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint;
@@ -79,11 +81,12 @@
 
     @Before
     public void setUp() throws Exception {
-        DataBindingExtensionPoint dataBindingRegistry = new DefaultDataBindingExtensionPoint();
-        TransformerExtensionPoint registry = new DefaultTransformerExtensionPoint(null);
+        ExtensionPointRegistry extensionPointRegistry = new DefaultExtensionPointRegistry();
+        DataBindingExtensionPoint dataBindingRegistry = new DefaultDataBindingExtensionPoint(extensionPointRegistry);
+        TransformerExtensionPoint registry = new DefaultTransformerExtensionPoint(extensionPointRegistry);
 
         registry.addTransformer(new String2SAX(), true);
-        registry.addTransformer(new SAX2DOMPipe(), true);
+        registry.addTransformer(new SAX2DOMPipe(extensionPointRegistry), true);
         registry.addTransformer(new Node2String(), true);
         registry.addTransformer(new Node2Writer(), true);
 

Modified: tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java
(original)
+++ tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java
Fri Aug  7 06:56:48 2009
@@ -22,11 +22,13 @@
 import java.io.StringReader;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.tuscany.sca.databinding.xml.XMLDocumentStreamReader;
+import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
+import org.apache.tuscany.sca.common.xml.stax.reader.XMLDocumentStreamReader;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;
 import org.junit.Assert;
 
@@ -38,13 +40,15 @@
 
     @org.junit.Test
     public void testReader() throws Exception {
-        XMLInputFactory factory = XMLInputFactory.newInstance();
-        XMLStreamReader r1 = factory.createXMLStreamReader(new StringReader(xml));
+        ExtensionPointRegistry extensionPointRegistry = new DefaultExtensionPointRegistry();
+
+        StAXHelper helper = StAXHelper.getInstance(extensionPointRegistry);
+        XMLStreamReader r1 = helper.createXMLStreamReader(new StringReader(xml));
         XMLDocumentStreamReader r2 = new XMLDocumentStreamReader(r1);
-        XMLStreamReader2String t1 = new XMLStreamReader2String();
+        XMLStreamReader2String t1 = new XMLStreamReader2String(extensionPointRegistry);
         String result = t1.transform(r2, null);
         System.out.println(result);
-        XMLStreamReader r3 = factory.createXMLStreamReader(new StringReader(xml));
+        XMLStreamReader r3 = helper.createXMLStreamReader(new StringReader(xml));
         r3.nextTag();
         r3.nextTag();
         Assert.assertEquals(XMLStreamConstants.START_ELEMENT, r3.getEventType());

Modified: tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java
(original)
+++ tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java
Fri Aug  7 06:56:48 2009
@@ -27,6 +27,7 @@
 
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.custommonkey.xmlunit.Diff;
 import org.junit.Test;
 
@@ -68,7 +69,7 @@
         bean.map.put("key1", "value1");
         bean.map.put("key2", "value2");
         XMLStreamReader reader = new BeanXMLStreamReaderImpl(null, bean);
-        XMLStreamReader2String t3 = new XMLStreamReader2String();
+        XMLStreamReader2String t3 = new XMLStreamReader2String(new DefaultExtensionPointRegistry());
         String xml = t3.transform(reader, null);
         Diff diff = new Diff(XML_RESULT, xml);
         Diff diff1 = new Diff(XML_RESULT1, xml);

Modified: tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java
(original)
+++ tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java
Fri Aug  7 06:56:48 2009
@@ -22,7 +22,12 @@
 
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.common.xml.stax.reader.DOMXmlNodeImpl;
+import org.apache.tuscany.sca.common.xml.stax.reader.XmlTreeStreamReaderImpl;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.custommonkey.xmlunit.XMLAssert;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.w3c.dom.Node;
 
@@ -64,13 +69,20 @@
     private static final String CRAZY_XML =
         "<p:e1 xmlns=\"http://ns0\" xmlns:p=\"http://p1\">" + "<p:e2 xmlns:p=\"http://p2\"/><e3/><e4
xmlns=\"\">E4</e4></p:e1>";
 
+    private static ExtensionPointRegistry registry;
+    
+    @BeforeClass
+    public static void init() {
+        registry = new DefaultExtensionPointRegistry();
+    }
+    
     @Test
     public void testTransformation() throws Exception {
         String2Node t1 = new String2Node();
         Node node = t1.transform(IPO_XML, null);
         Node2XMLStreamReader t2 = new Node2XMLStreamReader();
         XMLStreamReader reader = t2.transform(node, null);
-        XMLStreamReader2String t3 = new XMLStreamReader2String();
+        XMLStreamReader2String t3 = new XMLStreamReader2String(registry);
         String xml = t3.transform(reader, null);
         XMLAssert.assertXMLEqual(IPO_XML, xml);
         // assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>")
!= -1);
@@ -82,7 +94,7 @@
         Node node = t1.transform(CRAZY_XML, null);
         Node2XMLStreamReader t2 = new Node2XMLStreamReader();
         XMLStreamReader reader = t2.transform(node, null);
-        XMLStreamReader2String t3 = new XMLStreamReader2String();
+        XMLStreamReader2String t3 = new XMLStreamReader2String(registry);
         String xml = t3.transform(reader, null);
         // System.out.println(xml);
         XMLAssert.assertXMLEqual(CRAZY_XML, xml);
@@ -95,7 +107,7 @@
         Node node = t1.transform(IPO_XML, null);
         DOMXmlNodeImpl element = new DOMXmlNodeImpl(node);
         XmlTreeStreamReaderImpl reader = new XmlTreeStreamReaderImpl(element);
-        XMLStreamReader2String t3 = new XMLStreamReader2String();
+        XMLStreamReader2String t3 = new XMLStreamReader2String(registry);
         String xml = t3.transform(reader, null);
         XMLAssert.assertXMLEqual(IPO_XML, xml);
         // assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>")
!= -1);

Modified: tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
(original)
+++ tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
Fri Aug  7 06:56:48 2009
@@ -20,6 +20,7 @@
 
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLStreamReaderTransformer;
 import org.custommonkey.xmlunit.XMLAssert;
 import org.junit.Test;
@@ -45,7 +46,7 @@
         bean.bean = new AnotherBean();
         bean.bean.setName("Name");
         XMLStreamReader reader = t2.transform(bean, null);
-        XMLStreamReader2String t3 = new XMLStreamReader2String();
+        XMLStreamReader2String t3 = new XMLStreamReader2String(new DefaultExtensionPointRegistry());
         String xml = t3.transform(reader, null);
         XMLAssert.assertXMLEqual(XML_RESULT, xml);
 

Modified: tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
(original)
+++ tuscany/java/sca/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
Fri Aug  7 06:56:48 2009
@@ -20,6 +20,8 @@
 
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.impl.PipedTransformer;
 import org.junit.Assert;
 import org.junit.Test;
@@ -63,11 +65,12 @@
 
     @Test
     public void testTransformation() {
-        String2XMLStreamReader t1 = new String2XMLStreamReader();
+        ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
+        String2XMLStreamReader t1 = new String2XMLStreamReader(registry);
         XMLStreamReader reader = t1.transform(IPO_XML, null);
-        XMLStreamReader2SAX t2 = new XMLStreamReader2SAX();
+        XMLStreamReader2SAX t2 = new XMLStreamReader2SAX(registry);
         PipedTransformer<XMLStreamReader, ContentHandler, Node> t3 =
-            new PipedTransformer<XMLStreamReader, ContentHandler, Node>(t2, new SAX2DOMPipe());
+            new PipedTransformer<XMLStreamReader, ContentHandler, Node>(t2, new SAX2DOMPipe(registry));
         Node node = t3.transform(reader, null);
         Assert.assertNotNull(node);
         Node2String t4 = new Node2String();

Modified: tuscany/java/sca/modules/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/pom.xml?rev=801895&r1=801894&r2=801895&view=diff
==============================================================================
--- tuscany/java/sca/modules/pom.xml (original)
+++ tuscany/java/sca/modules/pom.xml Fri Aug  7 06:56:48 2009
@@ -44,6 +44,7 @@
         <module>binding-ws-axis2-policy</module>
         <module>binding-ws-wsdlgen</module>
         <module>binding-ws-xml</module>
+        <module>common-xml</module>
         <module>contribution</module>
         <module>core</module>
         <module>core-databinding</module>



Mime
View raw message