org/sonews/storage/Storage.java
author cli
Thu, 20 Aug 2009 16:49:38 +0200
changeset 13 de98fd5b35f5
parent 12 bb6990c0dd1a
child 14 efce4ec25564
permissions -rw-r--r--
Remove aggregated group stubs and fix #543.
     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   /**
    35    * Stores the given Article in the storage.
    36    * @param art
    37    * @throws StorageBackendException
    38    */
    39   void addArticle(Article art)
    40     throws StorageBackendException;
    41 
    42   void addEvent(long timestamp, int type, long groupID)
    43     throws StorageBackendException;
    44 
    45   void addGroup(String groupname, int flags)
    46     throws StorageBackendException;
    47 
    48   int countArticles()
    49     throws StorageBackendException;
    50 
    51   int countGroups()
    52     throws StorageBackendException;
    53 
    54   void delete(String messageID)
    55     throws StorageBackendException;
    56 
    57   Article getArticle(String messageID)
    58     throws StorageBackendException;
    59 
    60   Article getArticle(long articleIndex, long groupID)
    61     throws StorageBackendException;
    62 
    63   List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last)
    64     throws StorageBackendException;
    65 
    66   List<Pair<Long, String>> getArticleHeaders(Channel channel, long start, long end,
    67     String header, String pattern)
    68     throws StorageBackendException;
    69 
    70   long getArticleIndex(Article art, Group group)
    71     throws StorageBackendException;
    72 
    73   List<Long> getArticleNumbers(long groupID)
    74     throws StorageBackendException;
    75 
    76   String getConfigValue(String key)
    77     throws StorageBackendException;
    78 
    79   int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
    80     Channel channel)
    81     throws StorageBackendException;
    82 
    83   double getEventsPerHour(int key, long gid)
    84     throws StorageBackendException;
    85 
    86   int getFirstArticleNumber(Group group)
    87     throws StorageBackendException;
    88 
    89   Group getGroup(String name)
    90     throws StorageBackendException;
    91 
    92   List<Channel> getGroups()
    93     throws StorageBackendException;
    94 
    95   List<String> getGroupsForList(InternetAddress inetaddress)
    96     throws StorageBackendException;
    97 
    98   int getLastArticleNumber(Group group)
    99     throws StorageBackendException;
   100 
   101   /**
   102    * Returns a list of email addresses that are related to the given
   103    * groupname. In most cases the list may contain only one entry.
   104    * @param groupname
   105    * @return
   106    * @throws StorageBackendException
   107    */
   108   List<String> getListsForGroup(String groupname)
   109     throws StorageBackendException;
   110 
   111   String getOldestArticle()
   112     throws StorageBackendException;
   113 
   114   int getPostingsCount(String groupname)
   115     throws StorageBackendException;
   116 
   117   List<Subscription> getSubscriptions(int type)
   118     throws StorageBackendException;
   119 
   120   boolean isArticleExisting(String messageID)
   121     throws StorageBackendException;
   122 
   123   boolean isGroupExisting(String groupname)
   124     throws StorageBackendException;
   125 
   126   void purgeGroup(Group group)
   127     throws StorageBackendException;
   128 
   129   void setConfigValue(String key, String value)
   130     throws StorageBackendException;
   131 
   132   boolean update(Group group)
   133     throws StorageBackendException;
   134 
   135 }