aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2006-09-04 13:23:08 +0000
committerDamian Minkov <damencho@jitsi.org>2006-09-04 13:23:08 +0000
commit53f2aae096704d4a78707cc13d5df4f548a982a0 (patch)
tree89193abc7b6f6691af8ea0c507da26ff700607a6 /src/net/java/sip
parent1d2f145a005faf8d4b98667c857bba9b9003e33f (diff)
downloadjitsi-53f2aae096704d4a78707cc13d5df4f548a982a0.zip
jitsi-53f2aae096704d4a78707cc13d5df4f548a982a0.tar.gz
jitsi-53f2aae096704d4a78707cc13d5df4f548a982a0.tar.bz2
History Service does not leaves content after testing.
Added method in History Service for removing content.
Diffstat (limited to 'src/net/java/sip')
-rw-r--r--src/net/java/sip/communicator/impl/history/HistoryServiceImpl.java49
-rw-r--r--src/net/java/sip/communicator/service/history/HistoryService.java9
2 files changed, 54 insertions, 4 deletions
diff --git a/src/net/java/sip/communicator/impl/history/HistoryServiceImpl.java b/src/net/java/sip/communicator/impl/history/HistoryServiceImpl.java
index 50e857d..7a13337 100644
--- a/src/net/java/sip/communicator/impl/history/HistoryServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/history/HistoryServiceImpl.java
@@ -18,6 +18,7 @@ import net.java.sip.communicator.util.*;
/**
* @author Alexander Pelov
+ * @author Damian Minkov
*/
public class HistoryServiceImpl implements HistoryService {
@@ -223,7 +224,7 @@ public class HistoryServiceImpl implements HistoryService {
/**
* Set the configuration service.
*
- * @param configurationService
+ * @param configurationService ConfigurationService
*/
public void setConfigurationService(
ConfigurationService configurationService)
@@ -245,7 +246,7 @@ public class HistoryServiceImpl implements HistoryService {
/**
* Remove a configuration service.
*
- * @param configurationService
+ * @param configurationService ConfigurationService
*/
public void unsetConfigurationService(
ConfigurationService configurationService)
@@ -263,7 +264,7 @@ public class HistoryServiceImpl implements HistoryService {
/**
* Set the file access service.
*
- * @param fileAccessService
+ * @param fileAccessService FileAccessService
*/
public void setFileAccessService(FileAccessService fileAccessService)
{
@@ -277,7 +278,7 @@ public class HistoryServiceImpl implements HistoryService {
/**
* Remove the file access service.
*
- * @param fileAccessService
+ * @param fileAccessService FileAccessService
*/
public void unsetFileAccessService(FileAccessService fileAccessService)
{
@@ -300,4 +301,44 @@ public class HistoryServiceImpl implements HistoryService {
return cacheEnabled;
}
+ /**
+ * Permamently removes local stored History
+ *
+ * @param id HistoryID
+ * @throws IOException
+ */
+ public void purgeLocallyStoredHistory(HistoryID id)
+ throws IOException
+ {
+ // get the history direcoty coresponding the given id
+ File dir = this.createHistoryDirectories(id);
+ log.trace("Removing history directory " + dir);
+ deleteDirAndContent(dir);
+ }
+
+ /**
+ * Deletes given directory and its content
+ *
+ * @param dir File
+ * @throws IOException
+ */
+ private void deleteDirAndContent(File dir)
+ throws IOException
+ {
+ if(!dir.isDirectory())
+ return;
+
+ File[] content = dir.listFiles();
+
+ File tmp;
+ for (int i = 0; i < content.length; i++)
+ {
+ tmp = content[i];
+ if(tmp.isDirectory())
+ deleteDirAndContent(tmp);
+ else
+ tmp.delete();
+ }
+ dir.delete();
+ }
}
diff --git a/src/net/java/sip/communicator/service/history/HistoryService.java b/src/net/java/sip/communicator/service/history/HistoryService.java
index 36ca765..cac0a85 100644
--- a/src/net/java/sip/communicator/service/history/HistoryService.java
+++ b/src/net/java/sip/communicator/service/history/HistoryService.java
@@ -74,4 +74,13 @@ public interface HistoryService {
*/
History createHistory(HistoryID id, HistoryRecordStructure recordStructure)
throws IllegalArgumentException, IOException;
+
+ /**
+ * Permamently removes local stored History
+ *
+ * @param id HistoryID
+ * @throws IOException
+ * Thrown if the history could not be removed due to a IO error.
+ */
+ public void purgeLocallyStoredHistory(HistoryID id) throws IOException;
}