Class SchedulerServiceImpl
java.lang.Object
org.opencastproject.elasticsearch.index.rebuild.AbstractIndexProducer
org.opencastproject.scheduler.impl.SchedulerServiceImpl
- All Implemented Interfaces:
IndexProducer,SchedulerService,org.osgi.service.cm.ManagedService
public class SchedulerServiceImpl
extends AbstractIndexProducer
implements SchedulerService, org.osgi.service.cm.ManagedService
Implementation of
SchedulerService.-
Field Summary
FieldsModifier and TypeFieldDescriptionThe last modified cacheFields inherited from interface org.opencastproject.scheduler.api.SchedulerService
JOB_TYPE, WORKFLOW_CONFIG_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) Activates Scheduler Service.voidaddCatalogUIAdapter(EventCatalogUIAdapter catalogUIAdapter) OSGi callback to addEventCatalogUIAdapterinstance.voidaddEvent(Date startDateTime, Date endDateTime, String captureAgentId, Set<String> userIds, 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, 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.voidOSGi callback to add an update handler.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.findConflictingEvents(String captureAgentId, net.fortuna.ical4j.model.property.RRule rrule, Date start, Date end, long duration, TimeZone tz) Returns list of all conflicting events.Generates calendar for specified capture agent.getCaptureAgentConfiguration(String mediaPackageId) Retrieves capture agent configuration for specified event.getCurrentRecording(String captureAgentId) Retrieves the currently active recording for the given capture agent (if any).getDublinCore(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.getMediaPackage(String mediaPackageId) Retrieves mediapackage associated with specified event ID.Gets the state of a recording, if it exists.getScheduleLastModified(String captureAgentId) Returns hash of last modification of event belonging to specified capture agent.Get the service that implements IndexProducer.getTechnicalMetadata(String mediaPackageId) Retrieves the technical metadata associated with specified event ID.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.voidremoveCatalogUIAdapter(EventCatalogUIAdapter catalogUIAdapter) OSGi callback to removeEventCatalogUIAdapterinstance.voidremoveEvent(String mediaPackageId) Removes event with specified ID.voidRemoves a recording from the system, if the recording exists.voidremoveScheduledRecordingsBeforeBuffer(long buffer) Remove all of the scheduled events before a buffer.voidvoidRe-add the data of this service to the index.search(Optional<String> captureAgentId, Optional<Date> startsFrom, Optional<Date> startsTo, Optional<Date> endFrom, Optional<Date> endTo) Retrieves all events matching given filter.voidsetAssetManager(AssetManager assetManager) OSGi callback to set the asset manager.voidsetAuthorizationService(AuthorizationService authorizationService) OSGi callback to set the authorization service.voidsetIndex(ElasticsearchIndex index) OSgi callback to set the Elasticsearch index.voidsetOrgDirectoryService(OrganizationDirectoryService orgDirectoryService) OSGi callback to set the organization directory service.voidsetPersistence(SchedulerServiceDatabase persistence) OSGi callback to set Persistence Service.voidsetSecurityService(SecurityService securityService) OSGi callback to set security service.voidsetSeriesService(SeriesService seriesService) OSGi callback for setting Series Service.voidsetWorkspace(Workspace workspace) OSGi callback to set the workspace.voidupdated(Dictionary<String, ?> properties) voidupdateEvent(String mpId, Optional<Date> startDateTime, Optional<Date> endDateTime, Optional<String> captureAgentId, Optional<Set<String>> userIds, Optional<MediaPackage> mediaPackage, Optional<Map<String, String>> wfProperties, Optional<Map<String, String>> caMetadata) Updates event with specified ID and check for conflicts.voidupdateEvent(String mpId, Optional<Date> startDateTime, Optional<Date> endDateTime, Optional<String> captureAgentId, Optional<Set<String>> userIds, Optional<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 id, String state) Updates the state of a recording with the given state, if it exists.Methods inherited from class org.opencastproject.elasticsearch.index.rebuild.AbstractIndexProducer
logIndexRebuildBegin, logIndexRebuildBegin, logIndexRebuildError, logIndexRebuildError, logIndexRebuildError, logIndexRebuildProgress, logIndexRebuildProgress, logIndexRebuildProgress, logIndexRebuildProgress, logSkippingElement, logSkippingElementMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opencastproject.elasticsearch.index.rebuild.IndexProducer
dataTypeSupported, getSupportedDataTypes
-
Field Details
-
lastModifiedCache
The last modified cache
-
-
Constructor Details
-
SchedulerServiceImpl
public SchedulerServiceImpl()
-
-
Method Details
-
addSchedulerUpdateHandler
OSGi callback to add an update handler.- Parameters:
handler-
-
removeSchedulerUpdateHandler
-
setPersistence
OSGi callback to set Persistence Service.- Parameters:
persistence-
-
setSeriesService
OSGi callback for setting Series Service.- Parameters:
seriesService-
-
setSecurityService
OSGi callback to set security service.- Parameters:
securityService-
-
setAssetManager
OSGi callback to set the asset manager.- Parameters:
assetManager-
-
setWorkspace
OSGi callback to set the workspace.- Parameters:
workspace-
-
setAuthorizationService
OSGi callback to set the authorization service.- Parameters:
authorizationService-
-
setOrgDirectoryService
OSGi callback to set the organization directory service.- Parameters:
orgDirectoryService-
-
setIndex
OSgi callback to set the Elasticsearch index.- Parameters:
index- the Elasticsearch index.
-
addCatalogUIAdapter
OSGi callback to addEventCatalogUIAdapterinstance. -
removeCatalogUIAdapter
OSGi callback to removeEventCatalogUIAdapterinstance. -
activate
Activates Scheduler Service.- Parameters:
cc- ComponentContext- Throws:
Exception
-
updated
public void updated(Dictionary<String, ?> properties) throws org.osgi.service.cm.ConfigurationException- Specified by:
updatedin interfaceorg.osgi.service.cm.ManagedService- Throws:
org.osgi.service.cm.ConfigurationException
-
addEvent
public void addEvent(Date startDateTime, Date endDateTime, String captureAgentId, Set<String> userIds, MediaPackage mediaPackage, Map<String, String> wfProperties, Map<String, throws UnauthorizedException, SchedulerExceptionString> caMetadata, Optional<String> schedulingSource) Description copied from interface:SchedulerServiceCreates 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)
- Specified by:
addEventin interfaceSchedulerService- 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:
UnauthorizedException- if the caller is not authorized to take this actionSchedulerException- if creating new events failed
-
addMultipleEvents
public 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, MediaPackage templateMp, Map<String, String> wfProperties, Map<String, throws UnauthorizedException, SchedulerConflictException, SchedulerExceptionString> caMetadata, Optional<String> schedulingSource) Description copied from interface:SchedulerServiceCreates 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)
- Specified by:
addMultipleEventsin interfaceSchedulerService- 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:
UnauthorizedException- if the caller is not authorized to take this actionSchedulerConflictException- if there are conflicting eventsSchedulerException- if creating new events failed
-
updateEvent
public void updateEvent(String mpId, Optional<Date> startDateTime, Optional<Date> endDateTime, Optional<String> captureAgentId, Optional<Set<String>> userIds, Optional<MediaPackage> mediaPackage, Optional<Map<String, String>> wfProperties, Optional<Map<String, throws NotFoundException, UnauthorizedException, SchedulerExceptionString>> caMetadata) Description copied from interface:SchedulerServiceUpdates 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)
- Specified by:
updateEventin interfaceSchedulerService- Parameters:
mpId- 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:
NotFoundException- if event with specified ID cannot be foundUnauthorizedException- if the current user is not authorized to perform this actionSchedulerException- if exception occurred
-
updateEvent
public void updateEvent(String mpId, Optional<Date> startDateTime, Optional<Date> endDateTime, Optional<String> captureAgentId, Optional<Set<String>> userIds, Optional<MediaPackage> mediaPackage, Optional<Map<String, String>> wfProperties, Optional<Map<String, throws NotFoundException, UnauthorizedException, SchedulerExceptionString>> caMetadata, boolean allowConflict) Description copied from interface:SchedulerServiceUpdates 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)
- Specified by:
updateEventin interfaceSchedulerService- Parameters:
mpId- 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:
NotFoundException- if event with specified ID cannot be foundUnauthorizedException- if the current user is not authorized to perform this actionSchedulerException- if exception occurred
-
removeEvent
Description copied from interface:SchedulerServiceRemoves event with specified ID.- Specified by:
removeEventin interfaceSchedulerService- Parameters:
mediaPackageId- the event identifier- Throws:
NotFoundException- if event with specified ID cannot be foundSchedulerException- if exception occurred
-
getMediaPackage
public MediaPackage getMediaPackage(String mediaPackageId) throws NotFoundException, SchedulerException Description copied from interface:SchedulerServiceRetrieves mediapackage associated with specified event ID.- Specified by:
getMediaPackagein interfaceSchedulerService- Parameters:
mediaPackageId- ID of event for which mediapackage will be retrieved- Returns:
MediaPackagefor specified event- Throws:
NotFoundException- if event with specified ID cannot be foundSchedulerException- if exception occurred
-
getDublinCore
public DublinCoreCatalog getDublinCore(String mediaPackageId) throws NotFoundException, SchedulerException Description copied from interface:SchedulerServiceRetrieves dublin core catalog associated with specified event ID.- Specified by:
getDublinCorein interfaceSchedulerService- Parameters:
mediaPackageId- ID of event for which DublinCore will be retrieved- Returns:
DublinCoreCatalogfor specified event- Throws:
NotFoundException- if event with specified ID cannot be foundSchedulerException- if exception occurred
-
getTechnicalMetadata
public TechnicalMetadata getTechnicalMetadata(String mediaPackageId) throws NotFoundException, UnauthorizedException, SchedulerException Description copied from interface:SchedulerServiceRetrieves the technical metadata associated with specified event ID.- Specified by:
getTechnicalMetadatain interfaceSchedulerService- Parameters:
mediaPackageId- ID of event for which technical metadata will be retrieved- Returns:
TechnicalMetadatafor specified event- Throws:
NotFoundException- if event with specified ID cannot be foundSchedulerException- if exception occurredUnauthorizedException
-
getWorkflowConfig
public Map<String,String> getWorkflowConfig(String mediaPackageId) throws NotFoundException, SchedulerException Description copied from interface:SchedulerServiceRetrieves workflow configuration associated with specified event ID.- Specified by:
getWorkflowConfigin interfaceSchedulerService- Parameters:
mediaPackageId- ID of event for which workflow configuration will be retrieved- Returns:
- configuration of the workflow
- Throws:
NotFoundException- if event with specified ID cannot be foundSchedulerException- if exception occurred
-
getCaptureAgentConfiguration
public Map<String,String> getCaptureAgentConfiguration(String mediaPackageId) throws NotFoundException, SchedulerException Description copied from interface:SchedulerServiceRetrieves capture agent configuration for specified event.- Specified by:
getCaptureAgentConfigurationin interfaceSchedulerService- Parameters:
mediaPackageId- ID of event for which capture agent configuration will be retrieved- Returns:
- configurations of capture agent
- Throws:
NotFoundException- if event with specified ID cannot be foundSchedulerException- if exception occurred
-
getEventCount
Description copied from interface:SchedulerServiceReturns the number of scheduled events.- Specified by:
getEventCountin interfaceSchedulerService- Returns:
- the number of scheduled events
- Throws:
SchedulerException- if exception occurred
-
search
public List<MediaPackage> search(Optional<String> captureAgentId, Optional<Date> startsFrom, Optional<Date> startsTo, Optional<Date> endFrom, Optional<Date> endTo) throws SchedulerException Description copied from interface:SchedulerServiceRetrieves all events matching given filter.- Specified by:
searchin interfaceSchedulerService- 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 occurred
-
getCurrentRecording
Description copied from interface:SchedulerServiceRetrieves the currently active recording for the given capture agent (if any).- Specified by:
getCurrentRecordingin interfaceSchedulerService- 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.
-
getUpcomingRecording
Description copied from interface:SchedulerServiceRetrieves the upcoming recording for the given capture agent (if any).- Specified by:
getUpcomingRecordingin interfaceSchedulerService- 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.
-
findConflictingEvents
public List<MediaPackage> findConflictingEvents(String captureDeviceID, Date startDate, Date endDate) throws SchedulerException Description copied from interface:SchedulerServiceReturns list of all conflicting events, i.e. all events that ends after start date and begins before end date.- Specified by:
findConflictingEventsin interfaceSchedulerService- 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 occurred
-
findConflictingEvents
public List<MediaPackage> findConflictingEvents(String captureAgentId, net.fortuna.ical4j.model.property.RRule rrule, Date start, Date end, long duration, TimeZone tz) throws SchedulerException Description copied from interface:SchedulerServiceReturns list of all conflicting events. Conflicting periods are calculated based on recurrence rule, start date, end date and duration of each conflicting period.- Specified by:
findConflictingEventsin interfaceSchedulerService- Parameters:
captureAgentId- capture agent ID for which conflicting events are searched forrrule- recurrence rulestart- beginning of periodend- ending of periodduration- duration of each periodtz- the time zone of the capture agent- Returns:
- a
MediaPackagelist of all conflicting events - Throws:
SchedulerException- if exception occurred
-
getCalendar
public String getCalendar(Optional<String> captureAgentId, Optional<String> seriesId, Optional<Date> cutoff) throws SchedulerException Description copied from interface:SchedulerServiceGenerates calendar for specified capture agent.- Specified by:
getCalendarin interfaceSchedulerService- Parameters:
captureAgentId- capture agent id filterseriesId- series id filtercutoff- cutoff date filter- Returns:
- generated calendar
- Throws:
SchedulerException- if exception occurred
-
getScheduleLastModified
Description copied from interface:SchedulerServiceReturns hash of last modification of event belonging to specified capture agent.- Specified by:
getScheduleLastModifiedin interfaceSchedulerService- Parameters:
captureAgentId- the capture agent identifier- Returns:
- the last modification hash
- Throws:
SchedulerException- if exception occurred
-
removeScheduledRecordingsBeforeBuffer
Description copied from interface:SchedulerServiceRemove all of the scheduled events before a buffer.- Specified by:
removeScheduledRecordingsBeforeBufferin interfaceSchedulerService- 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
-
updateRecordingState
public boolean updateRecordingState(String id, String state) throws NotFoundException, SchedulerException Description copied from interface:SchedulerServiceUpdates the state of a recording with the given state, if it exists.- Specified by:
updateRecordingStatein interfaceSchedulerService- Parameters:
id- The id of the recording in the system.state- The state to set for that recording. This should be defined fromRecording.- Throws:
NotFoundException- if the recording with the given id has not been foundSchedulerException
-
getRecordingState
Description copied from interface:SchedulerServiceGets the state of a recording, if it exists.- Specified by:
getRecordingStatein interfaceSchedulerService- Parameters:
id- 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:
NotFoundException- if the recording with the given id has not been foundSchedulerException
-
removeRecording
Description copied from interface:SchedulerServiceRemoves a recording from the system, if the recording exists.- Specified by:
removeRecordingin interfaceSchedulerService- Parameters:
id- The id of the recording to remove.- Throws:
NotFoundException- if the recording with the given id has not been foundSchedulerException
-
getKnownRecordings
Description copied from interface:SchedulerServiceGets the state of all recordings in the system.- Specified by:
getKnownRecordingsin interfaceSchedulerService- Returns:
- A map of recording-state pairs.
- Throws:
SchedulerException
-
repopulate
Description copied from interface:IndexProducerRe-add the data of this service to the index.- Specified by:
repopulatein interfaceIndexProducer- Parameters:
type- Limit the data added to the index. Use ALL to re-index all data.- Throws:
IndexRebuildException
-
getService
Description copied from interface:IndexProducerGet the service that implements IndexProducer.- Specified by:
getServicein interfaceIndexProducer- Returns:
- service The service that implements IndexProducer.
-
getSecurityService
-