Article(javax.mail.Message) now has a safe method to read the byte body from the given message object (fixes #16).
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 org.sonews.feed.Subscription;
23 import org.sonews.util.Pair;
26 * A generic storage backend interface.
27 * @author Christian Lins
30 public interface Storage
34 * Stores the given Article in the storage.
36 * @throws StorageBackendException
38 void addArticle(Article art)
39 throws StorageBackendException;
41 void addEvent(long timestamp, int type, long groupID)
42 throws StorageBackendException;
44 void addGroup(String groupname, int flags)
45 throws StorageBackendException;
48 throws StorageBackendException;
51 throws StorageBackendException;
53 void delete(String messageID)
54 throws StorageBackendException;
56 Article getArticle(String messageID)
57 throws StorageBackendException;
59 Article getArticle(long articleIndex, long groupID)
60 throws StorageBackendException;
62 List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last)
63 throws StorageBackendException;
65 List<Pair<Long, String>> getArticleHeaders(Channel channel, long start, long end,
66 String header, String pattern)
67 throws StorageBackendException;
69 long getArticleIndex(Article art, Group group)
70 throws StorageBackendException;
72 List<Long> getArticleNumbers(long groupID)
73 throws StorageBackendException;
75 String getConfigValue(String key)
76 throws StorageBackendException;
78 int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
80 throws StorageBackendException;
82 double getEventsPerHour(int key, long gid)
83 throws StorageBackendException;
85 int getFirstArticleNumber(Group group)
86 throws StorageBackendException;
88 Group getGroup(String name)
89 throws StorageBackendException;
91 List<Channel> getGroups()
92 throws StorageBackendException;
95 * Retrieves the collection of groupnames that are associated with the
99 * @throws StorageBackendException
101 List<String> getGroupsForList(String listAddress)
102 throws StorageBackendException;
104 int getLastArticleNumber(Group group)
105 throws StorageBackendException;
108 * Returns a list of email addresses that are related to the given
109 * groupname. In most cases the list may contain only one entry.
112 * @throws StorageBackendException
114 List<String> getListsForGroup(String groupname)
115 throws StorageBackendException;
117 String getOldestArticle()
118 throws StorageBackendException;
120 int getPostingsCount(String groupname)
121 throws StorageBackendException;
123 List<Subscription> getSubscriptions(int type)
124 throws StorageBackendException;
126 boolean isArticleExisting(String messageID)
127 throws StorageBackendException;
129 boolean isGroupExisting(String groupname)
130 throws StorageBackendException;
132 void purgeGroup(Group group)
133 throws StorageBackendException;
135 void setConfigValue(String key, String value)
136 throws StorageBackendException;
139 * Updates headers and channel references of the given article.
142 * @throws StorageBackendException
144 boolean update(Article article)
145 throws StorageBackendException;
147 boolean update(Group group)
148 throws StorageBackendException;