Skip to content
Miguel Guimarães edited this page May 14, 2021 · 3 revisions
    // 1) instantiate E-ARK SIP object
    SIP sip = new EARKSIP("Simple-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"));
    // 1.4.1) optionally one may rename file final name
    // metadataOtherFile.setRenameTo("metadata_other_renamed.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.9) add a representation (status will be set to the default value, i.e.,
    // ORIGINAL)
    IPRepresentation representation1 = new IPRepresentation("representation 1");
    sip.addRepresentation(representation1);

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

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