Interface FileManager


  • @Role
    @Unstable
    public interface FileManager
    Exposes APIs to run file system jobs.
    Since:
    2.0M1
    Version:
    $Id$
    • Field Detail

      • JOB_ID_PREFIX

        static final String JOB_ID_PREFIX
        The string used as a prefix for all file system jobs.
        See Also:
        Constant Field Values
    • Method Detail

      • move

        String move​(Collection<Path> paths,
                    Path destination)
             throws org.xwiki.job.JobException
        Schedules a job to move the specified files and folders to the given destination.
        Parameters:
        paths - the files and folders to move
        destination - where to move the specified files and folders
        Returns:
        the id of the move job that has been scheduled
        Throws:
        org.xwiki.job.JobException - if scheduling the move job fails
      • copy

        String copy​(Collection<Path> paths,
                    Path destination)
             throws org.xwiki.job.JobException
        Schedules a job to copy the specified files and folders to the given destination.
        Parameters:
        paths - the files and folders to copy
        destination - where to copy the specified files and folders
        Returns:
        the id of the copy job that has been scheduled
        Throws:
        org.xwiki.job.JobException - if scheduling the copy job fails
      • delete

        String delete​(Collection<Path> paths)
               throws org.xwiki.job.JobException
        Schedules a job to delete the specified files and folders.
        Parameters:
        paths - the files and folders to delete
        Returns:
        the id of the delete job that has been scheduled
        Throws:
        org.xwiki.job.JobException - if scheduling the delete job fails
      • pack

        String pack​(Collection<Path> paths,
                    org.xwiki.model.reference.AttachmentReference outputFileReference)
             throws org.xwiki.job.JobException
        Packs the specified files and folders in a single ZIP archive that is written in the specified output file.

        The DocumentReference part of the given AttachmentReference represents the document that is going to be used to access the output ZIP file. This means that only users with view right on this document can access the output file. The name property of the given AttachmentReference will be used as the name of the output ZIP file.

        The output file is a temporary file (deleted automatically when the server is stopped) that can be accessed through the 'temp' action, e.g.: /xwiki/temp/Space/Page/filemanager/file.zip .

        Parameters:
        paths - the files and folders to be packed
        outputFileReference - the reference to the temporary output file
        Returns:
        the id of the pack job that has been scheduled
        Throws:
        org.xwiki.job.JobException - if scheduling the pack job fails
        Since:
        2.0M2
      • getJobStatus

        org.xwiki.job.event.status.JobStatus getJobStatus​(String jobId)
        Parameters:
        jobId - the job whose status to return
        Returns:
        the status of the specified job
      • getActiveJobs

        List<String> getActiveJobs()
        Returns:
        the list of jobs that are running or are pending for execution