001/*
002 * (C) Copyright 2015 Nuxeo SA (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-2.1.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 *      Nelson Silva
016 */
017
018package org.nuxeo.ecm.media.publishing;
019
020import org.nuxeo.ecm.media.publishing.adapter.PublishableMedia;
021import org.nuxeo.ecm.media.publishing.upload.MediaPublishingProgressListener;
022
023import java.io.IOException;
024import java.util.List;
025import java.util.Map;
026
027/**
028 * Interface to be implemented by Media Publishing Providers.
029 *
030 * @since 7.3
031 */
032public interface MediaPublishingProvider {
033
034    /**
035     * Upload the media
036     */
037    String upload(PublishableMedia media, MediaPublishingProgressListener progressListener, String account, Map<String, String> options) throws IOException;
038
039    /**
040     * Unpublish the media
041     *
042     * @since 7.4
043     */
044    boolean unpublish(PublishableMedia media) throws IOException;
045
046    /**
047     * Retrieve the URL for the published media
048     */
049    String getPublishedUrl(String mediaId, String account);
050
051    /**
052     * Retrieve the HTML code for embedding the media
053     */
054    String getEmbedCode(String mediaId, String account);
055
056    /**
057     * Retrieve a map of statistics (depends on the provider)
058     */
059    Map<String, String> getStats(String mediaId, String account);
060
061    /**
062     * Checks if the provider is available
063     */
064    boolean isAvailable();
065
066    /**
067     * Checks it the given {@link PublishableMedia} is acessible
068     */
069    boolean isMediaAvailable(PublishableMedia media);
070
071    /**
072     * Checks if a media is published by the provider
073     */
074    boolean isMediaPublished(String mediaId, String account);
075}