3 * see AUTHORS for the list of contributors
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.
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.
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/>.
19 package org.sonews.storage;
21 import java.util.List;
22 import javax.mail.internet.InternetAddress;
23 import org.sonews.feed.Subscription;
24 import org.sonews.util.Pair;
27 * A generic storage backend interface.
28 * @author Christian Lins
31 public interface Storage
35 * Stores the given Article in the storage.
37 * @throws StorageBackendException
39 void addArticle(Article art)
40 throws StorageBackendException;
42 void addEvent(long timestamp, int type, long groupID)
43 throws StorageBackendException;
45 void addGroup(String groupname, int flags)
46 throws StorageBackendException;
49 throws StorageBackendException;
52 throws StorageBackendException;
54 void delete(String messageID)
55 throws StorageBackendException;
57 Article getArticle(String messageID)
58 throws StorageBackendException;
60 Article getArticle(long articleIndex, long groupID)
61 throws StorageBackendException;
63 List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last)
64 throws StorageBackendException;
66 List<Pair<Long, String>> getArticleHeaders(Channel channel, long start, long end,
67 String header, String pattern)
68 throws StorageBackendException;
70 long getArticleIndex(Article art, Group group)
71 throws StorageBackendException;
73 List<Long> getArticleNumbers(long groupID)
74 throws StorageBackendException;
76 String getConfigValue(String key)
77 throws StorageBackendException;
79 int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
81 throws StorageBackendException;
83 double getEventsPerHour(int key, long gid)
84 throws StorageBackendException;
86 int getFirstArticleNumber(Group group)
87 throws StorageBackendException;
89 Group getGroup(String name)
90 throws StorageBackendException;
92 List<Channel> getGroups()
93 throws StorageBackendException;
95 List<String> getGroupsForList(InternetAddress inetaddress)
96 throws StorageBackendException;
98 int getLastArticleNumber(Group group)
99 throws StorageBackendException;
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.
106 * @throws StorageBackendException
108 List<String> getListsForGroup(String groupname)
109 throws StorageBackendException;
111 String getOldestArticle()
112 throws StorageBackendException;
114 int getPostingsCount(String groupname)
115 throws StorageBackendException;
117 List<Subscription> getSubscriptions(int type)
118 throws StorageBackendException;
120 boolean isArticleExisting(String messageID)
121 throws StorageBackendException;
123 boolean isGroupExisting(String groupname)
124 throws StorageBackendException;
126 void purgeGroup(Group group)
127 throws StorageBackendException;
129 void setConfigValue(String key, String value)
130 throws StorageBackendException;
132 boolean update(Group group)
133 throws StorageBackendException;