1 package org.codehaus.xfire.message; 2 3 import javax.xml.stream.XMLStreamReader; 4 import javax.xml.stream.XMLStreamWriter; 5 6 import org.codehaus.xfire.MessageContext; 7 import org.codehaus.xfire.handler.SoapHandler; 8 import org.codehaus.xfire.service.object.ObjectService; 9 import org.codehaus.xfire.service.object.Operation; 10 import org.codehaus.xfire.type.TypeMapping; 11 12 /*** 13 * Basic message bridging functionality. 14 * 15 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a> 16 */ 17 public abstract class AbstractMessageBridge 18 implements MessageBridge 19 { 20 private ObjectService service; 21 22 private MessageContext context; 23 24 private XMLStreamReader request; 25 26 protected Operation operation; 27 28 public AbstractMessageBridge() 29 { 30 } 31 32 public AbstractMessageBridge(MessageContext context) 33 { 34 this.service = (ObjectService) context.getService(); 35 this.context = context; 36 this.request = context.getXMLStreamReader(); 37 } 38 39 /*** 40 * @return Returns the typeMappingRegistry. 41 */ 42 public TypeMapping getTypeMapping() 43 { 44 return service.getTypeMapping(); 45 } 46 47 /*** 48 * @return Returns the service. 49 */ 50 public ObjectService getService() 51 { 52 return service; 53 } 54 55 /*** 56 * @return Returns the context. 57 */ 58 public MessageContext getContext() 59 { 60 return context; 61 } 62 63 /*** 64 * @param context 65 * The context to set. 66 */ 67 public void setContext(MessageContext context) 68 { 69 this.context = context; 70 } 71 72 public XMLStreamReader getRequestReader() 73 { 74 return request; 75 } 76 77 /*** 78 * @return Returns the response body. 79 */ 80 public XMLStreamWriter getResponseWriter() 81 { 82 return (XMLStreamWriter) context.getProperty(SoapHandler.STAX_WRITER_KEY); 83 } 84 85 /*** 86 * @see org.codehaus.xfire.message.MessageBridge#getOperation() 87 */ 88 public Operation getOperation() 89 { 90 return operation; 91 } 92 93 /*** 94 * @param operation 95 * The operation to set. 96 */ 97 public void setOperation(Operation operation) 98 { 99 this.operation = operation; 100 } 101 }