Class StreamingDistributionServiceRemoteImpl
java.lang.Object
org.opencastproject.serviceregistry.api.RemoteBase
org.opencastproject.distribution.streaming.remote.StreamingDistributionServiceRemoteImpl
- All Implemented Interfaces:
DistributionService,StreamingDistributionService
public class StreamingDistributionServiceRemoteImpl
extends RemoteBase
implements StreamingDistributionService
A remote distribution service invoker.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opencastproject.serviceregistry.api.RemoteBase
RemoteBase.HttpClientClosingInputStream -
Field Summary
FieldsFields inherited from class org.opencastproject.serviceregistry.api.RemoteBase
client, remoteServiceManager, serviceTypeFields inherited from interface org.opencastproject.distribution.api.DistributionService
CONFIG_KEY_STORE_TYPE, JOB_TYPE_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidactivate(org.osgi.service.component.ComponentContext cc) activates the componentdistribute(String channelId, MediaPackage mediaPackage, String elementId) Distribute a media package element.distribute(String channelId, MediaPackage mediaPackage, Set<String> elementIds) distributeSync(String channelId, MediaPackage mediaPackage, String elementId) Distributes a media package element synchronously, bypassing the Opencast job system.distributeSync(String channelId, MediaPackage mediapackage, Set<String> elementIds) Distributes the given elements synchronously.Returns the distribution type for this service.booleanChecks if streaming is enabled for the current tenant.retract(String channelId, MediaPackage mediaPackage, String elementId) Retract a media package element from the distribution channel.retract(String channelId, MediaPackage mediaPackage, Set<String> elementIds) retractSync(String channelId, MediaPackage mediaPackage, String elementId) Retract a media package element from the distribution channel synchronously, bypassing the Opencast job system.retractSync(String channelId, MediaPackage mediaPackage, Set<String> elementIds) Retracts the given elements synchronously.voidsetRemoteServiceManager(ServiceRegistry serviceRegistry) Sets the remote service manager.voidsetTrustedHttpClient(TrustedHttpClient trustedHttpClient) Sets the trusted http clientMethods inherited from class org.opencastproject.serviceregistry.api.RemoteBase
closeConnection, elementsFromHttpResponse, getResponse, getResponse, runRequest
-
Field Details
-
distributionChannel
The distribution channel identifier
-
-
Constructor Details
-
StreamingDistributionServiceRemoteImpl
public StreamingDistributionServiceRemoteImpl()
-
-
Method Details
-
activate
protected void activate(org.osgi.service.component.ComponentContext cc) activates the component -
getDistributionType
Description copied from interface:DistributionServiceReturns the distribution type for this service. This type should be unique within an Opencast instance, and is used to select where file distribution happens.- Specified by:
getDistributionTypein interfaceDistributionService- Returns:
- The distribution type. A string like "download", or "streaming"
-
distribute
public Job distribute(String channelId, MediaPackage mediaPackage, String elementId) throws DistributionException, MediaPackageException Description copied from interface:DistributionServiceDistribute a media package element.- Specified by:
distributein interfaceDistributionService- Parameters:
mediaPackage- the media packageelementId- the element in the media package to distribute- Returns:
- The job
- Throws:
DistributionException- if there was a problem distributing the mediaMediaPackageException- if there was a problem with the mediapackage element
-
publishToStreaming
public boolean publishToStreaming()Description copied from interface:StreamingDistributionServiceChecks if streaming is enabled for the current tenant.- Specified by:
publishToStreamingin interfaceStreamingDistributionService- Returns:
- whether streaming is enabled for the current tenant
-
distribute
public Job distribute(String channelId, MediaPackage mediaPackage, Set<String> elementIds) throws DistributionException, MediaPackageException - Specified by:
distributein interfaceStreamingDistributionService- Throws:
DistributionExceptionMediaPackageException
-
retract
public Job retract(String channelId, MediaPackage mediaPackage, String elementId) throws DistributionException Description copied from interface:DistributionServiceRetract a media package element from the distribution channel.- Specified by:
retractin interfaceDistributionService- Parameters:
mediaPackage- the media packageelementId- the media package element to retract- Throws:
DistributionException- if there was a problem retracting the mediapackage
-
retract
public Job retract(String channelId, MediaPackage mediaPackage, Set<String> elementIds) throws DistributionException - Specified by:
retractin interfaceStreamingDistributionService- Throws:
DistributionException
-
distributeSync
public List<MediaPackageElement> distributeSync(String channelId, MediaPackage mediaPackage, String elementId) throws DistributionException Description copied from interface:DistributionServiceDistributes a media package element synchronously, bypassing the Opencast job system.- Specified by:
distributeSyncin interfaceDistributionService- Parameters:
mediaPackage- the media packageelementId- the element in the media package to distribute- Returns:
- list of distributed media package elements
- Throws:
DistributionException- if there was a problem distributing the media
-
distributeSync
public List<MediaPackageElement> distributeSync(String channelId, MediaPackage mediapackage, Set<String> elementIds) throws DistributionException Description copied from interface:StreamingDistributionServiceDistributes the given elements synchronously. This should be used rarely since load balancing will be unavailable. However, since the dispatching logic is bypassed, synchronous execution is much faster. It is useful in interactive scenarios where you synchronously wait for job execution anyway and you don't want to make the user waiting for too long.- Specified by:
distributeSyncin interfaceStreamingDistributionService- Parameters:
channelId- The channel to retract from.mediapackage- A media package holding the elements to retract.elementIds- The IDs of the elements to retract.- Returns:
- The distributed elements.
- Throws:
DistributionException- In case distribution fails.
-
retractSync
public List<MediaPackageElement> retractSync(String channelId, MediaPackage mediaPackage, String elementId) throws DistributionException Description copied from interface:DistributionServiceRetract a media package element from the distribution channel synchronously, bypassing the Opencast job system.- Specified by:
retractSyncin interfaceDistributionService- Parameters:
mediaPackage- the media packageelementId- the media package element to retract- Returns:
- list of retracted media package elements
- Throws:
DistributionException- if there was a problem retracting the mediapackage
-
retractSync
public List<MediaPackageElement> retractSync(String channelId, MediaPackage mediaPackage, Set<String> elementIds) throws DistributionException Description copied from interface:StreamingDistributionServiceRetracts the given elements synchronously. This should be used rarely since load balancing will be unavailable. However, since the dispatching logic is bypassed, synchronous execution is much faster. It is useful in interactive scenarios where you synchronously wait for job execution anyway and you don't want to make the user waiting for too long.- Specified by:
retractSyncin interfaceStreamingDistributionService- Parameters:
channelId- The channel to retract from.mediaPackage- A media package holding the elements to retract.elementIds- The IDs of the elements to retract.- Returns:
- The retracted elements.
- Throws:
DistributionException- In case retraction fails.
-
setTrustedHttpClient
Description copied from class:RemoteBaseSets the trusted http client- Overrides:
setTrustedHttpClientin classRemoteBase- Parameters:
trustedHttpClient-
-
setRemoteServiceManager
Description copied from class:RemoteBaseSets the remote service manager.- Overrides:
setRemoteServiceManagerin classRemoteBase- Parameters:
serviceRegistry-
-