001/*
002 * Copyright 2002-2009 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.oxm.mime;
018
019import java.io.IOException;
020
021import javax.xml.transform.Source;
022
023import org.springframework.lang.Nullable;
024import org.springframework.oxm.Unmarshaller;
025import org.springframework.oxm.XmlMappingException;
026
027/**
028 * Subinterface of {@link org.springframework.oxm.Unmarshaller} that can use MIME attachments
029 * to optimize storage of binary data. Attachments can be added as MTOM, XOP, or SwA.
030 *
031 * @author Arjen Poutsma
032 * @since 3.0
033 * @see <a href="https://www.w3.org/TR/2004/WD-soap12-mtom-20040608/">SOAP Message Transmission Optimization Mechanism</a>
034 * @see <a href="https://www.w3.org/TR/2005/REC-xop10-20050125/">XML-binary Optimized Packaging</a>
035 */
036public interface MimeUnmarshaller extends Unmarshaller {
037
038        /**
039         * Unmarshals the given provided {@link Source} into an object graph,
040         * reading binary attachments from a {@link MimeContainer}.
041         * @param source the source to marshal from
042         * @param mimeContainer the MIME container to read extracted binary content from
043         * @return the object graph
044         * @throws XmlMappingException if the given source cannot be mapped to an object
045         * @throws IOException if an I/O Exception occurs
046         */
047        Object unmarshal(Source source, @Nullable MimeContainer mimeContainer) throws XmlMappingException, IOException;
048
049}