IngestServiceImpl extends AbstractJobProducer implements IngestService, ManagedService { @Override public void updated(Dictionary<String, ?> properties) throws ConfigurationException { if (properties == null) { logger.info("No configuration available, using defaults"); return; } downloadPassword = StringUtils.trimToEmpty((String)properties.get(DOWNLOAD_PASSWORD)); downloadUser = StringUtils.trimToEmpty(((String) properties.get(DOWNLOAD_USER))); downloadSource = StringUtils.trimToEmpty(((String) properties.get(DOWNLOAD_SOURCE))); skipAttachments = BooleanUtils.toBoolean(Objects.toString(properties.get(SKIP_ATTACHMENTS_KEY), BooleanUtils.toStringTrueFalse(DEFAULT_SKIP))); skipCatalogs = BooleanUtils.toBoolean(Objects.toString(properties.get(SKIP_CATALOGS_KEY), BooleanUtils.toStringTrueFalse(DEFAULT_SKIP))); logger.debug("Skip attachments sent by agents for scheduled events: {}", skipAttachments); logger.debug("Skip metadata catalogs sent by agents for scheduled events: {}", skipCatalogs); ingestFileJobLoad = LoadUtil.getConfiguredLoadValue(properties, FILE_JOB_LOAD_KEY, DEFAULT_INGEST_FILE_JOB_LOAD, serviceRegistry); ingestZipJobLoad = LoadUtil.getConfiguredLoadValue(properties, ZIP_JOB_LOAD_KEY, DEFAULT_INGEST_ZIP_JOB_LOAD, serviceRegistry); isAllowModifySeries = BooleanUtils.toBoolean(Objects.toString(properties.get(MODIFY_OPENCAST_SERIES_KEY), BooleanUtils.toStringTrueFalse(DEFAULT_ALLOW_SERIES_MODIFICATIONS))); isAddOnlyNew = BooleanUtils.toBoolean(Objects.toString(properties.get(ADD_ONLY_NEW_FLAVORS_KEY), BooleanUtils.toStringTrueFalse(DEFAULT_ALLOW_ONLY_NEW_FLAVORS))); logger.info("Only allow new flavored catalogs and attachments on ingest:'{}'", isAddOnlyNew); logger.info("Allowing series modification:'{}'", isAllowModifySeries); } IngestServiceImpl(); @Override @Activate void activate(ComponentContext cc); @Deactivate void deactivate(); @Override void updated(Dictionary<String, ?> properties); @Reference void setHttpClient(TrustedHttpClient httpClient); @Reference void setServiceRegistry(ServiceRegistry serviceRegistry); @Reference void setMediaInspectionService(MediaInspectionService mediaInspectionService); WorkflowInstance addZippedMediaPackage(InputStream zipStream); @Override WorkflowInstance addZippedMediaPackage(InputStream zipStream, String wd, Map<String, String> workflowConfig); @Override WorkflowInstance addZippedMediaPackage(InputStream zipStream, String workflowDefinitionId,
          Map<String, String> workflowConfig, Long workflowInstanceId); @Override MediaPackage createMediaPackage(); @Override MediaPackage createMediaPackage(String mediaPackageId); @Override MediaPackage addTrack(URI uri, MediaPackageElementFlavor flavor, MediaPackage mediaPackage); @Override MediaPackage addTrack(URI uri, MediaPackageElementFlavor flavor, String[] tags, MediaPackage mediaPackage); @Override MediaPackage addTrack(InputStream in, String fileName, MediaPackageElementFlavor flavor,
          MediaPackage mediaPackage); @Override MediaPackage addTrack(InputStream in, String fileName, MediaPackageElementFlavor flavor, String[] tags,
          MediaPackage mediaPackage); @Override MediaPackage addPartialTrack(URI uri, MediaPackageElementFlavor flavor, long startTime,
          MediaPackage mediaPackage); @Override MediaPackage addPartialTrack(InputStream in, String fileName, MediaPackageElementFlavor flavor, long startTime,
          MediaPackage mediaPackage); @Override MediaPackage addCatalog(URI uri, MediaPackageElementFlavor flavor, MediaPackage mediaPackage); @Override MediaPackage addCatalog(InputStream in, String fileName, MediaPackageElementFlavor flavor,
          MediaPackage mediaPackage); @Override MediaPackage addCatalog(InputStream in, String fileName, MediaPackageElementFlavor flavor, String[] tags,
          MediaPackage mediaPackage); @Override MediaPackage addAttachment(URI uri, MediaPackageElementFlavor flavor, MediaPackage mediaPackage); @Override MediaPackage addAttachment(InputStream in, String fileName, MediaPackageElementFlavor flavor, String[] tags,
          MediaPackage mediaPackage); @Override MediaPackage addAttachment(InputStream in, String fileName, MediaPackageElementFlavor flavor,
          MediaPackage mediaPackage); @Override WorkflowInstance ingest(MediaPackage mp); @Override WorkflowInstance ingest(MediaPackage mp, String wd, Map<String, String> properties); @Override WorkflowInstance ingest(MediaPackage mp, String workflowDefinitionId, Map<String, String> properties,
          Long workflowInstanceId); @Override void schedule(MediaPackage mediaPackage, String workflowDefinitionID, Map<String, String> properties); @Override void discardMediaPackage(MediaPackage mp); @Reference void setWorkflowService(WorkflowService workflowService); @Reference void setWorkingFileRepository(WorkingFileRepository workingFileRepository); @Reference void setSeriesService(SeriesService seriesService); @Reference void setDublinCoreService(DublinCoreCatalogService dublinCoreService); @Reference void setSecurityService(SecurityService securityService); @Reference void setUserDirectoryService(UserDirectoryService userDirectoryService); @Reference( policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL, unbind = "unsetSchedulerService" ) void setSchedulerService(SchedulerService schedulerService); void unsetSchedulerService(SchedulerService schedulerService); @Reference void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectory); static Function<MediaPackageElement, Job> newEnrichJob(final MediaInspectionService svc); static Function<Job, Track> payloadAsTrack(final ServiceRegistry reg); static final String LEGACY_MEDIAPACKAGE_ID_KEY; static final String JOB_TYPE; static final String INGEST_ZIP; static final String INGEST_TRACK; static final String INGEST_TRACK_FROM_URI; static final String INGEST_ATTACHMENT; static final String INGEST_ATTACHMENT_FROM_URI; static final String INGEST_CATALOG; static final String INGEST_CATALOG_FROM_URI; static final float DEFAULT_INGEST_FILE_JOB_LOAD; static final float DEFAULT_INGEST_ZIP_JOB_LOAD; static final String FILE_JOB_LOAD_KEY; static final String ZIP_JOB_LOAD_KEY; static final String DOWNLOAD_SOURCE; static final String DOWNLOAD_USER; static final String DOWNLOAD_PASSWORD; static final boolean DEFAULT_ALLOW_SERIES_MODIFICATIONS; static final boolean DEFAULT_ALLOW_ONLY_NEW_FLAVORS; static final boolean DEFAULT_SKIP; @Deprecated
  static final String MODIFY_OPENCAST_SERIES_KEY; static final String ADD_ONLY_NEW_FLAVORS_KEY; static final String SKIP_CATALOGS_KEY; static final String SKIP_ATTACHMENTS_KEY; }
@Test public void testVaryEpisodeWithOnlyNewFlavorsFalse() throws Exception { Dictionary<String, String> properties = new Hashtable<>(); boolean isAddOnlyNew; properties.put(IngestServiceImpl.ADD_ONLY_NEW_FLAVORS_KEY, "false"); service.updated(properties); isAddOnlyNew = service.isAddOnlyNew; Assert.assertFalse("Updated overwrite property to false", isAddOnlyNew); testEpisodeUpdateNewAndExisting(); }
@Test public void testVaryEpisodeWithOnlyNewFlavorsMissingParam() throws Exception { Dictionary<String, String> properties = new Hashtable<>(); boolean isAddOnlyNew; properties = new Hashtable<>(); properties.put("blahblah", "blahblah"); service.updated(properties); isAddOnlyNew = service.isAddOnlyNew; Assert.assertTrue("Is Add Only New defaults to true when param is not found (i.e. commented out)", isAddOnlyNew); }
@Test public void testNoPropertiesEpisodeOverwriteParam() throws Exception { Dictionary<String, String> properties = new Hashtable<>(); boolean isAddOnlyNew; properties = new Hashtable<>(); service.updated(properties); isAddOnlyNew = service.isAddOnlyNew; Assert.assertTrue("Overwrite property defaults to true when param is commented out", isAddOnlyNew); }