Class DssServiceRpcGeneric

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.apache.log4j.Logger operationLog
      Logger with LogCategory.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
    • 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.
      • Methods inherited from class ch.systemsx.cisd.openbis.dss.generic.server.AbstractDssServiceRpc

        addToRepositoryAndReturnDownloadUrl, getHierarchicalContent, getHierarchicalContentProvider, getHomeDatabaseInstance, getOpenBISService, getShareIdManager, getStoreDirectory, setDownloadUrl, tryGetDataSet
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • operationLog

        protected static org.apache.log4j.Logger operationLog
        Logger with LogCategory.OPERATION with name of the concrete class, needs to be static for our purpose.
    • 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)
      • 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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        dataSetCode - The data set to retrieve file information about
        startPath - The path within the data set to retrieve file information about
        isRecursive - 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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        dataSetCode - The data set to retrieve file from
        path - The path within the data set to retrieve file information about
        Throws:
        IOExceptionUnchecked - Thrown if an IOException occurs when listing the files
        java.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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        dataSetCode - The data set to retrieve file from
        path - The path within the data set to retrieve file information about
        Throws:
        IOExceptionUnchecked - Thrown if an IOException occurs when listing the files
        java.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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        dataSetCode - The data set to retrieve file from
        path - The path within the data set to retrieve file information about
        validityDurationInSeconds - The number of seconds for which the download URL should be valid.
        Throws:
        IOExceptionUnchecked - Thrown if an IOException occurs when listing the files
        java.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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        newDataSet - The new data set that should be registered
        inputStream - 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 files
        java.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 interface IDssServiceRpcGeneric
        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 interface IDssServiceRpcGeneric
        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 interface IDssServiceRpcGeneric
        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 interface IDssServiceRpcGeneric
        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 interface IRpcService
      • 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 interface IRpcService
      • 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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        fileOrFolder - The file or folder to retrieve
        Throws:
        IOExceptionUnchecked - Thrown if an IOException occurs when listing the files
        java.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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        fileOrFolder - The file or folder to retrieve
        Throws:
        IOExceptionUnchecked - Thrown if an IOException occurs when listing the files
        java.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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        fileOrFolder - The file or folder to retrieve
        validityDurationInSeconds - 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 files
        java.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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        fileOrFolder - The file or folder to get information on
        Throws:
        IOExceptionUnchecked - Thrown if an IOException occurs when listing the files
        java.lang.IllegalArgumentException - Thrown if the dataSetCode or startPath are not valid
      • 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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        dataSetCode - The data set to retrieve file from
        overrideStoreRootPathOrNull - 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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        dataSetCode - The data set to retrieve file from
        overrideStoreRootPathOrNull - 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)
      • 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 interface IDssServiceRpcGeneric
      • 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 interface IDssServiceRpcGeneric
        Parameters:
        sessionToken - The session token
        dataSetTypeOrNull - 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 script
        java.lang.IllegalArgumentException - Thrown if the data set type or startPath are not valid