src/org/sonews/storage/Channel.java
author cli
Sun, 11 Sep 2011 14:19:19 +0200
changeset 47 e118b4d60029
parent 42 7f84f4de2893
permissions -rwxr-xr-x
Complete XDAEMON GROUPFLAG subcommand.
chris@3
     1
/*
chris@3
     2
 *   SONEWS News Server
chris@3
     3
 *   see AUTHORS for the list of contributors
chris@3
     4
 *
chris@3
     5
 *   This program is free software: you can redistribute it and/or modify
chris@3
     6
 *   it under the terms of the GNU General Public License as published by
chris@3
     7
 *   the Free Software Foundation, either version 3 of the License, or
chris@3
     8
 *   (at your option) any later version.
chris@3
     9
 *
chris@3
    10
 *   This program is distributed in the hope that it will be useful,
chris@3
    11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
chris@3
    12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
chris@3
    13
 *   GNU General Public License for more details.
chris@3
    14
 *
chris@3
    15
 *   You should have received a copy of the GNU General Public License
chris@3
    16
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
chris@3
    17
 */
chris@3
    18
package org.sonews.storage;
chris@3
    19
chris@3
    20
import java.util.ArrayList;
chris@3
    21
import java.util.List;
chris@3
    22
import org.sonews.util.Pair;
chris@3
    23
chris@3
    24
/**
chris@3
    25
 * A logical communication Channel is the a generic structural element for sets
chris@3
    26
 * of messages; e.g. a Newsgroup for a set of Articles.
chris@3
    27
 * A Channel can either be a real set of messages or an aggregated set of
chris@3
    28
 * several subsets.
chris@3
    29
 * @author Christian Lins
chris@3
    30
 * @since sonews/1.0
chris@3
    31
 */
cli@42
    32
public abstract class Channel {
chris@3
    33
cli@37
    34
	/**
cli@37
    35
	 * If this flag is set the Group is no real newsgroup but a mailing list
cli@37
    36
	 * mirror. In that case every posting and receiving mails must go through
cli@37
    37
	 * the mailing list gateway.
cli@37
    38
	 */
cli@37
    39
	public static final int MAILINGLIST = 0x1;
cli@37
    40
	/**
cli@37
    41
	 * If this flag is set the Group is marked as readonly and the posting
cli@37
    42
	 * is prohibited. This can be useful for groups that are synced only in
cli@37
    43
	 * one direction.
cli@37
    44
	 */
cli@37
    45
	public static final int READONLY = 0x2;
cli@37
    46
	/**
cli@37
    47
	 * If this flag is set the Group is marked as deleted and must not occur
cli@37
    48
	 * in any output. The deletion is done lazily by a low priority daemon.
cli@37
    49
	 */
cli@37
    50
	public static final int DELETED = 0x80;
chris@3
    51
cli@42
    52
	public static List<Channel> getAll() {
cli@37
    53
		List<Channel> all = new ArrayList<Channel>();
chris@3
    54
cli@37
    55
		/*List<Channel> agroups = AggregatedGroup.getAll();
cli@37
    56
		if(agroups != null)
cli@37
    57
		{
cli@37
    58
		all.addAll(agroups);
cli@37
    59
		}*/
chris@3
    60
cli@37
    61
		List<Channel> groups = Group.getAll();
cli@37
    62
		if (groups != null) {
cli@37
    63
			all.addAll(groups);
cli@37
    64
		}
chris@3
    65
cli@37
    66
		return all;
cli@37
    67
	}
chris@3
    68
cli@37
    69
	public static Channel getByName(String name)
cli@42
    70
			throws StorageBackendException {
cli@37
    71
		return StorageManager.current().getGroup(name);
cli@37
    72
	}
chris@3
    73
cli@37
    74
	public abstract Article getArticle(long idx)
cli@42
    75
			throws StorageBackendException;
chris@3
    76
cli@37
    77
	public abstract List<Pair<Long, ArticleHead>> getArticleHeads(
cli@42
    78
			final long first, final long last)
cli@42
    79
			throws StorageBackendException;
chris@3
    80
cli@37
    81
	public abstract List<Long> getArticleNumbers()
cli@42
    82
			throws StorageBackendException;
chris@3
    83
cli@37
    84
	public abstract long getFirstArticleNumber()
cli@42
    85
			throws StorageBackendException;
chris@3
    86
cli@37
    87
	public abstract long getIndexOf(Article art)
cli@42
    88
			throws StorageBackendException;
chris@3
    89
cli@37
    90
	public abstract long getInternalID();
chris@3
    91
cli@37
    92
	public abstract long getLastArticleNumber()
cli@42
    93
			throws StorageBackendException;
chris@3
    94
cli@37
    95
	public abstract String getName();
chris@3
    96
cli@37
    97
	public abstract long getPostingsCount()
cli@42
    98
			throws StorageBackendException;
chris@3
    99
cli@37
   100
	public abstract boolean isDeleted();
chris@3
   101
cli@37
   102
	public abstract boolean isWriteable();
chris@3
   103
}