diff options
Diffstat (limited to 'branches/sca-java-M2/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.java')
-rw-r--r-- | branches/sca-java-M2/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.java | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/branches/sca-java-M2/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.java b/branches/sca-java-M2/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.java deleted file mode 100644 index 34fbdf8c6f..0000000000 --- a/branches/sca-java-M2/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.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.core.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.spi.databinding.PushTransformer; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.databinding.TransformationException; -import org.apache.tuscany.spi.databinding.Transformer; -import org.apache.tuscany.spi.databinding.extension.TransformerExtension; -import org.osoa.sca.annotations.Service; -import org.w3c.dom.Node; - -/** - * Push DOM Node to OutputStream - */ -@Service(Transformer.class) -public class Node2OutputStream extends TransformerExtension<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); - } - } - - public Class getSourceType() { - return Node.class; - } - - public Class getTargetType() { - return OutputStream.class; - } - - public int getWeight() { - return 40; - } - -} |