Class DownloadDistributionServiceImpl
java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.distribution.api.AbstractDistributionService
org.opencastproject.distribution.download.DownloadDistributionServiceImpl
- All Implemented Interfaces:
org.opencastproject.distribution.api.DistributionService,org.opencastproject.distribution.api.DownloadDistributionService,org.opencastproject.job.api.JobProducer,org.osgi.service.cm.ManagedService
public class DownloadDistributionServiceImpl
extends org.opencastproject.distribution.api.AbstractDistributionService
implements org.opencastproject.distribution.api.DistributionService, org.opencastproject.distribution.api.DownloadDistributionService, org.osgi.service.cm.ManagedService
Distributes media to the local media delivery directory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatThe load on the system introduced by creating a distribute jobstatic final floatThe load on the system introduced by creating a retract jobstatic final StringThe key to look for in the service configuration file to override theDEFAULT_DISTRIBUTE_JOB_LOADstatic final StringReceipt typestatic final StringThe key to look for in the service configuration file to override theDEFAULT_RETRACT_JOB_LOADFields inherited from class org.opencastproject.distribution.api.AbstractDistributionService
distributionChannel, distributionDirectory, organizationDirectoryService, securityService, serviceRegistry, serviceUrl, trustedHttpClient, userDirectoryService, workspaceFields 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.distribution.api.DistributionService
CONFIG_KEY_STORE_TYPE, JOB_TYPE_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of the download distribution service. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) Activate method for this OSGi service implementation.org.opencastproject.mediapackage.TrackcheckDistributeHLSElement(org.opencastproject.mediapackage.Track element, boolean checkAvailability) org.opencastproject.job.api.Jobdistribute(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId) org.opencastproject.job.api.Jobdistribute(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId, boolean checkAvailability) org.opencastproject.job.api.Jobdistribute(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability) org.opencastproject.job.api.Jobdistribute(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability, boolean preserveReference) org.opencastproject.mediapackage.MediaPackageElementdistributeElement(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, org.opencastproject.mediapackage.MediaPackageElement element, boolean checkAvailability, boolean preserveReference) Distribute a Mediapackage element to the download distribution service.org.opencastproject.mediapackage.MediaPackageElement[]distributeElements(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability) Distribute Mediapackage elements to the download distribution service.org.opencastproject.mediapackage.MediaPackageElement[]distributeElements(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability, boolean preserveReference) Distribute Mediapackage elements to the download distribution service.List<org.opencastproject.mediapackage.MediaPackageElement> distributeSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId) List<org.opencastproject.mediapackage.MediaPackageElement> distributeSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability) List<org.opencastproject.mediapackage.MediaPackageElement> distributeSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability, boolean preserveReference) protected FilegetDistributionFile(String channelId, org.opencastproject.mediapackage.MediaPackage mp, org.opencastproject.mediapackage.MediaPackageElement element) Gets the destination file to copy the contents of a mediapackage element.protected URIgetDistributionUri(String channelId, String mediaPackageId, org.opencastproject.mediapackage.MediaPackageElement element) Gets the URI for the element to be distributed.protected FilegetMediaPackageDirectory(String channelId, org.opencastproject.mediapackage.MediaPackage mp) Gets the directory containing the distributed files for this mediapackage.protected Stringprocess(org.opencastproject.job.api.Job job) org.opencastproject.job.api.Jobretract(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId) org.opencastproject.job.api.Jobretract(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds) protected org.opencastproject.mediapackage.MediaPackageElementretractElement(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, org.opencastproject.mediapackage.MediaPackageElement element) Retract a media package element from the distribution channel.protected org.opencastproject.mediapackage.MediaPackageElement[]retractElements(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds) Retract a media package element from the distribution channel.List<org.opencastproject.mediapackage.MediaPackageElement> retractSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId) List<org.opencastproject.mediapackage.MediaPackageElement> retractSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds) voidsetOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryService) voidsetSecurityService(org.opencastproject.security.api.SecurityService securityService) voidsetServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry) voidsetTrustedHttpClient(org.opencastproject.security.api.TrustedHttpClient trustedHttpClient) org.opencastproject.mediapackage.TracksetUpHLSElementforDistribution(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, org.opencastproject.mediapackage.Track element, boolean preserveReference) voidsetUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService) voidsetWorkspace(org.opencastproject.workspace.api.Workspace workspace) voidupdated(Dictionary properties) Methods inherited from class org.opencastproject.distribution.api.AbstractDistributionService
getOrganizationDirectoryService, getSecurityService, getServiceRegistry, getTrustedHttpClient, getUserDirectoryServiceMethods inherited from class org.opencastproject.job.api.AbstractJobProducer
acceptJob, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs
-
Field Details
-
JOB_TYPE
Receipt type- See Also:
-
DEFAULT_DISTRIBUTE_JOB_LOAD
public static final float DEFAULT_DISTRIBUTE_JOB_LOADThe load on the system introduced by creating a distribute job- See Also:
-
DEFAULT_RETRACT_JOB_LOAD
public static final float DEFAULT_RETRACT_JOB_LOADThe load on the system introduced by creating a retract job- See Also:
-
DISTRIBUTE_JOB_LOAD_KEY
The key to look for in the service configuration file to override theDEFAULT_DISTRIBUTE_JOB_LOAD- See Also:
-
RETRACT_JOB_LOAD_KEY
The key to look for in the service configuration file to override theDEFAULT_RETRACT_JOB_LOAD- See Also:
-
-
Constructor Details
-
DownloadDistributionServiceImpl
public DownloadDistributionServiceImpl()Creates a new instance of the download distribution service.
-
-
Method Details
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) Activate method for this OSGi service implementation.- Overrides:
activatein classorg.opencastproject.job.api.AbstractJobProducer- Parameters:
cc- the OSGi component context
-
getDistributionType
- Specified by:
getDistributionTypein interfaceorg.opencastproject.distribution.api.DistributionService
-
distribute
public org.opencastproject.job.api.Job distribute(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId) throws org.opencastproject.distribution.api.DistributionException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
distributein interfaceorg.opencastproject.distribution.api.DistributionService- Throws:
org.opencastproject.distribution.api.DistributionExceptionorg.opencastproject.mediapackage.MediaPackageException
-
distribute
public org.opencastproject.job.api.Job distribute(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId, boolean checkAvailability) throws org.opencastproject.distribution.api.DistributionException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
distributein interfaceorg.opencastproject.distribution.api.DownloadDistributionService- Throws:
org.opencastproject.distribution.api.DistributionExceptionorg.opencastproject.mediapackage.MediaPackageException
-
distribute
public org.opencastproject.job.api.Job distribute(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability) throws org.opencastproject.distribution.api.DistributionException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
distributein interfaceorg.opencastproject.distribution.api.DownloadDistributionService- Throws:
org.opencastproject.distribution.api.DistributionExceptionorg.opencastproject.mediapackage.MediaPackageException
-
distribute
public org.opencastproject.job.api.Job distribute(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability, boolean preserveReference) throws org.opencastproject.distribution.api.DistributionException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
distributein interfaceorg.opencastproject.distribution.api.DownloadDistributionService- Throws:
org.opencastproject.distribution.api.DistributionExceptionorg.opencastproject.mediapackage.MediaPackageException
-
distributeElements
public org.opencastproject.mediapackage.MediaPackageElement[] distributeElements(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability) throws org.opencastproject.distribution.api.DistributionException Distribute Mediapackage elements to the download distribution service.- Parameters:
channelId- # The id of the publication channel to be distributed to.mediapackage- The media package that contains the elements to be distributed.elementIds- The ids of the elements that should be distributed contained within the media package.checkAvailability- Check the availability of the distributed element via http.- Returns:
- A reference to the MediaPackageElements that have been distributed.
- Throws:
org.opencastproject.distribution.api.DistributionException- Thrown if the parent directory of the MediaPackageElement cannot be created, if the MediaPackageElement cannot be copied or another unexpected exception occurs.
-
distributeElements
public org.opencastproject.mediapackage.MediaPackageElement[] distributeElements(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability, boolean preserveReference) throws org.opencastproject.distribution.api.DistributionException Distribute Mediapackage elements to the download distribution service.- Parameters:
channelId- # The id of the publication channel to be distributed to.mediapackage- The media package that contains the elements to be distributed.elementIds- The ids of the elements that should be distributed contained within the media package.checkAvailability- Check the availability of the distributed element via http.preserveReference- copy actual Reference to the new distributed element- Returns:
- A reference to the MediaPackageElements that have been distributed.
- Throws:
org.opencastproject.distribution.api.DistributionException- Thrown if the parent directory of the MediaPackageElement cannot be created, if the MediaPackageElement cannot be copied or another unexpected exception occurs.
-
distributeElement
public org.opencastproject.mediapackage.MediaPackageElement distributeElement(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, org.opencastproject.mediapackage.MediaPackageElement element, boolean checkAvailability, boolean preserveReference) throws org.opencastproject.distribution.api.DistributionException Distribute a Mediapackage element to the download distribution service.- Parameters:
channelId- # The id of the publication channel to be distributed to.mediapackage- The media package that contains the element to be distributed.element- The the element that should be distributed contained within the media package.checkAvailability- Check the availability of the distributed element via http.preserveReference- Copy existing Track-Reference to the new distributed Track- Returns:
- A reference to the MediaPackageElement that has been distributed.
- Throws:
org.opencastproject.distribution.api.DistributionException- Thrown if the parent directory of the MediaPackageElement cannot be created, if the MediaPackageElement cannot be copied or another unexpected exception occurs.
-
setUpHLSElementforDistribution
public org.opencastproject.mediapackage.Track setUpHLSElementforDistribution(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, org.opencastproject.mediapackage.Track element, boolean preserveReference) throws org.opencastproject.distribution.api.DistributionException - Throws:
org.opencastproject.distribution.api.DistributionException
-
checkDistributeHLSElement
public org.opencastproject.mediapackage.Track checkDistributeHLSElement(org.opencastproject.mediapackage.Track element, boolean checkAvailability) throws org.opencastproject.distribution.api.DistributionException - Throws:
org.opencastproject.distribution.api.DistributionException
-
retract
public org.opencastproject.job.api.Job retract(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId) throws org.opencastproject.distribution.api.DistributionException - Specified by:
retractin interfaceorg.opencastproject.distribution.api.DistributionService- Throws:
org.opencastproject.distribution.api.DistributionException
-
retract
public org.opencastproject.job.api.Job retract(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds) throws org.opencastproject.distribution.api.DistributionException - Specified by:
retractin interfaceorg.opencastproject.distribution.api.DownloadDistributionService- Throws:
org.opencastproject.distribution.api.DistributionException
-
distributeSync
public List<org.opencastproject.mediapackage.MediaPackageElement> distributeSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId) throws org.opencastproject.distribution.api.DistributionException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
distributeSyncin interfaceorg.opencastproject.distribution.api.DistributionService- Throws:
org.opencastproject.distribution.api.DistributionExceptionorg.opencastproject.mediapackage.MediaPackageException
-
distributeSync
public List<org.opencastproject.mediapackage.MediaPackageElement> distributeSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability, boolean preserveReference) throws org.opencastproject.distribution.api.DistributionException, org.opencastproject.mediapackage.MediaPackageException - Throws:
org.opencastproject.distribution.api.DistributionExceptionorg.opencastproject.mediapackage.MediaPackageException
-
distributeSync
public List<org.opencastproject.mediapackage.MediaPackageElement> distributeSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds, boolean checkAvailability) throws org.opencastproject.distribution.api.DistributionException - Specified by:
distributeSyncin interfaceorg.opencastproject.distribution.api.DownloadDistributionService- Throws:
org.opencastproject.distribution.api.DistributionException
-
retractSync
public List<org.opencastproject.mediapackage.MediaPackageElement> retractSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, String elementId) throws org.opencastproject.distribution.api.DistributionException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
retractSyncin interfaceorg.opencastproject.distribution.api.DistributionService- Throws:
org.opencastproject.distribution.api.DistributionExceptionorg.opencastproject.mediapackage.MediaPackageException
-
retractSync
public List<org.opencastproject.mediapackage.MediaPackageElement> retractSync(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds) throws org.opencastproject.distribution.api.DistributionException - Specified by:
retractSyncin interfaceorg.opencastproject.distribution.api.DownloadDistributionService- Throws:
org.opencastproject.distribution.api.DistributionException
-
retractElements
protected org.opencastproject.mediapackage.MediaPackageElement[] retractElements(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, Set<String> elementIds) throws org.opencastproject.distribution.api.DistributionException Retract a media package element from the distribution channel. The retracted element must not necessarily be the one given as parameterelementId. Instead, the element's distribution URI will be calculated. This way you are able to retract elements by providing the "original" element here.- Parameters:
channelId- the channel idmediapackage- the mediapackageelementIds- the element identifiers- Returns:
- the retracted element or
nullif the element was not retracted - Throws:
org.opencastproject.distribution.api.DistributionException- in case of an error
-
retractElement
protected org.opencastproject.mediapackage.MediaPackageElement retractElement(String channelId, org.opencastproject.mediapackage.MediaPackage mediapackage, org.opencastproject.mediapackage.MediaPackageElement element) throws org.opencastproject.distribution.api.DistributionException Retract a media package element from the distribution channel. The retracted element must not necessarily be the one given as parameterelementId. Instead, the element's distribution URI will be calculated. This way you are able to retract elements by providing the "original" element here.- Parameters:
channelId- the channel idmediapackage- the mediapackageelement- the element- Returns:
- the retracted element or
nullif the element was not retracted - Throws:
org.opencastproject.distribution.api.DistributionException- in case of an error
-
process
- Specified by:
processin classorg.opencastproject.job.api.AbstractJobProducer- Throws:
Exception- See Also:
-
getDistributionFile
protected File getDistributionFile(String channelId, org.opencastproject.mediapackage.MediaPackage mp, org.opencastproject.mediapackage.MediaPackageElement element) Gets the destination file to copy the contents of a mediapackage element.- Returns:
- The file to copy the content to
-
getMediaPackageDirectory
protected File getMediaPackageDirectory(String channelId, org.opencastproject.mediapackage.MediaPackage mp) Gets the directory containing the distributed files for this mediapackage.- Returns:
- the filesystem directory
-
getDistributionUri
protected URI getDistributionUri(String channelId, String mediaPackageId, org.opencastproject.mediapackage.MediaPackageElement element) throws URISyntaxException Gets the URI for the element to be distributed.- Parameters:
mediaPackageId- the mediapackage identifierelement- The mediapackage element being distributed- Returns:
- The resulting URI after distribution
- Throws:
URISyntaxException- if the concrete implementation tries to create a malformed uri
-
updated
- Specified by:
updatedin interfaceorg.osgi.service.cm.ManagedService- Throws:
org.osgi.service.cm.ConfigurationException
-
setWorkspace
public void setWorkspace(org.opencastproject.workspace.api.Workspace workspace) - Overrides:
setWorkspacein classorg.opencastproject.distribution.api.AbstractDistributionService
-
setServiceRegistry
public void setServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry) - Overrides:
setServiceRegistryin classorg.opencastproject.distribution.api.AbstractDistributionService
-
setSecurityService
public void setSecurityService(org.opencastproject.security.api.SecurityService securityService) - Overrides:
setSecurityServicein classorg.opencastproject.distribution.api.AbstractDistributionService
-
setUserDirectoryService
public void setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService) - Overrides:
setUserDirectoryServicein classorg.opencastproject.distribution.api.AbstractDistributionService
-
setOrganizationDirectoryService
public void setOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryService) - Overrides:
setOrganizationDirectoryServicein classorg.opencastproject.distribution.api.AbstractDistributionService
-
setTrustedHttpClient
public void setTrustedHttpClient(org.opencastproject.security.api.TrustedHttpClient trustedHttpClient) - Overrides:
setTrustedHttpClientin classorg.opencastproject.distribution.api.AbstractDistributionService
-