Class ArvadosFacade


  • public class ArvadosFacade
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Collection createEmptyCollection​(java.lang.String collectionName, java.lang.String projectUuid)
      Creates and uploads new empty collection to specified project.
      Group createNewProject​(java.lang.String projectName)
      Creates new project that will be a subproject of "home" for current user.
      Group createNewSubProject​(java.lang.String ownerUuid, java.lang.String projectName)
      Creates new project that will be a subproject of "home" for the specified owner.
      Collection deleteCollection​(java.lang.String collectionUuid)
      Deletes collection with specified uuid.
      java.util.List<java.io.File> downloadCollectionFiles​(java.lang.String collectionUuid, java.lang.String pathToDownloadFolder, boolean usingKeepWeb)
      This method downloads all files from collection.
      java.io.File downloadFile​(java.lang.String filePathName, java.lang.String collectionUuid, java.lang.String pathToDownloadFolder)
      This method downloads single file from collection using Arvados Keep-Web.
      CollectionList getCollectionsFromProjectByName​(java.lang.String collectionName, java.lang.String projectUuid)
      Filters all collections from selected project and returns list of those that contain passed String in their name.
      User getCurrentUser()
      Returns current user information based on Api Token provided via configuration
      Group getProjectByUuid​(java.lang.String projectUuid)
      Gets project details by uuid.
      java.util.List<FileToken> listFileInfoFromCollection​(java.lang.String collectionUuid)
      Lists all FileTokens (objects containing information about files) for specified collection.
      GroupList showGroupsAccessibleByCurrentUser()
      Gets uuid of current user based on api Token provided in configuration and uses it to list all projects that this user has read access to in Arvados.
      GroupList showGroupsOwnedByCurrentUser()
      Gets uuid of current user based on api Token provided in configuration and uses it to list all projects that this user owns in Arvados.
      Collection updateWithReplaceFiles​(java.lang.String collectionUUID, java.util.Map<java.lang.String,​java.lang.String> files)
      Uploads multiple files to an existing collection.
      Collection upload​(java.io.File file)
      Creates and uploads new collection containing a single file.
      Collection upload​(java.util.List<java.io.File> files)
      Creates and uploads new collection containing passed files.
      Collection upload​(java.util.List<java.io.File> sourceFiles, java.lang.String collectionName, java.lang.String projectUuid)
      Uploads new collection with specified name and containing selected files to an existing project.
      Collection uploadToExistingCollection​(java.io.File file, java.lang.String collectionUUID)
      Uploads a file to a specified collection.
      Collection uploadToExistingCollection​(java.util.List<java.io.File> files, java.lang.String collectionUUID)
      Uploads multiple files to an existing collection.
      • Methods inherited from class java.lang.Object

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

      • ArvadosFacade

        public ArvadosFacade()
    • Method Detail

      • downloadFile

        public java.io.File downloadFile​(java.lang.String filePathName,
                                         java.lang.String collectionUuid,
                                         java.lang.String pathToDownloadFolder)
        This method downloads single file from collection using Arvados Keep-Web. File is saved on a drive in specified location and returned.
        Parameters:
        filePathName - path to the file in collection. If requested file is stored directly in collection (not within its subdirectory) this would be just the name of file (ex. 'file.txt'). Otherwise full file path must be passed (ex. 'folder/file.txt')
        collectionUuid - uuid of collection containing requested file
        pathToDownloadFolder - path to location in which file should be saved. Passed location must be a directory in which file of that name does not already exist.
        Returns:
        downloaded file
      • downloadCollectionFiles

        public java.util.List<java.io.File> downloadCollectionFiles​(java.lang.String collectionUuid,
                                                                    java.lang.String pathToDownloadFolder,
                                                                    boolean usingKeepWeb)
        This method downloads all files from collection. Directory named by collection uuid is created in specified location, files are saved on a drive in this directory and list with downloaded files is returned.
        Parameters:
        collectionUuid - uuid of collection from which files are downloaded
        pathToDownloadFolder - path to location in which files should be saved. New folder named by collection uuid, containing downloaded files, is created in this location. Passed location must be a directory in which folder of that name does not already exist.
        usingKeepWeb - if set to true files will be downloaded using Keep Web. If set to false files will be downloaded using Keep Server API.
        Returns:
        list containing downloaded files
      • listFileInfoFromCollection

        public java.util.List<FileToken> listFileInfoFromCollection​(java.lang.String collectionUuid)
        Lists all FileTokens (objects containing information about files) for specified collection. Information in each FileToken includes file path, name, size and position in data stream
        Parameters:
        collectionUuid - uuid of collection for which FileTokens are listed
        Returns:
        list containing FileTokens for each file in specified collection
      • upload

        public Collection upload​(java.util.List<java.io.File> files)
        Creates and uploads new collection containing passed files. Created collection has a default name and is uploaded to user's 'Home' project.
        Parameters:
        files - list of files to be uploaded within new collection
        Returns:
        collection object mapped from JSON that is returned from server after successful upload
        See Also:
        upload(List, String, String)
      • upload

        public Collection upload​(java.io.File file)
        Creates and uploads new collection containing a single file. Created collection has a default name and is uploaded to user's 'Home' project.
        Parameters:
        file - file to be uploaded
        Returns:
        collection object mapped from JSON that is returned from server after successful upload
        See Also:
        upload(List, String, String)
      • upload

        public Collection upload​(java.util.List<java.io.File> sourceFiles,
                                 java.lang.String collectionName,
                                 java.lang.String projectUuid)
        Uploads new collection with specified name and containing selected files to an existing project.
        Parameters:
        sourceFiles - list of files to be uploaded within new collection
        collectionName - name for the newly created collection. Collection with that name cannot be already created in specified project. If null is passed then collection name is set to default, containing phrase 'New Collection' and a timestamp.
        projectUuid - uuid of the project in which created collection is to be included. If null is passed then collection is uploaded to user's 'Home' project.
        Returns:
        collection object mapped from JSON that is returned from server after successful upload
      • uploadToExistingCollection

        public Collection uploadToExistingCollection​(java.io.File file,
                                                     java.lang.String collectionUUID)
        Uploads a file to a specified collection.
        Parameters:
        file - file to be uploaded to existing collection. Filenames must be unique in comparison with files already existing within collection.
        collectionUUID - UUID of collection to which files should be uploaded
        Returns:
        collection object mapped from JSON that is returned from server after successful upload
        See Also:
        uploadToExistingCollection(List, String)
      • uploadToExistingCollection

        public Collection uploadToExistingCollection​(java.util.List<java.io.File> files,
                                                     java.lang.String collectionUUID)
        Uploads multiple files to an existing collection.
        Parameters:
        files - list of files to be uploaded to existing collection. File names must be unique - both within passed list and in comparison with files already existing within collection.
        collectionUUID - UUID of collection to which files should be uploaded
        Returns:
        collection object mapped from JSON that is returned from server after successful upload
      • createEmptyCollection

        public Collection createEmptyCollection​(java.lang.String collectionName,
                                                java.lang.String projectUuid)
        Creates and uploads new empty collection to specified project.
        Parameters:
        collectionName - name for the newly created collection. Collection with that name cannot be already created in specified project.
        projectUuid - uuid of project that will contain uploaded empty collection. To select home project pass current user's uuid from getCurrentUser()
        Returns:
        collection object mapped from JSON that is returned from server after successful upload
        See Also:
        getCurrentUser()
      • updateWithReplaceFiles

        public Collection updateWithReplaceFiles​(java.lang.String collectionUUID,
                                                 java.util.Map<java.lang.String,​java.lang.String> files)
        Uploads multiple files to an existing collection.
        Parameters:
        collectionUUID - UUID of collection to which the files are to be copied
        files - map of files to be copied to existing collection. The map consists of a pair in the form of a filename and a filename along with the Portable data hash
        Returns:
        collection object mapped from JSON that is returned from server after successful copied
      • getCurrentUser

        public User getCurrentUser()
        Returns current user information based on Api Token provided via configuration
        Returns:
        user object mapped from JSON that is returned from server based on provided Api Token. It contains information about user who has this token assigned.
      • showGroupsOwnedByCurrentUser

        public GroupList showGroupsOwnedByCurrentUser()
        Gets uuid of current user based on api Token provided in configuration and uses it to list all projects that this user owns in Arvados.
        Returns:
        GroupList containing all groups that current user is owner of.
        See Also:
        getCurrentUser()
      • showGroupsAccessibleByCurrentUser

        public GroupList showGroupsAccessibleByCurrentUser()
        Gets uuid of current user based on api Token provided in configuration and uses it to list all projects that this user has read access to in Arvados.
        Returns:
        GroupList containing all groups that current user has read access to.
      • getCollectionsFromProjectByName

        public CollectionList getCollectionsFromProjectByName​(java.lang.String collectionName,
                                                              java.lang.String projectUuid)
        Filters all collections from selected project and returns list of those that contain passed String in their name. Operator "LIKE" is used so in order to obtain certain collection it is sufficient to pass just part of its name. Returned collections in collectionList are ordered by date of creation (starting from oldest one).
        Parameters:
        collectionName - collections containing this param in their name will be returned. Passing a wildcard is possible - for example passing "a%" searches for all collections starting with "a".
        projectUuid - uuid of project in which will be searched for collections with given name. To search home project provide user uuid (from getCurrentUser())
        Returns:
        object CollectionList containing all collections matching specified name criteria
        See Also:
        getCurrentUser()
      • getProjectByUuid

        public Group getProjectByUuid​(java.lang.String projectUuid)
        Gets project details by uuid.
        Parameters:
        projectUuid - uuid of project
        Returns:
        Group object containing information about project
      • createNewProject

        public Group createNewProject​(java.lang.String projectName)
        Creates new project that will be a subproject of "home" for current user.
        Parameters:
        projectName - name for the newly created project
        Returns:
        Group object containing information about created project (mapped from JSON returned from server after creating the project)
      • createNewSubProject

        public Group createNewSubProject​(java.lang.String ownerUuid,
                                         java.lang.String projectName)
        Creates new project that will be a subproject of "home" for the specified owner.
        Parameters:
        ownerUuid - uuid of owner for subproject
        projectName - name for the newly created subproject
        Returns:
        Group object containing information about created project (mapped from JSON returned from server after creating the project)
      • deleteCollection

        public Collection deleteCollection​(java.lang.String collectionUuid)
        Deletes collection with specified uuid.
        Parameters:
        collectionUuid - uuid of collection to be deleted. User whose token is provided in configuration must be authorized to delete such collection.
        Returns:
        collection object with deleted collection (mapped from JSON returned from server after deleting the collection)