001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     dragos
016 *
017 * $Id$
018 */
019
020package org.nuxeo.ecm.platform.rendering;
021
022import java.io.InputStream;
023import java.io.Serializable;
024
025import org.nuxeo.runtime.model.Adaptable;
026
027/**
028 * A rendering result is an object that wraps a rendering result and give several methods to retrieve the rendering
029 * outcome.
030 * <p>
031 * The default one is to expose the rendering outcome as a stream.
032 * <p>
033 * Specialized results may be retrieved using {@link Adaptable#getAdapter(Class)} method
034 *
035 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
036 * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
037 */
038public interface RenderingResult extends Adaptable, Serializable {
039
040    /**
041     * Gets the format name of the result. This can be use to identify the type of the result. The format name can be a
042     * mime type or any application-defined format.
043     *
044     * @return the format name
045     */
046    String getFormatName();
047
048    /**
049     * Gets the rendering result as a stream.
050     *
051     * @return the stream or null if the outcome cannot be expressed as a stream
052     */
053    InputStream getStream();
054
055    /**
056     * Gets the rendering result object.
057     *
058     * @return the rendering result. must never be null
059     */
060    Object getOutcome();
061
062}