@Test public void removeScheduledRecordingsBeforeBufferEmpty() throws Exception { schedSvc.removeScheduledRecordingsBeforeBuffer(0); }
@Override public void removeScheduledRecordingsBeforeBuffer(long buffer) throws SchedulerException { DateTime end = new DateTime(DateTimeZone.UTC).minus(buffer * 1000); logger.info("Starting to look for scheduled recordings that have finished before {}.", DateTimeSupport.toUTC(end.getMillis())); List<ExtendedEventDto> finishedEvents; try { finishedEvents = persistence.search(Opt.<String> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.some(end.toDate()), Opt.none()); logger.debug("Found {} events from search.", finishedEvents.size()); } catch (Exception e) { throw new SchedulerException(e); } int recordingsRemoved = 0; for (ExtendedEventDto extEvt : finishedEvents) { final String eventId = extEvt.getMediaPackageId(); try { removeEvent(eventId); logger.debug("Sucessfully removed scheduled event with id " + eventId); recordingsRemoved++; } catch (NotFoundException e) { logger.debug("Skipping event with id {} because it is not found", eventId); } catch (Exception e) { logger.warn("Unable to delete event with id '{}':", eventId, e); } } logger.info("Found {} to remove that ended before {}.", recordingsRemoved, DateTimeSupport.toUTC(end.getMillis())); }
SchedulerServiceImpl extends AbstractIndexProducer implements SchedulerService, ManagedService { @Override public void removeScheduledRecordingsBeforeBuffer(long buffer) throws SchedulerException { DateTime end = new DateTime(DateTimeZone.UTC).minus(buffer * 1000); logger.info("Starting to look for scheduled recordings that have finished before {}.", DateTimeSupport.toUTC(end.getMillis())); List<ExtendedEventDto> finishedEvents; try { finishedEvents = persistence.search(Opt.<String> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.some(end.toDate()), Opt.none()); logger.debug("Found {} events from search.", finishedEvents.size()); } catch (Exception e) { throw new SchedulerException(e); } int recordingsRemoved = 0; for (ExtendedEventDto extEvt : finishedEvents) { final String eventId = extEvt.getMediaPackageId(); try { removeEvent(eventId); logger.debug("Sucessfully removed scheduled event with id " + eventId); recordingsRemoved++; } catch (NotFoundException e) { logger.debug("Skipping event with id {} because it is not found", eventId); } catch (Exception e) { logger.warn("Unable to delete event with id '{}':", eventId, e); } } logger.info("Found {} to remove that ended before {}.", recordingsRemoved, DateTimeSupport.toUTC(end.getMillis())); } }
SchedulerServiceImpl extends AbstractIndexProducer implements SchedulerService, ManagedService { @Override public void removeScheduledRecordingsBeforeBuffer(long buffer) throws SchedulerException { DateTime end = new DateTime(DateTimeZone.UTC).minus(buffer * 1000); logger.info("Starting to look for scheduled recordings that have finished before {}.", DateTimeSupport.toUTC(end.getMillis())); List<ExtendedEventDto> finishedEvents; try { finishedEvents = persistence.search(Opt.<String> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.some(end.toDate()), Opt.none()); logger.debug("Found {} events from search.", finishedEvents.size()); } catch (Exception e) { throw new SchedulerException(e); } int recordingsRemoved = 0; for (ExtendedEventDto extEvt : finishedEvents) { final String eventId = extEvt.getMediaPackageId(); try { removeEvent(eventId); logger.debug("Sucessfully removed scheduled event with id " + eventId); recordingsRemoved++; } catch (NotFoundException e) { logger.debug("Skipping event with id {} because it is not found", eventId); } catch (Exception e) { logger.warn("Unable to delete event with id '{}':", eventId, e); } } logger.info("Found {} to remove that ended before {}.", recordingsRemoved, DateTimeSupport.toUTC(end.getMillis())); }  }
SchedulerServiceImpl extends AbstractIndexProducer implements SchedulerService, ManagedService { @Override public void removeScheduledRecordingsBeforeBuffer(long buffer) throws SchedulerException { DateTime end = new DateTime(DateTimeZone.UTC).minus(buffer * 1000); logger.info("Starting to look for scheduled recordings that have finished before {}.", DateTimeSupport.toUTC(end.getMillis())); List<ExtendedEventDto> finishedEvents; try { finishedEvents = persistence.search(Opt.<String> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.some(end.toDate()), Opt.none()); logger.debug("Found {} events from search.", finishedEvents.size()); } catch (Exception e) { throw new SchedulerException(e); } int recordingsRemoved = 0; for (ExtendedEventDto extEvt : finishedEvents) { final String eventId = extEvt.getMediaPackageId(); try { removeEvent(eventId); logger.debug("Sucessfully removed scheduled event with id " + eventId); recordingsRemoved++; } catch (NotFoundException e) { logger.debug("Skipping event with id {} because it is not found", eventId); } catch (Exception e) { logger.warn("Unable to delete event with id '{}':", eventId, e); } } logger.info("Found {} to remove that ended before {}.", recordingsRemoved, DateTimeSupport.toUTC(end.getMillis())); }  void setMessageSender(MessageSender messageSender); void setMessageReceiver(MessageReceiver messageReceiver); void setPersistence(SchedulerServiceDatabase persistence); void setSeriesService(SeriesService seriesService); void setSecurityService(SecurityService securityService); void setAssetManager(AssetManager assetManager); void setWorkspace(Workspace workspace); void setAuthorizationService(AuthorizationService authorizationService); void setOrgDirectoryService(OrganizationDirectoryService orgDirectoryService); void addCatalogUIAdapter(EventCatalogUIAdapter catalogUIAdapter); void removeCatalogUIAdapter(EventCatalogUIAdapter catalogUIAdapter); void activate(ComponentContext cc); @Override void deactivate(); @Override void updated(Dictionary<String, ?> properties); @Override void addEvent(Date startDateTime, Date endDateTime, String captureAgentId, Set<String> userIds,
          MediaPackage mediaPackage, Map<String, String> wfProperties, Map<String, String> caMetadata,
          Opt<String> schedulingSource); @Override Map<String, Period> addMultipleEvents(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, Opt<String> schedulingSource); @Override void updateEvent(final String mpId, Opt<Date> startDateTime, Opt<Date> endDateTime, Opt<String> captureAgentId,
          Opt<Set<String>> userIds, Opt<MediaPackage> mediaPackage, Opt<Map<String, String>> wfProperties,
          Opt<Map<String, String>> caMetadata); @Override void updateEvent(final String mpId, Opt<Date> startDateTime, Opt<Date> endDateTime, Opt<String> captureAgentId,
          Opt<Set<String>> userIds, Opt<MediaPackage> mediaPackage, Opt<Map<String, String>> wfProperties,
          Opt<Map<String, String>> caMetadata, boolean allowConflict); @Override synchronized void removeEvent(String mediaPackageId); @Override MediaPackage getMediaPackage(String mediaPackageId); @Override DublinCoreCatalog getDublinCore(String mediaPackageId); @Override TechnicalMetadata getTechnicalMetadata(String mediaPackageId); @Override Map<String, String> getWorkflowConfig(String mediaPackageId); @Override Map<String, String> getCaptureAgentConfiguration(String mediaPackageId); @Override int getEventCount(); @Override List<MediaPackage> search(Opt<String> captureAgentId, Opt<Date> startsFrom, Opt<Date> startsTo,
          Opt<Date> endFrom, Opt<Date> endTo); @Override Opt<MediaPackage> getCurrentRecording(String captureAgentId); @Override Opt<MediaPackage> getUpcomingRecording(String captureAgentId); @Override List<MediaPackage> findConflictingEvents(String captureDeviceID, Date startDate, Date endDate); @Override List<MediaPackage> findConflictingEvents(String captureAgentId, RRule rrule, Date start, Date end,
          long duration, TimeZone tz); @Override String getCalendar(Opt<String> captureAgentId, Opt<String> seriesId, Opt<Date> cutoff); @Override String getScheduleLastModified(String captureAgentId); @Override void removeScheduledRecordingsBeforeBuffer(long buffer); @Override boolean updateRecordingState(String id, String state); @Override Recording getRecordingState(String id); @Override void removeRecording(String id); @Override Map<String, Recording> getKnownRecordings(); @Override void repopulate(final String indexName); @Override MessageReceiver getMessageReceiver(); @Override Service getService(); @Override String getClassName(); @Override MessageSender getMessageSender(); @Override SecurityService getSecurityService(); @Override String getSystemUserName(); }
SchedulerServiceImpl extends AbstractIndexProducer implements SchedulerService, ManagedService { @Override public void removeScheduledRecordingsBeforeBuffer(long buffer) throws SchedulerException { DateTime end = new DateTime(DateTimeZone.UTC).minus(buffer * 1000); logger.info("Starting to look for scheduled recordings that have finished before {}.", DateTimeSupport.toUTC(end.getMillis())); List<ExtendedEventDto> finishedEvents; try { finishedEvents = persistence.search(Opt.<String> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.<Date> none(), Opt.some(end.toDate()), Opt.none()); logger.debug("Found {} events from search.", finishedEvents.size()); } catch (Exception e) { throw new SchedulerException(e); } int recordingsRemoved = 0; for (ExtendedEventDto extEvt : finishedEvents) { final String eventId = extEvt.getMediaPackageId(); try { removeEvent(eventId); logger.debug("Sucessfully removed scheduled event with id " + eventId); recordingsRemoved++; } catch (NotFoundException e) { logger.debug("Skipping event with id {} because it is not found", eventId); } catch (Exception e) { logger.warn("Unable to delete event with id '{}':", eventId, e); } } logger.info("Found {} to remove that ended before {}.", recordingsRemoved, DateTimeSupport.toUTC(end.getMillis())); }  void setMessageSender(MessageSender messageSender); void setMessageReceiver(MessageReceiver messageReceiver); void setPersistence(SchedulerServiceDatabase persistence); void setSeriesService(SeriesService seriesService); void setSecurityService(SecurityService securityService); void setAssetManager(AssetManager assetManager); void setWorkspace(Workspace workspace); void setAuthorizationService(AuthorizationService authorizationService); void setOrgDirectoryService(OrganizationDirectoryService orgDirectoryService); void addCatalogUIAdapter(EventCatalogUIAdapter catalogUIAdapter); void removeCatalogUIAdapter(EventCatalogUIAdapter catalogUIAdapter); void activate(ComponentContext cc); @Override void deactivate(); @Override void updated(Dictionary<String, ?> properties); @Override void addEvent(Date startDateTime, Date endDateTime, String captureAgentId, Set<String> userIds,
          MediaPackage mediaPackage, Map<String, String> wfProperties, Map<String, String> caMetadata,
          Opt<String> schedulingSource); @Override Map<String, Period> addMultipleEvents(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, Opt<String> schedulingSource); @Override void updateEvent(final String mpId, Opt<Date> startDateTime, Opt<Date> endDateTime, Opt<String> captureAgentId,
          Opt<Set<String>> userIds, Opt<MediaPackage> mediaPackage, Opt<Map<String, String>> wfProperties,
          Opt<Map<String, String>> caMetadata); @Override void updateEvent(final String mpId, Opt<Date> startDateTime, Opt<Date> endDateTime, Opt<String> captureAgentId,
          Opt<Set<String>> userIds, Opt<MediaPackage> mediaPackage, Opt<Map<String, String>> wfProperties,
          Opt<Map<String, String>> caMetadata, boolean allowConflict); @Override synchronized void removeEvent(String mediaPackageId); @Override MediaPackage getMediaPackage(String mediaPackageId); @Override DublinCoreCatalog getDublinCore(String mediaPackageId); @Override TechnicalMetadata getTechnicalMetadata(String mediaPackageId); @Override Map<String, String> getWorkflowConfig(String mediaPackageId); @Override Map<String, String> getCaptureAgentConfiguration(String mediaPackageId); @Override int getEventCount(); @Override List<MediaPackage> search(Opt<String> captureAgentId, Opt<Date> startsFrom, Opt<Date> startsTo,
          Opt<Date> endFrom, Opt<Date> endTo); @Override Opt<MediaPackage> getCurrentRecording(String captureAgentId); @Override Opt<MediaPackage> getUpcomingRecording(String captureAgentId); @Override List<MediaPackage> findConflictingEvents(String captureDeviceID, Date startDate, Date endDate); @Override List<MediaPackage> findConflictingEvents(String captureAgentId, RRule rrule, Date start, Date end,
          long duration, TimeZone tz); @Override String getCalendar(Opt<String> captureAgentId, Opt<String> seriesId, Opt<Date> cutoff); @Override String getScheduleLastModified(String captureAgentId); @Override void removeScheduledRecordingsBeforeBuffer(long buffer); @Override boolean updateRecordingState(String id, String state); @Override Recording getRecordingState(String id); @Override void removeRecording(String id); @Override Map<String, Recording> getKnownRecordings(); @Override void repopulate(final String indexName); @Override MessageReceiver getMessageReceiver(); @Override Service getService(); @Override String getClassName(); @Override MessageSender getMessageSender(); @Override SecurityService getSecurityService(); @Override String getSystemUserName(); static final String WORKFLOW_CONFIG_PREFIX; }