1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/org/sonews/storage/Storage.java Wed Aug 12 13:03:23 2009 +0200
1.3 @@ -0,0 +1,123 @@
1.4 +/*
1.5 + * SONEWS News Server
1.6 + * see AUTHORS for the list of contributors
1.7 + *
1.8 + * This program is free software: you can redistribute it and/or modify
1.9 + * it under the terms of the GNU General Public License as published by
1.10 + * the Free Software Foundation, either version 3 of the License, or
1.11 + * (at your option) any later version.
1.12 + *
1.13 + * This program is distributed in the hope that it will be useful,
1.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.16 + * GNU General Public License for more details.
1.17 + *
1.18 + * You should have received a copy of the GNU General Public License
1.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
1.20 + */
1.21 +
1.22 +package org.sonews.storage;
1.23 +
1.24 +import java.util.List;
1.25 +import javax.mail.internet.InternetAddress;
1.26 +import org.sonews.feed.Subscription;
1.27 +import org.sonews.util.Pair;
1.28 +
1.29 +/**
1.30 + * A generic storage backend interface.
1.31 + * @author Christian Lins
1.32 + * @since sonews/1.0
1.33 + */
1.34 +public interface Storage
1.35 +{
1.36 +
1.37 + void addArticle(Article art)
1.38 + throws StorageBackendException;
1.39 +
1.40 + void addEvent(long timestamp, int type, long groupID)
1.41 + throws StorageBackendException;
1.42 +
1.43 + void addGroup(String groupname, int flags)
1.44 + throws StorageBackendException;
1.45 +
1.46 + int countArticles()
1.47 + throws StorageBackendException;
1.48 +
1.49 + int countGroups()
1.50 + throws StorageBackendException;
1.51 +
1.52 + void delete(String messageID)
1.53 + throws StorageBackendException;
1.54 +
1.55 + Article getArticle(String messageID)
1.56 + throws StorageBackendException;
1.57 +
1.58 + Article getArticle(long articleIndex, long groupID)
1.59 + throws StorageBackendException;
1.60 +
1.61 + List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last)
1.62 + throws StorageBackendException;
1.63 +
1.64 + List<Pair<Long, String>> getArticleHeaders(Channel channel, long start, long end,
1.65 + String header, String pattern)
1.66 + throws StorageBackendException;
1.67 +
1.68 + long getArticleIndex(Article art, Group group)
1.69 + throws StorageBackendException;
1.70 +
1.71 + List<Long> getArticleNumbers(long groupID)
1.72 + throws StorageBackendException;
1.73 +
1.74 + String getConfigValue(String key)
1.75 + throws StorageBackendException;
1.76 +
1.77 + int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
1.78 + Channel channel)
1.79 + throws StorageBackendException;
1.80 +
1.81 + double getEventsPerHour(int key, long gid)
1.82 + throws StorageBackendException;
1.83 +
1.84 + int getFirstArticleNumber(Group group)
1.85 + throws StorageBackendException;
1.86 +
1.87 + Group getGroup(String name)
1.88 + throws StorageBackendException;
1.89 +
1.90 + List<Channel> getGroups()
1.91 + throws StorageBackendException;
1.92 +
1.93 + List<String> getGroupsForList(InternetAddress inetaddress)
1.94 + throws StorageBackendException;
1.95 +
1.96 + int getLastArticleNumber(Group group)
1.97 + throws StorageBackendException;
1.98 +
1.99 + String getListForGroup(String groupname)
1.100 + throws StorageBackendException;
1.101 +
1.102 + String getOldestArticle()
1.103 + throws StorageBackendException;
1.104 +
1.105 + int getPostingsCount(String groupname)
1.106 + throws StorageBackendException;
1.107 +
1.108 + List<Subscription> getSubscriptions(int type)
1.109 + throws StorageBackendException;
1.110 +
1.111 + boolean isArticleExisting(String messageID)
1.112 + throws StorageBackendException;
1.113 +
1.114 + boolean isGroupExisting(String groupname)
1.115 + throws StorageBackendException;
1.116 +
1.117 + void purgeGroup(Group group)
1.118 + throws StorageBackendException;
1.119 +
1.120 + void setConfigValue(String key, String value)
1.121 + throws StorageBackendException;
1.122 +
1.123 + boolean update(Group group)
1.124 + throws StorageBackendException;
1.125 +
1.126 +}