Skip to content

Double representation EARK SIP

Miguel Guimarães edited this page May 14, 2021 · 2 revisions
    // 1) instantiate E-ARK SIP object
    SIP sip = new EARKSIP("Double-Representation-EARK-SIP");
    sip.addCreatorSoftwareAgent("RODA Commons IP", "2.0.0");

    // 1.1) set optional human-readable description
    sip.setDescription("An example of E-ARK SIP creation using commons-ip library for Webinar #11");

    // 1.2) add descriptive metadata (SIP level)
    IPDescriptiveMetadata metadataDescriptiveDC = new IPDescriptiveMetadata(
      new IPFile(Paths.get("src/main/resources/webinar/metadata_descriptive_dc.xml")),
      new MetadataType(MetadataType.MetadataTypeEnum.DC), null);
    sip.addDescriptiveMetadata(metadataDescriptiveDC);

    // 1.3) add preservation metadata (SIP level)
    IPMetadata metadataPreservation = new IPMetadata(
      new IPFile(Paths.get("src/main/resources/webinar/metadata_preservation_premis.xml")));
    sip.addPreservationMetadata(metadataPreservation);

    // 1.4) add other metadata (SIP level)
    IPFile metadataOtherFile = new IPFile(Paths.get("src/main/resources/webinar/metadata_other.txt"));
    IPMetadata metadataOther = new IPMetadata(metadataOtherFile);
    sip.addOtherMetadata(metadataOther);

    // 1.5) add xml schema (SIP level)
    sip.addSchema(new IPFile(Paths.get("src/main/resources/webinar/schema.xsd")));

    // 1.6) add documentation (SIP level)
    sip.addDocumentation(new IPFile(Paths.get("src/main/resources/webinar/documentation.pdf")));

    // 1.7) add an agent (SIP level)
    IPAgent agent = new IPAgent("Example of agent Name", "OTHER", "OTHER ROLE", METSEnums.CreatorType.INDIVIDUAL,
      "OTHER TYPE", "", IPAgentNoteTypeEnum.SOFTWARE_VERSION);
    sip.addAgent(agent);

    // 1.8) add a representation (status will be set to the default value, i.e.,
    // ORIGINAL)
    IPRepresentation representation1 = new IPRepresentation("representation 1");
    sip.addRepresentation(representation1);

    // 1.8.1) add a file to the representation
    IPFile representationFile = new IPFile(Paths.get("src/main/resources/webinar/documentation.pdf"));
    representation1.addFile(representationFile);

    // 1.9) add another representation
    IPRepresentation representation2 = new IPRepresentation("representation 2");
    sip.addRepresentation(representation2);

    // 1.9.1) add a file to the representation
    IPFile representation2File = new IPFile(Paths.get("src/main/resources/webinar/documentation.pdf"));
    // There is a possibility to rename files
    representation2File.setRenameTo("another_file.pdf");
    representation2.addFile(representation2File);

    // Final Step - Build
    Path build = sip.build(webinarFolder);
Clone this wiki locally