View Javadoc
1   /*
2    * Licensed to The Apereo Foundation under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional
4    * information regarding copyright ownership.
5    *
6    *
7    * The Apereo Foundation licenses this file to you under the Educational
8    * Community License, Version 2.0 (the "License"); you may not use this file
9    * except in compliance with the License. You may obtain a copy of the License
10   * at:
11   *
12   *   http://opensource.org/licenses/ecl2.txt
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
17   * License for the specific language governing permissions and limitations under
18   * the License.
19   *
20   */
21  
22  package org.opencastproject.publication.api;
23  
24  import org.opencastproject.job.api.Job;
25  import org.opencastproject.mediapackage.MediaPackage;
26  import org.opencastproject.mediapackage.MediaPackageElement;
27  import org.opencastproject.mediapackage.MediaPackageException;
28  import org.opencastproject.mediapackage.Publication;
29  
30  import java.util.Collection;
31  import java.util.Set;
32  
33  public interface ConfigurablePublicationService {
34  
35    String JOB_TYPE = "org.opencastproject.publication.configurable";
36  
37    /**
38     * Replaces media package elements.
39     *
40     * @param mediaPackage
41     *          the media package
42     * @param channelId
43     *          the id of the publication channel
44     * @param addElements
45     *          the media package elements to be added
46     * @param retractElementIds
47     *          the ids of the media package elements to be removed
48     * @return The job
49     * @throws PublicationException
50     *           if there was a problem publishing the media
51     * @throws MediaPackageException
52     *           if there was a problem with the mediapackage element
53     */
54    Job replace(
55        MediaPackage mediaPackage,
56        String channelId,
57        Collection<? extends MediaPackageElement> addElements,
58        Set<String> retractElementIds
59    ) throws PublicationException, MediaPackageException;
60  
61    /**
62     * Synchronously replaces media package elements.
63     *
64     * @param mediaPackage
65     *          the media package
66     * @param channelId
67     *          the id of the publication channel
68     * @param addElements
69     *          the media package elements to be added
70     * @param retractElementIds
71     *          the ids of the media package elements to be removed
72     * @return The publication with the updated media package.
73     * @throws PublicationException
74     *           if there was a problem publishing the media
75     * @throws MediaPackageException
76     *           if there was a problem with the mediapackage element
77     */
78    Publication replaceSync(
79        MediaPackage mediaPackage,
80        String channelId, Collection<? extends MediaPackageElement> addElements,
81        Set<String> retractElementIds
82    ) throws PublicationException, MediaPackageException;
83  }