Class DataSetDss
- java.lang.Object
-
- ch.systemsx.cisd.openbis.dss.client.api.v1.impl.DataSetDss
-
- All Implemented Interfaces:
IDataSetDss
public class DataSetDss extends java.lang.Object implements IDataSetDss
-
-
Constructor Summary
Constructors Constructor Description DataSetDss(java.lang.String code, IDssServiceRpcGeneric service, ch.systemsx.cisd.openbis.dss.client.api.v1.impl.AuthenticatedState parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCode()
The code of this data set.java.io.InputStream
getFile(java.lang.String path)
Get anInputStream
with contents of a file contained in this data set.java.io.File
getLinkOrCopyOfContent(java.lang.String overrideStoreRootPathOrNull, java.io.File downloadDir, java.lang.String pathInDataSet)
Returns aFile
, if possible, that directly references some specified content of a data set in the data store server.java.io.File
getLinkOrCopyOfContents(java.lang.String overrideStoreRootPathOrNull, java.io.File downloadDir)
Returns aFile
, if possible, that directly references the contents of a data set in the data store server.ch.systemsx.cisd.openbis.dss.client.api.v1.impl.AuthenticatedState
getParent()
IDssServiceRpcGeneric
getService()
java.lang.String
getSessionURLForFile(java.lang.String path)
Get a URL that will return the contents of a file contained in this data set.java.lang.String
getURLForFileWithTimeout(java.lang.String path, long validityDurationInSeconds)
Get a URL that will return the contents of a file contained in this data set.FileInfoDssDTO[]
listFiles(java.lang.String startPath, boolean isRecursive)
List files contained in this data set.java.lang.String
toString()
java.lang.String
tryGetInternalPathInDataStore()
Returns the internal storage path of this data set in the datastore.java.io.File
tryLinkToContents(java.lang.String overrideStoreRootPathOrNull)
Returns aFile
, if possible, that directly references the contents of a data set in the data store server.
-
-
-
Constructor Detail
-
DataSetDss
public DataSetDss(java.lang.String code, IDssServiceRpcGeneric service, ch.systemsx.cisd.openbis.dss.client.api.v1.impl.AuthenticatedState parent)
-
-
Method Detail
-
getCode
public java.lang.String getCode()
Description copied from interface:IDataSetDss
The code of this data set.- Specified by:
getCode
in interfaceIDataSetDss
-
getFile
public java.io.InputStream getFile(java.lang.String path) throws java.lang.IllegalArgumentException, InvalidSessionException
Description copied from interface:IDataSetDss
Get anInputStream
with contents of a file contained in this data set.- Specified by:
getFile
in interfaceIDataSetDss
- Parameters:
path
- The path of the file to retrieve. The path must be relative with respect to the data set, such as the path returned byFileInfoDssDTO.getPathInDataSet()
.- Throws:
java.lang.IllegalArgumentException
InvalidSessionException
-
listFiles
public FileInfoDssDTO[] listFiles(java.lang.String startPath, boolean isRecursive) throws java.lang.IllegalArgumentException, InvalidSessionException
Description copied from interface:IDataSetDss
List files contained in this data set.- Specified by:
listFiles
in interfaceIDataSetDss
- Parameters:
startPath
- The path for the listing. The path must be relative with respect to the data set, such as the path returned byFileInfoDssDTO.getPathInDataSet()
. Use "/" or "" for the root of the hierarchy for this data set.isRecursive
- If true, the contents of any subdirectories will be listed as well.- Throws:
java.lang.IllegalArgumentException
InvalidSessionException
-
tryLinkToContents
public java.io.File tryLinkToContents(java.lang.String overrideStoreRootPathOrNull) throws java.lang.IllegalArgumentException, InvalidSessionException
Description copied from interface:IDataSetDss
Returns aFile
, if possible, that directly references the contents of a data set in the data store server. This is only possible if the file system used by the DSS is also mounted locally.- Specified by:
tryLinkToContents
in interfaceIDataSetDss
- Parameters:
overrideStoreRootPathOrNull
- A path, in the context of the local file system mounts, to the DSS' store root. If null, paths are returned in the context of the DSS' file system mounts.- Returns:
- Returns null if the operation is not possible (e.g. when the data set is a container), a File that references the contents of the data set otherwise.
- Throws:
java.lang.IllegalArgumentException
InvalidSessionException
-
tryGetInternalPathInDataStore
public java.lang.String tryGetInternalPathInDataStore() throws InvalidSessionException, EnvironmentFailureException
Description copied from interface:IDataSetDss
Returns the internal storage path of this data set in the datastore.Caution: using the return value of this methods to perform any operation on the dataset, e.g. in your own scripts, scripts opens you to a set of race conditions, e.g. when the dataset is moved to another share or deleted. Consider using
IDataSetDss.tryLinkToContents(String)
if you are actually interested in the data set content.- Specified by:
tryGetInternalPathInDataStore
in interfaceIDataSetDss
- Returns:
- Returns null if the operation is not possible (e.g. when the data set is a container), the path of the data set in the data store otherwise.
- Throws:
InvalidSessionException
EnvironmentFailureException
-
getLinkOrCopyOfContents
public java.io.File getLinkOrCopyOfContents(java.lang.String overrideStoreRootPathOrNull, java.io.File downloadDir) throws java.lang.IllegalArgumentException, InvalidSessionException
Description copied from interface:IDataSetDss
Returns aFile
, if possible, that directly references the contents of a data set in the data store server. If not possible, downloads the data set contents and returns a File in the downloadDir containing the contents of the data set.- Specified by:
getLinkOrCopyOfContents
in interfaceIDataSetDss
- Parameters:
overrideStoreRootPathOrNull
- A path, in the context of the local file system mounts, to the DSS' store root. If null, datasets are copied to the downloadDir folder.downloadDir
- The directory in which to place the contents of the data set if they must be downloaded.- Returns:
- A File containing the contents of the data set.
- Throws:
java.lang.IllegalArgumentException
InvalidSessionException
-
getLinkOrCopyOfContent
public java.io.File getLinkOrCopyOfContent(java.lang.String overrideStoreRootPathOrNull, java.io.File downloadDir, java.lang.String pathInDataSet) throws java.lang.IllegalArgumentException, InvalidSessionException
Description copied from interface:IDataSetDss
Returns aFile
, if possible, that directly references some specified content of a data set in the data store server. If not possible, downloads that content and returns a File in the downloadDir containing that content.- Specified by:
getLinkOrCopyOfContent
in interfaceIDataSetDss
- Parameters:
overrideStoreRootPathOrNull
- A path, in the context of the local file system mounts, to the DSS' store root. If null, datasets are copied to the downloadDir folder.downloadDir
- The directory in which to place the contents of the data set if they must be downloaded.pathInDataSet
- Path of requested content inside the data set.- Returns:
- A File containing the requested content.
- Throws:
java.lang.IllegalArgumentException
InvalidSessionException
-
getParent
public ch.systemsx.cisd.openbis.dss.client.api.v1.impl.AuthenticatedState getParent()
-
getService
public IDssServiceRpcGeneric getService()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getSessionURLForFile
public java.lang.String getSessionURLForFile(java.lang.String path) throws java.lang.IllegalArgumentException, InvalidSessionException
Description copied from interface:IDataSetDss
Get a URL that will return the contents of a file contained in this data set. The URL will be valid for the lifetime of the session.- Specified by:
getSessionURLForFile
in interfaceIDataSetDss
- Parameters:
path
- The path of the file to retrieve. The path must be relative with respect to the data set, such as the path returned byFileInfoDssDTO.getPathInDataSet()
.- Throws:
java.lang.IllegalArgumentException
InvalidSessionException
-
getURLForFileWithTimeout
public java.lang.String getURLForFileWithTimeout(java.lang.String path, long validityDurationInSeconds) throws java.lang.IllegalArgumentException, InvalidSessionException
Description copied from interface:IDataSetDss
Get a URL that will return the contents of a file contained in this data set. The URL will be valid for specified time duration.- Specified by:
getURLForFileWithTimeout
in interfaceIDataSetDss
- Parameters:
path
- The path of the file to retrieve. The path must be relative with respect to the data set, such as the path returned byFileInfoDssDTO.getPathInDataSet()
.validityDurationInSeconds
- The number of seconds for which the URL is valid.- Throws:
java.lang.IllegalArgumentException
InvalidSessionException
-
-