Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.fileaccess
Class FileAccessServiceImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.fileaccess.FileAccessServiceImpl
All Implemented Interfaces:
FileAccessService

public class FileAccessServiceImpl
extends Object
implements FileAccessService

Default FileAccessService implementation.

Author:
Alexander Pelov, Lubomir Marinov

Field Summary
static String TEMP_FILE_PREFIX
          The file prefix for all temp files.
static String TEMP_FILE_SUFFIX
          The file suffix for all temp files.
 
Fields inherited from interface net.java.sip.communicator.service.fileaccess.FileAccessService
CONFPROPERTYKEY_USER_HOME
 
Constructor Summary
FileAccessServiceImpl()
           
 
Method Summary
 FailSafeTransaction createFailSafeTransaction(File file)
          Creates a failsafe transaction which can be used to safely store informations into a file.
 File getDefaultDownloadDirectory()
          Returns the default download directory.
 File getPrivatePersistentDirectory(String dirName)
          This method creates a directory specific to the current user.
 File getPrivatePersistentDirectory(String[] dirNames)
          This method creates a directory specific to the current user.
 File getPrivatePersistentFile(String fileName)
          This method returns a file specific to the current user.
 String getScHomeDirLocation()
          Returns the location of the directory where SIP Communicator is to store user specific data such as configuration files, message and call history as well as is bundle repository.
 String getScHomeDirName()
          Returns the name of the directory where SIP Communicator is to store user specific data such as configuration files, message and call history as well as is bundle repository.
 File getTemporaryDirectory()
          Returns the temporary directory.
 File getTemporaryFile()
          This method returns a created temporary file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMP_FILE_PREFIX

public static final String TEMP_FILE_PREFIX
The file prefix for all temp files.

See Also:
Constant Field Values

TEMP_FILE_SUFFIX

public static final String TEMP_FILE_SUFFIX
The file suffix for all temp files.

See Also:
Constant Field Values
Constructor Detail

FileAccessServiceImpl

public FileAccessServiceImpl()
Method Detail

getTemporaryFile

public File getTemporaryFile()
                      throws IOException
This method returns a created temporary file. After you close this file it is not guaranteed that you will be able to open it again nor that it will contain any information. Note: DO NOT store unencrypted sensitive information in this file

Specified by:
getTemporaryFile in interface FileAccessService
Returns:
The created temporary file
Throws:
IOException - If the file cannot be created

getTemporaryDirectory

public File getTemporaryDirectory()
                           throws IOException
Returns the temporary directory.

Specified by:
getTemporaryDirectory in interface FileAccessService
Returns:
the created temporary directory
Throws:
IOException - if the temporary directory cannot not be created

getPrivatePersistentFile

public File getPrivatePersistentFile(String fileName)
                              throws Exception
This method returns a file specific to the current user. It may not exist, but it is guaranteed that you will have the sufficient rights to create it. This file should not be considered secure because the implementor may return a file accesible to everyone. Generaly it will reside in current user's homedir, but it may as well reside in a shared directory. Note: DO NOT store unencrypted sensitive information in this file

Specified by:
getPrivatePersistentFile in interface FileAccessService
Parameters:
fileName - The name of the private file you wish to access
Returns:
The file
Throws:
Exception - if we faile to create the file.

getPrivatePersistentDirectory

public File getPrivatePersistentDirectory(String dirName)
                                   throws Exception
This method creates a directory specific to the current user. This directory should not be considered secure because the implementor may return a directory accesible to everyone. Generaly it will reside in current user's homedir, but it may as well reside in a shared directory. It is guaranteed that you will be able to create files in it. Note: DO NOT store unencrypted sensitive information in this file

Specified by:
getPrivatePersistentDirectory in interface FileAccessService
Parameters:
dirName - The name of the private directory you wish to access.
Returns:
The created directory.
Throws:
Exception - Thrown if there is no suitable location for the persistent directory.

getPrivatePersistentDirectory

public File getPrivatePersistentDirectory(String[] dirNames)
                                   throws Exception
This method creates a directory specific to the current user. getPrivatePersistentDirectory(String)

Specified by:
getPrivatePersistentDirectory in interface FileAccessService
Parameters:
dirNames - The name of the private directory you wish to access.
Returns:
The created directory.
Throws:
Exception - Thrown if there is no suitable location for the persistent directory.

getScHomeDirName

public String getScHomeDirName()
Returns the name of the directory where SIP Communicator is to store user specific data such as configuration files, message and call history as well as is bundle repository.

Returns:
the name of the directory where SIP Communicator is to store user specific data such as configuration files, message and call history as well as is bundle repository.

getScHomeDirLocation

public String getScHomeDirLocation()
Returns the location of the directory where SIP Communicator is to store user specific data such as configuration files, message and call history as well as is bundle repository.

Returns:
the location of the directory where SIP Communicator is to store user specific data such as configuration files, message and call history as well as is bundle repository.

getDefaultDownloadDirectory

public File getDefaultDownloadDirectory()
                                 throws IOException
Returns the default download directory.

Specified by:
getDefaultDownloadDirectory in interface FileAccessService
Returns:
the default download directory
Throws:
IOException - if it I/O error occurred

createFailSafeTransaction

public FailSafeTransaction createFailSafeTransaction(File file)
Creates a failsafe transaction which can be used to safely store informations into a file.

Specified by:
createFailSafeTransaction in interface FileAccessService
Parameters:
file - The file concerned by the transaction, null if file is null.
Returns:
A new failsafe transaction related to the given file.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.