Interface SchedulerService


public interface SchedulerService
Scheduler service manages events (creates new, updates already existing and removes events). It enables searches over existing events, retrieving event data like dublincore, acl or workflow configuration for specific event, search for conflicting events and generating calendar for capture agent.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Identifier for service registration and location
    static final String
    The workflow configuration prefix
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEvent(Date startDateTime, Date endDateTime, String captureAgentId, Set<String> userIds, org.opencastproject.mediapackage.MediaPackage mediaPackage, Map<String,String> wfProperties, Map<String,String> caMetadata, com.entwinemedia.fn.data.Opt<String> schedulingSource)
    Creates new event using specified mediapackage, workflow configuration and capture agent configuration.
    Map<String,net.fortuna.ical4j.model.Period>
    addMultipleEvents(net.fortuna.ical4j.model.property.RRule rRule, Date start, Date end, Long duration, TimeZone tz, String captureAgentId, Set<String> userIds, org.opencastproject.mediapackage.MediaPackage templateMp, Map<String,String> wfProperties, Map<String,String> caMetadata, com.entwinemedia.fn.data.Opt<String> schedulingSource)
    Creates a group of new event using specified mediapackage, workflow configuration and capture agent configuration.
    List<org.opencastproject.mediapackage.MediaPackage>
    findConflictingEvents(String captureDeviceID, Date startDate, Date endDate)
    Returns list of all conflicting events, i.e. all events that ends after start date and begins before end date.
    List<org.opencastproject.mediapackage.MediaPackage>
    findConflictingEvents(String captureAgentId, net.fortuna.ical4j.model.property.RRule rrule, Date startDate, Date endDate, long duration, TimeZone timezone)
    Returns list of all conflicting events.
    getCalendar(com.entwinemedia.fn.data.Opt<String> captureAgentId, com.entwinemedia.fn.data.Opt<String> seriesId, com.entwinemedia.fn.data.Opt<Date> cutoff)
    Generates calendar for specified capture agent.
    Retrieves capture agent configuration for specified event.
    com.entwinemedia.fn.data.Opt<org.opencastproject.mediapackage.MediaPackage>
    getCurrentRecording(String captureAgentId)
    Retrieves the currently active recording for the given capture agent (if any).
    org.opencastproject.metadata.dublincore.DublinCoreCatalog
    getDublinCore(String mediaPackageId)
    Retrieves dublin core catalog associated with specified event ID.
    int
    Returns the number of scheduled events.
    Gets the state of all recordings in the system.
    org.opencastproject.mediapackage.MediaPackage
    getMediaPackage(String mediaPackageId)
    Retrieves mediapackage associated with specified event ID.
    getRecordingState(String mediaPackageId)
    Gets the state of a recording, if it exists.
    Returns hash of last modification of event belonging to specified capture agent.
    getTechnicalMetadata(String mediaPackageId)
    Retrieves the technical metadata associated with specified event ID.
    com.entwinemedia.fn.data.Opt<org.opencastproject.mediapackage.MediaPackage>
    getUpcomingRecording(String captureAgentId)
    Retrieves the upcoming recording for the given capture agent (if any).
    getWorkflowConfig(String mediaPackageId)
    Retrieves workflow configuration associated with specified event ID.
    void
    removeEvent(String mediaPackageId)
    Removes event with specified ID.
    void
    removeRecording(String mediaPackageId)
    Removes a recording from the system, if the recording exists.
    void
    Remove all of the scheduled events before a buffer.
    List<org.opencastproject.mediapackage.MediaPackage>
    search(com.entwinemedia.fn.data.Opt<String> captureAgentId, com.entwinemedia.fn.data.Opt<Date> startsFrom, com.entwinemedia.fn.data.Opt<Date> startsTo, com.entwinemedia.fn.data.Opt<Date> endFrom, com.entwinemedia.fn.data.Opt<Date> endTo)
    Retrieves all events matching given filter.
    void
    updateEvent(String mediaPackageId, com.entwinemedia.fn.data.Opt<Date> startDateTime, com.entwinemedia.fn.data.Opt<Date> endDateTime, com.entwinemedia.fn.data.Opt<String> captureAgentId, com.entwinemedia.fn.data.Opt<Set<String>> userIds, com.entwinemedia.fn.data.Opt<org.opencastproject.mediapackage.MediaPackage> mediaPackage, com.entwinemedia.fn.data.Opt<Map<String,String>> wfProperties, com.entwinemedia.fn.data.Opt<Map<String,String>> caMetadata)
    Updates event with specified ID and check for conflicts.
    void
    updateEvent(String mediaPackageId, com.entwinemedia.fn.data.Opt<Date> startDateTime, com.entwinemedia.fn.data.Opt<Date> endDateTime, com.entwinemedia.fn.data.Opt<String> captureAgentId, com.entwinemedia.fn.data.Opt<Set<String>> userIds, com.entwinemedia.fn.data.Opt<org.opencastproject.mediapackage.MediaPackage> mediaPackage, com.entwinemedia.fn.data.Opt<Map<String,String>> wfProperties, com.entwinemedia.fn.data.Opt<Map<String,String>> caMetadata, boolean allowConflict)
    Updates event with specified ID and possibly checking for conflicts.
    boolean
    updateRecordingState(String mediaPackageId, String state)
    Updates the state of a recording with the given state, if it exists.
  • Field Details

  • Method Details

    • addEvent

      void addEvent(Date startDateTime, Date endDateTime, String captureAgentId, Set<String> userIds, org.opencastproject.mediapackage.MediaPackage mediaPackage, Map<String,String> wfProperties, Map<String,String> caMetadata, com.entwinemedia.fn.data.Opt<String> schedulingSource) throws org.opencastproject.security.api.UnauthorizedException, SchedulerConflictException, SchedulerException
      Creates new event using specified mediapackage, workflow configuration and capture agent configuration. The mediapackage id is used as the event's identifier. Default capture agent properties are created from agentId and DublinCore. Following values are generated:
      • event.title (mapped from dc:title)
      • event.series (mapped from mediaPackage#getSeries())
      • event.location (mapped from captureAgentId)
      Parameters:
      startDateTime - the event start time (the start date must be before the end date)
      endDateTime - the event end time (the end date must be after the start date)
      captureAgentId - the capture agent id
      userIds - the list of user identifiers of speakers/lecturers
      mediaPackage - the mediapackage
      wfProperties - the workflow configuration
      caMetadata - the capture agent configuration
      schedulingSource - the optional scheduling source from which the event comes from
      Throws:
      org.opencastproject.security.api.UnauthorizedException - if the caller is not authorized to take this action
      SchedulerConflictException - if there are conflicting events
      SchedulerException - if creating new events failed
    • addMultipleEvents

      Map<String,net.fortuna.ical4j.model.Period> addMultipleEvents(net.fortuna.ical4j.model.property.RRule rRule, Date start, Date end, Long duration, TimeZone tz, String captureAgentId, Set<String> userIds, org.opencastproject.mediapackage.MediaPackage templateMp, Map<String,String> wfProperties, Map<String,String> caMetadata, com.entwinemedia.fn.data.Opt<String> schedulingSource) throws org.opencastproject.security.api.UnauthorizedException, SchedulerConflictException, SchedulerException
      Creates a group of new event using specified mediapackage, workflow configuration and capture agent configuration. The mediapackage id is used as the event's identifier. Default capture agent properties are created from agentId and DublinCore. Following values are generated:
      • event.title (mapped from dc:title)
      • event.series (mapped from mediaPackage#getSeries())
      • event.location (mapped from captureAgentId)
      Parameters:
      rRule - the RRule for the events to schedule
      start - the start date for the recurrence
      end - the end date for the recurrence
      duration - the duration of the events
      tz - the TimeZone for the events
      captureAgentId - the capture agent id
      userIds - the list of user identifiers of speakers/lecturers
      templateMp - the mediapackage to base the events on
      wfProperties - the workflow configuration
      caMetadata - the capture agent configuration
      schedulingSource - the optional scheduling source from which the event comes from
      Returns:
      A Map of mediapackage ID and Period where the event occurs
      Throws:
      org.opencastproject.security.api.UnauthorizedException - if the caller is not authorized to take this action
      SchedulerConflictException - if there are conflicting events
      SchedulerException - if creating new events failed
    • updateEvent

      void updateEvent(String mediaPackageId, com.entwinemedia.fn.data.Opt<Date> startDateTime, com.entwinemedia.fn.data.Opt<Date> endDateTime, com.entwinemedia.fn.data.Opt<String> captureAgentId, com.entwinemedia.fn.data.Opt<Set<String>> userIds, com.entwinemedia.fn.data.Opt<org.opencastproject.mediapackage.MediaPackage> mediaPackage, com.entwinemedia.fn.data.Opt<Map<String,String>> wfProperties, com.entwinemedia.fn.data.Opt<Map<String,String>> caMetadata) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerConflictException, SchedulerException
      Updates event with specified ID and check for conflicts. Default capture agent properties are created from DublinCore. Following values are generated:
      • event.title (mapped from dc:title)
      • event.series (mapped from mediaPackage#getSeries())
      • event.location (mapped from captureAgentId)
      Parameters:
      mediaPackageId - the optional event identifier
      startDateTime - the optional event start time
      endDateTime - the optional event end time
      captureAgentId - the optional capture agent id
      userIds - the optional list of user identifiers of speakers/lecturers
      mediaPackage - the optional mediapackage to update
      wfProperties - the optional workflow configuration to update
      caMetadata - the optional capture configuration to update
      Throws:
      org.opencastproject.util.NotFoundException - if event with specified ID cannot be found
      org.opencastproject.security.api.UnauthorizedException - if the current user is not authorized to perform this action
      SchedulerConflictException - if there are conflicting events
      SchedulerException - if exception occurred
    • updateEvent

      void updateEvent(String mediaPackageId, com.entwinemedia.fn.data.Opt<Date> startDateTime, com.entwinemedia.fn.data.Opt<Date> endDateTime, com.entwinemedia.fn.data.Opt<String> captureAgentId, com.entwinemedia.fn.data.Opt<Set<String>> userIds, com.entwinemedia.fn.data.Opt<org.opencastproject.mediapackage.MediaPackage> mediaPackage, com.entwinemedia.fn.data.Opt<Map<String,String>> wfProperties, com.entwinemedia.fn.data.Opt<Map<String,String>> caMetadata, boolean allowConflict) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerConflictException, SchedulerException
      Updates event with specified ID and possibly checking for conflicts. Default capture agent properties are created from DublinCore. Following values are generated:
      • event.title (mapped from dc:title)
      • event.series (mapped from mediaPackage#getSeries())
      • event.location (mapped from captureAgentId)
      Parameters:
      mediaPackageId - the event identifier
      startDateTime - the optional event start time
      endDateTime - the optional event end time
      captureAgentId - the optional capture agent id
      userIds - the optional list of user identifiers of speakers/lecturers
      mediaPackage - the optional mediapackage to update
      wfProperties - the optional workflow configuration to update
      caMetadata - the optional capture configuration to update
      allowConflict - the flag to ignore conflict checks
      Throws:
      org.opencastproject.util.NotFoundException - if event with specified ID cannot be found
      org.opencastproject.security.api.UnauthorizedException - if the current user is not authorized to perform this action
      SchedulerConflictException - if there are conflicting events
      SchedulerException - if exception occurred
    • removeEvent

      void removeEvent(String mediaPackageId) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerException
      Removes event with specified ID.
      Parameters:
      mediaPackageId - the event identifier
      Throws:
      org.opencastproject.util.NotFoundException - if event with specified ID cannot be found
      org.opencastproject.security.api.UnauthorizedException - if the current user is not authorized to perform this action
      SchedulerException - if exception occurred
    • getMediaPackage

      org.opencastproject.mediapackage.MediaPackage getMediaPackage(String mediaPackageId) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerException
      Retrieves mediapackage associated with specified event ID.
      Parameters:
      mediaPackageId - ID of event for which mediapackage will be retrieved
      Returns:
      MediaPackage for specified event
      Throws:
      org.opencastproject.util.NotFoundException - if event with specified ID cannot be found
      SchedulerException - if exception occurred
      org.opencastproject.security.api.UnauthorizedException
    • getDublinCore

      org.opencastproject.metadata.dublincore.DublinCoreCatalog getDublinCore(String mediaPackageId) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerException
      Retrieves dublin core catalog associated with specified event ID.
      Parameters:
      mediaPackageId - ID of event for which DublinCore will be retrieved
      Returns:
      DublinCoreCatalog for specified event
      Throws:
      org.opencastproject.util.NotFoundException - if event with specified ID cannot be found
      SchedulerException - if exception occurred
      org.opencastproject.security.api.UnauthorizedException
    • getTechnicalMetadata

      TechnicalMetadata getTechnicalMetadata(String mediaPackageId) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerException
      Retrieves the technical metadata associated with specified event ID.
      Parameters:
      mediaPackageId - ID of event for which technical metadata will be retrieved
      Returns:
      TechnicalMetadata for specified event
      Throws:
      org.opencastproject.util.NotFoundException - if event with specified ID cannot be found
      SchedulerException - if exception occurred
      org.opencastproject.security.api.UnauthorizedException
    • getWorkflowConfig

      Map<String,String> getWorkflowConfig(String mediaPackageId) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerException
      Retrieves workflow configuration associated with specified event ID.
      Parameters:
      mediaPackageId - ID of event for which workflow configuration will be retrieved
      Returns:
      configuration of the workflow
      Throws:
      org.opencastproject.util.NotFoundException - if event with specified ID cannot be found
      SchedulerException - if exception occurred
      org.opencastproject.security.api.UnauthorizedException
    • getCaptureAgentConfiguration

      Map<String,String> getCaptureAgentConfiguration(String mediaPackageId) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerException
      Retrieves capture agent configuration for specified event.
      Parameters:
      mediaPackageId - ID of event for which capture agent configuration will be retrieved
      Returns:
      configurations of capture agent
      Throws:
      org.opencastproject.util.NotFoundException - if event with specified ID cannot be found
      SchedulerException - if exception occurred
      org.opencastproject.security.api.UnauthorizedException
    • getEventCount

      int getEventCount() throws SchedulerException, org.opencastproject.security.api.UnauthorizedException
      Returns the number of scheduled events.
      Returns:
      the number of scheduled events
      Throws:
      SchedulerException - if exception occurred
      org.opencastproject.security.api.UnauthorizedException
    • search

      List<org.opencastproject.mediapackage.MediaPackage> search(com.entwinemedia.fn.data.Opt<String> captureAgentId, com.entwinemedia.fn.data.Opt<Date> startsFrom, com.entwinemedia.fn.data.Opt<Date> startsTo, com.entwinemedia.fn.data.Opt<Date> endFrom, com.entwinemedia.fn.data.Opt<Date> endTo) throws SchedulerException, org.opencastproject.security.api.UnauthorizedException
      Retrieves all events matching given filter.
      Parameters:
      captureAgentId - the capture agent id filter
      startsFrom - the start from date filter
      startsTo - the start to date filter
      endFrom - the end from date filter
      endTo - the end to date filter
      Returns:
      a MediaPackage list of matching events
      Throws:
      SchedulerException - if exception occurred
      org.opencastproject.security.api.UnauthorizedException
    • getCurrentRecording

      com.entwinemedia.fn.data.Opt<org.opencastproject.mediapackage.MediaPackage> getCurrentRecording(String captureAgentId) throws SchedulerException, org.opencastproject.security.api.UnauthorizedException
      Retrieves the currently active recording for the given capture agent (if any).
      Parameters:
      captureAgentId - The id of the agent to get the current recording of.
      Returns:
      The currently active recording or none, if agent is currently idle
      Throws:
      SchedulerException - In case the current recording cannot be retrieved.
      org.opencastproject.security.api.UnauthorizedException
    • getUpcomingRecording

      com.entwinemedia.fn.data.Opt<org.opencastproject.mediapackage.MediaPackage> getUpcomingRecording(String captureAgentId) throws SchedulerException, org.opencastproject.security.api.UnauthorizedException
      Retrieves the upcoming recording for the given capture agent (if any).
      Parameters:
      captureAgentId - The id of the agent to get the upcoming recording of.
      Returns:
      The cupcoming recording or none, if there is none.
      Throws:
      SchedulerException - In case the upcoming recording cannot be retrieved.
      org.opencastproject.security.api.UnauthorizedException
    • findConflictingEvents

      List<org.opencastproject.mediapackage.MediaPackage> findConflictingEvents(String captureDeviceID, Date startDate, Date endDate) throws org.opencastproject.security.api.UnauthorizedException, SchedulerException
      Returns list of all conflicting events, i.e. all events that ends after start date and begins before end date.
      Parameters:
      captureDeviceID - capture device ID for which conflicting events are searched for
      startDate - start date of conflicting period
      endDate - end date of conflicting period
      Returns:
      a MediaPackage list of all conflicting events
      Throws:
      SchedulerException - if exception occurred
      org.opencastproject.security.api.UnauthorizedException
    • findConflictingEvents

      List<org.opencastproject.mediapackage.MediaPackage> findConflictingEvents(String captureAgentId, net.fortuna.ical4j.model.property.RRule rrule, Date startDate, Date endDate, long duration, TimeZone timezone) throws org.opencastproject.security.api.UnauthorizedException, SchedulerException
      Returns list of all conflicting events. Conflicting periods are calculated based on recurrence rule, start date, end date and duration of each conflicting period.
      Parameters:
      captureAgentId - capture agent ID for which conflicting events are searched for
      rrule - recurrence rule
      startDate - beginning of period
      endDate - ending of period
      duration - duration of each period
      timezone - the time zone of the capture agent
      Returns:
      a MediaPackage list of all conflicting events
      Throws:
      SchedulerException - if exception occurred
      org.opencastproject.security.api.UnauthorizedException
    • getCalendar

      String getCalendar(com.entwinemedia.fn.data.Opt<String> captureAgentId, com.entwinemedia.fn.data.Opt<String> seriesId, com.entwinemedia.fn.data.Opt<Date> cutoff) throws SchedulerException
      Generates calendar for specified capture agent.
      Parameters:
      captureAgentId - capture agent id filter
      seriesId - series id filter
      cutoff - cutoff date filter
      Returns:
      generated calendar
      Throws:
      SchedulerException - if exception occurred
    • getScheduleLastModified

      String getScheduleLastModified(String captureAgentId) throws SchedulerException
      Returns hash of last modification of event belonging to specified capture agent.
      Parameters:
      captureAgentId - the capture agent identifier
      Returns:
      the last modification hash
      Throws:
      SchedulerException - if exception occurred
    • updateRecordingState

      boolean updateRecordingState(String mediaPackageId, String state) throws org.opencastproject.util.NotFoundException, SchedulerException
      Updates the state of a recording with the given state, if it exists.
      Parameters:
      mediaPackageId - The id of the recording in the system.
      state - The state to set for that recording. This should be defined from Recording.
      Throws:
      org.opencastproject.util.NotFoundException - if the recording with the given id has not been found
      SchedulerException
    • getRecordingState

      Recording getRecordingState(String mediaPackageId) throws org.opencastproject.util.NotFoundException, SchedulerException
      Gets the state of a recording, if it exists.
      Parameters:
      mediaPackageId - The id of the recording.
      Returns:
      The state of the recording, or null if it does not exist. This should be defined from Recording.
      Throws:
      org.opencastproject.util.NotFoundException - if the recording with the given id has not been found
      SchedulerException
    • removeRecording

      void removeRecording(String mediaPackageId) throws org.opencastproject.util.NotFoundException, SchedulerException
      Removes a recording from the system, if the recording exists.
      Parameters:
      mediaPackageId - The id of the recording to remove.
      Throws:
      org.opencastproject.util.NotFoundException - if the recording with the given id has not been found
      SchedulerException
    • getKnownRecordings

      Map<String,Recording> getKnownRecordings() throws SchedulerException
      Gets the state of all recordings in the system.
      Returns:
      A map of recording-state pairs.
      Throws:
      SchedulerException
    • removeScheduledRecordingsBeforeBuffer

      void removeScheduledRecordingsBeforeBuffer(long buffer) throws org.opencastproject.security.api.UnauthorizedException, SchedulerException
      Remove all of the scheduled events before a buffer.
      Parameters:
      buffer - The number of seconds before now that defines a cutoff for events, if they have their end time before this cutoff they will be removed
      Throws:
      SchedulerException
      org.opencastproject.security.api.UnauthorizedException