1 17 package org.apache.servicemix.components.activesoap; 18 19 import java.io.Writer ; 20 21 import javax.jbi.messaging.MessagingException; 22 import javax.jbi.messaging.NormalizedMessage; 23 import javax.xml.stream.XMLStreamException; 24 import javax.xml.stream.XMLStreamReader; 25 import javax.xml.stream.XMLStreamWriter; 26 import javax.xml.transform.Source ; 27 28 import org.apache.servicemix.jbi.jaxp.StringSource; 29 import org.codehaus.activesoap.MessageExchange; 30 import org.codehaus.activesoap.util.XMLStreamFactory; 31 32 35 public class ASMarshaler { 36 37 private XMLStreamFactory streamFactory = new XMLStreamFactory(); 38 39 public void setContent(NormalizedMessage message, String xml) throws MessagingException { 40 message.setContent(new StringSource(xml)); 41 } 42 43 public XMLStreamReader createStreamReader(NormalizedMessage message) throws XMLStreamException { 44 Source content = message.getContent(); 45 return streamFactory.getInputFactory().createXMLStreamReader(content); 46 } 47 48 49 public XMLStreamWriter createStreamWriter(Writer writer) throws XMLStreamException { 50 return streamFactory.getOutputFactory().createXMLStreamWriter(writer); 51 } 52 53 56 public void fromNMS(MessageExchange asExchange, NormalizedMessage normalizedMessage) { 57 } 58 59 62 public void toNMS(NormalizedMessage normalizedMessage, MessageExchange asExchange) { 63 } 64 65 66 public XMLStreamFactory getStreamFactory() { 69 return streamFactory; 70 } 71 72 public void setStreamFactory(XMLStreamFactory streamFactory) { 73 this.streamFactory = streamFactory; 74 } 75 } 76 | Popular Tags |