Awake File v1.1

org.awakefw.file.api.server.fileaction
Interface AwakeFileActionManager

All Known Implementing Classes:
DefaultAwakeFileActionManager

public interface AwakeFileActionManager

The Action Manager for files: define how all concrete operations will be done on files.

Since:
1.0

Method Summary
 boolean delete(AwakeFileConfigurator awakeFileConfigurator, String username, String filename)
          Action: deletes a file.
 boolean download(OutputStream out, AwakeFileConfigurator awakeFileConfigurator, String username, String filename)
          Action: downloads a file on the Servlet response output stream.
 boolean exists(AwakeFileConfigurator awakeFileConfigurator, String username, String filename)
          Action: says if a file exists.
 long length(AwakeFileConfigurator awakeFileConfigurator, String username, String filename)
          Action: returns the file length in bytes.
 List<File> listDirectories(AwakeFileConfigurator awakeFileConfigurator, String username, String filename)
          Action: Lists all sub-directories of a directory.
 List<File> listFiles(AwakeFileConfigurator awakeFileConfigurator, String username, String filename)
          Action: Lists all files of a directory.
 boolean mkdir(AwakeFileConfigurator awakeFileConfigurator, String username, String filename)
          Action: creates a directory or sub-directory.
 boolean mkdirs(AwakeFileConfigurator awakeFileConfigurator, String username, String filename)
          Action: creates a directory or sub-directory.
 void upload(AwakeFileConfigurator awakeFileConfigurator, InputStream inputStream, String username, String filename)
          Action: creates the uploaded file on the server.
 

Method Detail

delete

boolean delete(AwakeFileConfigurator awakeFileConfigurator,
               String username,
               String filename)
               throws IOException
Action: deletes a file.

Parameters:
awakeFileConfigurator - the user configuration
username - the client username
filename - the full path of filename to delete
Returns:
true if the file is deleted
Throws:
IOException - if any IOException occurs

download

boolean download(OutputStream out,
                 AwakeFileConfigurator awakeFileConfigurator,
                 String username,
                 String filename)
                 throws FileNotFoundException,
                        IOException
Action: downloads a file on the Servlet response output stream.

Parameters:
awakeFileConfigurator - the user configuration
username - the client username
filename - the filename to download
out - the Servlet response output stream
Returns:
true if the filename content is copied to the output stream, else false
Throws:
FileNotFoundException
IOException

exists

boolean exists(AwakeFileConfigurator awakeFileConfigurator,
               String username,
               String filename)
               throws IOException
Action: says if a file exists.

Parameters:
awakeFileConfigurator - the user configuration
username - the client username
filename - the full path of filename to delete
Returns:
true if the file exists
Throws:
IOException - if any IOException occurs

length

long length(AwakeFileConfigurator awakeFileConfigurator,
            String username,
            String filename)
            throws IOException
Action: returns the file length in bytes.

Parameters:
awakeFileConfigurator - the user configuration
username - the client username
filename - the filename to get the size from
Returns:
the file size or 0 if it not exists
Throws:
IOException

listDirectories

List<File> listDirectories(AwakeFileConfigurator awakeFileConfigurator,
                           String username,
                           String filename)
                           throws IOException
Action: Lists all sub-directories of a directory.

Parameters:
awakeFileConfigurator - the user configuration
username - the client username
filename - the full path of the directory into which to search for sur-directories
Returns:
the list of files in the sub-directory
Throws:
IOException

listFiles

List<File> listFiles(AwakeFileConfigurator awakeFileConfigurator,
                     String username,
                     String filename)
                     throws IOException
Action: Lists all files of a directory.

Parameters:
awakeFileConfigurator - the user configuration
username - the client username
filename - the full path of the directory into which to search for files
Returns:
the list of files in the sub-directory
Throws:
IOException

mkdir

boolean mkdir(AwakeFileConfigurator awakeFileConfigurator,
              String username,
              String filename)
              throws IOException
Action: creates a directory or sub-directory.

Parameters:
awakeFileConfigurator - the user configuration
username - the client username
filename - the full path of filename to create the sub-dir for
Returns:
true if the directory or sub-directory is created
Throws:
IOException - if any IOException occurs

mkdirs

boolean mkdirs(AwakeFileConfigurator awakeFileConfigurator,
               String username,
               String filename)
               throws IOException
Action: creates a directory or sub-directory.

Parameters:
awakeFileConfigurator - the user configuration
username - the client username
filename - the full path of filename to create the sub-dir for
Returns:
true if the directory or sub-directory is created
Throws:
IOException - if any IOException occurs

upload

void upload(AwakeFileConfigurator awakeFileConfigurator,
            InputStream inputStream,
            String username,
            String filename)
            throws IOException
Action: creates the uploaded file on the server.

Parameters:
awakeFileConfigurator - the user configuration
inputStream - the input stream of the multipart uploaded file
username - the client username
filename - the full path of filename to create
Throws:
IOException - if any IOException occurs

Awake File v1.1

Copyright © 2012 Kawan Softwares SAS