aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2009-06-23 14:54:45 +0000
committerDamian Minkov <damencho@jitsi.org>2009-06-23 14:54:45 +0000
commit8a7cd18b2b8b0fbd0164ff7369f6868260304813 (patch)
tree3028f1d3f65c1548abbefe1eb6cb43f31577aa73 /src
parent1dc10bff444f7a769d0991e53b311dfcd4f07f37 (diff)
downloadjitsi-8a7cd18b2b8b0fbd0164ff7369f6868260304813.zip
jitsi-8a7cd18b2b8b0fbd0164ff7369f6868260304813.tar.gz
jitsi-8a7cd18b2b8b0fbd0164ff7369f6868260304813.tar.bz2
FileHistory Service.
Diffstat (limited to 'src')
-rw-r--r--src/net/java/sip/communicator/service/filehistory/FileHistoryService.java171
-rw-r--r--src/net/java/sip/communicator/service/filehistory/FileRecord.java108
2 files changed, 279 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/service/filehistory/FileHistoryService.java b/src/net/java/sip/communicator/service/filehistory/FileHistoryService.java
new file mode 100644
index 0000000..52c2490
--- /dev/null
+++ b/src/net/java/sip/communicator/service/filehistory/FileHistoryService.java
@@ -0,0 +1,171 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.filehistory;
+
+import java.util.*;
+
+import net.java.sip.communicator.service.contactlist.*;
+
+/**
+ * File History Service stores info for file transfers from various protocols.
+ *
+ * @author Damian Minkov
+ */
+public interface FileHistoryService
+{
+ /**
+ * Returns all the file transfers made after the given date
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param startDate Date the start date of the transfers
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findByStartDate(MetaContact contact, Date startDate)
+ throws RuntimeException;
+
+ /**
+ * Returns all the file transfers made before the given date
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param endDate Date the end date of the transfers
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findByEndDate(MetaContact contact, Date endDate)
+ throws RuntimeException;
+
+ /**
+ * Returns all the file transfers made between the given dates
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param startDate Date the start date of the transfers
+ * @param endDate Date the end date of the transfers
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findByPeriod(MetaContact contact, Date startDate, Date endDate)
+ throws RuntimeException;
+
+ /**
+ * Returns all the file transfers made between the given dates and
+ * having the given keywords in the filename
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param startDate Date the start date of the transfers
+ * @param endDate Date the end date of the transfers
+ * @param keywords array of keywords
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findByPeriod(MetaContact contact,
+ Date startDate, Date endDate, String[] keywords)
+ throws RuntimeException;
+
+ /**
+ * Returns all the file transfers made between the given dates
+ * and having the given keywords in the filename
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param startDate Date the start date of the transfers
+ * @param endDate Date the end date of the transfers
+ * @param keywords array of keywords
+ * @param caseSensitive is keywords search case sensitive
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findByPeriod(
+ MetaContact contact, Date startDate, Date endDate,
+ String[] keywords, boolean caseSensitive)
+ throws RuntimeException;
+
+
+ /**
+ * Returns the supplied number of file transfers
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param count filetransfer count
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findLast(MetaContact contact, int count)
+ throws RuntimeException;
+
+ /**
+ * Returns all the file transfers having the given keyword in the filename
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param keyword keyword
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findByKeyword(MetaContact contact, String keyword)
+ throws RuntimeException;
+
+ /**
+ * Returns all the file transfers having the given keyword in the filename
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param keyword keyword
+ * @param caseSensitive is keywords search case sensitive
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ Collection<FileRecord> findByKeyword(
+ MetaContact contact, String keyword, boolean caseSensitive)
+ throws RuntimeException;
+
+ /**
+ * Returns all the file transfers having the given keywords in the filename
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param keywords keyword
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findByKeywords(MetaContact contact, String[] keywords)
+ throws RuntimeException;
+
+ /**
+ * Returns all the file transfershaving the given keywords in the filename
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param keywords keyword
+ * @param caseSensitive is keywords search case sensitive
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findByKeywords(
+ MetaContact contact, String[] keywords, boolean caseSensitive)
+ throws RuntimeException;
+
+ /**
+ * Returns the supplied number of recent file transfers after the given date
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param date transfers after date
+ * @param count transfers count
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findFirstRecordsAfter(
+ MetaContact contact, Date date, int count)
+ throws RuntimeException;
+
+ /**
+ * Returns the supplied number of recent file transfers before the given date
+ *
+ * @param contact MetaContact the receiver or sender of the file
+ * @param date transfers before date
+ * @param count transfers count
+ * @return Collection of FileRecords
+ * @throws RuntimeException
+ */
+ public Collection<FileRecord> findLastRecordsBefore(
+ MetaContact contact, Date date, int count)
+ throws RuntimeException;
+}
diff --git a/src/net/java/sip/communicator/service/filehistory/FileRecord.java b/src/net/java/sip/communicator/service/filehistory/FileRecord.java
new file mode 100644
index 0000000..0c909ff
--- /dev/null
+++ b/src/net/java/sip/communicator/service/filehistory/FileRecord.java
@@ -0,0 +1,108 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.filehistory;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Structure used for encapsulating data when writing or reading
+ * File History Data.
+ *
+ * @author Damian Minkov
+ */
+public class FileRecord
+{
+ /**
+ * Possible directions of the transfer
+ */
+ public final static String OUT = "out";
+ public final static String IN = "in";
+
+ /**
+ * Status indicating that the file transfer has been completed.
+ */
+ public static final String COMPLETED = "completed";
+
+ /**
+ * Status indicating that the file transfer has been canceled.
+ */
+ public static final String CANCELED = "canceled";
+
+ /**
+ * Status indicating that the file transfer has failed.
+ */
+ public static final String FAILED = "failed";
+
+ /**
+ * Status indicating that the file transfer has been refused.
+ */
+ public static final String REFUSED = "refused";
+
+ private String direction = null;
+
+ private Date date = null;
+
+ private File file = null;
+ private String status;
+
+ /**
+ * Constructs new FileRecord
+ *
+ * @param direction
+ * @param date
+ * @param file
+ * @param status
+ */
+ public FileRecord(
+ String direction,
+ Date date,
+ File file,
+ String status)
+ {
+ this.direction = direction;
+ this.date = date;
+ this.file = file;
+ this.status = status;
+ }
+
+ /**
+ * The direction of the transfer.
+ * @return the direction
+ */
+ public String getDirection()
+ {
+ return direction;
+ }
+
+ /**
+ * The date of the record.
+ * @return the date
+ */
+ public Date getDate()
+ {
+ return date;
+ }
+
+ /**
+ * The file that was transfered.
+ * @return the file
+ */
+ public File getFile()
+ {
+ return file;
+ }
+
+ /**
+ * The status of the transfer.
+ * @return the status
+ */
+ public String getStatus()
+ {
+ return status;
+ }
+}