Class OaiPmhPublicationServiceImpl
java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.publication.oaipmh.OaiPmhPublicationServiceImpl
- All Implemented Interfaces:
JobProducer,OaiPmhPublicationService
public class OaiPmhPublicationServiceImpl
extends AbstractJobProducer
implements OaiPmhPublicationService
Publishes a recording to an OAI-PMH publication repository.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.opencastproject.job.api.AbstractJobProducer
ACCEPT_JOB_LOADS_EXCEEDING_PROPERTY, acceptJobLoadsExeedingMaxLoad, DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING, executor, jobTypeFields inherited from interface org.opencastproject.publication.api.OaiPmhPublicationService
JOB_TYPE, PUBLICATION_CHANNEL_PREFIX, SEPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckInputArguments(MediaPackage mediaPackage, String repository) protected PublicationcreatePublicationElement(String mpId, String repository) Create a new publication element.protected OrganizationDirectoryServiceReturns a reference to the organization directory service.protected StringgetPublicationChannelName(String repository) protected SecurityServiceReturns a reference to the security serviceprotected ServiceRegistryReturns a reference to the service registry.protected UserDirectoryServiceReturns a reference to the user directory servicestatic MediaPackagemerge(MediaPackage updatedMp, MediaPackage publishedMp) Merges the updated media package with the one that is currently published in a way where the updated elements replace existing ones in the published media package based on their flavor.protected StringAsks the overriding class to process the arguments using the given operation.protected Publicationpublish(Job job, MediaPackage mediaPackage, String repository, Set<String> downloadElementIds, Set<String> streamingElementIds, boolean checkAvailability) publish(MediaPackage mediaPackage, String repository, Set<String> downloadElementIds, Set<String> streamingElementIds, boolean checkAvailability) Publishes some media package elements.static MediaPackageremoveMatchingNonExistantElements(MediaPackage updatedMp, MediaPackage publishedMp, Set<MediaPackageElementFlavor> flavors, Set<String> tags) Remove all these elements frompublishedMp, that matches the given flavors and tags but are not in theupdatedMp.replace(MediaPackage mediaPackage, String repository, Set<? extends MediaPackageElement> downloadElements, Set<? extends MediaPackageElement> streamingElements, Set<MediaPackageElementFlavor> retractDownloadFlavors, Set<MediaPackageElementFlavor> retractStreamingFlavors, Set<? extends Publication> publications, boolean checkAvailability) Updates the given media package in the Oai-Pmh storage incrementally, i.e. without retracting the whole media package.replaceSync(MediaPackage mediaPackage, String repository, Set<? extends MediaPackageElement> downloadElements, Set<? extends MediaPackageElement> streamingElements, Set<MediaPackageElementFlavor> retractDownloadFlavors, Set<MediaPackageElementFlavor> retractStreamingFlavors, Set<? extends Publication> publications, boolean checkAvailability) Synchronously updates the given media package in the Oai-Pmh storage incrementally, i.e. without retracting the whole media package.protected Publicationretract(Job job, MediaPackage mediaPackage, String repository) retract(MediaPackage mediaPackage, String repository) Retract a media package from the publication channel.voidsetDownloadDistributionService(DownloadDistributionService downloadDistributionService) OSGI DIvoidsetOaiPmhDatabase(OaiPmhDatabase oaiPmhDatabase) OSGI DIvoidsetOaiPmhServerInfo(OaiPmhServerInfo oaiPmhServerInfo) OSGI DIvoidsetOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService) OSGI DIvoidsetSecurityService(SecurityService securityService) OSGI DIvoidsetServiceRegistry(ServiceRegistry serviceRegistry) OSGI DIvoidsetStreamingDistributionService(StreamingDistributionService streamingDistributionService) OSGI DIvoidsetUserDirectoryService(UserDirectoryService userDirectoryService) OSGI DIprotected PublicationupdateMetadata(Job job, MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags, boolean checkAvailability) updateMetadata(MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags, boolean checkAvailability) Update all media package elements that match the flavors and tags.Methods inherited from class org.opencastproject.job.api.AbstractJobProducer
acceptJob, activate, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs
-
Constructor Details
-
OaiPmhPublicationServiceImpl
public OaiPmhPublicationServiceImpl()
-
-
Method Details
-
process
Description copied from class:AbstractJobProducerAsks the overriding class to process the arguments using the given operation. The result will be added to the associated job as the payload.- Specified by:
processin classAbstractJobProducer- Parameters:
job- the job to process- Returns:
- the operation result
- Throws:
Exception
-
replace
public Job replace(MediaPackage mediaPackage, String repository, Set<? extends MediaPackageElement> downloadElements, Set<? extends MediaPackageElement> streamingElements, Set<MediaPackageElementFlavor> retractDownloadFlavors, Set<MediaPackageElementFlavor> retractStreamingFlavors, Set<? extends Publication> publications, boolean checkAvailability) throws PublicationException Description copied from interface:OaiPmhPublicationServiceUpdates the given media package in the Oai-Pmh storage incrementally, i.e. without retracting the whole media package.- Specified by:
replacein interfaceOaiPmhPublicationService- Parameters:
mediaPackage- The media package to publish the element forrepository- The OAI-PMH repositorydownloadElements- the download elements to publishstreamingElements- the streaming elements to publishretractDownloadFlavors- flavors to use to search for download elements to retract.retractStreamingFlavors- flavors to use to search for streaming elements to retract.publications- the publications to updatecheckAvailability- whether to check the distributed download artifacts are available at their URLs- Returns:
- The job which performs the operation (The job payload will hold the publication with the updated media package).
- Throws:
PublicationException- if the job could not be created.
-
replaceSync
public Publication replaceSync(MediaPackage mediaPackage, String repository, Set<? extends MediaPackageElement> downloadElements, Set<? extends MediaPackageElement> streamingElements, Set<MediaPackageElementFlavor> retractDownloadFlavors, Set<MediaPackageElementFlavor> retractStreamingFlavors, Set<? extends Publication> publications, boolean checkAvailability) throws PublicationException, MediaPackageException Description copied from interface:OaiPmhPublicationServiceSynchronously updates the given media package in the Oai-Pmh storage incrementally, i.e. without retracting the whole media package.- Specified by:
replaceSyncin interfaceOaiPmhPublicationService- Parameters:
mediaPackage- The media package to publish the element forrepository- The OAI-PMH repositorydownloadElements- the download elements to publishstreamingElements- the streaming elements to publishretractDownloadFlavors- flavors to use to search for download elements to retract.retractStreamingFlavors- flavors to use to search for streaming elements to retract.publications- the publications to updatecheckAvailability- whether to check the distributed download artifacts are available at their URLs- Returns:
- The publication with the updated media package.
- Throws:
PublicationException- if the job could not be created.MediaPackageException- if distribution failed.
-
publish
public Job publish(MediaPackage mediaPackage, String repository, Set<String> downloadElementIds, Set<String> streamingElementIds, boolean checkAvailability) throws PublicationException, MediaPackageException Description copied from interface:OaiPmhPublicationServicePublishes some media package elements.- Specified by:
publishin interfaceOaiPmhPublicationService- Parameters:
mediaPackage- the media packagerepository- the OAI-PMH repositorydownloadElementIds- the download element ids to publishstreamingElementIds- the streaming element ids to publishcheckAvailability- whether to check the distributed download artifacts are available at its URL- Returns:
- The job
- Throws:
PublicationException- if there was a problem publishing the mediaMediaPackageException- if there was a problem with the mediapackage element
-
retract
public Job retract(MediaPackage mediaPackage, String repository) throws PublicationException, NotFoundException Description copied from interface:OaiPmhPublicationServiceRetract a media package from the publication channel.- Specified by:
retractin interfaceOaiPmhPublicationService- Parameters:
mediaPackage- the media packagerepository- the OAI-PMH repository- Throws:
PublicationException- if there was a problem retracting the mediapackageNotFoundException- if there was no mediapackage to retract from this channel
-
updateMetadata
public Job updateMetadata(MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags, boolean checkAvailability) throws PublicationException, MediaPackageException Description copied from interface:OaiPmhPublicationServiceUpdate all media package elements that match the flavors and tags. Also update the media package in the given OAI-PMH repository.- Specified by:
updateMetadatain interfaceOaiPmhPublicationService- Parameters:
mediaPackage- media package with updated elementsrepository- OAI-PMH repository where to update the media packageflavors- updated media package element flavorstags- updated media package element tagscheckAvailability- whether to check the distributed download artifacts are available at its URL- Returns:
- The job to update the media package
- Throws:
PublicationException- if there was a problem publishing the mediaMediaPackageException- if there was a problem with the media package element
-
publish
protected Publication publish(Job job, MediaPackage mediaPackage, String repository, Set<String> downloadElementIds, Set<String> streamingElementIds, boolean checkAvailability) throws PublicationException, MediaPackageException -
retract
protected Publication retract(Job job, MediaPackage mediaPackage, String repository) throws PublicationException, NotFoundException -
updateMetadata
protected Publication updateMetadata(Job job, MediaPackage mediaPackage, String repository, Set<String> flavors, Set<String> tags, boolean checkAvailability) throws PublicationException - Throws:
PublicationException
-
checkInputArguments
-
getPublicationChannelName
-
createPublicationElement
protected Publication createPublicationElement(String mpId, String repository) throws PublicationException Create a new publication element.- Throws:
PublicationException
-
removeMatchingNonExistantElements
public static MediaPackage removeMatchingNonExistantElements(MediaPackage updatedMp, MediaPackage publishedMp, Set<MediaPackageElementFlavor> flavors, Set<String> tags) Remove all these elements frompublishedMp, that matches the given flavors and tags but are not in theupdatedMp.- Parameters:
updatedMp- the updated media packagepublishedMp- the media package that is currently publishedflavors- flavors of elements to updatetags- tags of elements to update- Returns:
- published media package without elements, that matches the flavors and tags but are not in the updated media package
-
merge
Merges the updated media package with the one that is currently published in a way where the updated elements replace existing ones in the published media package based on their flavor.If
publishedMpisnull, this method returns the updated media package without any modifications.- Parameters:
updatedMp- the updated media packagepublishedMp- the media package that is currently published- Returns:
- the merged media package
-
getServiceRegistry
Description copied from class:AbstractJobProducerReturns a reference to the service registry.- Specified by:
getServiceRegistryin classAbstractJobProducer- Returns:
- the service registry
-
getSecurityService
Returns a reference to the security service- Specified by:
getSecurityServicein classAbstractJobProducer- Returns:
- the security service
- See Also:
-
getUserDirectoryService
Returns a reference to the user directory service- Specified by:
getUserDirectoryServicein classAbstractJobProducer- Returns:
- the user directory service
- See Also:
-
getOrganizationDirectoryService
Returns a reference to the organization directory service.- Specified by:
getOrganizationDirectoryServicein classAbstractJobProducer- Returns:
- the organization directory service
- See Also:
-
setServiceRegistry
OSGI DI -
setSecurityService
OSGI DI -
setUserDirectoryService
OSGI DI -
setOrganizationDirectoryService
public void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService) OSGI DI -
setDownloadDistributionService
OSGI DI -
setStreamingDistributionService
public void setStreamingDistributionService(StreamingDistributionService streamingDistributionService) OSGI DI -
setOaiPmhServerInfo
OSGI DI -
setOaiPmhDatabase
OSGI DI
-