Package edu.ucsb.nceas.metacat.download
Class PackageDownloaderV2
java.lang.Object
edu.ucsb.nceas.metacat.download.PackageDownloaderV2
A class that handles downloading data packages under the V2 format. It contains a number of
private members that hold information about the data package (lists of identifiers, metadata,
file paths, etc). The public member functions are used as interfaces: identifiers, metadata,
etc. are added to this class through them.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPackageDownloaderV2
(org.dataone.service.types.v1.Identifier pid, org.dspace.foresite.ResourceMap resourceMap, org.dataone.service.types.v2.SystemMetadata resourceMapSystemMetadata) Creates a PackageDownloader object -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataFile
(org.dataone.service.types.v2.SystemMetadata systemMetadata, InputStream inputStream) Adds a data file's stream to the bagvoid
Adds the resource map to the bag.void
addScienceMetadata
(org.dataone.service.types.v2.SystemMetadata sysMeta, InputStream inputStream) Adds a system metadata document and its InputStream to the class recordvoid
void
addScienceSystemMetadata
(org.dataone.service.types.v1.Identifier scienceMetadataIdentifier) Sets the science metadatavoid
addSystemMetadata
(org.dataone.service.types.v2.SystemMetadata systemMetadata) Adds a system metadata object to the bagdownload()
Streams the completed bag to the caller.List<org.dataone.service.types.v1.Identifier>
Returns the core metadata identifiersList<org.dataone.service.types.v1.Identifier>
Gets all of the science metadata documents in the downloadervoid
-
Field Details
-
speedBag
public org.dataone.speedbagit.SpeedBagIt speedBag
-
-
Constructor Details
-
PackageDownloaderV2
public PackageDownloaderV2(org.dataone.service.types.v1.Identifier pid, org.dspace.foresite.ResourceMap resourceMap, org.dataone.service.types.v2.SystemMetadata resourceMapSystemMetadata) throws org.dataone.service.exceptions.ServiceFailure Creates a PackageDownloader object- Parameters:
pid
- : The PID of the resource mapresourceMap
- : The package's resource map- Throws:
org.dataone.service.exceptions.ServiceFailure
-
-
Method Details
-
getCoreMetadataIdentifiers
Returns the core metadata identifiers -
addScienceSystemMetadata
public void addScienceSystemMetadata(org.dataone.service.types.v1.Identifier scienceMetadataIdentifier) Sets the science metadata- Parameters:
scienceMetadataIdentifier
- : The science metadata identifier
-
getScienceMetadataIdentifiers
Gets all of the science metadata documents in the downloader- Returns:
-
addScienceMetadata
public void addScienceMetadata(org.dataone.service.types.v2.SystemMetadata sysMeta, InputStream inputStream) Adds a system metadata document and its InputStream to the class record- Parameters:
sysMeta
- the system metadata being addedinputStream
- An InputStream to the science metadata
-
addDataFile
public void addDataFile(org.dataone.service.types.v2.SystemMetadata systemMetadata, InputStream inputStream) throws org.dataone.service.exceptions.ServiceFailure Adds a data file's stream to the bag- Parameters:
systemMetadata
- The object's system metadatainputStream
- An input stream to the data file- Throws:
org.dataone.service.exceptions.ServiceFailure
-
addScienceMetadatas
public void addScienceMetadatas() throws NoSuchAlgorithmException, org.dataone.service.exceptions.ServiceFailure- Throws:
NoSuchAlgorithmException
org.dataone.service.exceptions.ServiceFailure
-
addResourceMap
public void addResourceMap() throws NoSuchAlgorithmException, org.dataone.service.exceptions.ServiceFailureAdds the resource map to the bag.- Throws:
NoSuchAlgorithmException
org.dataone.service.exceptions.ServiceFailure
-
addSystemMetadata
public void addSystemMetadata(org.dataone.service.types.v2.SystemMetadata systemMetadata) throws NoSuchAlgorithmException Adds a system metadata object to the bag- Parameters:
systemMetadata
- : The system metadata object being added to the bag- Throws:
NoSuchAlgorithmException
-
download
public InputStream download() throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotImplementedStreams the completed bag to the caller.- Returns:
- An InputStream consisting of the bag bytes
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.NotImplemented
-
getScienceMetadataIds
public void getScienceMetadataIds()
-