001/*
002 * (C) Copyright 2010 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 * Contributors:
014 * Nuxeo - initial API and implementation
015 */
016
017package org.nuxeo.ecm.platform.rendition.extension;
018
019import java.util.List;
020
021import org.nuxeo.ecm.core.api.Blob;
022import org.nuxeo.ecm.core.api.DocumentModel;
023import org.nuxeo.ecm.platform.rendition.Rendition;
024import org.nuxeo.ecm.platform.rendition.service.RenditionDefinition;
025
026/**
027 * Interface to hide providers of {@link Rendition}. A provider could be converter based, template based, or Automation
028 * based
029 *
030 * @since 5.6
031 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a>
032 */
033public interface RenditionProvider {
034
035    /**
036     * Test if the Rendition is available on the given DocumentModel
037     */
038    boolean isAvailable(DocumentModel doc, RenditionDefinition definition);
039
040    /**
041     * Generate the rendition Blobs for a given {@link RenditionDefinition}. Return is a List of Blob for bigger
042     * flexibility (typically HTML rendition with resources)
043     *
044     * @param doc the target {@link DocumentModel}
045     * @param definition the {@link RenditionDefinition} to use
046     * @return The list of Blobs
047     */
048    List<Blob> render(DocumentModel doc, RenditionDefinition definition);
049
050}