org/sonews/storage/Storage.java
author chris <chris@marvin>
Wed Jul 22 14:04:05 2009 +0200 (2009-07-22)
changeset 3 2fdc9cc89502
child 12 bb6990c0dd1a
permissions -rw-r--r--
sonews/1.0.0
     1 /*
     2  *   SONEWS News Server
     3  *   see AUTHORS for the list of contributors
     4  *
     5  *   This program is free software: you can redistribute it and/or modify
     6  *   it under the terms of the GNU General Public License as published by
     7  *   the Free Software Foundation, either version 3 of the License, or
     8  *   (at your option) any later version.
     9  *
    10  *   This program is distributed in the hope that it will be useful,
    11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  *   GNU General Public License for more details.
    14  *
    15  *   You should have received a copy of the GNU General Public License
    16  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17  */
    18 
    19 package org.sonews.storage;
    20 
    21 import java.util.List;
    22 import javax.mail.internet.InternetAddress;
    23 import org.sonews.feed.Subscription;
    24 import org.sonews.util.Pair;
    25 
    26 /**
    27  * A generic storage backend interface.
    28  * @author Christian Lins
    29  * @since sonews/1.0
    30  */
    31 public interface Storage
    32 {
    33 
    34   void addArticle(Article art)
    35     throws StorageBackendException;
    36 
    37   void addEvent(long timestamp, int type, long groupID)
    38     throws StorageBackendException;
    39 
    40   void addGroup(String groupname, int flags)
    41     throws StorageBackendException;
    42 
    43   int countArticles()
    44     throws StorageBackendException;
    45 
    46   int countGroups()
    47     throws StorageBackendException;
    48 
    49   void delete(String messageID)
    50     throws StorageBackendException;
    51 
    52   Article getArticle(String messageID)
    53     throws StorageBackendException;
    54 
    55   Article getArticle(long articleIndex, long groupID)
    56     throws StorageBackendException;
    57 
    58   List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last)
    59     throws StorageBackendException;
    60 
    61   List<Pair<Long, String>> getArticleHeaders(Channel channel, long start, long end,
    62     String header, String pattern)
    63     throws StorageBackendException;
    64 
    65   long getArticleIndex(Article art, Group group)
    66     throws StorageBackendException;
    67 
    68   List<Long> getArticleNumbers(long groupID)
    69     throws StorageBackendException;
    70 
    71   String getConfigValue(String key)
    72     throws StorageBackendException;
    73 
    74   int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
    75     Channel channel)
    76     throws StorageBackendException;
    77 
    78   double getEventsPerHour(int key, long gid)
    79     throws StorageBackendException;
    80 
    81   int getFirstArticleNumber(Group group)
    82     throws StorageBackendException;
    83 
    84   Group getGroup(String name)
    85     throws StorageBackendException;
    86 
    87   List<Channel> getGroups()
    88     throws StorageBackendException;
    89 
    90   List<String> getGroupsForList(InternetAddress inetaddress)
    91     throws StorageBackendException;
    92 
    93   int getLastArticleNumber(Group group)
    94     throws StorageBackendException;
    95 
    96   String getListForGroup(String groupname)
    97     throws StorageBackendException;
    98 
    99   String getOldestArticle()
   100     throws StorageBackendException;
   101 
   102   int getPostingsCount(String groupname)
   103     throws StorageBackendException;
   104 
   105   List<Subscription> getSubscriptions(int type)
   106     throws StorageBackendException;
   107 
   108   boolean isArticleExisting(String messageID)
   109     throws StorageBackendException;
   110 
   111   boolean isGroupExisting(String groupname)
   112     throws StorageBackendException;
   113 
   114   void purgeGroup(Group group)
   115     throws StorageBackendException;
   116 
   117   void setConfigValue(String key, String value)
   118     throws StorageBackendException;
   119 
   120   boolean update(Group group)
   121     throws StorageBackendException;
   122 
   123 }