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: cli@37: /** cli@37: * If this flag is set the Group is no real newsgroup but a mailing list cli@37: * mirror. In that case every posting and receiving mails must go through cli@37: * the mailing list gateway. cli@37: */ cli@37: public static final int MAILINGLIST = 0x1; cli@39: cli@37: /** cli@37: * If this flag is set the Group is marked as readonly and the posting cli@37: * is prohibited. This can be useful for groups that are synced only in cli@37: * one direction. cli@37: */ cli@37: public static final int READONLY = 0x2; cli@39: cli@37: /** cli@37: * If this flag is set the Group is marked as deleted and must not occur cli@37: * in any output. The deletion is done lazily by a low priority daemon. cli@37: */ cli@37: public static final int DELETED = 0x80; chris@3: cli@37: public static List getAll() cli@37: { cli@37: List all = new ArrayList(); chris@3: cli@37: /*List agroups = AggregatedGroup.getAll(); cli@37: if(agroups != null) cli@37: { cli@37: all.addAll(agroups); cli@37: }*/ chris@3: cli@37: List groups = Group.getAll(); cli@37: if (groups != null) { cli@37: all.addAll(groups); cli@37: } chris@3: cli@37: return all; cli@37: } chris@3: cli@37: public static Channel getByName(String name) cli@37: throws StorageBackendException cli@37: { cli@37: return StorageManager.current().getGroup(name); cli@37: } chris@3: cli@37: public abstract Article getArticle(long idx) cli@37: throws StorageBackendException; chris@3: cli@37: public abstract List> getArticleHeads( cli@37: final long first, final long last) cli@37: throws StorageBackendException; chris@3: cli@37: public abstract List getArticleNumbers() cli@37: throws StorageBackendException; chris@3: cli@37: public abstract long getFirstArticleNumber() cli@37: throws StorageBackendException; chris@3: cli@37: public abstract long getIndexOf(Article art) cli@37: throws StorageBackendException; chris@3: cli@37: public abstract long getInternalID(); chris@3: cli@37: public abstract long getLastArticleNumber() cli@37: throws StorageBackendException; chris@3: cli@37: public abstract String getName(); chris@3: cli@37: public abstract long getPostingsCount() cli@37: throws StorageBackendException; chris@3: cli@37: public abstract boolean isDeleted(); chris@3: cli@37: public abstract boolean isWriteable(); chris@3: }