-
Notifications
You must be signed in to change notification settings - Fork 14
Full EARK SIP
Miguel Guimarães edited this page May 14, 2021
·
3 revisions
// 1) instantiate E-ARK SIP object
SIP sip = new EARKSIP("Full-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")).setRenameTo("DC.xml"),
new MetadataType(MetadataType.MetadataTypeEnum.DC), null);
sip.addDescriptiveMetadata(metadataDescriptiveDC);
IPDescriptiveMetadata metadataDescriptiveEAD = new IPDescriptiveMetadata(
new IPFile(Paths.get("src/main/resources/webinar/metadata_descriptive_ead.xml")).setRenameTo("EAD.xml"),
new MetadataType(MetadataType.MetadataTypeEnum.EAD), null);
sip.addDescriptiveMetadata(metadataDescriptiveEAD);
// 1.3) add preservation metadata (SIP level)
IPMetadata metadataPreservation = new IPMetadata(
new IPFile(Paths.get("src/main/resources/webinar/metadata_preservation_premis.xml")).setRenameTo("PREMIS1.xml"));
sip.addPreservationMetadata(metadataPreservation);
IPMetadata metadataPreservation2 = new IPMetadata(
new IPFile(Paths.get("src/main/resources/webinar/metadata_preservation_premis.xml")).setRenameTo("PREMIS2.xml"));
sip.addPreservationMetadata(metadataPreservation2);
// 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")).setRenameTo("EAD.xsd"));
sip.addSchema(new IPFile(Paths.get("src/main/resources/webinar/schema.xsd")).setRenameTo("DC.xsd"));
sip.addSchema(new IPFile(Paths.get("src/main/resources/webinar/schema.xsd")).setRenameTo("PREMIS.xsd"));
// 1.6) add documentation (SIP level)
sip.addDocumentation(
new IPFile(Paths.get("src/main/resources/webinar/documentation.pdf")).setRenameTo("UserManual.pdf"));
sip.addDocumentation(
new IPFile(Paths.get("src/main/resources/webinar/documentation.pdf")).setRenameTo("SubmissionProcess.pdf"));
// 1.7) add a representation
IPRepresentation representation1 = new IPRepresentation("representation 1");
sip.addRepresentation(representation1);
representation1.addPreservationMetadata(
new IPMetadata(new IPFile(Paths.get("src/main/resources/webinar/metadata_preservation_premis.xml"))
.setRenameTo("PREMIS_R1-xml")));
representation1.addDocumentation(
new IPFile(Paths.get("src/main/resources/webinar/documentation.pdf")).setRenameTo("PDF-format-spec.pdf"));
IPFile representationFile = new IPFile(Paths.get("src/main/resources/webinar/documentation.pdf"));
representation1.addFile(representationFile);
// 1.8) add a representation
IPRepresentation representation2 = new IPRepresentation("representation 2");
sip.addRepresentation(representation2);
representation2.addPreservationMetadata(
new IPMetadata(new IPFile(Paths.get("src/main/resources/webinar/metadata_preservation_premis.xml"))
.setRenameTo("PREMIS_R2-xml")));
representation2.addDocumentation(
new IPFile(Paths.get("src/main/resources/webinar/documentation.pdf")).setRenameTo("SIARD-format-spec.pdf"));
IPFile representationFile2 = new IPFile(Paths.get("src/main/resources/webinar/test.siard"));
representation2.addFile(representationFile2);
// Final Step - Build
Path build = sip.build(webinarFolder);