1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.xml.internal.ws.api.message;
  27 
  28 import com.sun.istack.internal.NotNull;
  29 import com.sun.istack.internal.Nullable;
  30 import com.sun.xml.internal.bind.api.Bridge;
  31 import com.sun.xml.internal.ws.api.SOAPVersion;
  32 import com.sun.xml.internal.ws.api.WSBinding;
  33 import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
  34 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
  35 import com.sun.xml.internal.ws.spi.db.XMLBridge;
  36 
  37 import org.xml.sax.ContentHandler;
  38 import org.xml.sax.ErrorHandler;
  39 import org.xml.sax.SAXException;
  40 
  41 import javax.xml.bind.JAXBException;
  42 import javax.xml.bind.Unmarshaller;
  43 import javax.xml.namespace.QName;
  44 import javax.xml.soap.SOAPException;
  45 import javax.xml.soap.SOAPMessage;
  46 import javax.xml.stream.XMLStreamException;
  47 import javax.xml.stream.XMLStreamReader;
  48 import javax.xml.stream.XMLStreamWriter;
  49 import javax.xml.transform.Source;
  50 
  51 /**
  52  * A <code>FilterMessageImpl</code> contains some other Message, which it uses
  53  * as its  basic source of message data, possibly transforming the data along
  54  * the way or providing  additional functionality.
  55  *
  56  * <p>
  57  * The class <code>FilterMessageImpl</code> itself simply overrides
  58  * all the methods of <code>Message</code> and invokes them on
  59  * contained Message delegate. Subclasses of <code>FilterMessageImpl</code>
  60  * may further override some of  these methods and may also provide
  61  * additional methods and fields.
  62  *
  63  * @author Jitendra Kotamraju
  64  */
  65 public class FilterMessageImpl extends Message {
  66     private final Message delegate;
  67 
  68     protected FilterMessageImpl(Message delegate) {
  69         this.delegate = delegate;
  70     }
  71 
  72     public boolean hasHeaders() {
  73         return delegate.hasHeaders();
  74     }
  75 
  76     public @NotNull MessageHeaders getHeaders() {
  77         return delegate.getHeaders();
  78     }
  79 
  80     public @NotNull AttachmentSet getAttachments() {
  81         return delegate.getAttachments();
  82     }
  83 
  84     protected boolean hasAttachments() {
  85         return delegate.hasAttachments();
  86     }
  87 
  88     public boolean isOneWay(@NotNull WSDLPort port) {
  89         return delegate.isOneWay(port);
  90     }
  91 
  92     public @Nullable String getPayloadLocalPart() {
  93         return delegate.getPayloadLocalPart();
  94     }
  95 
  96     public String getPayloadNamespaceURI() {
  97         return delegate.getPayloadNamespaceURI();
  98     }
  99 
 100     public boolean hasPayload() {
 101         return delegate.hasPayload();
 102     }
 103 
 104     public boolean isFault() {
 105         return delegate.isFault();
 106     }
 107 
 108     public @Nullable QName getFirstDetailEntryName() {
 109         return delegate.getFirstDetailEntryName();
 110     }
 111 
 112     public Source readEnvelopeAsSource() {
 113         return delegate.readEnvelopeAsSource();
 114     }
 115 
 116     public Source readPayloadAsSource() {
 117         return delegate.readPayloadAsSource();
 118     }
 119 
 120     public SOAPMessage readAsSOAPMessage() throws SOAPException {
 121         return delegate.readAsSOAPMessage();
 122     }
 123 
 124     public SOAPMessage readAsSOAPMessage(Packet packet, boolean inbound) throws SOAPException {
 125         return delegate.readAsSOAPMessage(packet, inbound);
 126     }
 127 
 128     public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
 129         return (T)delegate.readPayloadAsJAXB(unmarshaller);
 130     }
 131     /** @deprecated */
 132     public <T> T readPayloadAsJAXB(Bridge<T> bridge) throws JAXBException {
 133         return delegate.readPayloadAsJAXB(bridge);
 134     }
 135 
 136     public <T> T readPayloadAsJAXB(XMLBridge<T> bridge) throws JAXBException {
 137         return delegate.readPayloadAsJAXB(bridge);
 138     }
 139 
 140     public XMLStreamReader readPayload() throws XMLStreamException {
 141         return delegate.readPayload();
 142     }
 143 
 144     public void consume() {
 145         delegate.consume();
 146     }
 147 
 148     public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException {
 149         delegate.writePayloadTo(sw);
 150     }
 151 
 152     public void writeTo(XMLStreamWriter sw) throws XMLStreamException {
 153         delegate.writeTo(sw);
 154     }
 155 
 156     public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
 157         delegate.writeTo(contentHandler, errorHandler);
 158     }
 159 
 160     public Message copy() {
 161         return delegate.copy();
 162     }
 163 
 164     public @NotNull String getID(@NotNull WSBinding binding) {
 165         return delegate.getID(binding);
 166     }
 167 
 168     public @NotNull String getID(AddressingVersion av, SOAPVersion sv) {
 169         return delegate.getID(av, sv);
 170     }
 171 
 172     public SOAPVersion getSOAPVersion() {
 173         return delegate.getSOAPVersion();
 174     }
 175 }