@Before
 public void setup() throws Exception {
   ram = PluginManager.getStorage("ram");
   ram.init("{}");
   ffmpeg = new FfmpegMockImpl();
   sourceObject =
       StorageUtils.storeFile(ram, new File(getClass().getResource("/african_drum.aif").toURI()));
 }
Exemplo n.º 2
0
  private String createDigitalObject(File file) throws HarvesterException, StorageException {
    String objectId;
    DigitalObject object;
    if (forceUpdate) {
      object = StorageUtils.storeFile(getStorage(), file, !forceLocalStorage);
    } else {
      String oid = StorageUtils.generateOid(file);
      String pid = StorageUtils.generatePid(file);
      object = getStorage().createObject(oid);
      if (forceLocalStorage) {
        try {
          object.createStoredPayload(pid, new FileInputStream(file));
        } catch (FileNotFoundException ex) {
          throw new HarvesterException(ex);
        }
      } else {
        object.createLinkedPayload(pid, file.getAbsolutePath());
      }
    }
    // update object metadata
    Properties props = object.getMetadata();
    props.setProperty("render-pending", "true");
    props.setProperty("file.path", FilenameUtils.separatorsToUnix(file.getAbsolutePath()));
    objectId = object.getId();

    // Store rendition information if we have it
    String ext = FilenameUtils.getExtension(file.getName());
    for (String chain : renderChains.keySet()) {
      Map<String, List<String>> details = renderChains.get(chain);
      if (details.get("fileTypes").contains(ext)) {
        storeList(props, details, "harvestQueue");
        storeList(props, details, "indexOnHarvest");
        storeList(props, details, "renderQueue");
      }
    }

    object.close();
    return objectId;
  }