summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml')
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java300
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java126
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java138
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java67
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java65
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java69
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java64
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java68
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java45
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java61
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java62
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java67
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java65
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java67
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java60
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java78
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java66
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java70
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java63
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java68
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java53
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java65
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java60
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java61
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java62
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java62
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java63
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java57
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java81
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java77
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java64
-rw-r--r--tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java50
32 files changed, 0 insertions, 2424 deletions
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
deleted file mode 100644
index ed59911a0b..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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.xml;
-
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BeanXMLStreamReaderImpl extends XmlTreeStreamReaderImpl {
- private static final Comparator<Accessor> COMPARATOR = new Comparator<Accessor>() {
- public int compare(Accessor o1, Accessor o2) {
- return o1.getName().compareTo(o2.getName());
- }
- };
-
- public static class BeanXmlNodeImpl extends SimpleXmlNodeImpl implements XmlNode {
- private static final Object[] NULL = null;
- private static final SimpleTypeMapper MAPPER = new SimpleTypeMapperImpl();
-
- public BeanXmlNodeImpl(Object bean) {
- super(getName(bean == null ? null : bean.getClass()), bean);
- }
-
- public BeanXmlNodeImpl(QName name, Object bean) {
- super(name, bean);
- }
-
- private static boolean isSimpleType(Class<?> javaType) {
- return MAPPER.getXMLType(javaType) != null;
- }
-
- private static String getStringValue(Object o) {
- if (o == null) {
- return null;
- }
- TypeInfo info = MAPPER.getXMLType(o.getClass());
- if (info != null) {
- return MAPPER.toXMLLiteral(info.getQName(), o, null);
- } else {
- return String.valueOf(o);
- }
- }
-
- @Override
- public Iterator<XmlNode> children() {
- if (name == null) {
- return null;
- }
- if (value == null) {
- return super.children();
- }
- if (isSimpleType(value.getClass())) {
- XmlNode textNode = new BeanXmlNodeImpl(null, value);
- return Arrays.asList(textNode).iterator();
- }
- if (Map.class.isAssignableFrom(value.getClass())) {
- List<XmlNode> entries = new ArrayList<XmlNode>();
- QName entryName = new QName(name.getNamespaceURI(), "entry");
- Map map = (Map)value;
- if (map != null) {
- for (Object e : map.entrySet()) {
- Map.Entry entry = (Map.Entry)e;
- entries.add(new BeanXmlNodeImpl(entryName, entry));
- }
- }
- return entries.iterator();
- }
- try {
- Map<String, Accessor> accessorMap = getAccessors(value);
- List<Accessor> accessorList = new ArrayList<Accessor>(accessorMap.values());
- Collections.sort(accessorList, COMPARATOR);
-
- List<XmlNode> props = new ArrayList<XmlNode>();
- for (Accessor accessor : accessorList) {
- Class<?> pType = accessor.getType();
-
- QName pName = new QName(name.getNamespaceURI(), accessor.getName());
- Object pValue = accessor.getValue();
- if (pType.isArray()) {
- if (pValue != null) {
- int i1 = Array.getLength(pValue);
- for (int j = 0; j < i1; j++) {
- Object o = Array.get(pValue, j);
- props.add(new BeanXmlNodeImpl(pName, o));
- }
- } else {
- // TODO: How to handle null?
- }
- } else if (Collection.class.isAssignableFrom(pType)) {
- Collection objList = (Collection)pValue;
- if (objList != null && objList.size() > 0) {
- for (Iterator j = objList.iterator(); j.hasNext();) {
- Object o = j.next();
- props.add(new BeanXmlNodeImpl(pName, o));
- }
-
- } else {
- // How to handle null
- }
- } else {
- props.add(new BeanXmlNodeImpl(pName, pValue));
- }
- }
- return props.iterator();
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- @Override
- public QName getName() {
- return name;
- }
-
- @Override
- public String getValue() {
- return getStringValue(value);
- }
-
- private static String getPackageName(Class<?> cls) {
- String name = cls.getName();
- int index = name.lastIndexOf('.');
- return index == -1 ? "" : name.substring(0, index);
- }
-
- public static QName getName(Class<?> cls) {
- if (cls == null) {
- return null;
- }
-
- String packageName = getPackageName(cls);
-
- if ("".equals(packageName)) {
- return new QName("", cls.getSimpleName());
- }
- StringBuffer ns = new StringBuffer("http://");
- String[] names = packageName.split("\\.");
- for (int i = names.length - 1; i >= 0; i--) {
- ns.append(names[i]);
- if (i != 0) {
- ns.append('.');
- }
- }
- ns.append('/');
- return new QName(ns.toString(), cls.getSimpleName());
- }
-
- }
-
- public BeanXMLStreamReaderImpl(QName name, Object bean) {
- super(getXmlNode(name, bean));
- }
-
- private static BeanXmlNodeImpl getXmlNode(QName name, Object bean) {
- BeanXmlNodeImpl root = null;
- if (name != null) {
- root = new BeanXmlNodeImpl(name, bean);
- } else {
- root = new BeanXmlNodeImpl(bean);
- }
- return root;
- }
-
- public static interface Accessor {
- String getName();
-
- Class<?> getType();
-
- Object getValue() throws Exception;
-
- void setValue(Object value) throws Exception;
- }
-
- private static class FieldAccessor implements Accessor {
- private Object target;
- private Field field;
-
- public FieldAccessor(Object target, Field field) {
- super();
- this.target = target;
- this.field = field;
- this.field.setAccessible(true);
- }
-
- public String getName() {
- return field.getName();
- }
-
- public Object getValue() throws Exception {
- return field.get(target);
- }
-
- public void setValue(Object value) throws Exception {
- field.set(target, value);
- }
-
- public Class<?> getType() {
- return field.getType();
- }
-
- }
-
- private static class PropertyAccessor implements Accessor {
- private Object target;
- private PropertyDescriptor prop;
-
- public PropertyAccessor(Object target, PropertyDescriptor prop) {
- super();
- this.target = target;
- this.prop = prop;
- }
-
- public String getName() {
- return prop.getName();
- }
-
- public Class<?> getType() {
- return prop.getPropertyType();
- }
-
- public Object getValue() throws Exception {
- Method getter = prop.getReadMethod();
- if (getter != null) {
- getter.setAccessible(true);
- return getter.invoke(target);
- }
- throw new IllegalAccessException("The property cannot be read: " + getName());
- }
-
- public void setValue(Object value) throws Exception {
- Method setter = prop.getWriteMethod();
- if (setter != null) {
- setter.setAccessible(true);
- setter.invoke(target);
- }
- throw new IllegalAccessException("The property cannot be written: " + getName());
- }
-
- }
-
- private static Map<String, Accessor> getAccessors(Object target) throws Exception {
- if (target == null) {
- return Collections.emptyMap();
- }
- Map<String, Accessor> map = new HashMap<String, Accessor>();
- Class<?> type = target.getClass();
- for (Field f : type.getFields()) {
- map.put(f.getName(), new FieldAccessor(target, f));
- }
- BeanInfo info = Introspector.getBeanInfo(type, Object.class);
- for (PropertyDescriptor p : info.getPropertyDescriptors()) {
- // if (p.getReadMethod() != null && p.getWriteMethod() != null) {
- map.put(p.getName(), new PropertyAccessor(target, p));
- // }
- }
- return map;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java
deleted file mode 100644
index ed0b5c9923..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.xml;
-
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * DOM DataBinding
- *
- * @version $Rev$ $Date$
- */
-public class DOMDataBinding extends BaseDataBinding {
- public static final String NAME = Node.class.getName();
-
- public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/dom/1.0";
- public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
-
- private DOMHelper domHelper;
-
- public DOMDataBinding(ExtensionPointRegistry registry) {
- super(NAME, Node.class);
- this.domHelper = DOMHelper.getInstance(registry);
- }
-
- @Override
- public WrapperHandler getWrapperHandler() {
- return new DOMWrapperHandler(domHelper);
- }
-
- @Override
- public Object copy(Object source, DataType dataType, Operation operation) {
- if (Node.class.isAssignableFrom(source.getClass())) {
- Node nodeSource = (Node)source;
- return nodeSource.cloneNode(true);
- }
- return super.copy(source, dataType, operation);
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (Node.class.isAssignableFrom(type.getPhysical())) {
- if (type.getLogical() == null) {
- type.setLogical(new XMLType(ROOT_ELEMENT, null));
- }
- type.setDataBinding(NAME);
- return true;
- }
- return false;
- }
-
- /**
- * @param context
- * @param element
- */
- public static Element adjustElementName(TransformationContext context, Element element) {
- if (context != null) {
- DataType dataType = context.getTargetDataType();
- Object logical = dataType == null ? null : dataType.getLogical();
- if (!(logical instanceof XMLType)) {
- return element;
- }
- XMLType xmlType = (XMLType)logical;
- QName name = new QName(element.getNamespaceURI(), element.getLocalName());
- if (xmlType.isElement() && !xmlType.getElementName().equals(name)) {
- QName newName = xmlType.getElementName();
- String prefix = newName.getPrefix();
- String qname = newName.getLocalPart();
- if (prefix != null && !prefix.equals("")) {
- qname = prefix + ":" + qname;
- }
- Document doc = element.getOwnerDocument();
- Element newElement = doc.createElementNS(newName.getNamespaceURI(), qname);
- // Copy the attributes to the new element
- NamedNodeMap attrs = element.getAttributes();
- for (int i = 0; i < attrs.getLength(); i++) {
- Attr attr = (Attr)doc.importNode(attrs.item(i), true);
- newElement.getAttributes().setNamedItem(attr);
- }
-
- // Move all the children
- while (element.hasChildNodes()) {
- newElement.appendChild(element.getFirstChild());
- }
-
- // Replace the old node with the new node
- if (element.getParentNode() != null) {
- element.getParentNode().replaceChild(newElement, element);
- }
-
- return newElement;
- }
- }
- return element;
- }
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java
deleted file mode 100644
index 4ce5dc6c69..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.xml;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class DOMWrapperHandler implements WrapperHandler<Node> {
- private DOMHelper domHelper;
-
- public DOMWrapperHandler(DOMHelper domHelper) {
- super();
- this.domHelper = domHelper;
- }
-
- public Node create(Operation operation, boolean input) {
-
- WrapperInfo wrapperInfo = operation.getWrapper();
- ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement();
- // Class<?> wrapperClass = input ? wrapperInfo.getInputWrapperClass() : wrapperInfo.getOutputWrapperClass();
- Document document = domHelper.newDocument();
- QName name = element.getQName();
- return DOMHelper.createElement(document, name);
- }
-
- public void setChildren(Node wrapper,
- Object[] childObjects,
- Operation operation, boolean input) {
- List<ElementInfo> childElements = input? operation.getWrapper().getInputChildElements():
- operation.getWrapper().getOutputChildElements();
- for (int i = 0; i < childElements.size(); i++) {
- setChild(wrapper, i, childElements.get(i), childObjects[i]);
- }
-
- }
- public void setChild(Node wrapper, int i, ElementInfo childElement, Object value) {
- Node node = (Node)value;
- if (node.getNodeType() == Node.DOCUMENT_NODE) {
- node = ((Document)node).getDocumentElement();
- }
- wrapper.appendChild(wrapper.getOwnerDocument().importNode(node, true));
- }
-
- public List getChildren(Node wrapper, Operation operation, boolean input) {
- assert wrapper != null;
- List<ElementInfo> childElements = input? operation.getWrapper().getInputChildElements():
- operation.getWrapper().getOutputChildElements();
- if (wrapper.getNodeType() == Node.DOCUMENT_NODE) {
- wrapper = ((Document)wrapper).getDocumentElement();
- }
- List<Node> elements = new ArrayList<Node>();
- NodeList nodes = wrapper.getChildNodes();
- for (int j = 0; j < nodes.getLength(); j++) {
- Node node = nodes.item(j);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- elements.add(node);
- }
- }
- return elements;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(Operation, boolean)
- */
- public DataType getWrapperType(Operation operation, boolean input) {
- WrapperInfo wrapper = operation.getWrapper();
- ElementInfo element = input? wrapper.getInputWrapperElement(): wrapper.getOutputWrapperElement();
- DataType<XMLType> wrapperType =
- new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(element));
- return wrapperType;
- }
-
- public boolean isInstance(Object wrapperObj,
- Operation operation,
- boolean input) {
- WrapperInfo wrapperInfo = operation.getWrapper();
- ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement();
- List<ElementInfo> childElements =
- input ? wrapperInfo.getInputChildElements() : wrapperInfo.getOutputChildElements();
- Node wrapper = (Node)wrapperObj;
- if (wrapper.getNodeType() == Node.DOCUMENT_NODE) {
- wrapper = ((Document)wrapper).getDocumentElement();
- }
- QName elementName = new QName(wrapper.getNamespaceURI(), wrapper.getLocalName());
- if (!element.getQName().equals(elementName)) {
- return false;
- }
- Set<QName> names = new HashSet<QName>();
- for (ElementInfo e : childElements) {
- names.add(e.getQName());
- }
- NodeList nodes = wrapper.getChildNodes();
- for (int j = 0; j < nodes.getLength(); j++) {
- Node node = nodes.item(j);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- elementName = new QName(wrapper.getNamespaceURI(), wrapper.getLocalName());
- if (!names.contains(elementName)) {
- return false;
- }
- }
- }
- return true;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java
deleted file mode 100644
index 5f583da283..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.xml;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-/**
- * Push DOM InputSource to Node
- *
- * @version $Rev$ $Date$
- */
-public class InputSource2Node extends BaseTransformer<InputSource, Node> implements
- PullTransformer<InputSource, Node> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public Node transform(InputSource source, TransformationContext context) {
- try {
- Source streamSource = new StreamSource(source.getCharacterStream());
- DOMResult result = new DOMResult();
- TRANSFORMER.transform(streamSource, result, context);
- return result.getNode();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<InputSource> getSourceType() {
- return InputSource.class;
- }
-
- @Override
- public Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java
deleted file mode 100644
index 39116ba4a1..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.xml;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Push InputSource to SAX
- *
- * @version $Rev$ $Date$
- */
-public class InputSource2SAX extends BaseTransformer<InputSource, ContentHandler> implements
- PushTransformer<InputSource, ContentHandler> {
-
- public void transform(InputSource source, ContentHandler target, TransformationContext context) {
- try {
- XMLReader reader = XMLReaderFactory.createXMLReader();
- reader.setFeature("http://xml.org/sax/features/namespaces", true);
- reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
- reader.setContentHandler(target);
- reader.parse(source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<InputSource> getSourceType() {
- return InputSource.class;
- }
-
- @Override
- public Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
deleted file mode 100644
index e40c3006fb..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.InputStream;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.sax.SAXSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-/**
- * Push DOM InputSource to Node
- *
- * @version $Rev$ $Date$
- */
-public class InputStream2Node extends BaseTransformer<InputStream, Node> implements
- PullTransformer<InputStream, Node> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public Node transform(InputStream source, TransformationContext context) {
- try {
- Source streamSource = new SAXSource(new InputSource(source));
- DOMResult result = new DOMResult();
- TRANSFORMER.transform(streamSource, result, context);
- return result.getNode();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<InputStream> getSourceType() {
- return InputStream.class;
- }
-
- @Override
- public Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java
deleted file mode 100644
index 3b7bd3088a..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.InputStream;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Push InputStream to SAX
- *
- * @version $Rev$ $Date$
- */
-public class InputStream2SAX extends BaseTransformer<InputStream, ContentHandler> implements
- PushTransformer<InputStream, ContentHandler> {
- public void transform(InputStream source, ContentHandler target, TransformationContext context) {
- try {
- XMLReader reader = XMLReaderFactory.createXMLReader();
- reader.setContentHandler(target);
- reader.parse(new InputSource(source));
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<InputStream> getSourceType() {
- return InputStream.class;
- }
-
- @Override
- public Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java
deleted file mode 100644
index 5500d0bcca..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.OutputStream;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Push DOM Node to OutputStream
- *
- * @version $Rev$ $Date$
- */
-public class Node2OutputStream extends BaseTransformer<Node, OutputStream> implements
- PushTransformer<Node, OutputStream> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public void transform(Node source, OutputStream writer, TransformationContext context) {
- try {
- Source domSource = new DOMSource(source);
- Result result = new StreamResult(writer);
- TRANSFORMER.transform(domSource, result, context);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<OutputStream> getTargetType() {
- return OutputStream.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java
deleted file mode 100644
index d5bf7e76b5..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.xml;
-
-import org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Transformer to convert data from a simple java Object to OMElement.
- *
- * @version $Rev$ $Date$
- */
-public class Node2SimpleJavaType extends SimpleType2JavaTransformer<Node> {
-
- @Override
- protected String getText(Node source) {
- if (source instanceof Document) {
- source = ((Document)source).getDocumentElement();
- }
- return source.getTextContent();
-
- }
-
- @Override
- public Class getSourceType() {
- return Node.class;
- }
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java
deleted file mode 100644
index 3c9022bc3c..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.xml;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Transform TrAX Node to Source
- *
- * @version $Rev$ $Date$
- */
-public class Node2SourceTransformer extends BaseTransformer<Node, Source> implements
- PullTransformer<Node, Source> {
-
- public Source transform(Node source, TransformationContext context) {
- try {
- return new DOMSource(source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<Source> getTargetType() {
- return Source.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java
deleted file mode 100644
index 1b54b1fd1e..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.StringWriter;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Transform DOM Node to XML String
- *
- * @version $Rev$ $Date$
- */
-public class Node2String extends BaseTransformer<Node, String> implements PullTransformer<Node, String> {
- private static final Node2Writer TRANSFORMER = new Node2Writer();
-
- public String transform(Node source, TransformationContext context) {
- try {
- StringWriter writer = new StringWriter();
- TRANSFORMER.transform(source, writer, context);
- return writer.toString();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- public Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java
deleted file mode 100644
index c9631595dc..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.Writer;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Push DOM Node to Writer
- *
- * @version $Rev$ $Date$
- */
-public class Node2Writer extends BaseTransformer<Node, Writer> implements PushTransformer<Node, Writer> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public void transform(Node source, Writer writer, TransformationContext context) {
- try {
- Source domSource = new DOMSource(source);
- Result result = new StreamResult(writer);
- TRANSFORMER.transform(domSource, result, context);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<Writer> getTargetType() {
- return Writer.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
deleted file mode 100644
index 3d89a26cab..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.xml;
-
-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;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Transform DOM Node to XML XMLStreamReader
- *
- * @version $Rev$ $Date$
- */
-public class Node2XMLStreamReader extends BaseTransformer<Node, XMLStreamReader> implements
- PullTransformer<Node, XMLStreamReader> {
-
- public XMLStreamReader transform(Node source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- DOMXMLStreamReader reader = new DOMXMLStreamReader(source);
- return reader;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java
deleted file mode 100644
index 70387fa862..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.Reader;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Push DOM Reader to Node
- *
- * @version $Rev$ $Date$
- */
-public class Reader2Node extends BaseTransformer<Reader, Node> implements PullTransformer<Reader, Node> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public Node transform(Reader source, TransformationContext context) {
- try {
- Source streamSource = new StreamSource(source);
- DOMResult result = new DOMResult();
- TRANSFORMER.transform(streamSource, result, context);
- return result.getNode();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Reader> getSourceType() {
- return Reader.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java
deleted file mode 100644
index 188ecaffa3..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.Reader;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-
-/**
- * Transform XML string to SAX
- *
- * @version $Rev$ $Date$
- */
-public class Reader2SAX extends BaseTransformer<Reader, ContentHandler> implements
- PushTransformer<Reader, ContentHandler> {
- public void transform(Reader source, ContentHandler target, TransformationContext context) {
- try {
- new InputSource2SAX().transform(new InputSource(source), target, context);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Reader> getSourceType() {
- return Reader.class;
- }
-
- @Override
- protected Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
deleted file mode 100644
index b6b3c05462..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.xml;
-
-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;
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-public class SAX2DOMPipe extends BaseTransformer<ContentHandler, Node> implements DataPipeTransformer<ContentHandler, Node> {
- private DOMHelper domHelper;
- /**
- *
- */
- public SAX2DOMPipe(ExtensionPointRegistry registry) {
- super();
- domHelper = DOMHelper.getInstance(registry);
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.DataPipeTransformer#newInstance()
- */
- public DataPipe<ContentHandler, Node> newInstance() {
- return new Pipe();
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- protected Class<ContentHandler> getSourceType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 30;
- }
-
- private class Pipe implements DataPipe<ContentHandler, Node> {
- private DOMHelper.NodeContentHandler pipe;
-
- public Pipe() {
- super();
- this.pipe = domHelper.createContentHandler(null);
- }
-
- public Node getResult() {
- return pipe.getNode();
- }
-
- public ContentHandler getSink() {
- return pipe;
- }
-
- }
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java
deleted file mode 100644
index 0bb13bb3ea..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.Java2SimpleTypeTransformer;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Transformer to convert data from an simple OMElement to Java Object
- *
- * @version $Rev$ $Date$
- */
-public class SimpleJavaType2Node extends Java2SimpleTypeTransformer<Node> {
- private DOMHelper helper;
-
- public SimpleJavaType2Node(ExtensionPointRegistry registry) {
- super();
- helper = DOMHelper.getInstance(registry);
- }
-
- @Override
- protected Node createElement(QName element, String text, TransformationContext context) {
- if (element == null) {
- element = DOMDataBinding.ROOT_ELEMENT;
- }
- Document factory = helper.newDocument();
- Node root = DOMHelper.createElement(factory, element);
- if (text != null) {
- root.appendChild(factory.createTextNode(text));
- } else {
- Attr nil = factory.createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:nil");
- nil.setValue("true");
- root.appendChild(nil);
- }
- return root;
- }
-
- @Override
- public Class getTargetType() {
- return Node.class;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java
deleted file mode 100644
index 54b281acb5..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.xml;
-
-import javax.xml.transform.Source;
-
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-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;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Transform TrAX Source to Node
- *
- * @version $Rev$ $Date$
- */
-public class Source2NodeTransformer extends BaseTransformer<Source, Node> implements
- PullTransformer<Source, Node> {
- private DOMHelper helper;
-
- public Source2NodeTransformer(ExtensionPointRegistry registry) {
- super();
- helper = DOMHelper.getInstance(registry);
- }
-
- public Node transform(Source source, TransformationContext context) {
- try {
- Document doc = helper.load(source);
- return DOMDataBinding.adjustElementName(context, doc.getDocumentElement());
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Source> getSourceType() {
- return Source.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java
deleted file mode 100644
index 8a2b6b39aa..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.xml;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * Transform TrAX Source to Result
- *
- * @version $Rev$ $Date$
- */
-public class Source2ResultTransformer extends BaseTransformer<Source, Result> implements
- PushTransformer<Source, Result> {
- private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
-
- public void transform(Source source, Result result, TransformationContext context) {
- try {
- javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
- transformer.transform(source, result);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Source> getSourceType() {
- return Source.class;
- }
-
- @Override
- protected Class<Result> getTargetType() {
- return Result.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java
deleted file mode 100644
index 2ed548ad76..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.StringWriter;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * Transform TrAX Source to String
- *
- * @version $Rev$ $Date$
- */
-public class Source2StringTransformer extends BaseTransformer<Source, String> implements
- PullTransformer<Source, String> {
- private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
-
- public String transform(Source source, TransformationContext context) {
- try {
- javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
- StringWriter sw = new StringWriter();
- StreamResult result = new StreamResult(sw);
- transformer.transform(source, result);
- return sw.toString();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Source> getSourceType() {
- return Source.class;
- }
-
- @Override
- protected Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java
deleted file mode 100644
index ed57992910..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.xml;
-
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * A DataBinding for the StAX
- *
- * @version $Rev$ $Date$
- */
-public class StAXDataBinding extends BaseDataBinding {
- public static final String NAME = XMLStreamReader.class.getName();
-
- public StAXDataBinding() {
- super(NAME, XMLStreamReader.class);
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (super.introspect(type, operation)) {
- type.setLogical(XMLType.UNKNOWN);
- type.setDataBinding(NAME);
- return true;
- } else {
- return false;
- }
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java
deleted file mode 100644
index f8967e35b6..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.tuscany.sca.databinding.DataPipe;
-import org.apache.tuscany.sca.databinding.DataPipeTransformer;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-public class StreamDataPipe extends BaseTransformer<OutputStream, InputStream> implements
- DataPipeTransformer<OutputStream, InputStream> {
-
- public DataPipe<OutputStream, InputStream> newInstance() {
- return new Pipe();
- }
-
- @Override
- protected Class<InputStream> getTargetType() {
- return InputStream.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
- @Override
- protected Class<OutputStream> getSourceType() {
- return OutputStream.class;
- }
-
- public static class Pipe implements DataPipe<OutputStream, InputStream> {
- private ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-
- public InputStream getResult() {
- return new ByteArrayInputStream(outputStream.toByteArray());
- }
-
- public OutputStream getSink() {
- return outputStream;
- }
-
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java
deleted file mode 100644
index 548342094e..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.xml;
-
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-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;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-public class String2Node extends BaseTransformer<String, Node> implements PullTransformer<String, Node> {
- private DOMHelper helper;
-
- public String2Node(ExtensionPointRegistry registry) {
- super();
- helper = DOMHelper.getInstance(registry);
- }
-
- public Node transform(String source, TransformationContext context) {
- try {
- return helper.load(source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java
deleted file mode 100644
index c56dba1843..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.StringReader;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-
-/**
- * Transform XML string to SAX
- *
- * @version $Rev$ $Date$
- */
-public class String2SAX extends BaseTransformer<String, ContentHandler> implements
- PushTransformer<String, ContentHandler> {
-
- public void transform(String source, ContentHandler target, TransformationContext context) {
- try {
- new InputSource2SAX().transform(new InputSource(new StringReader(source)), target, context);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java
deleted file mode 100644
index c2de202a9b..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.StringReader;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * Transform XML String to Source
- *
- * @version $Rev$ $Date$
- */
-public class String2SourceTransformer extends BaseTransformer<String, Source> implements
- PullTransformer<String, Source> {
-
- public Source transform(String source, TransformationContext context) {
- try {
- return new StreamSource(new StringReader(source));
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<Source> getTargetType() {
- return Source.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
deleted file mode 100644
index ac46bfd3d9..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.xml;
-
-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;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-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 helper.createXMLStreamReader(source);
- } catch (XMLStreamException e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java
deleted file mode 100644
index 5ab7272d58..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import org.apache.tuscany.sca.databinding.DataPipe;
-import org.apache.tuscany.sca.databinding.DataPipeTransformer;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-public class Writer2ReaderDataPipe extends BaseTransformer<Writer, Reader> implements DataPipeTransformer<Writer, Reader> {
-
- public DataPipe<Writer, Reader> newInstance() {
- return new Pipe();
- }
-
- @Override
- protected Class<Reader> getTargetType() {
- return Reader.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
- @Override
- protected Class<Writer> getSourceType() {
- return Writer.class;
- }
-
- private static class Pipe implements DataPipe<Writer, Reader> {
- private StringWriter writer = new StringWriter();
-
- public Reader getResult() {
- return new StringReader(writer.toString());
- }
-
- public Writer getSink() {
- return writer;
- }
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java
deleted file mode 100644
index f7c895db1e..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.xml;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLEventWriter;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.databinding.impl.GroupDataBinding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-
-/**
- * A Group DataBinding
- *
- * @version $Rev$ $Date$
- */
-public class XMLGroupDataBinding extends GroupDataBinding {
-
- public XMLGroupDataBinding() {
- super(new Class[] {InputStream.class, OutputStream.class, Reader.class, Writer.class,
- // Source.class, Result.class,
- InputSource.class, ContentHandler.class, XMLStreamReader.class,
- XMLStreamWriter.class, XMLEventReader.class, XMLEventWriter.class});
- }
-
- @Override
- protected Object getLogical(Class<?> markerType, Operation operation) {
- return XMLType.UNKNOWN;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
deleted file mode 100644
index 2ebfcf06e9..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.xml;
-
-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;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-/**
- * Transform DOM Node to XML XMLStreamReader
- *
- * @version $Rev$ $Date$
- */
-public class XMLStreamReader2Node extends BaseTransformer<XMLStreamReader, Node> implements
- PullTransformer<XMLStreamReader, Node> {
-
- 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 = sax2domPipe.newInstance();
- stax2sax.transform(source, pipe.getSink(), context);
- Node node = pipe.getResult();
- source.close();
- if (node instanceof Document) {
- Document doc = (Document)node;
- return DOMDataBinding.adjustElementName(context, doc.getDocumentElement());
- } else {
- return node;
- }
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
deleted file mode 100644
index a45c563293..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.xml;
-
-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;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-
-/**
- * XMLStreamReader to SAX events
- *
- * @version $Rev$ $Date$
- */
-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;
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.PushTransformer#getWeight()
- */
- @Override
- public int getWeight() {
- return 20;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object,
- * java.lang.Object,
- * org.apache.tuscany.sca.databinding.TransformationContext)
- */
- public void transform(XMLStreamReader source, ContentHandler sink, TransformationContext context) {
- try {
- helper.saveAsSAX(source, sink);
- source.close();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
deleted file mode 100644
index fa06303433..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.xml;
-
-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;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-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 = helper.saveAsString(source);
- source.close();
- return str;
- } catch (XMLStreamException e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- protected Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java b/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java
deleted file mode 100644
index 22b173dce5..0000000000
--- a/tags/java/sca/2.0-M4-RC3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.xml;
-
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * A DataBinding for the XML string
- *
- * @version $Rev$ $Date$
- */
-public class XMLStringDataBinding extends BaseDataBinding {
- public static final String NAME = String.class.getName();
-
- public XMLStringDataBinding() {
- super(NAME, String.class);
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (type.getPhysical() == String.class && NAME.equals(type.getDataBinding())) {
- type.setDataBinding(NAME);
- type.setLogical(XMLType.UNKNOWN);
- return true;
- } else {
- return false;
- }
- }
-}