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.ArrayList; chris@3: import java.util.List; chris@3: import org.sonews.util.Pair; chris@3: chris@3: /** chris@3: * A logical communication Channel is the a generic structural element for sets chris@3: * of messages; e.g. a Newsgroup for a set of Articles. chris@3: * A Channel can either be a real set of messages or an aggregated set of chris@3: * several subsets. chris@3: * @author Christian Lins chris@3: * @since sonews/1.0 chris@3: */ chris@3: public abstract class Channel chris@3: { chris@3: chris@3: /** chris@3: * If this flag is set the Group is no real newsgroup but a mailing list chris@3: * mirror. In that case every posting and receiving mails must go through chris@3: * the mailing list gateway. chris@3: */ chris@3: public static final int MAILINGLIST = 0x1; chris@3: chris@3: /** chris@3: * If this flag is set the Group is marked as readonly and the posting chris@3: * is prohibited. This can be useful for groups that are synced only in chris@3: * one direction. chris@3: */ chris@3: public static final int READONLY = 0x2; chris@3: chris@3: /** chris@3: * If this flag is set the Group is marked as deleted and must not occur chris@3: * in any output. The deletion is done lazily by a low priority daemon. chris@3: */ chris@3: public static final int DELETED = 0x80; chris@3: chris@3: public static List getAll() chris@3: { chris@3: List all = new ArrayList(); chris@3: chris@3: /*List agroups = AggregatedGroup.getAll(); chris@3: if(agroups != null) chris@3: { chris@3: all.addAll(agroups); chris@3: }*/ chris@3: chris@3: List groups = Group.getAll(); chris@3: if(groups != null) chris@3: { chris@3: all.addAll(groups); chris@3: } chris@3: chris@3: return all; chris@3: } chris@3: chris@3: public static Channel getByName(String name) chris@3: { cli@13: return Group.getByName(name); chris@3: } chris@3: chris@3: public abstract Article getArticle(long idx) chris@3: throws StorageBackendException; chris@3: chris@3: public abstract List> getArticleHeads( chris@3: final long first, final long last) chris@3: throws StorageBackendException; chris@3: chris@3: public abstract List getArticleNumbers() chris@3: throws StorageBackendException; chris@3: chris@3: public abstract long getFirstArticleNumber() chris@3: throws StorageBackendException; chris@3: chris@3: public abstract long getIndexOf(Article art) chris@3: throws StorageBackendException; chris@3: chris@3: public abstract long getInternalID(); chris@3: chris@3: public abstract long getLastArticleNumber() chris@3: throws StorageBackendException; chris@3: chris@3: public abstract String getName(); chris@3: chris@3: public abstract long getPostingsCount() chris@3: throws StorageBackendException; chris@3: chris@3: public abstract boolean isDeleted(); chris@3: chris@3: public abstract boolean isWriteable(); chris@3: chris@3: }