diff -r 000000000000 -r 0b76e099eb96 org/sonews/storage/Storage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/sonews/storage/Storage.java Wed Aug 12 13:03:23 2009 +0200 @@ -0,0 +1,123 @@ +/* + * SONEWS News Server + * see AUTHORS for the list of contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.sonews.storage; + +import java.util.List; +import javax.mail.internet.InternetAddress; +import org.sonews.feed.Subscription; +import org.sonews.util.Pair; + +/** + * A generic storage backend interface. + * @author Christian Lins + * @since sonews/1.0 + */ +public interface Storage +{ + + void addArticle(Article art) + throws StorageBackendException; + + void addEvent(long timestamp, int type, long groupID) + throws StorageBackendException; + + void addGroup(String groupname, int flags) + throws StorageBackendException; + + int countArticles() + throws StorageBackendException; + + int countGroups() + throws StorageBackendException; + + void delete(String messageID) + throws StorageBackendException; + + Article getArticle(String messageID) + throws StorageBackendException; + + Article getArticle(long articleIndex, long groupID) + throws StorageBackendException; + + List> getArticleHeads(Group group, long first, long last) + throws StorageBackendException; + + List> getArticleHeaders(Channel channel, long start, long end, + String header, String pattern) + throws StorageBackendException; + + long getArticleIndex(Article art, Group group) + throws StorageBackendException; + + List getArticleNumbers(long groupID) + throws StorageBackendException; + + String getConfigValue(String key) + throws StorageBackendException; + + int getEventsCount(int eventType, long startTimestamp, long endTimestamp, + Channel channel) + throws StorageBackendException; + + double getEventsPerHour(int key, long gid) + throws StorageBackendException; + + int getFirstArticleNumber(Group group) + throws StorageBackendException; + + Group getGroup(String name) + throws StorageBackendException; + + List getGroups() + throws StorageBackendException; + + List getGroupsForList(InternetAddress inetaddress) + throws StorageBackendException; + + int getLastArticleNumber(Group group) + throws StorageBackendException; + + String getListForGroup(String groupname) + throws StorageBackendException; + + String getOldestArticle() + throws StorageBackendException; + + int getPostingsCount(String groupname) + throws StorageBackendException; + + List getSubscriptions(int type) + throws StorageBackendException; + + boolean isArticleExisting(String messageID) + throws StorageBackendException; + + boolean isGroupExisting(String groupname) + throws StorageBackendException; + + void purgeGroup(Group group) + throws StorageBackendException; + + void setConfigValue(String key, String value) + throws StorageBackendException; + + boolean update(Group group) + throws StorageBackendException; + +}