001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
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 *     http://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 * Contributors:
017 *     dragos
018 *
019 * $Id$
020 */
021
022package org.nuxeo.ecm.platform.rendering;
023
024import java.io.InputStream;
025import java.io.Serializable;
026
027import org.nuxeo.runtime.model.Adaptable;
028
029/**
030 * A rendering result is an object that wraps a rendering result and give several methods to retrieve the rendering
031 * outcome.
032 * <p>
033 * The default one is to expose the rendering outcome as a stream.
034 * <p>
035 * Specialized results may be retrieved using {@link Adaptable#getAdapter(Class)} method
036 *
037 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
038 * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
039 */
040public interface RenderingResult extends Adaptable, Serializable {
041
042    /**
043     * Gets the format name of the result. This can be use to identify the type of the result. The format name can be a
044     * mime type or any application-defined format.
045     *
046     * @return the format name
047     */
048    String getFormatName();
049
050    /**
051     * Gets the rendering result as a stream.
052     *
053     * @return the stream or null if the outcome cannot be expressed as a stream
054     */
055    InputStream getStream();
056
057    /**
058     * Gets the rendering result object.
059     *
060     * @return the rendering result. must never be null
061     */
062    Object getOutcome();
063
064}