chris@3: /*
chris@3: * SONEWS News Server
chris@3: * see AUTHORS for the list of contributors
chris@3: *
chris@3: * This program is free software: you can redistribute it and/or modify
chris@3: * it under the terms of the GNU General Public License as published by
chris@3: * the Free Software Foundation, either version 3 of the License, or
chris@3: * (at your option) any later version.
chris@3: *
chris@3: * This program is distributed in the hope that it will be useful,
chris@3: * but WITHOUT ANY WARRANTY; without even the implied warranty of
chris@3: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
chris@3: * GNU General Public License for more details.
chris@3: *
chris@3: * You should have received a copy of the GNU General Public License
chris@3: * along with this program. If not, see .
chris@3: */
chris@3:
chris@3: package org.sonews.storage;
chris@3:
chris@3: import java.util.List;
chris@3: import org.sonews.feed.Subscription;
chris@3: import org.sonews.util.Pair;
chris@3:
chris@3: /**
chris@3: * A generic storage backend interface.
chris@3: * @author Christian Lins
chris@3: * @since sonews/1.0
chris@3: */
chris@3: public interface Storage
chris@3: {
chris@3:
cli@12: /**
cli@12: * Stores the given Article in the storage.
cli@12: * @param art
cli@12: * @throws StorageBackendException
cli@12: */
chris@3: void addArticle(Article art)
chris@3: throws StorageBackendException;
chris@3:
chris@3: void addEvent(long timestamp, int type, long groupID)
chris@3: throws StorageBackendException;
chris@3:
chris@3: void addGroup(String groupname, int flags)
chris@3: throws StorageBackendException;
chris@3:
chris@3: int countArticles()
chris@3: throws StorageBackendException;
chris@3:
chris@3: int countGroups()
chris@3: throws StorageBackendException;
chris@3:
chris@3: void delete(String messageID)
chris@3: throws StorageBackendException;
chris@3:
chris@3: Article getArticle(String messageID)
chris@3: throws StorageBackendException;
chris@3:
chris@3: Article getArticle(long articleIndex, long groupID)
chris@3: throws StorageBackendException;
chris@3:
chris@3: List> getArticleHeads(Group group, long first, long last)
chris@3: throws StorageBackendException;
chris@3:
chris@3: List> getArticleHeaders(Channel channel, long start, long end,
chris@3: String header, String pattern)
chris@3: throws StorageBackendException;
chris@3:
chris@3: long getArticleIndex(Article art, Group group)
chris@3: throws StorageBackendException;
chris@3:
chris@3: List getArticleNumbers(long groupID)
chris@3: throws StorageBackendException;
chris@3:
chris@3: String getConfigValue(String key)
chris@3: throws StorageBackendException;
chris@3:
chris@3: int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
chris@3: Channel channel)
chris@3: throws StorageBackendException;
chris@3:
chris@3: double getEventsPerHour(int key, long gid)
chris@3: throws StorageBackendException;
chris@3:
chris@3: int getFirstArticleNumber(Group group)
chris@3: throws StorageBackendException;
chris@3:
chris@3: Group getGroup(String name)
chris@3: throws StorageBackendException;
chris@3:
chris@3: List getGroups()
chris@3: throws StorageBackendException;
chris@3:
cli@14: /**
cli@14: * Retrieves the collection of groupnames that are associated with the
cli@14: * given list address.
cli@14: * @param inetaddress
cli@14: * @return
cli@14: * @throws StorageBackendException
cli@14: */
cli@14: List getGroupsForList(String listAddress)
chris@3: throws StorageBackendException;
chris@3:
chris@3: int getLastArticleNumber(Group group)
chris@3: throws StorageBackendException;
chris@3:
cli@12: /**
cli@12: * Returns a list of email addresses that are related to the given
cli@12: * groupname. In most cases the list may contain only one entry.
cli@12: * @param groupname
cli@12: * @return
cli@12: * @throws StorageBackendException
cli@12: */
cli@12: List getListsForGroup(String groupname)
chris@3: throws StorageBackendException;
chris@3:
chris@3: String getOldestArticle()
chris@3: throws StorageBackendException;
chris@3:
chris@3: int getPostingsCount(String groupname)
chris@3: throws StorageBackendException;
chris@3:
chris@3: List getSubscriptions(int type)
chris@3: throws StorageBackendException;
chris@3:
chris@3: boolean isArticleExisting(String messageID)
chris@3: throws StorageBackendException;
chris@3:
chris@3: boolean isGroupExisting(String groupname)
chris@3: throws StorageBackendException;
chris@3:
chris@3: void purgeGroup(Group group)
chris@3: throws StorageBackendException;
chris@3:
chris@3: void setConfigValue(String key, String value)
chris@3: throws StorageBackendException;
chris@3:
cli@24: /**
cli@24: * Updates headers and channel references of the given article.
cli@24: * @param article
cli@24: * @return
cli@24: * @throws StorageBackendException
cli@24: */
cli@24: boolean update(Article article)
cli@24: throws StorageBackendException;
cli@24:
chris@3: boolean update(Group group)
chris@3: throws StorageBackendException;
chris@3:
chris@3: }