Class DssServiceRpcGeneric
- java.lang.Object
-
- ch.systemsx.cisd.openbis.common.spring.AbstractServiceWithLogger<T>
-
- ch.systemsx.cisd.openbis.dss.generic.server.AbstractDssServiceRpc<IDssServiceRpcGenericInternal>
-
- ch.systemsx.cisd.openbis.dss.generic.server.api.v1.DssServiceRpcGeneric
-
- All Implemented Interfaces:
IRpcService
,ch.systemsx.cisd.openbis.common.spring.IInvocationLoggerFactory<IDssServiceRpcGenericInternal>
,IDssServiceRpcGenericInternal
,IDssServiceRpcGeneric
public class DssServiceRpcGeneric extends ch.systemsx.cisd.openbis.dss.generic.server.AbstractDssServiceRpc<IDssServiceRpcGenericInternal> implements IDssServiceRpcGenericInternal
Implementation of the generic RPC interface.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.log4j.Logger
operationLog
Logger withLogCategory.OPERATION
with name of the concrete class, needs to be static for our purpose.-
Fields inherited from class ch.systemsx.cisd.openbis.common.spring.AbstractServiceWithLogger
authenticationLog, notificationLog
-
Fields inherited from interface ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric
DSS_SERVICE_NAME
-
-
Constructor Summary
Constructors Constructor Description DssServiceRpcGeneric(ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService openBISService, IQueryApiServer apiServer, ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IPluginTaskInfoProvider infoProvider)
The designated constructor.DssServiceRpcGeneric(ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService openBISService, IQueryApiServer apiServer, ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IPluginTaskInfoProvider infoProvider, ch.systemsx.cisd.openbis.dss.generic.server.IStreamRepository streamRepository, ch.systemsx.cisd.common.filesystem.IFreeSpaceProvider freeSpaceProvider, ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager, ch.systemsx.cisd.openbis.dss.generic.shared.IHierarchicalContentProvider contentProvider, PutDataSetService service)
A constructor for testing.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
convertPath(java.io.File storeRoot, java.io.File dataSetRoot, java.lang.String overrideStoreRootPathOrNull)
IDssServiceRpcGenericInternal
createLogger(ch.systemsx.cisd.openbis.common.spring.IInvocationLoggerContext context)
QueryTableModel
createReportFromAggregationService(java.lang.String sessionToken, java.lang.String aggregationServiceName, java.util.Map<java.lang.String,java.lang.Object> parameters)
Create the report from the specified aggregation service.QueryTableModel
createReportFromDataSets(java.lang.String sessionToken, java.lang.String serviceKey, java.util.List<java.lang.String> dataSetCodes)
Creates for the specified data sets a report.boolean
deleteSessionWorkspaceFile(java.lang.String sessionToken, java.lang.String path)
Delete a file or directory in the session workspace.java.lang.String
getDownloadUrlForFileForDataSet(java.lang.String sessionToken, DataSetFileDTO fileOrFolder)
Returns an URL from which the requested file.java.lang.String
getDownloadUrlForFileForDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String path)
Returns an URL from which the requested file of the specified data set can be downloaded.java.lang.String
getDownloadUrlForFileForDataSetWithTimeout(java.lang.String sessionToken, DataSetFileDTO fileOrFolder, long validityDurationInSeconds)
Returns an URL from which the requested file.java.lang.String
getDownloadUrlForFileForDataSetWithTimeout(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String path, long validityDurationInSeconds)
Returns an URL from which the requested file of the specified data set can be downloaded.java.io.InputStream
getFileForDataSet(java.lang.String sessionToken, DataSetFileDTO fileOrFolder)
Get an array of FileInfoDss objects that describe the file-system structure of the data set.java.io.InputStream
getFileForDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String path)
Get an array of FileInfoDss objects that describe the file-system structure of the data set.java.io.InputStream
getFileFromSessionWorkspace(java.lang.String sessionToken, java.lang.String filePath)
Download a file from the user's session workspace.int
getMajorVersion()
Returns the major version of the server side interface.int
getMinorVersion()
Returns the minor version of this server side interface.java.lang.String
getPathToDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String overrideStoreRootPathOrNull)
Get a path to the data set.java.lang.String
getValidationScript(java.lang.String sessionToken, java.lang.String dataSetTypeOrNull)
Get the validation script for the specified data set type.java.util.List<AggregationServiceDescription>
listAggregationServices(java.lang.String sessionToken)
Returns metadata for all aggregation services.java.util.List<ShareInfo>
listAllShares(java.lang.String sessionToken)
Lists all shares.FileInfoDssDTO[]
listFilesForDataSet(java.lang.String sessionToken, DataSetFileDTO fileOrFolder)
Get an array of FileInfoDss objects that describe the file-system structure of the data set.FileInfoDssDTO[]
listFilesForDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String startPath, boolean isRecursive)
Get an array of FileInfoDss objects that describe the file-system structure of the data set.java.util.List<ReportDescription>
listTableReportDescriptions(java.lang.String sessionToken)
Returns meta data for all reporting plugins which deliver a table.java.lang.String
putDataSet(java.lang.String sessionToken, NewDataSetDTO newDataSet, java.io.InputStream inputStream)
Upload a new data set to the DSS.long
putFileSliceToSessionWorkspace(java.lang.String sessionToken, java.lang.String filePath, long slicePosition, java.io.InputStream sliceInputStream)
Upload a file slice to the user's session workspace.long
putFileToSessionWorkspace(java.lang.String sessionToken, java.lang.String filePath, java.io.InputStream inputStream)
Upload a new file to the user's session workspace.void
setDataStoreCode(java.lang.String dataStoreCode)
void
setStoreDirectory(java.io.File aFile)
void
shuffleDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String shareId)
Moves specified data set to specified share.java.lang.String
tryGetPathToDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String overrideStoreRootPathOrNull)
Get a path to the data set.
-
-
-
Constructor Detail
-
DssServiceRpcGeneric
public DssServiceRpcGeneric(ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService openBISService, IQueryApiServer apiServer, ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IPluginTaskInfoProvider infoProvider)
The designated constructor.
-
DssServiceRpcGeneric
public DssServiceRpcGeneric(ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService openBISService, IQueryApiServer apiServer, ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IPluginTaskInfoProvider infoProvider, ch.systemsx.cisd.openbis.dss.generic.server.IStreamRepository streamRepository, ch.systemsx.cisd.common.filesystem.IFreeSpaceProvider freeSpaceProvider, ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager, ch.systemsx.cisd.openbis.dss.generic.shared.IHierarchicalContentProvider contentProvider, PutDataSetService service)
A constructor for testing.
-
-
Method Detail
-
setDataStoreCode
public void setDataStoreCode(java.lang.String dataStoreCode)
-
createLogger
public IDssServiceRpcGenericInternal createLogger(ch.systemsx.cisd.openbis.common.spring.IInvocationLoggerContext context)
- Specified by:
createLogger
in interfacech.systemsx.cisd.openbis.common.spring.IInvocationLoggerFactory<IDssServiceRpcGenericInternal>
-
listFilesForDataSet
public FileInfoDssDTO[] listFilesForDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String startPath, boolean isRecursive) throws java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Get an array of FileInfoDss objects that describe the file-system structure of the data set.- Specified by:
listFilesForDataSet
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokendataSetCode
- The data set to retrieve file information aboutstartPath
- The path within the data set to retrieve file information aboutisRecursive
- Should the result include information for sub folders?- Throws:
java.lang.IllegalArgumentException
- Thrown if the dataSetCode or startPath are not valid
-
getFileForDataSet
public java.io.InputStream getFileForDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String path) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Get an array of FileInfoDss objects that describe the file-system structure of the data set.- Specified by:
getFileForDataSet
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokendataSetCode
- The data set to retrieve file frompath
- The path within the data set to retrieve file information about- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs when listing the filesjava.lang.IllegalArgumentException
- Thrown if the dataSetCode or startPath are not valid
-
getDownloadUrlForFileForDataSet
public java.lang.String getDownloadUrlForFileForDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String path) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Returns an URL from which the requested file of the specified data set can be downloaded. The URL is valid only for a short time.- Specified by:
getDownloadUrlForFileForDataSet
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokendataSetCode
- The data set to retrieve file frompath
- The path within the data set to retrieve file information about- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs when listing the filesjava.lang.IllegalArgumentException
- Thrown if the dataSetCode or startPath are not valid
-
getDownloadUrlForFileForDataSetWithTimeout
public java.lang.String getDownloadUrlForFileForDataSetWithTimeout(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String path, long validityDurationInSeconds) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Returns an URL from which the requested file of the specified data set can be downloaded. The URL is valid for a caller-specified amount of time.- Specified by:
getDownloadUrlForFileForDataSetWithTimeout
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokendataSetCode
- The data set to retrieve file frompath
- The path within the data set to retrieve file information aboutvalidityDurationInSeconds
- The number of seconds for which the download URL should be valid.- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs when listing the filesjava.lang.IllegalArgumentException
- Thrown if the dataSetCode or startPath are not valid
-
putDataSet
public java.lang.String putDataSet(java.lang.String sessionToken, NewDataSetDTO newDataSet, java.io.InputStream inputStream) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Upload a new data set to the DSS.- Specified by:
putDataSet
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokennewDataSet
- The new data set that should be registeredinputStream
- An input stream on the file or folder to register- Returns:
- The code of the newly-added data set
- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs when listing the filesjava.lang.IllegalArgumentException
- Thrown if the dataSetCode or startPath are not valid
-
putFileToSessionWorkspace
public long putFileToSessionWorkspace(java.lang.String sessionToken, java.lang.String filePath, java.io.InputStream inputStream) throws IOExceptionUnchecked
Description copied from interface:IDssServiceRpcGeneric
Upload a new file to the user's session workspace.- Specified by:
putFileToSessionWorkspace
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session token.filePath
- The file path (including the sub-directory) to upload the file to.inputStream
- An input stream on the file to upload.- Throws:
IOExceptionUnchecked
- Thrown if because filePath does not exist.
-
putFileSliceToSessionWorkspace
public long putFileSliceToSessionWorkspace(java.lang.String sessionToken, java.lang.String filePath, long slicePosition, java.io.InputStream sliceInputStream) throws IOExceptionUnchecked
Description copied from interface:IDssServiceRpcGeneric
Upload a file slice to the user's session workspace. If the file does not exist then it will created.- Specified by:
putFileSliceToSessionWorkspace
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session token.filePath
- The file path (including the sub-directory) to upload the slice to.slicePosition
- The position the slice should be inserted at.sliceInputStream
- An input stream of the slice to be uploaded.- Returns:
- The number of bytes written.
- Throws:
IOExceptionUnchecked
- Thrown if IOException occurs.
-
getFileFromSessionWorkspace
public java.io.InputStream getFileFromSessionWorkspace(java.lang.String sessionToken, java.lang.String filePath) throws IOExceptionUnchecked
Description copied from interface:IDssServiceRpcGeneric
Download a file from the user's session workspace.- Specified by:
getFileFromSessionWorkspace
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session token.filePath
- The file path (including the sub-directory) to download the file from.- Returns:
- The input stream containing the file content.
- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs.
-
deleteSessionWorkspaceFile
public boolean deleteSessionWorkspaceFile(java.lang.String sessionToken, java.lang.String path)
Description copied from interface:IDssServiceRpcGeneric
Delete a file or directory in the session workspace.- Specified by:
deleteSessionWorkspaceFile
in interfaceIDssServiceRpcGeneric
- Returns:
true
if the path doesn't exist anymore.
-
getMajorVersion
public int getMajorVersion()
Description copied from interface:IRpcService
Returns the major version of the server side interface. Different major versions are incompatible with one another.- Specified by:
getMajorVersion
in interfaceIRpcService
-
getMinorVersion
public int getMinorVersion()
Description copied from interface:IRpcService
Returns the minor version of this server side interface. Different minor versions, within the same major version, are compatible with one another.- Specified by:
getMinorVersion
in interfaceIRpcService
-
getFileForDataSet
public java.io.InputStream getFileForDataSet(java.lang.String sessionToken, DataSetFileDTO fileOrFolder) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Get an array of FileInfoDss objects that describe the file-system structure of the data set.- Specified by:
getFileForDataSet
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokenfileOrFolder
- The file or folder to retrieve- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs when listing the filesjava.lang.IllegalArgumentException
- Thrown if the dataSetCode or startPath are not valid
-
getDownloadUrlForFileForDataSet
public java.lang.String getDownloadUrlForFileForDataSet(java.lang.String sessionToken, DataSetFileDTO fileOrFolder) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Returns an URL from which the requested file. The URL is valid only for a short time.- Specified by:
getDownloadUrlForFileForDataSet
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokenfileOrFolder
- The file or folder to retrieve- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs when listing the filesjava.lang.IllegalArgumentException
- Thrown if the dataSetCode or startPath are not valid
-
getDownloadUrlForFileForDataSetWithTimeout
public java.lang.String getDownloadUrlForFileForDataSetWithTimeout(java.lang.String sessionToken, DataSetFileDTO fileOrFolder, long validityDurationInSeconds) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Returns an URL from which the requested file. The URL is valid for a caller-specified amount of time.- Specified by:
getDownloadUrlForFileForDataSetWithTimeout
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokenfileOrFolder
- The file or folder to retrievevalidityDurationInSeconds
- The number of seconds for which the download URL should be valid. The validity is clipped to the durations defined in the properties data-stream-timeout and data-stream-max-timeout, which default to 5 seconds and 4 hours, respectively.- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs when listing the filesjava.lang.IllegalArgumentException
- Thrown if the dataSetCode or startPath are not valid
-
listFilesForDataSet
public FileInfoDssDTO[] listFilesForDataSet(java.lang.String sessionToken, DataSetFileDTO fileOrFolder) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Get an array of FileInfoDss objects that describe the file-system structure of the data set.- Specified by:
listFilesForDataSet
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokenfileOrFolder
- The file or folder to get information on- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs when listing the filesjava.lang.IllegalArgumentException
- Thrown if the dataSetCode or startPath are not valid
-
setStoreDirectory
public void setStoreDirectory(java.io.File aFile)
- Specified by:
setStoreDirectory
in interfaceIDssServiceRpcGenericInternal
- Overrides:
setStoreDirectory
in classch.systemsx.cisd.openbis.dss.generic.server.AbstractDssServiceRpc<IDssServiceRpcGenericInternal>
-
getPathToDataSet
public java.lang.String getPathToDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String overrideStoreRootPathOrNull) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Get a path to the data set. This can be used by clients that run on the same machine as the DSS for more efficient access to a data set.NOTE: This method shouldn't be called for a container data set. No file would exist with the returned path.
- Specified by:
getPathToDataSet
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokendataSetCode
- The data set to retrieve file fromoverrideStoreRootPathOrNull
- The path to replace the store path (see return comment).- Returns:
- An absolute path to the data set. If overrideStorePathOrNull is specified, it replaces the DSS's notion of the store path. Otherwise the return value will begin with the DSS's storeRootPath.
- Throws:
IOExceptionUnchecked
- if an IOException occurs when listing the files.java.lang.IllegalArgumentException
- if dataSetCode is a container dataset.- See Also:
IDssServiceRpcGeneric.tryGetPathToDataSet(String, String, String)
-
tryGetPathToDataSet
public java.lang.String tryGetPathToDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String overrideStoreRootPathOrNull) throws IOExceptionUnchecked
Description copied from interface:IDssServiceRpcGeneric
Get a path to the data set. This can be used by clients that run on the same machine as the DSS for more efficient access to a data set.NOTE: This method returns null for a container data set.
- Specified by:
tryGetPathToDataSet
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokendataSetCode
- The data set to retrieve file fromoverrideStoreRootPathOrNull
- The path to replace the store path (see return comment).- Returns:
- An absolute path to the data set. If overrideStorePathOrNull is specified, it replaces the DSS's notion of the store path. Otherwise the return value will begin with the DSS's storeRootPath. For a container data set returns null.
- Throws:
IOExceptionUnchecked
- if an IOException occurs when listing the files.- See Also:
IDssServiceRpcGeneric.getPathToDataSet(String, String, String)
-
listAllShares
public java.util.List<ShareInfo> listAllShares(java.lang.String sessionToken)
Description copied from interface:IDssServiceRpcGeneric
Lists all shares.- Specified by:
listAllShares
in interfaceIDssServiceRpcGeneric
-
shuffleDataSet
public void shuffleDataSet(java.lang.String sessionToken, java.lang.String dataSetCode, java.lang.String shareId)
Description copied from interface:IDssServiceRpcGeneric
Moves specified data set to specified share.- Specified by:
shuffleDataSet
in interfaceIDssServiceRpcGeneric
-
convertPath
public static java.lang.String convertPath(java.io.File storeRoot, java.io.File dataSetRoot, java.lang.String overrideStoreRootPathOrNull)
-
getValidationScript
public java.lang.String getValidationScript(java.lang.String sessionToken, java.lang.String dataSetTypeOrNull) throws IOExceptionUnchecked, java.lang.IllegalArgumentException
Description copied from interface:IDssServiceRpcGeneric
Get the validation script for the specified data set type.- Specified by:
getValidationScript
in interfaceIDssServiceRpcGeneric
- Parameters:
sessionToken
- The session tokendataSetTypeOrNull
- The data set type the script should validate, or null to request the generic validation script.- Returns:
- The string of the python (jython) script for the validation or null if there is no applicable validation script.
- Throws:
IOExceptionUnchecked
- Thrown if an IOException occurs when accessing the scriptjava.lang.IllegalArgumentException
- Thrown if the data set type or startPath are not valid
-
createReportFromAggregationService
public QueryTableModel createReportFromAggregationService(java.lang.String sessionToken, java.lang.String aggregationServiceName, java.util.Map<java.lang.String,java.lang.Object> parameters)
Description copied from interface:IDssServiceRpcGeneric
Create the report from the specified aggregation service. SeeIQueryApiServer.createReportFromAggregationService(String, String, String, Map)
- Specified by:
createReportFromAggregationService
in interfaceIDssServiceRpcGeneric
-
createReportFromDataSets
public QueryTableModel createReportFromDataSets(java.lang.String sessionToken, java.lang.String serviceKey, java.util.List<java.lang.String> dataSetCodes)
Description copied from interface:IDssServiceRpcGeneric
Creates for the specified data sets a report. SeeIQueryApiServer.createReportFromDataSets(String, String, String, List)
- Specified by:
createReportFromDataSets
in interfaceIDssServiceRpcGeneric
-
listAggregationServices
public java.util.List<AggregationServiceDescription> listAggregationServices(java.lang.String sessionToken)
Description copied from interface:IDssServiceRpcGeneric
Returns metadata for all aggregation services. SeeIQueryApiServer.listAggregationServices(String)
- Specified by:
listAggregationServices
in interfaceIDssServiceRpcGeneric
-
listTableReportDescriptions
public java.util.List<ReportDescription> listTableReportDescriptions(java.lang.String sessionToken)
Description copied from interface:IDssServiceRpcGeneric
Returns meta data for all reporting plugins which deliver a table. SeeIQueryApiServer.listTableReportDescriptions(String)
- Specified by:
listTableReportDescriptions
in interfaceIDssServiceRpcGeneric
-
-