Interface TemplateStorage

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      @Nullable java.io.OutputStream appendOutputStream​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new OutputStream that will append its content to the file at the given path.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.io.OutputStream> appendOutputStreamAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new OutputStream that will append its content to the file at the given path.
      default @Nullable java.util.zip.ZipInputStream asZipInputStream​(@NotNull ServiceTemplate template)
      Gets a template into a ZipInputStream.
      default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.zip.ZipInputStream> asZipInputStreamAsync​(@NotNull ServiceTemplate template)
      Gets a template into a ZipInputStream.
      void close()
      Closes this storage, after it has been closed, no more interaction to this storage should be done and might lead to errors.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> closeAsync()
      Closes this storage, after it has been closed, no more interaction to this storage should be done and might lead to errors.
      boolean copy​(@NotNull ServiceTemplate template, @NotNull java.nio.file.Path directory)
      Copies the given template into the given directory
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> copyAsync​(@NotNull ServiceTemplate template, @NotNull java.nio.file.Path directory)
      Copies the given template into the given directory
      boolean create​(@NotNull ServiceTemplate template)
      Creates the given template if it doesn't exists.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> createAsync​(@NotNull ServiceTemplate template)
      Creates the given template if it doesn't exists.
      boolean createDirectory​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new directory in the given template at the given path if it doesn't exist.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> createDirectoryAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new directory in the given template at the given path if it doesn't exist.
      boolean createFile​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new file in the given template at the given path if it doesn't exist.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> createFileAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new file in the given template at the given path if it doesn't exist.
      boolean delete​(@NotNull ServiceTemplate template)
      Deletes the given template if it exists.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deleteAsync​(@NotNull ServiceTemplate template)
      Deletes the given template if it exists.
      boolean deleteFile​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Deletes a file in the given template at the given path if it doesn't exist.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deleteFileAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Deletes a file in the given template at the given path if it doesn't exist.
      boolean deploy​(@NotNull java.io.InputStream inputStream, @NotNull ServiceTemplate target)
      Copies the given stream into the given template.
      default boolean deploy​(@NotNull java.nio.file.Path directory, @NotNull ServiceTemplate target)
      Copies the given directory into the given template.
      boolean deploy​(@NotNull java.nio.file.Path directory, @NotNull ServiceTemplate target, @Nullable java.util.function.Predicate<java.nio.file.Path> fileFilter)
      Deploys the following directory files to the target template storage.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deployAsync​(@NotNull java.io.InputStream inputStream, @NotNull ServiceTemplate target)
      Copies the given directory into the given template.
      default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deployAsync​(@NotNull java.nio.file.Path directory, @NotNull ServiceTemplate target)
      Copies the given directory into the given template.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deployAsync​(@NotNull java.nio.file.Path directory, @NotNull ServiceTemplate target, @Nullable java.util.function.Predicate<java.nio.file.Path> fileFilter)
      Deploys the following directory files to the target template storage.
      @Nullable FileInfo getFileInfo​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Retrieves information about a specified file/directory.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo> getFileInfoAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Retrieves information about a specified file/directory.
      @NotNull java.util.Collection<ServiceTemplate> getTemplates()
      Gets a list of all templates that exist in this storage.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<ServiceTemplate>> getTemplatesAsync()
      Gets a list of all templates that exist in this storage.
      boolean has​(@NotNull ServiceTemplate template)
      Checks whether the given template exists.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> hasAsync​(@NotNull ServiceTemplate template)
      Checks whether the given template exists.
      boolean hasFile​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Checks whether the given path/directory exists in the given template, it doesn't matter if it is a directory or a file.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> hasFileAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Checks whether the given path/directory exists in the given template, it doesn't matter if it is a directory or a file.
      default @Nullable FileInfo[] listFiles​(@NotNull ServiceTemplate template)
      Lists all files in the root directory of the template (including sub directories).
      default @Nullable FileInfo[] listFiles​(@NotNull ServiceTemplate template, boolean deep)
      Lists all files in the root directory of the template.
      default @Nullable FileInfo[] listFiles​(@NotNull ServiceTemplate template, @NotNull java.lang.String dir)
      Lists all files in the given directory (including sub directories).
      @Nullable FileInfo[] listFiles​(@NotNull ServiceTemplate template, @NotNull java.lang.String dir, boolean deep)
      Lists all files in the given directory.
      default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo[]> listFilesAsync​(@NotNull ServiceTemplate template)
      Lists all files in the root directory of the template (including sub directories).
      default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo[]> listFilesAsync​(@NotNull ServiceTemplate template, boolean deep)
      Lists all files in the root directory of the template.
      default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo[]> listFilesAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String dir)
      Lists all files in the given directory (including sub directories).
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo[]> listFilesAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String dir, boolean deep)
      Lists all files in the given directory.
      @Nullable java.io.InputStream newInputStream​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new InputStream with the data of the file at the given path in the given template.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.io.InputStream> newInputStreamAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new InputStream with the data of the file at the given path in the given template.
      @Nullable java.io.OutputStream newOutputStream​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new OutputStream that will override its content to the file at the given path.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.io.OutputStream> newOutputStreamAsync​(@NotNull ServiceTemplate template, @NotNull java.lang.String path)
      Creates a new OutputStream that will override its content to the file at the given path.
      @Nullable java.io.InputStream zipTemplate​(@NotNull ServiceTemplate template)
      Zips a template into an InputStream.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.io.InputStream> zipTemplateAsync​(@NotNull ServiceTemplate template)
      Zips a template into an InputStream.
      • Methods inherited from interface de.dytanic.cloudnet.common.INameable

        getName
    • Method Detail

      • deploy

        boolean deploy​(@NotNull
                       @NotNull java.nio.file.Path directory,
                       @NotNull
                       @NotNull ServiceTemplate target,
                       @Nullable
                       @Nullable java.util.function.Predicate<java.nio.file.Path> fileFilter)
        Deploys the following directory files to the target template storage. If the given file filter is not null, method will apply every single file to the given file filter and only deploy files that were allowed by the filter.
        Parameters:
        directory - the directory to be deployed
        target - the template to be deployed to
        fileFilter - the filter for files that should be deployed
        Returns:
        whether it was copied successfully
      • deploy

        default boolean deploy​(@NotNull
                               @NotNull java.nio.file.Path directory,
                               @NotNull
                               @NotNull ServiceTemplate target)
        Copies the given directory into the given template.
        Parameters:
        directory - the directory to be deployed
        target - the template to be deployed to
        Returns:
        whether it was copied successfully
      • deploy

        boolean deploy​(@NotNull
                       @NotNull java.io.InputStream inputStream,
                       @NotNull
                       @NotNull ServiceTemplate target)
        Copies the given stream into the given template.
        Parameters:
        inputStream - the zipped data to be deployed
        target - the template to be deployed to
        Returns:
        whether it was copied successfully
      • copy

        boolean copy​(@NotNull
                     @NotNull ServiceTemplate template,
                     @NotNull
                     @NotNull java.nio.file.Path directory)
        Copies the given template into the given directory
        Parameters:
        template - the template to copy the files from
        directory - the target directory to copy the files to
        Returns:
        whether it was copied successfully
      • asZipInputStream

        @Nullable
        default @Nullable java.util.zip.ZipInputStream asZipInputStream​(@NotNull
                                                                        @NotNull ServiceTemplate template)
                                                                 throws java.io.IOException
        Gets a template into a ZipInputStream.
        Parameters:
        template - the template to be zipped
        Returns:
        a new ZipInputStream or null if it the template doesn't exist
        Throws:
        java.io.IOException - if an I/O error occurred
      • zipTemplate

        @Nullable
        @Nullable java.io.InputStream zipTemplate​(@NotNull
                                                  @NotNull ServiceTemplate template)
                                           throws java.io.IOException
        Zips a template into an InputStream.
        Parameters:
        template - the template to be zipped
        Returns:
        a new InputStream or null if it the template doesn't exist
        Throws:
        java.io.IOException - if an I/O error occurred
      • delete

        boolean delete​(@NotNull
                       @NotNull ServiceTemplate template)
        Deletes the given template if it exists.
        Parameters:
        template - the template to be deleted
        Returns:
        whether the template was successfully deleted, false if it doesn't exists
      • create

        boolean create​(@NotNull
                       @NotNull ServiceTemplate template)
        Creates the given template if it doesn't exists.
        Parameters:
        template - the template to be deleted
        Returns:
        whether the template was successfully created, false if it already exists
      • has

        boolean has​(@NotNull
                    @NotNull ServiceTemplate template)
        Checks whether the given template exists.
        Parameters:
        template - the template to be checked
        Returns:
        whether the template exists or not
      • appendOutputStream

        @Nullable
        @Nullable java.io.OutputStream appendOutputStream​(@NotNull
                                                          @NotNull ServiceTemplate template,
                                                          @NotNull
                                                          @NotNull java.lang.String path)
                                                   throws java.io.IOException
        Creates a new OutputStream that will append its content to the file at the given path. If the file at the given path doesn't exist, it will be created. To finish your modifications, you'll need to close the OutputStream.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        a new OutputStream or null if it couldn't be opened
        Throws:
        java.io.IOException - if an I/O error occurred
      • newOutputStream

        @Nullable
        @Nullable java.io.OutputStream newOutputStream​(@NotNull
                                                       @NotNull ServiceTemplate template,
                                                       @NotNull
                                                       @NotNull java.lang.String path)
                                                throws java.io.IOException
        Creates a new OutputStream that will override its content to the file at the given path. If the file at the given path doesn't exist, it will be created. To finish your modifications, you'll need to close the OutputStream.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        a new OutputStream or null if it couldn't be opened
        Throws:
        java.io.IOException - if an I/O error occurred
      • createFile

        boolean createFile​(@NotNull
                           @NotNull ServiceTemplate template,
                           @NotNull
                           @NotNull java.lang.String path)
                    throws java.io.IOException
        Creates a new file in the given template at the given path if it doesn't exist.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        whether the file was created successfully, false if it already exists
        Throws:
        java.io.IOException - if an I/O error occurred
      • createDirectory

        boolean createDirectory​(@NotNull
                                @NotNull ServiceTemplate template,
                                @NotNull
                                @NotNull java.lang.String path)
                         throws java.io.IOException
        Creates a new directory in the given template at the given path if it doesn't exist.
        Parameters:
        template - the template where the target file is located at
        path - the path to the directory relative to the template
        Returns:
        whether the directory was created successfully, false if it already exists
        Throws:
        java.io.IOException - if an I/O error occurred
      • hasFile

        boolean hasFile​(@NotNull
                        @NotNull ServiceTemplate template,
                        @NotNull
                        @NotNull java.lang.String path)
                 throws java.io.IOException
        Checks whether the given path/directory exists in the given template, it doesn't matter if it is a directory or a file.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        whether the file exists
        Throws:
        java.io.IOException - if an I/O error occurred
      • deleteFile

        boolean deleteFile​(@NotNull
                           @NotNull ServiceTemplate template,
                           @NotNull
                           @NotNull java.lang.String path)
                    throws java.io.IOException
        Deletes a file in the given template at the given path if it doesn't exist.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        whether the file was deleted successfully, false if it already exists
        Throws:
        java.io.IOException - if an I/O error occurred
      • newInputStream

        @Nullable
        @Nullable java.io.InputStream newInputStream​(@NotNull
                                                     @NotNull ServiceTemplate template,
                                                     @NotNull
                                                     @NotNull java.lang.String path)
                                              throws java.io.IOException
        Creates a new InputStream with the data of the file at the given path in the given template.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        the new InputStream or null if the file doesn't exist/is a directory
        Throws:
        java.io.IOException - if an I/O error occurred
      • getFileInfo

        @Nullable
        @Nullable FileInfo getFileInfo​(@NotNull
                                       @NotNull ServiceTemplate template,
                                       @NotNull
                                       @NotNull java.lang.String path)
                                throws java.io.IOException
        Retrieves information about a specified file/directory.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        the FileInfo or null if the file/directory doesn't exist
        Throws:
        java.io.IOException - if an I/O error occurred
      • listFiles

        @Nullable
        @Nullable FileInfo[] listFiles​(@NotNull
                                       @NotNull ServiceTemplate template,
                                       @NotNull
                                       @NotNull java.lang.String dir,
                                       boolean deep)
                                throws java.io.IOException
        Lists all files in the given directory.
        Parameters:
        template - the template where the target file is located at
        dir - the directory
        deep - whether the contents of sub directories should also be discovered
        Returns:
        a list of all files in the given directory or null if the given directory doesn't exist/is not a directory
        Throws:
        java.io.IOException - if an I/O error occurred
      • listFiles

        @Nullable
        default @Nullable FileInfo[] listFiles​(@NotNull
                                               @NotNull ServiceTemplate template,
                                               boolean deep)
                                        throws java.io.IOException
        Lists all files in the root directory of the template.
        Parameters:
        template - the template where the target file is located at
        deep - whether the contents of sub directories should also be discovered
        Returns:
        a list of all files in the given directory or null if the given directory doesn't exist/is not a directory
        Throws:
        java.io.IOException - if an I/O error occurred
      • listFiles

        @Nullable
        default @Nullable FileInfo[] listFiles​(@NotNull
                                               @NotNull ServiceTemplate template,
                                               @NotNull
                                               @NotNull java.lang.String dir)
                                        throws java.io.IOException
        Lists all files in the given directory (including sub directories).
        Parameters:
        template - the template where the target file is located at
        dir - the directory
        Returns:
        a list of all files in the given directory or null if the given directory doesn't exist/is not a directory
        Throws:
        java.io.IOException - if an I/O error occurred
      • listFiles

        @Nullable
        default @Nullable FileInfo[] listFiles​(@NotNull
                                               @NotNull ServiceTemplate template)
                                        throws java.io.IOException
        Lists all files in the root directory of the template (including sub directories).
        Parameters:
        template - the template where the target file is located at
        Returns:
        a list of all files in the given directory or null if the given directory doesn't exist/is not a directory
        Throws:
        java.io.IOException - if an I/O error occurred
      • getTemplates

        @NotNull
        @NotNull java.util.Collection<ServiceTemplate> getTemplates()
        Gets a list of all templates that exist in this storage. Modifications to the collection won't have any effect.
        Returns:
        a list of all templates
      • close

        void close()
            throws java.io.IOException
        Closes this storage, after it has been closed, no more interaction to this storage should be done and might lead to errors.
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.io.IOException - if an I/O error occurred
      • deployAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deployAsync​(@NotNull
                                                                                            @NotNull java.nio.file.Path directory,
                                                                                            @NotNull
                                                                                            @NotNull ServiceTemplate target,
                                                                                            @Nullable
                                                                                            @Nullable java.util.function.Predicate<java.nio.file.Path> fileFilter)
        Deploys the following directory files to the target template storage. If the given file filter is not null, method will apply every single file to the given file filter and only deploy files that were allowed by the filter.
        Parameters:
        directory - the directory to be deployed
        target - the template to be deployed to
        fileFilter - the filter for files that should be deployed
        Returns:
        whether it was copied successfully
      • deployAsync

        @NotNull
        default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deployAsync​(@NotNull
                                                                                                    @NotNull java.nio.file.Path directory,
                                                                                                    @NotNull
                                                                                                    @NotNull ServiceTemplate target)
        Copies the given directory into the given template.
        Parameters:
        directory - the directory to be deployed
        target - the template to be deployed to
        Returns:
        whether it was copied successfully
      • deployAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deployAsync​(@NotNull
                                                                                            @NotNull java.io.InputStream inputStream,
                                                                                            @NotNull
                                                                                            @NotNull ServiceTemplate target)
        Copies the given directory into the given template.
        Parameters:
        inputStream - the zipped data to be deployed
        target - the template to be deployed to
        Returns:
        whether it was copied successfully
      • copyAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> copyAsync​(@NotNull
                                                                                          @NotNull ServiceTemplate template,
                                                                                          @NotNull
                                                                                          @NotNull java.nio.file.Path directory)
        Copies the given template into the given directory
        Parameters:
        template - the template to copy the files from
        directory - the target directory to copy the files to
        Returns:
        whether it was copied successfully
      • asZipInputStreamAsync

        @NotNull
        default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.zip.ZipInputStream> asZipInputStreamAsync​(@NotNull
                                                                                                                         @NotNull ServiceTemplate template)
        Gets a template into a ZipInputStream.
        Parameters:
        template - the template to be zipped
        Returns:
        a new ZipInputStream or null if it the template doesn't exist
      • zipTemplateAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.io.InputStream> zipTemplateAsync​(@NotNull
                                                                                                   @NotNull ServiceTemplate template)
        Zips a template into an InputStream.
        Parameters:
        template - the template to be zipped
        Returns:
        a new InputStream or null if it the template doesn't exist
      • deleteAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deleteAsync​(@NotNull
                                                                                            @NotNull ServiceTemplate template)
        Deletes the given template if it exists.
        Parameters:
        template - the template to be deleted
        Returns:
        whether the template was successfully deleted, false if it doesn't exists
      • createAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> createAsync​(@NotNull
                                                                                            @NotNull ServiceTemplate template)
        Creates the given template if it doesn't exists.
        Parameters:
        template - the template to be deleted
        Returns:
        whether the template was successfully created, false if it already exists
      • hasAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> hasAsync​(@NotNull
                                                                                         @NotNull ServiceTemplate template)
        Checks whether the given template exists.
        Parameters:
        template - the template to be checked
        Returns:
        whether the template exists or not
      • appendOutputStreamAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.io.OutputStream> appendOutputStreamAsync​(@NotNull
                                                                                                           @NotNull ServiceTemplate template,
                                                                                                           @NotNull
                                                                                                           @NotNull java.lang.String path)
        Creates a new OutputStream that will append its content to the file at the given path. If the file at the given path doesn't exist, it will be created. To finish your modifications, you'll need to close the OutputStream.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        a new OutputStream or null if it couldn't be opened
      • newOutputStreamAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.io.OutputStream> newOutputStreamAsync​(@NotNull
                                                                                                        @NotNull ServiceTemplate template,
                                                                                                        @NotNull
                                                                                                        @NotNull java.lang.String path)
        Creates a new OutputStream that will override its content to the file at the given path. If the file at the given path doesn't exist, it will be created. To finish your modifications, you'll need to close the OutputStream.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        a new OutputStream or null if it couldn't be opened
      • createFileAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> createFileAsync​(@NotNull
                                                                                                @NotNull ServiceTemplate template,
                                                                                                @NotNull
                                                                                                @NotNull java.lang.String path)
        Creates a new file in the given template at the given path if it doesn't exist.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        whether the file was created successfully, false if it already exists
      • createDirectoryAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> createDirectoryAsync​(@NotNull
                                                                                                     @NotNull ServiceTemplate template,
                                                                                                     @NotNull
                                                                                                     @NotNull java.lang.String path)
        Creates a new directory in the given template at the given path if it doesn't exist.
        Parameters:
        template - the template where the target file is located at
        path - the path to the directory relative to the template
        Returns:
        whether the directory was created successfully, false if it already exists
      • hasFileAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> hasFileAsync​(@NotNull
                                                                                             @NotNull ServiceTemplate template,
                                                                                             @NotNull
                                                                                             @NotNull java.lang.String path)
        Checks whether the given path/directory exists in the given template, it doesn't matter if it is a directory or a file.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        whether the file exists
      • deleteFileAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deleteFileAsync​(@NotNull
                                                                                                @NotNull ServiceTemplate template,
                                                                                                @NotNull
                                                                                                @NotNull java.lang.String path)
        Deletes a file in the given template at the given path if it doesn't exist.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        whether the file was deleted successfully, false if it already exists
      • newInputStreamAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.io.InputStream> newInputStreamAsync​(@NotNull
                                                                                                      @NotNull ServiceTemplate template,
                                                                                                      @NotNull
                                                                                                      @NotNull java.lang.String path)
        Creates a new InputStream with the data of the file at the given path in the given template.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        the new InputStream or null if the file doesn't exist/is a directory
      • getFileInfoAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo> getFileInfoAsync​(@NotNull
                                                                                        @NotNull ServiceTemplate template,
                                                                                        @NotNull
                                                                                        @NotNull java.lang.String path)
        Retrieves information about a specified file/directory.
        Parameters:
        template - the template where the target file is located at
        path - the path to the file relative to the template
        Returns:
        the FileInfo or null if the file/directory doesn't exist
      • listFilesAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo[]> listFilesAsync​(@NotNull
                                                                                        @NotNull ServiceTemplate template,
                                                                                        @NotNull
                                                                                        @NotNull java.lang.String dir,
                                                                                        boolean deep)
        Lists all files in the given directory.
        Parameters:
        template - the template where the target file is located at
        dir - the directory
        deep - whether the contents of sub directories should also be discovered
        Returns:
        a list of all files in the given directory or null if the given directory doesn't exist/is not a directory
      • listFilesAsync

        @NotNull
        default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo[]> listFilesAsync​(@NotNull
                                                                                                @NotNull ServiceTemplate template,
                                                                                                boolean deep)
        Lists all files in the root directory of the template.
        Parameters:
        template - the template where the target file is located at
        deep - whether the contents of sub directories should also be discovered
        Returns:
        a list of all files in the given directory or null if the given directory doesn't exist/is not a directory
      • listFilesAsync

        @NotNull
        default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo[]> listFilesAsync​(@NotNull
                                                                                                @NotNull ServiceTemplate template,
                                                                                                @NotNull
                                                                                                @NotNull java.lang.String dir)
        Lists all files in the given directory (including sub directories).
        Parameters:
        template - the template where the target file is located at
        dir - the directory
        Returns:
        a list of all files in the given directory or null if the given directory doesn't exist/is not a directory
      • listFilesAsync

        @NotNull
        default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<FileInfo[]> listFilesAsync​(@NotNull
                                                                                                @NotNull ServiceTemplate template)
        Lists all files in the root directory of the template (including sub directories).
        Parameters:
        template - the template where the target file is located at
        Returns:
        a list of all files in the given directory or null if the given directory doesn't exist/is not a directory
      • getTemplatesAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<ServiceTemplate>> getTemplatesAsync()
        Gets a list of all templates that exist in this storage. Modifications to the collection won't have any effect.
        Returns:
        a list of all templates
      • closeAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> closeAsync()
        Closes this storage, after it has been closed, no more interaction to this storage should be done and might lead to errors.