Class BagItROService
- java.lang.Object
-
- uk.org.esciencelab.researchobjectservice.serialization.BagItROService
-
@Service public class BagItROService extends java.lang.Object
A service for creating a BagIt RO folder (or Zip file) from a given ResearchObject.
-
-
Constructor Summary
Constructors Constructor Description BagItROService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.file.Path
bag(ResearchObject researchObject)
Create a BagIt RO folder.void
bagToZip(ResearchObject researchObject, java.io.OutputStream outputStream)
Bag the given Research Object, then Zip it to the given output stream.java.util.ArrayList<RemoteResource>
gatherBagEntries(com.fasterxml.jackson.databind.JsonNode json, org.everit.json.schema.Schema schema, java.lang.String bagPath)
A recursive method to traverse a JSON object, discovering and gathering a list of RemoteResource objects that should be bagged in the BagIt RO.
-
-
-
Method Detail
-
bag
public java.nio.file.Path bag(ResearchObject researchObject) throws java.lang.Exception
Create a BagIt RO folder.- Parameters:
researchObject
- The Research Object to bag.- Returns:
- The path to the folder.
- Throws:
java.lang.Exception
-
bagToZip
public void bagToZip(ResearchObject researchObject, java.io.OutputStream outputStream) throws java.lang.Exception
Bag the given Research Object, then Zip it to the given output stream.- Parameters:
researchObject
- The RO to bag.outputStream
- The stream to zip to.- Throws:
java.lang.Exception
-
gatherBagEntries
public java.util.ArrayList<RemoteResource> gatherBagEntries(com.fasterxml.jackson.databind.JsonNode json, org.everit.json.schema.Schema schema, java.lang.String bagPath)
A recursive method to traverse a JSON object, discovering and gathering a list of RemoteResource objects that should be bagged in the BagIt RO.- Parameters:
json
- The JSON object to traverse.schema
- A schema for the JSON object.bagPath
- The path (relative to bagRoot) where to bag the next JSON object that is discovered. Should be null to start with.- Returns:
- A list of RemoteResources.
-
-