Class PackageDownloaderV2

java.lang.Object
edu.ucsb.nceas.metacat.download.PackageDownloaderV2

public class PackageDownloaderV2 extends Object
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 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 map
      resourceMap - : The package's resource map
      Throws:
      org.dataone.service.exceptions.ServiceFailure
  • Method Details

    • getCoreMetadataIdentifiers

      public List<org.dataone.service.types.v1.Identifier> 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

      public List<org.dataone.service.types.v1.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 added
      inputStream - 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 metadata
      inputStream - 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.ServiceFailure
      Adds 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.NotImplemented
      Streams 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()