Class RemoteResource
- java.lang.Object
-
- uk.org.esciencelab.researchobjectservice.serialization.RemoteResource
-
public class RemoteResource extends java.lang.ObjectA 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.StringgetChecksum(java.lang.String alg)java.lang.StringgetFilename()java.nio.file.PathgetFilepath()Get the file path relative to the root of the bag.java.nio.file.PathgetFullFolderPath()longgetLength()org.apache.taverna.robundle.manifest.PathMetadatagetPathMetadata()Create a PathMetadata entry for this resource, used to populate the "aggregates" section of the RO's manifest.json.java.net.URLgetUrl()voidsetChecksum(java.lang.String alg, java.lang.String value)java.lang.StringtoString()
-
-
-
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:
toStringin classjava.lang.Object
-
-