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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEvent(Date startDateTime, Date endDateTime, String captureAgentId, Set<String> userIds, org.opencastproject.mediapackage.MediaPackage mediaPackage, Map<String, String> wfProperties, Map<String, String> caMetadata, Optional<String> schedulingSource) Creates new event using specified mediapackage, workflow configuration and capture agent configuration.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, Optional<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.Generates calendar for specified capture agent.getCaptureAgentConfiguration(String mediaPackageId) Retrieves capture agent configuration for specified event.Optional<org.opencastproject.mediapackage.MediaPackage> getCurrentRecording(String captureAgentId) Retrieves the currently active recording for the given capture agent (if any).org.opencastproject.metadata.dublincore.DublinCoreCataloggetDublinCore(String mediaPackageId) Retrieves dublin core catalog associated with specified event ID.intReturns the number of scheduled events.Gets the state of all recordings in the system.org.opencastproject.mediapackage.MediaPackagegetMediaPackage(String mediaPackageId) Retrieves mediapackage associated with specified event ID.getRecordingState(String mediaPackageId) Gets the state of a recording, if it exists.getScheduleLastModified(String captureAgentId) Returns hash of last modification of event belonging to specified capture agent.getTechnicalMetadata(String mediaPackageId) Retrieves the technical metadata associated with specified event ID.Optional<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.voidremoveEvent(String mediaPackageId) Removes event with specified ID.voidremoveRecording(String mediaPackageId) Removes a recording from the system, if the recording exists.voidremoveScheduledRecordingsBeforeBuffer(long buffer) Remove all of the scheduled events before a buffer.List<org.opencastproject.mediapackage.MediaPackage> search(Optional<String> captureAgentId, Optional<Date> startsFrom, Optional<Date> startsTo, Optional<Date> endFrom, Optional<Date> endTo) Retrieves all events matching given filter.voidupdateEvent(String mediaPackageId, Optional<Date> startDateTime, Optional<Date> endDateTime, Optional<String> captureAgentId, Optional<Set<String>> userIds, Optional<org.opencastproject.mediapackage.MediaPackage> mediaPackage, Optional<Map<String, String>> wfProperties, Optional<Map<String, String>> caMetadata) Updates event with specified ID and check for conflicts.voidupdateEvent(String mediaPackageId, Optional<Date> startDateTime, Optional<Date> endDateTime, Optional<String> captureAgentId, Optional<Set<String>> userIds, Optional<org.opencastproject.mediapackage.MediaPackage> mediaPackage, Optional<Map<String, String>> wfProperties, Optional<Map<String, String>> caMetadata, boolean allowConflict) Updates event with specified ID and possibly checking for conflicts.booleanupdateRecordingState(String mediaPackageId, String state) Updates the state of a recording with the given state, if it exists.
-
Field Details
-
JOB_TYPE
Identifier for service registration and location- See Also:
-
WORKFLOW_CONFIG_PREFIX
The workflow configuration prefix- See Also:
-
-
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, throws org.opencastproject.security.api.UnauthorizedException, SchedulerConflictException, SchedulerExceptionString> caMetadata, Optional<String> schedulingSource) 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 iduserIds- the list of user identifiers of speakers/lecturersmediaPackage- the mediapackagewfProperties- the workflow configurationcaMetadata- the capture agent configurationschedulingSource- 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 actionSchedulerConflictException- if there are conflicting eventsSchedulerException- 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, throws org.opencastproject.security.api.UnauthorizedException, SchedulerConflictException, SchedulerExceptionString> caMetadata, Optional<String> schedulingSource) 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- theRRulefor the events to schedulestart- the start date for the recurrenceend- the end date for the recurrenceduration- the duration of the eventstz- theTimeZonefor the eventscaptureAgentId- the capture agent iduserIds- the list of user identifiers of speakers/lecturerstemplateMp- the mediapackage to base the events onwfProperties- the workflow configurationcaMetadata- the capture agent configurationschedulingSource- the optional scheduling source from which the event comes from- Returns:
- A
Mapof mediapackage ID andPeriodwhere the event occurs - Throws:
org.opencastproject.security.api.UnauthorizedException- if the caller is not authorized to take this actionSchedulerConflictException- if there are conflicting eventsSchedulerException- if creating new events failed
-
updateEvent
void updateEvent(String mediaPackageId, Optional<Date> startDateTime, Optional<Date> endDateTime, Optional<String> captureAgentId, Optional<Set<String>> userIds, Optional<org.opencastproject.mediapackage.MediaPackage> mediaPackage, Optional<Map<String, String>> wfProperties, Optional<Map<String, throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerConflictException, SchedulerExceptionString>> caMetadata) 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 identifierstartDateTime- the optional event start timeendDateTime- the optional event end timecaptureAgentId- the optional capture agent iduserIds- the optional list of user identifiers of speakers/lecturersmediaPackage- the optional mediapackage to updatewfProperties- the optional workflow configuration to updatecaMetadata- the optional capture configuration to update- Throws:
org.opencastproject.util.NotFoundException- if event with specified ID cannot be foundorg.opencastproject.security.api.UnauthorizedException- if the current user is not authorized to perform this actionSchedulerConflictException- if there are conflicting eventsSchedulerException- if exception occurred
-
updateEvent
void updateEvent(String mediaPackageId, Optional<Date> startDateTime, Optional<Date> endDateTime, Optional<String> captureAgentId, Optional<Set<String>> userIds, Optional<org.opencastproject.mediapackage.MediaPackage> mediaPackage, Optional<Map<String, String>> wfProperties, Optional<Map<String, throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException, SchedulerConflictException, SchedulerExceptionString>> caMetadata, boolean allowConflict) 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 identifierstartDateTime- the optional event start timeendDateTime- the optional event end timecaptureAgentId- the optional capture agent iduserIds- the optional list of user identifiers of speakers/lecturersmediaPackage- the optional mediapackage to updatewfProperties- the optional workflow configuration to updatecaMetadata- the optional capture configuration to updateallowConflict- the flag to ignore conflict checks- Throws:
org.opencastproject.util.NotFoundException- if event with specified ID cannot be foundorg.opencastproject.security.api.UnauthorizedException- if the current user is not authorized to perform this actionSchedulerConflictException- if there are conflicting eventsSchedulerException- 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 foundorg.opencastproject.security.api.UnauthorizedException- if the current user is not authorized to perform this actionSchedulerException- 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:
MediaPackagefor specified event- Throws:
org.opencastproject.util.NotFoundException- if event with specified ID cannot be foundSchedulerException- if exception occurredorg.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:
DublinCoreCatalogfor specified event- Throws:
org.opencastproject.util.NotFoundException- if event with specified ID cannot be foundSchedulerException- if exception occurredorg.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:
TechnicalMetadatafor specified event- Throws:
org.opencastproject.util.NotFoundException- if event with specified ID cannot be foundSchedulerException- if exception occurredorg.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 foundSchedulerException- if exception occurredorg.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 foundSchedulerException- if exception occurredorg.opencastproject.security.api.UnauthorizedException
-
getEventCount
int getEventCount() throws SchedulerException, org.opencastproject.security.api.UnauthorizedExceptionReturns the number of scheduled events.- Returns:
- the number of scheduled events
- Throws:
SchedulerException- if exception occurredorg.opencastproject.security.api.UnauthorizedException
-
search
List<org.opencastproject.mediapackage.MediaPackage> search(Optional<String> captureAgentId, Optional<Date> startsFrom, Optional<Date> startsTo, Optional<Date> endFrom, Optional<Date> endTo) throws SchedulerException, org.opencastproject.security.api.UnauthorizedException Retrieves all events matching given filter.- Parameters:
captureAgentId- the capture agent id filterstartsFrom- the start from date filterstartsTo- the start to date filterendFrom- the end from date filterendTo- the end to date filter- Returns:
- a
MediaPackagelist of matching events - Throws:
SchedulerException- if exception occurredorg.opencastproject.security.api.UnauthorizedException
-
getCurrentRecording
Optional<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
Optional<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 forstartDate- start date of conflicting periodendDate- end date of conflicting period- Returns:
- a
MediaPackagelist of all conflicting events - Throws:
SchedulerException- if exception occurredorg.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 forrrule- recurrence rulestartDate- beginning of periodendDate- ending of periodduration- duration of each periodtimezone- the time zone of the capture agent- Returns:
- a
MediaPackagelist of all conflicting events - Throws:
SchedulerException- if exception occurredorg.opencastproject.security.api.UnauthorizedException
-
getCalendar
String getCalendar(Optional<String> captureAgentId, Optional<String> seriesId, Optional<Date> cutoff) throws SchedulerException Generates calendar for specified capture agent.- Parameters:
captureAgentId- capture agent id filterseriesId- series id filtercutoff- cutoff date filter- Returns:
- generated calendar
- Throws:
SchedulerException- if exception occurred
-
getScheduleLastModified
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 fromRecording.- Throws:
org.opencastproject.util.NotFoundException- if the recording with the given id has not been foundSchedulerException
-
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 foundSchedulerException
-
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 foundSchedulerException
-
getKnownRecordings
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:
SchedulerExceptionorg.opencastproject.security.api.UnauthorizedException
-