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