aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Ivov <emcho@jitsi.org>2006-08-04 11:23:45 +0000
committerEmil Ivov <emcho@jitsi.org>2006-08-04 11:23:45 +0000
commitcfda73e10ff447eed2453f2b28b6ca88612936a4 (patch)
tree75b57038ff80305fe22e1255f2eefc8f2696afd5
parent6f991b2796b4b2a22270e76927fc0ef971eebecf (diff)
downloadjitsi-cfda73e10ff447eed2453f2b28b6ca88612936a4.zip
jitsi-cfda73e10ff447eed2453f2b28b6ca88612936a4.tar.gz
jitsi-cfda73e10ff447eed2453f2b28b6ca88612936a4.tar.bz2
Check system properties for name of destination directory
-rw-r--r--src/net/java/sip/communicator/impl/fileaccess/FileAccessServiceImpl.java15
-rw-r--r--src/net/java/sip/communicator/service/fileaccess/FileAccessService.java34
2 files changed, 26 insertions, 23 deletions
diff --git a/src/net/java/sip/communicator/impl/fileaccess/FileAccessServiceImpl.java b/src/net/java/sip/communicator/impl/fileaccess/FileAccessServiceImpl.java
index d2dbbe3..dfbfa8b 100644
--- a/src/net/java/sip/communicator/impl/fileaccess/FileAccessServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/fileaccess/FileAccessServiceImpl.java
@@ -15,7 +15,7 @@ import net.java.sip.communicator.util.Logger;
/**
* Default FileAccessService implementation.
- *
+ *
* @author Alexander Pelov
*/
public class FileAccessServiceImpl implements FileAccessService {
@@ -43,14 +43,14 @@ public class FileAccessServiceImpl implements FileAccessService {
/**
* An synchronization object.
- *
+ *
* A lock should be obtained whenever the configuration service is accessed.
*/
private Object syncRoot = new Object();
/**
* Set the configuration service.
- *
+ *
* @param configurationService
*/
public void setConfigurationService(
@@ -63,7 +63,7 @@ public class FileAccessServiceImpl implements FileAccessService {
/**
* Remove a configuration service.
- *
+ *
* @param configurationService
*/
public void unsetConfigurationService(
@@ -189,6 +189,9 @@ public class FileAccessServiceImpl implements FileAccessService {
.getString(FileAccessService.CONFPROPERTYKEY_USER_HOME);
sipSubdir = this.configurationService
.getString(FileAccessService.CONFPROPERTYKEY_SIPCOMM_DIRECTORY);
+ if(sipSubdir == null)
+ sipSubdir = System.getProperty(
+ FileAccessService.CONFPROPERTYKEY_SIPCOMM_DIRECTORY);
}
if (userhome == null) {
@@ -216,10 +219,10 @@ public class FileAccessServiceImpl implements FileAccessService {
/**
* Checks if a file exists and if it is writable or readable. If not -
* checks if the user has a write privileges to the containing directory.
- *
+ *
* If those conditions are met it returns a File in the directory with a
* fileName. If not - returns null.
- *
+ *
* @param homedir
* @param fileName
* @return Returns null if the file does not exist and cannot be created.
diff --git a/src/net/java/sip/communicator/service/fileaccess/FileAccessService.java b/src/net/java/sip/communicator/service/fileaccess/FileAccessService.java
index a5dbb87..a628358 100644
--- a/src/net/java/sip/communicator/service/fileaccess/FileAccessService.java
+++ b/src/net/java/sip/communicator/service/fileaccess/FileAccessService.java
@@ -12,10 +12,10 @@ import java.io.IOException;
/**
* A service used to provide the basic functionality required to access the
* undelying file system.
- *
+ *
* Note: Never store unencrypted sensitive information, such as passwords,
* personal data, credit card numbers, etc..
- *
+ *
* @author Alexander Pelov
*/
public interface FileAccessService {
@@ -29,12 +29,12 @@ public interface FileAccessService {
* The key of the configuration property containing the user home dir - if
* it is not defined the system property is used
*/
- public static final String CONFPROPERTYKEY_USER_HOME = "net.java.sip.communicator.user.home";
+ public static final String CONFPROPERTYKEY_USER_HOME = "net.java.sip.communicator.fileaccess.USER_HOME";
/**
* The subdirectory of USER_HOME in which all user files will be stored
*/
- public static final String CONFPROPERTYKEY_SIPCOMM_DIRECTORY = "net.java.sip.communicator.user.home.sip-communicator-home";
+ public static final String CONFPROPERTYKEY_SIPCOMM_DIRECTORY = "net.java.sip.communicator.fileaccess.SIP_COMMUNICATOR_HOME";
/**
* The default subdirectory
@@ -45,9 +45,9 @@ public interface FileAccessService {
* 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
- *
+ *
* @return The created temporary file
* @throws IOException
* If the file cannot be created
@@ -57,11 +57,11 @@ public interface FileAccessService {
/**
* This method returns a created temporary directory. Any file you create in
* it will be a temporary file.
- *
+ *
* Note: If there is no opened file in this directory it may be deleted at
* any time. Note: DO NOT store unencrypted sensitive information in this
* directory
- *
+ *
* @return The created directory
* @throws IOException
* If the directory cannot be created
@@ -72,13 +72,13 @@ public interface FileAccessService {
* 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
- *
+ *
* @param fileName
* The name of the private file you wish to access
* @return The file
@@ -90,15 +90,15 @@ public interface FileAccessService {
/**
* 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
- *
+ *
* @param dirName
* The name of the private directory you wish to access.
* @return The created directory.
@@ -110,9 +110,9 @@ public interface FileAccessService {
/**
* This method creates a directory specific to the current user.
- *
+ *
* {@link #getPrivatePersistentDirectory(String)}
- *
+ *
* @param dirNames
* The name of the private directory you wish to access.
* @return The created directory.