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/>.
18 package org.sonews.storage;
20 import java.util.List;
21 import org.sonews.feed.Subscription;
22 import org.sonews.util.Pair;
25 * A generic storage backend interface.
26 * @author Christian Lins
29 public interface Storage {
32 * Stores the given Article in the storage.
34 * @throws StorageBackendException
36 void addArticle(Article art)
37 throws StorageBackendException;
39 void addEvent(long timestamp, int type, long groupID)
40 throws StorageBackendException;
42 void addGroup(String groupname, int flags)
43 throws StorageBackendException;
46 throws StorageBackendException;
49 throws StorageBackendException;
51 void delete(String messageID)
52 throws StorageBackendException;
54 Article getArticle(String messageID)
55 throws StorageBackendException;
57 Article getArticle(long articleIndex, long groupID)
58 throws StorageBackendException;
60 List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last)
61 throws StorageBackendException;
63 List<Pair<Long, String>> getArticleHeaders(Group group, long start, long end,
64 String header, String pattern)
65 throws StorageBackendException;
67 long getArticleIndex(Article art, Group group)
68 throws StorageBackendException;
70 List<Long> getArticleNumbers(long groupID)
71 throws StorageBackendException;
73 String getConfigValue(String key)
74 throws StorageBackendException;
76 int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
78 throws StorageBackendException;
80 double getEventsPerHour(int key, long gid)
81 throws StorageBackendException;
83 int getFirstArticleNumber(Group group)
84 throws StorageBackendException;
86 Group getGroup(String name)
87 throws StorageBackendException;
89 List<Group> getGroups()
90 throws StorageBackendException;
93 * Retrieves the collection of groupnames that are associated with the
97 * @throws StorageBackendException
99 List<String> getGroupsForList(String listAddress)
100 throws StorageBackendException;
102 int getLastArticleNumber(Group group)
103 throws StorageBackendException;
106 * Returns a list of email addresses that are related to the given
107 * groupname. In most cases the list may contain only one entry.
110 * @throws StorageBackendException
112 List<String> getListsForGroup(String groupname)
113 throws StorageBackendException;
115 String getOldestArticle()
116 throws StorageBackendException;
118 int getPostingsCount(String groupname)
119 throws StorageBackendException;
121 List<Subscription> getSubscriptions(int type)
122 throws StorageBackendException;
124 boolean isArticleExisting(String messageID)
125 throws StorageBackendException;
127 boolean isGroupExisting(String groupname)
128 throws StorageBackendException;
130 void purgeGroup(Group group)
131 throws StorageBackendException;
133 void setConfigValue(String key, String value)
134 throws StorageBackendException;
137 * Updates headers and channel references of the given article.
140 * @throws StorageBackendException
142 boolean update(Article article)
143 throws StorageBackendException;
145 boolean update(Group group)
146 throws StorageBackendException;
148 public boolean authenticateUser(String username, char[] password)
149 throws StorageBackendException;