summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/databinding/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-05-19 00:53:52 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-05-19 00:53:52 +0000
commitd683dc4b30c79348b5e73f0f11b1cfd8ce4b9812 (patch)
tree3b64741b708c3e13a6a301f7df21bec070547bfc /sca-java-2.x/trunk/modules/databinding/src
parenta0bfd24b7af22df3174e1c1e4e6d2eb913f41d2f (diff)
Merge branch 'jaxrs' into trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@945980 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/databinding/src')
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingContext.java95
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java11
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java9
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java9
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java10
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java9
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java10
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java12
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java12
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java4
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java6
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java6
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java2
-rw-r--r--sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java13
14 files changed, 183 insertions, 25 deletions
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingContext.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingContext.java
new file mode 100644
index 0000000000..c77d0ad0f6
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingContext.java
@@ -0,0 +1,95 @@
+/*
+ * 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.tuscany.sca.databinding;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * The context for databinding processing
+ */
+public class DataBindingContext {
+
+ private String contentType;
+ private Class<?> type;
+ private Type genericType;
+ private Annotation[] annotations;
+ private Operation operation;
+
+ public DataBindingContext(Class<?> type,
+ Type genericType,
+ Annotation[] annotations,
+ Operation operation,
+ String contentType) {
+ super();
+ this.type = type;
+ this.genericType = genericType;
+ this.annotations = annotations;
+ this.operation = operation;
+ this.contentType = contentType;
+ }
+
+ public DataBindingContext(Class<?> type, Type genericType, Annotation[] annotations) {
+ super();
+ this.type = type;
+ this.genericType = genericType;
+ this.annotations = annotations;
+ }
+
+ public DataBindingContext(Class<?> type) {
+ super();
+ this.type = type;
+ this.genericType = type;
+ }
+
+ public Class<?> getType() {
+ return type;
+ }
+
+ public Type getGenericType() {
+ return genericType;
+ }
+
+ public Annotation[] getAnnotations() {
+ return annotations;
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+
+ public <A extends Annotation> A getAnnotation(Class<A> type) {
+ if (annotations == null) {
+ return null;
+ }
+ for (Annotation a : annotations) {
+ if (a.annotationType() == type) {
+ return type.cast(a);
+ }
+ }
+ return null;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+}
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java
index 5333d8047a..0bb0513011 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java
@@ -22,6 +22,7 @@ import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.databinding.BaseTransformer;
import org.apache.tuscany.sca.databinding.PullTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
@@ -36,8 +37,14 @@ import org.xml.sax.InputSource;
*/
public class InputSource2Node extends BaseTransformer<InputSource, Node> implements
PullTransformer<InputSource, Node> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
+
+ private final Source2ResultTransformer TRANSFORMER;
+
+ public InputSource2Node(ExtensionPointRegistry registry) {
+ super();
+ this.TRANSFORMER = new Source2ResultTransformer(registry);
+ }
+
public Node transform(InputSource source, TransformationContext context) {
try {
Source streamSource = new StreamSource(source.getCharacterStream());
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
index 31254ff2c6..c9183c4cbf 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
@@ -24,6 +24,7 @@ import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.databinding.BaseTransformer;
import org.apache.tuscany.sca.databinding.PullTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
@@ -38,8 +39,14 @@ import org.xml.sax.InputSource;
*/
public class InputStream2Node extends BaseTransformer<InputStream, Node> implements
PullTransformer<InputStream, Node> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
+ private final Source2ResultTransformer TRANSFORMER;
+
+ public InputStream2Node(ExtensionPointRegistry registry) {
+ super();
+ this.TRANSFORMER = new Source2ResultTransformer(registry);
+ }
+
public Node transform(InputStream source, TransformationContext context) {
try {
Source streamSource = new SAXSource(new InputSource(source));
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java
index bf39509e35..25ed70dda5 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java
@@ -25,6 +25,7 @@ import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.databinding.BaseTransformer;
import org.apache.tuscany.sca.databinding.PushTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
@@ -38,8 +39,14 @@ import org.w3c.dom.Node;
*/
public class Node2OutputStream extends BaseTransformer<Node, OutputStream> implements
PushTransformer<Node, OutputStream> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
+ private final Source2ResultTransformer TRANSFORMER;
+
+ public Node2OutputStream(ExtensionPointRegistry registry) {
+ super();
+ this.TRANSFORMER = new Source2ResultTransformer(registry);
+ }
+
public void transform(Node source, OutputStream writer, TransformationContext context) {
try {
Source domSource = new DOMSource(source);
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java
index a43354e99c..fb3023345c 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java
@@ -20,6 +20,7 @@ package org.apache.tuscany.sca.databinding.xml;
import java.io.StringWriter;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.databinding.BaseTransformer;
import org.apache.tuscany.sca.databinding.PullTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
@@ -32,8 +33,13 @@ import org.w3c.dom.Node;
* @version $Rev$ $Date$
*/
public class Node2String extends BaseTransformer<Node, String> implements PullTransformer<Node, String> {
- private static final Node2Writer TRANSFORMER = new Node2Writer();
-
+ private final Node2Writer TRANSFORMER;
+
+ public Node2String(ExtensionPointRegistry registry) {
+ super();
+ this.TRANSFORMER = new Node2Writer(registry);
+ }
+
public String transform(Node source, TransformationContext context) {
try {
StringWriter writer = new StringWriter();
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java
index 18561d0eeb..6c1d241ce9 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java
@@ -25,6 +25,7 @@ import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.databinding.BaseTransformer;
import org.apache.tuscany.sca.databinding.PushTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
@@ -37,8 +38,14 @@ import org.w3c.dom.Node;
* @version $Rev$ $Date$
*/
public class Node2Writer extends BaseTransformer<Node, Writer> implements PushTransformer<Node, Writer> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
+ private final Source2ResultTransformer TRANSFORMER;
+
+ public Node2Writer(ExtensionPointRegistry registry) {
+ super();
+ this.TRANSFORMER = new Source2ResultTransformer(registry);
+ }
+
public void transform(Node source, Writer writer, TransformationContext context) {
try {
Source domSource = new DOMSource(source);
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java
index 31adea234d..1866f3864a 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java
@@ -24,6 +24,7 @@ import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.databinding.BaseTransformer;
import org.apache.tuscany.sca.databinding.PullTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
@@ -36,8 +37,13 @@ import org.w3c.dom.Node;
* @version $Rev$ $Date$
*/
public class Reader2Node extends BaseTransformer<Reader, Node> implements PullTransformer<Reader, Node> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
+ private final Source2ResultTransformer TRANSFORMER;
+
+ public Reader2Node(ExtensionPointRegistry registry) {
+ super();
+ this.TRANSFORMER = new Source2ResultTransformer(registry);
+ }
+
public Node transform(Reader source, TransformationContext context) {
try {
Source streamSource = new StreamSource(source);
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java
index da78e6f9a6..dd69e3ea66 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java
@@ -22,6 +22,8 @@ import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.databinding.BaseTransformer;
import org.apache.tuscany.sca.databinding.PushTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
@@ -34,11 +36,17 @@ import org.apache.tuscany.sca.databinding.TransformationException;
*/
public class Source2ResultTransformer extends BaseTransformer<Source, Result> implements
PushTransformer<Source, Result> {
- private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
+ private final TransformerFactory factory;
+ public Source2ResultTransformer(ExtensionPointRegistry registry) {
+ super();
+ FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+ factory = factories.getFactory(TransformerFactory.class);
+ }
+
public void transform(Source source, Result result, TransformationContext context) {
try {
- javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
+ javax.xml.transform.Transformer transformer = factory.newTransformer();
transformer.transform(source, result);
} catch (Exception e) {
throw new TransformationException(e);
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java
index 5cf1867b96..0c3db2a477 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java
@@ -24,6 +24,8 @@ import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.databinding.BaseTransformer;
import org.apache.tuscany.sca.databinding.PullTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
@@ -36,11 +38,17 @@ import org.apache.tuscany.sca.databinding.TransformationException;
*/
public class Source2StringTransformer extends BaseTransformer<Source, String> implements
PullTransformer<Source, String> {
- private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
+ private final TransformerFactory factory;
+ public Source2StringTransformer(ExtensionPointRegistry registry) {
+ super();
+ FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+ factory = factories.getFactory(TransformerFactory.class);
+ }
+
public String transform(Source source, TransformationContext context) {
try {
- javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
+ javax.xml.transform.Transformer transformer = factory.newTransformer();
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(sw);
transformer.transform(source, result);
diff --git a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
index a74a8e5550..953e539dd1 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
@@ -87,8 +87,8 @@ public class MediatorImplTestCase {
registry.addTransformer(new String2SAX(), true);
registry.addTransformer(new SAX2DOMPipe(extensionPointRegistry), true);
- registry.addTransformer(new Node2String(), true);
- registry.addTransformer(new Node2Writer(), true);
+ registry.addTransformer(new Node2String(extensionPointRegistry), true);
+ registry.addTransformer(new Node2Writer(extensionPointRegistry), true);
mediator = new MediatorImpl(dataBindingRegistry, registry);
}
diff --git a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java
index 682fbd4243..da18a4f89c 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java
@@ -27,6 +27,7 @@ import java.io.Writer;
import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+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.PipedTransformer;
@@ -76,11 +77,12 @@ public class DataPipeTestCase {
@Test
public final void testPiped() throws Exception {
- Node2Writer node2Writer = new Node2Writer();
+ ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
+ Node2Writer node2Writer = new Node2Writer(registry);
Writer2ReaderDataPipe pipe = new Writer2ReaderDataPipe();
PipedTransformer<Node, Writer, Reader> transformer =
new PipedTransformer<Node, Writer, Reader>(node2Writer, pipe);
- Document document = DOMHelper.getInstance(new DefaultExtensionPointRegistry()).newDocument();
+ Document document = DOMHelper.getInstance(registry).newDocument();
Element element = document.createElementNS("http://ns1", "root");
document.appendChild(element);
Reader reader = transformer.transform(document, null);
diff --git a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java
index 516b57c851..75c43dbf79 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java
@@ -20,6 +20,7 @@ package org.apache.tuscany.sca.databinding.xml;
import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -32,10 +33,11 @@ public class Node2StringTestCase {
@Test
public void testTransformation() throws Exception {
- Document document = DOMHelper.getInstance(new DefaultExtensionPointRegistry()).newDocument();
+ ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
+ Document document = DOMHelper.getInstance(registry).newDocument();
Element element = document.createElementNS("http://ns1", "test");
document.appendChild(element);
- new Node2String().transform(document, null);
+ new Node2String(registry).transform(document, null);
}
}
diff --git a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
index a8657a5be8..5027f64f01 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
@@ -73,7 +73,7 @@ public class PushTransformationTestCase {
new PipedTransformer<XMLStreamReader, ContentHandler, Node>(t2, new SAX2DOMPipe(registry));
Node node = t3.transform(reader, null);
Assert.assertNotNull(node);
- Node2String t4 = new Node2String();
+ Node2String t4 = new Node2String(registry);
String xml = t4.transform(node, null);
Assert.assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
}
diff --git a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java
index fb9895f120..6fd8ce2e8b 100644
--- a/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java
+++ b/sca-java-2.x/trunk/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java
@@ -28,6 +28,8 @@ import java.io.StringWriter;
import java.io.Writer;
import java.net.URL;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Node;
@@ -50,22 +52,23 @@ public class TraxTransformerTestCase {
@Test
public void testTransformDOM() throws IOException {
+ ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
InputStream is = url.openStream();
- InputStream2Node t1 = new InputStream2Node();
+ InputStream2Node t1 = new InputStream2Node(registry);
Node node = t1.transform(is, null);
is.close();
Writer writer = new StringWriter();
- Node2Writer t2 = new Node2Writer();
+ Node2Writer t2 = new Node2Writer(registry);
t2.transform(node, writer, null);
String str = writer.toString();
StringReader reader = new StringReader(str);
- Reader2Node t3 = new Reader2Node();
+ Reader2Node t3 = new Reader2Node(registry);
node = t3.transform(reader, null);
ByteArrayOutputStream os = new ByteArrayOutputStream();
- Node2OutputStream t4 = new Node2OutputStream();
+ Node2OutputStream t4 = new Node2OutputStream(registry);
t4.transform(node, os, null);
InputSource inputSource = new InputSource(new ByteArrayInputStream(os.toByteArray()));
- InputSource2Node t5 = new InputSource2Node();
+ InputSource2Node t5 = new InputSource2Node(registry);
node = t5.transform(inputSource, null);
}