Class RemoteResource


  • public class RemoteResource
    extends java.lang.Object
    A remote resource to be bagged.
    • Constructor Summary

      Constructors 
      Constructor Description
      RemoteResource​(java.lang.String folder, com.fasterxml.jackson.databind.JsonNode entryNode)  
      RemoteResource​(java.nio.file.Path folder, java.lang.String filename, java.net.URL url, long length)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getChecksum​(java.lang.String alg)  
      java.lang.String getFilename()  
      java.nio.file.Path getFilepath()
      Get the file path relative to the root of the bag.
      java.nio.file.Path getFullFolderPath()  
      long getLength()  
      org.apache.taverna.robundle.manifest.PathMetadata getPathMetadata()
      Create a PathMetadata entry for this resource, used to populate the "aggregates" section of the RO's manifest.json.
      java.net.URL getUrl()  
      void setChecksum​(java.lang.String alg, java.lang.String value)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RemoteResource

        public RemoteResource​(java.nio.file.Path folder,
                              java.lang.String filename,
                              java.net.URL url,
                              long length)
        Parameters:
        folder - A relative path where this resource will be bagged (within `_bag_root_/data`).
        filename - The filename of this resource.
        url - The URL from which this resource should be fetched/
        length - The length in bytes of the resource.
      • RemoteResource

        public RemoteResource​(java.lang.String folder,
                              com.fasterxml.jackson.databind.JsonNode entryNode)
                       throws java.net.MalformedURLException
        Parameters:
        folder - A string containing an absolute path of a folder in which to bag this resource. The root ("/") of the path is `_bag_root_/data`, so `/foo` would be bagged at `_bag_root_/data/foo` and `/` would be bagged at `_bag_root_/data`.
        entryNode - A JSON object conforming to `/schemas/_base.schema.json#/definitions/RemoteItem`, containing information on the filename, URL, length and checksums of this resource.
        Throws:
        java.net.MalformedURLException
    • Method Detail

      • getUrl

        public java.net.URL getUrl()
      • getFilename

        public java.lang.String getFilename()
      • getLength

        public long getLength()
      • getChecksum

        public java.lang.String getChecksum​(java.lang.String alg)
      • setChecksum

        public void setChecksum​(java.lang.String alg,
                                java.lang.String value)
      • getFullFolderPath

        public java.nio.file.Path getFullFolderPath()
      • getFilepath

        public java.nio.file.Path getFilepath()
        Get the file path relative to the root of the bag. e.g. data/hello_world.txt.
        Returns:
      • getPathMetadata

        public org.apache.taverna.robundle.manifest.PathMetadata getPathMetadata()
        Create a PathMetadata entry for this resource, used to populate the "aggregates" section of the RO's manifest.json.
        Returns:
        The PathMetadata entry.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object