Examples of MediaPackageElement


Examples of org.opencastproject.mediapackage.MediaPackageElement

  // FIXME Buscar un xeito de testear que se xenera ben a liña de comandos
  public void testWithInputElement() throws ExecuteException, NotFoundException {
    List<String> params = new ArrayList<String>();
    params.add("echo");
    params.add(PATTERN);
    MediaPackageElement element = MediaPackageElementBuilderFactory.newInstance().newElementBuilder()
            .elementFromURI(baseDirURI);

    String result = executor.doProcess(params, element, null, null);

    Assert.assertEquals(result, "");
View Full Code Here

Examples of org.opencastproject.mediapackage.MediaPackageElement

      if (expectedType == null)
        throw new WorkflowOperationException("'" + expectedTypeStr + "' is not a valid element type");
    }

    // Process the result element
    MediaPackageElement resultElement = null;
   
    try{
      Job job = executeService.execute(exec, params, mediaPackage, outputFilename, expectedType);

      // Wait for all jobs to be finished                                                                                                                                                                                             
      if (!waitForStatus(job).isSuccess())
        throw new WorkflowOperationException("Execute operation failed");

      if (StringUtils.trimToNull(job.getPayload()) != null) {

        resultElement = MediaPackageElementParser.getFromXml(job.getPayload());

        if (resultElement.getElementType() == MediaPackageElement.Type.Track) {
          // Have the track inspected and return the result
          Job inspectionJob = null;
          inspectionJob = inspectionService.inspect(resultElement.getURI());
          JobBarrier barrier = new JobBarrier(serviceRegistry, inspectionJob);
          if (!barrier.waitForJobs().isSuccess()) {
            throw new ExecuteException("Media inspection of " + resultElement.getURI() + " failed");
          }

          resultElement = MediaPackageElementParser.getFromXml(inspectionJob.getPayload());
        }

        // Store new element to mediaPackage
        mediaPackage.add(resultElement);
        // Store new element to mediaPackage
        URI uri = workspace.moveTo(resultElement.getURI(), mediaPackage.getIdentifier().toString(),
                resultElement.getIdentifier(), outputFilename);
        resultElement.setURI(uri);

        // Set new flavor
        if (targetFlavor != null)
          resultElement.setFlavor(targetFlavor);

        // Set new tags
        if (targetTags != null)
          // Assume the tags starting with "-" means we want to eliminate such tags form the result element
          for (String tag : asList(targetTags)) {
            if (tag.startsWith("-"))
              // We remove the tag resulting from stripping all the '-' characters at the beginning of the tag
              resultElement.removeTag(tag.replaceAll("^-+", ""));
            else
              resultElement.addTag(tag);             
          }

      }

      WorkflowOperationResult result = createResult(mediaPackage, Action.CONTINUE, job.getQueueTime());
      logger.debug("Execute operation {} completed", operation.getId());

      return result;

    } catch (ExecuteException e) {
      throw new WorkflowOperationException(e);
    } catch (MediaPackageException e) {
      throw new WorkflowOperationException("Some result element couldn't be serialized", e);
    } catch (NotFoundException e) {
      throw new WorkflowOperationException("Could not find mediapackage", e);
    } catch (IOException e) {
      throw new WorkflowOperationException("Error unmarshalling a result mediapackage element", e);
    } catch (MediaInspectionException e) {
      throw new WorkflowOperationException("Media inspection of " + resultElement.getURI() + " failed", e);
    }

  }
View Full Code Here

Examples of org.opencastproject.mediapackage.MediaPackageElement

      // FIXME: Falta o caso no que ningún estea inicializado
      if ((inputElementStr != null) && (inputMpStr != null)) {
        logger.error("Only one input MediaPackage OR input MediaPackageElement can be set at the same time");
        return Response.status(Response.Status.BAD_REQUEST).build();
      } else if ((inputElementStr != null) && (inputMpStr == null)) {
        MediaPackageElement inputElement = MediaPackageElementParser.getFromXml(inputElementStr);
        retJob = service.execute(exec, params, inputElement, outputFileName, expectedType);
      } else if ((inputElementStr == null) && (inputMpStr != null)) {
        MediaPackage inputMp = MediaPackageParser.getFromXml(inputMpStr);
        retJob = service.execute(exec, params, inputMp, outputFileName, expectedType);
      }
View Full Code Here

Examples of org.opencastproject.mediapackage.MediaPackageElement

    String outFileName = null;
    String strAux = null;
    MediaPackage mp = null;
    Type expectedType = null;
    MediaPackageElement element = null;
    Operation op = null;

    try {
      op = Operation.valueOf(job.getOperation());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.