Search in sources :

Example 11 with DistributionException

use of org.opencastproject.distribution.api.DistributionException in project opencast by opencast.

the class StreamingDistributionServiceRemoteImpl method distribute.

@Override
public Job distribute(String channelId, final MediaPackage mediaPackage, Set<String> elementIds) throws DistributionException, MediaPackageException {
    logger.info(format("Distributing %s elements to %s@%s", elementIds.size(), channelId, distributionChannel));
    final HttpPost req = post(param(PARAM_CHANNEL_ID, channelId), param(PARAM_MEDIAPACKAGE, MediaPackageParser.getAsXml(mediaPackage)), param(PARAM_ELEMENT_IDS, gson.toJson(elementIds)));
    for (Job job : join(runRequest(req, jobFromHttpResponse))) {
        return job;
    }
    throw new DistributionException(format("Unable to distribute '%s' elements of " + "mediapackage '%s' using a remote destribution service proxy", elementIds.size(), mediaPackage.getIdentifier().toString()));
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) DistributionException(org.opencastproject.distribution.api.DistributionException) Job(org.opencastproject.job.api.Job)

Example 12 with DistributionException

use of org.opencastproject.distribution.api.DistributionException in project opencast by opencast.

the class AwsS3DistributionServiceRemoteImpl method restore.

@Override
public Job restore(String channelId, MediaPackage mediaPackage, String elementId, String fileName) throws DistributionException {
    logger.info(format("Restoring %s from %s@%s", elementId, channelId, distributionChannel));
    final HttpPost req = post("/restore", param(PARAM_MEDIAPACKAGE, MediaPackageParser.getAsXml(mediaPackage)), param(PARAM_ELEMENT_ID, elementId), param(PARAM_CHANNEL_ID, channelId), param(PARAM_FILENAME, fileName));
    for (Job job : join(runRequest(req, jobFromHttpResponse))) {
        return job;
    }
    throw new DistributionException(format("Unable to restore element '%s' of " + "mediapackage '%s' using a remote destribution service proxy", elementId, mediaPackage.getIdentifier().toString()));
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) DistributionException(org.opencastproject.distribution.api.DistributionException) Job(org.opencastproject.job.api.Job)

Example 13 with DistributionException

use of org.opencastproject.distribution.api.DistributionException in project opencast by opencast.

the class DownloadDistributionServiceRemoteImpl method distribute.

@Override
public Job distribute(String channelId, final MediaPackage mediaPackage, Set<String> elementIds, boolean checkAvailability, boolean preserveReference) throws DistributionException {
    logger.info(format("Distributing %s elements to %s@%s", elementIds.size(), channelId, distributionChannel));
    final HttpPost req = post(param(PARAM_CHANNEL_ID, channelId), param(PARAM_MEDIAPACKAGE, MediaPackageParser.getAsXml(mediaPackage)), param(PARAM_ELEMENT_ID, gson.toJson(elementIds)), param(PARAM_CHECK_AVAILABILITY, Boolean.toString(checkAvailability)), param(PARAM_PRESERVE_REFERENCE, Boolean.toString(preserveReference)));
    for (Job job : join(runRequest(req, jobFromHttpResponse))) {
        return job;
    }
    throw new DistributionException(format("Unable to distribute '%s' elements of " + "mediapackage '%s' using a remote destribution service proxy", elementIds.size(), mediaPackage.getIdentifier().toString()));
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) DistributionException(org.opencastproject.distribution.api.DistributionException) Job(org.opencastproject.job.api.Job)

Example 14 with DistributionException

use of org.opencastproject.distribution.api.DistributionException in project opencast by opencast.

the class DownloadDistributionServiceRemoteImpl method retract.

@Override
public Job retract(String channelId, MediaPackage mediaPackage, Set<String> elementIds) throws DistributionException {
    logger.info(format("Retracting %s elements from %s@%s", elementIds.size(), channelId, distributionChannel));
    final HttpPost req = post("/retract", param(PARAM_MEDIAPACKAGE, MediaPackageParser.getAsXml(mediaPackage)), param(PARAM_ELEMENT_ID, gson.toJson(elementIds)), param(PARAM_CHANNEL_ID, channelId));
    for (Job job : join(runRequest(req, jobFromHttpResponse))) {
        return job;
    }
    throw new DistributionException(format("Unable to retract '%s' elements of " + "mediapackage '%s' using a remote destribution service proxy", elementIds.size(), mediaPackage.getIdentifier().toString()));
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) DistributionException(org.opencastproject.distribution.api.DistributionException) Job(org.opencastproject.job.api.Job)

Example 15 with DistributionException

use of org.opencastproject.distribution.api.DistributionException in project opencast by opencast.

the class AwsS3DistributionServiceRemoteImpl method distribute.

@Override
public Job distribute(String channelId, final MediaPackage mediaPackage, Set<String> elementIds, boolean checkAvailability) throws DistributionException {
    logger.info(format("Distributing %s elements to %s@%s", elementIds.size(), channelId, distributionChannel));
    final HttpPost req = post(param(PARAM_CHANNEL_ID, channelId), param(PARAM_MEDIAPACKAGE, MediaPackageParser.getAsXml(mediaPackage)), param(PARAM_ELEMENT_ID, gson.toJson(elementIds)), param(PARAM_CHECK_AVAILABILITY, Boolean.toString(checkAvailability)));
    for (Job job : join(runRequest(req, jobFromHttpResponse))) {
        return job;
    }
    throw new DistributionException(format("Unable to distribute '%s' elements of " + "mediapackage '%s' using a remote destribution service proxy", elementIds.size(), mediaPackage.getIdentifier().toString()));
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) DistributionException(org.opencastproject.distribution.api.DistributionException) Job(org.opencastproject.job.api.Job)

Aggregations

DistributionException (org.opencastproject.distribution.api.DistributionException)35 ServiceRegistryException (org.opencastproject.serviceregistry.api.ServiceRegistryException)17 Job (org.opencastproject.job.api.Job)16 MediaPackageElement (org.opencastproject.mediapackage.MediaPackageElement)14 MediaPackageException (org.opencastproject.mediapackage.MediaPackageException)11 NotFoundException (org.opencastproject.util.NotFoundException)11 IOException (java.io.IOException)9 File (java.io.File)7 URISyntaxException (java.net.URISyntaxException)7 ArrayList (java.util.ArrayList)7 HashSet (java.util.HashSet)7 HttpPost (org.apache.http.client.methods.HttpPost)7 MediaPackage (org.opencastproject.mediapackage.MediaPackage)7 URI (java.net.URI)6 ConfigurationException (org.osgi.service.cm.ConfigurationException)6 Publication (org.opencastproject.mediapackage.Publication)4 WorkflowOperationException (org.opencastproject.workflow.api.WorkflowOperationException)4 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)3 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)3 TransformerException (javax.xml.transform.TransformerException)3