Awake File v1.1

org.awakefw.file.api.server.fileaction
Class DefaultAwakeFileActionManager

java.lang.Object
  extended by org.awakefw.file.api.server.fileaction.DefaultAwakeFileActionManager
All Implemented Interfaces:
AwakeFileActionManager

public class DefaultAwakeFileActionManager
extends Object
implements AwakeFileActionManager

The Default Action Manager for files: all operations will simply be done on the local file system.

Since:
1.0

Constructor Summary
DefaultAwakeFileActionManager()
          Constructor.
 
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAwakeFileActionManager

public DefaultAwakeFileActionManager()
Constructor.

Method Detail

delete

public boolean delete(AwakeFileConfigurator awakeFileConfigurator,
                      String username,
                      String filename)
               throws IOException
Description copied from interface: AwakeFileActionManager
Action: deletes a file.

Specified by:
delete in interface AwakeFileActionManager
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

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

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

exists

public boolean exists(AwakeFileConfigurator awakeFileConfigurator,
                      String username,
                      String filename)
               throws IOException
Description copied from interface: AwakeFileActionManager
Action: says if a file exists.

Specified by:
exists in interface AwakeFileActionManager
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

public long length(AwakeFileConfigurator awakeFileConfigurator,
                   String username,
                   String filename)
            throws IOException
Description copied from interface: AwakeFileActionManager
Action: returns the file length in bytes.

Specified by:
length in interface AwakeFileActionManager
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

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

Specified by:
listDirectories in interface AwakeFileActionManager
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

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

Specified by:
listFiles in interface AwakeFileActionManager
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

public boolean mkdir(AwakeFileConfigurator awakeFileConfigurator,
                     String username,
                     String filename)
              throws IOException
Description copied from interface: AwakeFileActionManager
Action: creates a directory or sub-directory.

Specified by:
mkdir in interface AwakeFileActionManager
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

public boolean mkdirs(AwakeFileConfigurator awakeFileConfigurator,
                      String username,
                      String filename)
               throws IOException
Description copied from interface: AwakeFileActionManager
Action: creates a directory or sub-directory.

Specified by:
mkdirs in interface AwakeFileActionManager
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

public void upload(AwakeFileConfigurator awakeFileConfigurator,
                   InputStream inputStream,
                   String username,
                   String filename)
            throws IOException
Description copied from interface: AwakeFileActionManager
Action: creates the uploaded file on the server.

Specified by:
upload in interface AwakeFileActionManager
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