use of org.opencastproject.videoeditor.api.ProcessFailedException in project opencast by opencast.
the class VideoEditorServiceRemote method processSmil.
@Override
public List<Job> processSmil(Smil smil) throws ProcessFailedException {
HttpPost post = new HttpPost("/process-smil");
List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
try {
params.add(new BasicNameValuePair("smil", smil.toXML()));
post.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
} catch (Exception e) {
throw new ProcessFailedException("Unable to assemble a remote videoeditor request for smil " + smil.getId());
}
HttpResponse response = null;
try {
response = getResponse(post);
if (response != null) {
String entity = EntityUtils.toString(response.getEntity());
if (StringUtils.isNotEmpty(entity)) {
List<Job> jobs = new LinkedList<Job>();
for (JaxbJob job : JobParser.parseJobList(entity).getJobs()) {
jobs.add(job.toJob());
}
logger.info("Start proccessing smil '{}' on remote videoeditor service", smil.getId());
return jobs;
}
}
} catch (Exception e) {
throw new ProcessFailedException("Unable to proccess smil " + smil.getId() + " using a remote videoeditor service", e);
} finally {
closeConnection(response);
}
throw new ProcessFailedException("Unable to proccess smil " + smil.getId() + " using a remote videoeditor service.");
}
Aggregations